Merge branch 'saisie-jolie' into master-merge-saisie-jolie

This commit is contained in:
Émilie Feral
2018-05-16 11:28:07 +02:00
243 changed files with 7672 additions and 1679 deletions

View File

@@ -19,7 +19,7 @@ PythonCommandBin = "bin(x)"
PythonCommandCeil = "ceil(x)"
PythonCommandChoice = "choice(list)"
PythonCommandCmathFunction = "cmath.function"
PythonCommandCmathFunctionWithoutArg = "cmath."
PythonCommandCmathFunctionWithoutArg = "cmath."
PythonCommandColor = "color(r,g,b)"
PythonCommandComplex = "complex(a,b)"
PythonCommandCopySign = "copysign(x,y)"
@@ -57,7 +57,7 @@ PythonCommandIsFinite = "isfinite(x)"
PythonCommandIsInfinite = "isinf(x)"
PythonCommandIsNaN = "isnan(x)"
PythonCommandKandinskyFunction = "kandinsky.function"
PythonCommandKandinskyFunctionWithoutArg = "kandinsky."
PythonCommandKandinskyFunctionWithoutArg = "kandinsky."
PythonCommandLdexp = "ldexp(x,i)"
PythonCommandLgamma = "lgamma(x)"
PythonCommandLength = "len(object)"
@@ -66,7 +66,7 @@ PythonCommandLog10 = "log10(x)"
PythonCommandLog2 = "log2(x)"
PythonCommandLogComplex = "log(z,a)"
PythonCommandMathFunction = "math.function"
PythonCommandMathFunctionWithoutArg = "math."
PythonCommandMathFunctionWithoutArg = "math."
PythonCommandMax = "max(list)"
PythonCommandMin = "min(list)"
PythonCommandModf = "modf(x)"
@@ -80,7 +80,7 @@ PythonCommandRadians = "radians(x)"
PythonCommandRandom = "random()"
PythonCommandRandint = "randint(a,b)"
PythonCommandRandomFunction = "random.function"
PythonCommandRandomFunctionWithoutArg = "random."
PythonCommandRandomFunctionWithoutArg = "random."
PythonCommandRandrange = "randrange(start, stop)"
PythonCommandRangeStartStop = "range(start, stop)"
PythonCommandRangeStop = "range(stop)"
@@ -100,6 +100,6 @@ PythonCommandTanh = "tanh(x)"
PythonCommandTrunc = "trunc(x)"
PythonCommandImag = "z.imag"
PythonCommandReal = "z.real"
PythonCommandImagWithoutArg = "().imag"
PythonCommandRealWithoutArg = "().real"
PythonCommandImagWithoutArg = ".imag"
PythonCommandRealWithoutArg = ".real"
PythonCommandUniform = "uniform(a,b)"

View File

