From d5a18fcf1308c15a4b55e40d3c4558c428c3a7dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Mon, 20 Jan 2020 11:45:59 +0100 Subject: [PATCH] [apps/code] Add time module in the toolbox --- apps/code/catalog.de.i18n | 4 ++++ apps/code/catalog.en.i18n | 4 ++++ apps/code/catalog.es.i18n | 4 ++++ apps/code/catalog.fr.i18n | 4 ++++ apps/code/catalog.pt.i18n | 4 ++++ apps/code/catalog.universal.i18n | 6 ++++++ apps/code/python_toolbox.cpp | 16 +++++++++++++++- apps/code/toolbox.universal.i18n | 1 + 8 files changed, 42 insertions(+), 1 deletion(-) diff --git a/apps/code/catalog.de.i18n b/apps/code/catalog.de.i18n index 1a38de530..9bbfab17e 100644 --- a/apps/code/catalog.de.i18n +++ b/apps/code/catalog.de.i18n @@ -54,6 +54,7 @@ PythonImportIon = "Import ion module" PythonImportKandinsky = "Import kandinsky module" PythonImportRandom = "Import random module" PythonImportMath = "Import math module" +PythonImportTime = "Import time module" PythonImportTurtle = "Import turtle module" PythonImportFromCmath = "Import cmath module" PythonImportFromKandinsky = "Import kandinsky module" @@ -126,6 +127,7 @@ PythonMathFunction = "math module function prefix" PythonMax = "Maximum" PythonMin = "Minimum" PythonModf = "Fractional and integer parts of x" +PythonMonotonic = "Value of a monotonic clock" PythonOct = "Convert integer to octal" PythonPhase = "Phase of z" PythonConstantPi = "3.141592653589794" @@ -148,12 +150,14 @@ PythonSeed = "Initialize random number generator" PythonSetPixel = "Color pixel (x,y)" PythonSin = "Sine" PythonSinh = "Hyperbolic sine" +PythonSleep = "Suspend execution for t seconds" PythonSort = "Sort a list" PythonSorted = "Sort a list" PythonSqrt = "Square root" PythonSum = "Sum the items of a list" PythonTan = "Tangent" PythonTanh = "Hyperbolic tangent" +PythonTimeFunction = "time module function prefix" PythonTrunc = "x truncated to an integer" PythonTurtleBackward = "Move backward by x pixels" PythonTurtleBlack = "Black color" diff --git a/apps/code/catalog.en.i18n b/apps/code/catalog.en.i18n index 249ffa63e..1192d134e 100644 --- a/apps/code/catalog.en.i18n +++ b/apps/code/catalog.en.i18n @@ -54,6 +54,7 @@ PythonImportIon = "Import ion module" PythonImportKandinsky = "Import kandinsky module" PythonImportRandom = "Import random module" PythonImportMath = "Import math module" +PythonImportTime = "Import time module" PythonImportTurtle = "Import turtle module" PythonImportFromCmath = "Import cmath module" PythonImportFromKandinsky = "Import kandinsky module" @@ -126,6 +127,7 @@ PythonMathFunction = "math module function prefix" PythonMax = "Maximum" PythonMin = "Minimum" PythonModf = "Fractional and integer parts of x" +PythonMonotonic = "Value of a monotonic clock" PythonOct = "Convert integer to octal" PythonPhase = "Phase of z" PythonConstantPi = "3.141592653589794" @@ -148,12 +150,14 @@ PythonSeed = "Initialize random number generator" PythonSetPixel = "Color pixel (x,y)" PythonSin = "Sine" PythonSinh = "Hyperbolic sine" +PythonSleep = "Suspend execution for t seconds" PythonSort = "Sort a list" PythonSorted = "Sort a list" PythonSqrt = "Square root" PythonSum = "Sum the items of a list" PythonTan = "Tangent" PythonTanh = "Hyperbolic tangent" +PythonTimeFunction = "time module function prefix" PythonTrunc = "x truncated to an integer" PythonTurtleBackward = "Move backward by x pixels" PythonTurtleBlack = "Black color" diff --git a/apps/code/catalog.es.i18n b/apps/code/catalog.es.i18n index 249ffa63e..1192d134e 100644 --- a/apps/code/catalog.es.i18n +++ b/apps/code/catalog.es.i18n @@ -54,6 +54,7 @@ PythonImportIon = "Import ion module" PythonImportKandinsky = "Import kandinsky module" PythonImportRandom = "Import random module" PythonImportMath = "Import math module" +PythonImportTime = "Import time module" PythonImportTurtle = "Import turtle module" PythonImportFromCmath = "Import cmath module" PythonImportFromKandinsky = "Import kandinsky module" @@ -126,6 +127,7 @@ PythonMathFunction = "math module function prefix" PythonMax = "Maximum" PythonMin = "Minimum" PythonModf = "Fractional and integer parts of x" +PythonMonotonic = "Value of a monotonic clock" PythonOct = "Convert integer to octal" PythonPhase = "Phase of z" PythonConstantPi = "3.141592653589794" @@ -148,12 +150,14 @@ PythonSeed = "Initialize random number generator" PythonSetPixel = "Color pixel (x,y)" PythonSin = "Sine" PythonSinh = "Hyperbolic sine" +PythonSleep = "Suspend execution for t seconds" PythonSort = "Sort a list" PythonSorted = "Sort a list" PythonSqrt = "Square root" PythonSum = "Sum the items of a list" PythonTan = "Tangent" PythonTanh = "Hyperbolic tangent" +PythonTimeFunction = "time module function prefix" PythonTrunc = "x truncated to an integer" PythonTurtleBackward = "Move backward by x pixels" PythonTurtleBlack = "Black color" diff --git a/apps/code/catalog.fr.i18n b/apps/code/catalog.fr.i18n index 5efd31457..d0d988a62 100644 --- a/apps/code/catalog.fr.i18n +++ b/apps/code/catalog.fr.i18n @@ -55,6 +55,7 @@ PythonImportKandinsky = "Importation du module kandinsky" PythonImportRandom = "Importation du module random" PythonImportMath = "Importation du module math" PythonImportTurtle = "Importation du module turtle" +PythonImportTime = "Importation du module time" PythonImportFromCmath = "Importation du module cmath" PythonImportFromKandinsky = "Importation du module kandinsky" PythonImportFromRandom = "Importation du module random" @@ -126,6 +127,7 @@ PythonMathFunction = "Préfixe fonction du module math" PythonMax = "Maximum" PythonMin = "Minimum" PythonModf = "Parties fractionnaire et entière" +PythonMonotonic = "Renvoie la valeur d’une horloge monotone" PythonOct = "Conversion en octal" PythonPhase = "Argument de z" PythonConstantPi = "3.141592653589793" @@ -148,12 +150,14 @@ PythonSeed = "Initialiser générateur aléatoire" PythonSetPixel = "Colore le pixel (x,y)" PythonSin = "Sinus" PythonSinh = "Sinus hyperbolique" +PythonSleep = "Suspend l’exécution pendant t secondes" PythonSort = "Tri d'une liste" PythonSorted = "Tri d'une liste" PythonSqrt = "Racine carrée" PythonSum = "Somme des éléments d'une liste" PythonTan = "Tangente" PythonTanh = "Tangente hyperbolique" +PythonTimeFunction = "Préfixe fonction module time" PythonTrunc = "Troncature entière" PythonTurtleBackward = "Recule de x pixels" PythonTurtleBlack = "Couleur noire" diff --git a/apps/code/catalog.pt.i18n b/apps/code/catalog.pt.i18n index edc94e195..b9364571c 100644 --- a/apps/code/catalog.pt.i18n +++ b/apps/code/catalog.pt.i18n @@ -54,6 +54,7 @@ PythonImportIon = "Import ion module" PythonImportKandinsky = "Import kandinsky module" PythonImportRandom = "Import random module" PythonImportMath = "Import math module" +PythonImportTime = "Import time module" PythonImportTurtle = "Import turtle module" PythonImportFromCmath = "Import cmath module" PythonImportFromKandinsky = "Import kandinsky module" @@ -126,6 +127,7 @@ PythonMathFunction = "math module function prefix" PythonMax = "Maximum" PythonMin = "Minimum" PythonModf = "Fractional and integer parts of x" +PythonMonotonic = "Value of a monotonic clock" PythonOct = "Convert integer to octal" PythonPhase = "Phase of z" PythonConstantPi = "3.141592653589794" @@ -148,12 +150,14 @@ PythonSeed = "Initialize random number generator" PythonSetPixel = "Color pixel (x,y)" PythonSin = "Sine" PythonSinh = "Hyperbolic sine" +PythonSleep = "Suspend execution for t seconds" PythonSort = "Sort a list" PythonSorted = "Sort a list" PythonSqrt = "Square root" PythonSum = "Sum the items of a list" PythonTan = "Tangent" PythonTanh = "Hyperbolic tangent" +PythonTimeFunction = "time module function prefix" PythonTrunc = "x truncated to an integer" PythonTurtleBackward = "Move backward by x pixels" PythonTurtleBlack = "Black color" diff --git a/apps/code/catalog.universal.i18n b/apps/code/catalog.universal.i18n index 7130ca4a2..1d9711c9f 100644 --- a/apps/code/catalog.universal.i18n +++ b/apps/code/catalog.universal.i18n @@ -58,12 +58,14 @@ PythonCommandImportFromIon = "from ion import *" PythonCommandImportFromKandinsky = "from kandinsky import *" PythonCommandImportFromMath = "from math import *" PythonCommandImportFromRandom = "from random import *" +PythonCommandImportFromTime = "from time import *" PythonCommandImportFromTurtle = "from turtle import *" PythonCommandImportCmath = "import cmath" PythonCommandImportIon = "import ion" PythonCommandImportKandinsky = "import kandinsky" PythonCommandImportMath = "import math" PythonCommandImportRandom = "import random" +PythonCommandImportTime = "import time" PythonCommandImportTurtle = "import turtle" PythonCommandIndex = "index(x,start,end)" PythonCommandInput = "input(\"text\")" @@ -135,6 +137,7 @@ PythonCommandMathFunctionWithoutArg = "math.\x11" PythonCommandMax = "max(list)" PythonCommandMin = "min(list)" PythonCommandModf = "modf(x)" +PythonCommandMonotonic = "monotonic()" PythonCommandOct = "oct(x)" PythonCommandPhase = "phase(z)" PythonCommandPolar = "polar(z)" @@ -160,6 +163,7 @@ PythonCommandSetPixel = "set_pixel(x,y,color)" PythonCommandSin = "sin(x)" PythonCommandSinComplex = "sin(z)" PythonCommandSinh = "sinh(x)" +PythonCommandSleep = "sleep(t)" PythonCommandSort = "sort()" PythonCommandSorted = "sorted(list)" PythonCommandSqrt = "sqrt(x)" @@ -167,6 +171,8 @@ PythonCommandSqrtComplex = "sqrt(z)" PythonCommandSum = "sum(list)" PythonCommandTan = "tan(x)" PythonCommandTanh = "tanh(x)" +PythonCommandTimeFunction = "time.function" +PythonCommandTimeFunctionWithoutArg = "time.\x11" PythonCommandTrunc = "trunc(x)" PythonCommandTurtleFunction = "turtle.function" PythonCommandTurtleFunctionWithoutArg = "turtle.\x11" diff --git a/apps/code/python_toolbox.cpp b/apps/code/python_toolbox.cpp index e0eb30495..85022e2b7 100644 --- a/apps/code/python_toolbox.cpp +++ b/apps/code/python_toolbox.cpp @@ -220,13 +220,22 @@ const ToolboxMessageTree IonModuleChildren[] = { ToolboxMessageTree::Leaf(I18n::Message::PythonCommandKeyExe, I18n::Message::PythonKeyExe, false) }; +const ToolboxMessageTree TimeModuleChildren[] = { + ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportTime, I18n::Message::PythonImportTime, false), + ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportFromTime, I18n::Message::PythonImportTime, false), + ToolboxMessageTree::Leaf(I18n::Message::PythonCommandTimeFunction, I18n::Message::PythonTimeFunction, false, I18n::Message::PythonCommandTimeFunctionWithoutArg), + ToolboxMessageTree::Leaf(I18n::Message::PythonCommandMonotonic, I18n::Message::PythonMonotonic, false), + ToolboxMessageTree::Leaf(I18n::Message::PythonCommandSleep, I18n::Message::PythonSleep) +}; + const ToolboxMessageTree modulesChildren[] = { ToolboxMessageTree::Node(I18n::Message::MathModule, MathModuleChildren), ToolboxMessageTree::Node(I18n::Message::CmathModule, CMathModuleChildren), ToolboxMessageTree::Node(I18n::Message::RandomModule, RandomModuleChildren), ToolboxMessageTree::Node(I18n::Message::TurtleModule, TurtleModuleChildren), ToolboxMessageTree::Node(I18n::Message::KandinskyModule, KandinskyModuleChildren), - ToolboxMessageTree::Node(I18n::Message::IonModule, IonModuleChildren) + ToolboxMessageTree::Node(I18n::Message::IonModule, IonModuleChildren), + ToolboxMessageTree::Node(I18n::Message::TimeModule, TimeModuleChildren) }; const ToolboxMessageTree catalogChildren[] = { @@ -287,6 +296,7 @@ const ToolboxMessageTree catalogChildren[] = { ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportFromMath, I18n::Message::PythonImportFromMath, false), ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportFromRandom, I18n::Message::PythonImportFromRandom, false), ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportFromTurtle, I18n::Message::PythonImportFromTurtle, false), + ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportFromTime, I18n::Message::PythonImportTime, false), ToolboxMessageTree::Leaf(I18n::Message::PythonCommandGamma, I18n::Message::PythonGamma), ToolboxMessageTree::Leaf(I18n::Message::PythonCommandGetPixel, I18n::Message::PythonGetPixel), ToolboxMessageTree::Leaf(I18n::Message::PythonCommandGetrandbits, I18n::Message::PythonGetrandbits), @@ -302,6 +312,7 @@ const ToolboxMessageTree catalogChildren[] = { ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportMath, I18n::Message::PythonImportMath, false), ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportRandom, I18n::Message::PythonImportRandom, false), ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportTurtle, I18n::Message::PythonImportTurtle, false), + ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportTime, I18n::Message::PythonImportTime, false), ToolboxMessageTree::Leaf(I18n::Message::PythonCommandIndex, I18n::Message::PythonIndex), ToolboxMessageTree::Leaf(I18n::Message::PythonCommandInput, I18n::Message::PythonInput), ToolboxMessageTree::Leaf(I18n::Message::PythonCommandInsert, I18n::Message::PythonInsert), @@ -324,6 +335,7 @@ const ToolboxMessageTree catalogChildren[] = { ToolboxMessageTree::Leaf(I18n::Message::PythonCommandMax, I18n::Message::PythonMax), ToolboxMessageTree::Leaf(I18n::Message::PythonCommandMin, I18n::Message::PythonMin), ToolboxMessageTree::Leaf(I18n::Message::PythonCommandModf, I18n::Message::PythonModf), + ToolboxMessageTree::Leaf(I18n::Message::PythonCommandMonotonic, I18n::Message::PythonMonotonic, false), ToolboxMessageTree::Leaf(I18n::Message::PythonCommandOct, I18n::Message::PythonOct), ToolboxMessageTree::Leaf(I18n::Message::PythonTurtleCommandOrange, I18n::Message::PythonTurtleOrange, false), ToolboxMessageTree::Leaf(I18n::Message::PythonTurtleCommandPendown, I18n::Message::PythonTurtlePendown, false), @@ -358,6 +370,7 @@ const ToolboxMessageTree catalogChildren[] = { ToolboxMessageTree::Leaf(I18n::Message::PythonTurtleCommandShowturtle, I18n::Message::PythonTurtleShowturtle, false), ToolboxMessageTree::Leaf(I18n::Message::PythonCommandSin, I18n::Message::PythonSin), ToolboxMessageTree::Leaf(I18n::Message::PythonCommandSinh, I18n::Message::PythonSinh), + ToolboxMessageTree::Leaf(I18n::Message::PythonCommandSleep, I18n::Message::PythonSleep), ToolboxMessageTree::Leaf(I18n::Message::PythonCommandSort, I18n::Message::PythonSort, false), ToolboxMessageTree::Leaf(I18n::Message::PythonCommandSorted, I18n::Message::PythonSorted), ToolboxMessageTree::Leaf(I18n::Message::PythonTurtleCommandSpeed, I18n::Message::PythonTurtleSpeed), @@ -365,6 +378,7 @@ const ToolboxMessageTree catalogChildren[] = { ToolboxMessageTree::Leaf(I18n::Message::PythonCommandSum, I18n::Message::PythonSum), ToolboxMessageTree::Leaf(I18n::Message::PythonCommandTan, I18n::Message::PythonTan), ToolboxMessageTree::Leaf(I18n::Message::PythonCommandTanh, I18n::Message::PythonTanh), + ToolboxMessageTree::Leaf(I18n::Message::PythonCommandTimeFunction, I18n::Message::PythonTimeFunction, false, I18n::Message::PythonCommandTimeFunctionWithoutArg), ToolboxMessageTree::Leaf(I18n::Message::PythonCommandTrunc, I18n::Message::PythonTrunc), ToolboxMessageTree::Leaf(I18n::Message::PythonCommandTurtleFunction, I18n::Message::PythonTurtleFunction, false, I18n::Message::PythonCommandTurtleFunctionWithoutArg), ToolboxMessageTree::Leaf(I18n::Message::PythonCommandUniform, I18n::Message::PythonUniform), diff --git a/apps/code/toolbox.universal.i18n b/apps/code/toolbox.universal.i18n index 1551c5702..d5afd929c 100644 --- a/apps/code/toolbox.universal.i18n +++ b/apps/code/toolbox.universal.i18n @@ -2,6 +2,7 @@ CmathModule = "cmath" IonModule = "ion" KandinskyModule = "kandinsky" MathModule = "math" +TimeModule = "time" TurtleModule = "turtle" ForLoopMenu = "For" IfStatementMenu = "If"