mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 16:57:31 +01:00
[code] The Python console compiles and executes commands entered.
It stores and displays the result in the console store. An empty line returned at the end of the execution is deleted. Change-Id: Ic90e02e2d91d0a0033413da0588032d9450aefd0
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#include "console_edit_cell.h"
|
||||
#include "console_controller.h"
|
||||
#include <escher/app.h>
|
||||
#include <apps/i18n.h>
|
||||
#include <assert.h>
|
||||
|
||||
namespace Code {
|
||||
@@ -7,21 +9,28 @@ namespace Code {
|
||||
ConsoleEditCell::ConsoleEditCell(Responder * parentResponder, TextFieldDelegate * delegate) :
|
||||
HighlightCell(),
|
||||
Responder(parentResponder),
|
||||
m_textField(this, m_textBuffer, m_draftTextBuffer, TextField::maxBufferSize(), delegate)
|
||||
m_promptView(ConsoleController::k_fontSize, I18n::Message::ConsolePrompt, 0, 0.5),
|
||||
m_textField(this, m_textBuffer, m_draftTextBuffer, TextField::maxBufferSize(), delegate, true, ConsoleController::k_fontSize)
|
||||
{
|
||||
}
|
||||
|
||||
int ConsoleEditCell::numberOfSubviews() const {
|
||||
return 1;
|
||||
return 2;
|
||||
}
|
||||
|
||||
View * ConsoleEditCell::subviewAtIndex(int index) {
|
||||
assert(index == 0);
|
||||
return &m_textField;
|
||||
assert(index == 0 || index ==1);
|
||||
if (index == 0) {
|
||||
return &m_promptView;
|
||||
} else {
|
||||
return &m_textField;
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleEditCell::layoutSubviews() {
|
||||
m_textField.setFrame(bounds());
|
||||
KDSize chevronsSize = KDText::stringSize(I18n::translate(I18n::Message::ConsolePrompt), ConsoleController::k_fontSize);
|
||||
m_promptView.setFrame(KDRect(KDPointZero, chevronsSize.width(), bounds().height()));
|
||||
m_textField.setFrame(KDRect(KDPoint(chevronsSize.width(), KDCoordinate(0)), bounds().width() - chevronsSize.width(), bounds().height()));
|
||||
}
|
||||
|
||||
void ConsoleEditCell::didBecomeFirstResponder() {
|
||||
|
||||
Reference in New Issue
Block a user