@@ -279,7 +279,7 @@ bool ConsoleController::textFieldDidFinishEditing(TextField * textField, const c
return true;
}
bool ConsoleController::textFieldDidAbortEditing(TextField * textField, const char * text) {
bool ConsoleController::textFieldDidAbortEditing(TextField * textField) {
if (inputRunLoopActive()) {
askInputRunLoopTermination();
} else {

View File

@@ -59,7 +59,7 @@ public:
bool textFieldShouldFinishEditing(TextField * textField, Ion::Events::Event event) override;
bool textFieldDidReceiveEvent(TextField * textField, Ion::Events::Event event) override;
bool textFieldDidFinishEditing(TextField * textField, const char * text, Ion::Events::Event event) override;
bool textFieldDidAbortEditing(TextField * textField, const char * text) override;
bool textFieldDidAbortEditing(TextField * textField) override;
Toolbox * toolboxForTextInput(TextInput * textInput) override;
// MicroPython::ExecutionEnvironment

View File

@@ -57,7 +57,7 @@ void MenuController::willExitResponderChain(Responder * nextFirstResponder) {
TextField * tf = static_cast<EvenOddEditableTextCell *>(m_selectableTableView.selectedCell())->editableTextCell()->textField();
if (tf->isEditing()) {
tf->setEditing(false);
textFieldDidAbortEditing(tf, tf->text());
textFieldDidAbortEditing(tf);
}
}
}
@@ -345,8 +345,8 @@ bool MenuController::textFieldDidFinishEditing(TextField * textField, const char
return false;
}
bool MenuController::textFieldDidAbortEditing(TextField * textField, const char * text) {
if (strlen(text) <= strlen(ScriptStore::k_scriptExtension)) {
bool MenuController::textFieldDidAbortEditing(TextField * textField) {
if (strlen(textField->text()) <= strlen(ScriptStore::k_scriptExtension)) {
// The previous text was an empty name. Use a numbered default script name.
char numberedDefaultName[k_defaultScriptNameMaxSize];
numberedDefaultScriptName(numberedDefaultName);

View File

@@ -57,7 +57,7 @@ public:
bool textFieldShouldFinishEditing(TextField * textField, Ion::Events::Event event) override;
bool textFieldDidReceiveEvent(TextField * textField, Ion::Events::Event event) override;
bool textFieldDidFinishEditing(TextField * textField, const char * text, Ion::Events::Event event) override;
bool textFieldDidAbortEditing(TextField * textField, const char * text) override;
bool textFieldDidAbortEditing(TextField * textField) override;
bool textFieldDidHandleEvent(TextField * textField, bool returnValue, bool textHasChanged) override;
Toolbox * toolboxForTextInput(TextInput * textInput) override { return nullptr; }

View File

@@ -291,10 +291,10 @@ bool PythonToolbox::selectLeaf(ToolboxMessageTree * selectedMessageTree) {
m_selectableTableView.deselectTable();
ToolboxMessageTree * node = selectedMessageTree;
const char * editedText = I18n::translate(node->insertedText());
char strippedEditedText[strlen(editedText)+1];
Shared::ToolboxHelpers::TextToInsertForCommandMessage(node->insertedText(), strippedEditedText);
TextInput * textInput = static_cast<TextInput *>(sender());
textInput->handleEventWithText(strippedEditedText, true);
int strippedEditedTextMaxLength = strlen(editedText)+1;
char strippedEditedText[strippedEditedTextMaxLength];
Shared::ToolboxHelpers::TextToInsertForCommandMessage(node->insertedText(), strippedEditedText, strippedEditedTextMaxLength, true);
sender()->handleEventWithText(strippedEditedText, true);
app()->dismissModalViewController();
return true;
}

View File

@@ -10,10 +10,7 @@ namespace Code {
class PythonToolbox : public Toolbox {
public:
typedef void (*Action)(void * sender, const char * text);
PythonToolbox();
// StackViewController
bool handleEvent(Ion::Events::Event event) override;
protected:
KDCoordinate rowHeight(int j) override;

View File

@@ -20,27 +20,27 @@ NonEqualityCondition = "!="
NonEqualityConditionWithArg = "x!=y"
EqualityCondition = "=="
EqualityConditionWithArg = "x==y"
WhileLoop = "while ():\n "
WhileLoop = "while :\n "
WhileLoopWithArg = "while condition:\n instruction"
IfOrIfElseStatement = "if () or ():\n \nelse:\n "
IfOrIfElseStatement = "if or :\n \nelse:\n "
IfOrIfElseStatementWithArg = "if condition1 or condition2:\n instruction1\nelse:\n instruction2"
IfAndIfElseStatement = "if () and ():\n \nelse:\n "
IfAndIfElseStatement = "if and :\n \nelse:\n "
IfAndIfElseStatementWithArg = "if condition1 and condition2:\n instruction1\nelse:\n instruction2"
IfElifElseStatement = "if ():\n \nelif ():\n \nelse:\n "
IfElifElseStatement = "if :\n \nelif :\n \nelse:\n "
IfElifElseStatementWithArg = "if condition1:\n instruction1\nelif condition2:\n instruction2\nelse:\n instruction3"
IfThenStatement= "if ():\n "
IfThenStatement= "if :\n "
IfThenStatementWithArg = "if condition:\n instruction"
IfElseStatement = "if ():\n \nelse:\n "
IfElseStatement = "if :\n \nelse:\n "
IfElseStatementWithArg = "if condition:\n instruction1\nelse:\n instruction2"
ForInListLoop = "for i in ():\n "
ForInListLoop = "for i in :\n "
ForInListLoopWithArg = "for i in list:\n instruction"
ForInRange3ArgsLoop = "for i in range(,,):\n "
ForInRange3ArgsLoop = "for i in range(,,):\n "
ForInRange3ArgsLoopWithArg = "for i in range(start, stop, step):\n instruction"
ForInRange2ArgsLoop = "for i in range(,):\n "
ForInRange2ArgsLoop = "for i in range(,):\n "
ForInRange2ArgsLoopWithArg = "for i in range(start, stop):\n instruction"
ForInRange1ArgLoop = "for i in range():\n "
ForInRange1ArgLoop = "for i in range():\n "
ForInRange1ArgLoopWithArg = "for i in range(size):\n instruction"
PythonCommandDef = "def ():\n "
PythonCommandDef = "def ():\n "
PythonCommandDefWithArg = "def function(x):"
PythonCommandReturn = "return "
RandomModule = "random"

View File

@@ -115,8 +115,9 @@ void VariableBoxController::ContentViewController::willDisplayCellForIndex(Highl
}
void VariableBoxController::ContentViewController::insertTextInCaller(const char * text) {
char commandBuffer[strlen(text)+1];
Shared::ToolboxHelpers::TextToInsertForCommandText(text, commandBuffer);
int commandBufferMaxSize = strlen(text)+1;
char commandBuffer[commandBufferMaxSize];
Shared::ToolboxHelpers::TextToInsertForCommandText(text, commandBuffer, commandBufferMaxSize);
m_textInputCaller->handleEventWithText(commandBuffer);
}