From d4f0c7d3e82d7e030ad752d7c1227e3d5821f269 Mon Sep 17 00:00:00 2001 From: ArtichOwO Date: Wed, 7 Jul 2021 14:24:20 +0200 Subject: [PATCH] Added sys to the code toolbox --- apps/code/catalog.de.i18n | 8 ++++++++ apps/code/catalog.en.i18n | 8 ++++++++ apps/code/catalog.es.i18n | 8 ++++++++ apps/code/catalog.fr.i18n | 8 ++++++++ apps/code/catalog.hu.i18n | 8 ++++++++ apps/code/catalog.it.i18n | 8 ++++++++ apps/code/catalog.nl.i18n | 9 +++++++++ apps/code/catalog.pt.i18n | 8 ++++++++ apps/code/catalog.universal.i18n | 10 ++++++++++ apps/code/python_toolbox.cpp | 13 +++++++++++++ apps/code/toolbox.universal.i18n | 1 + 11 files changed, 89 insertions(+) diff --git a/apps/code/catalog.de.i18n b/apps/code/catalog.de.i18n index 39a87f0f5..0e5a92fda 100644 --- a/apps/code/catalog.de.i18n +++ b/apps/code/catalog.de.i18n @@ -78,11 +78,19 @@ PythonImportMatplotlibPyplot = "Matplotlib.pyplot-Modul importieren" PythonImportNumpy = "Ulab.numpy-Modul importieren" PythonImportScipy = "Ulab.scipy-Modul importieren" PythonImportOs = "OS-Modul importieren" +PythonImportSys = "SYS-Modul importieren" PythonOsUname = "Informationen über das System holen" PythonOsGetlogin = "Benutzernamen holen" PythonOsRemove = "Datei namens Dateiname entfernen" PythonOsRename = "Datei umbenennen von Alt nach Neu" PythonOsListdir = "Dateien im Speicher auflisten" +PythonSysExit = "Terminate current program" +PythonSysPrintexception = "Print exception" +PythonSysByteorder = "The byte order of the system" +PythonSysImplementation = "Information about Python" +PythonSysModules = "Dictionary of loaded modules" +PythonSysVersion = "Python language version (string)" +PythonSysVersioninfo = "Python language version (tuple)" PythonImportTime = "Time-Modul importieren" PythonImportTurtle = "Turtle-Modul importieren" PythonIndex = "Index des ersten x-Vorkommens" diff --git a/apps/code/catalog.en.i18n b/apps/code/catalog.en.i18n index 41191e4c1..b0ff6c784 100644 --- a/apps/code/catalog.en.i18n +++ b/apps/code/catalog.en.i18n @@ -176,11 +176,19 @@ PythonTurtleWrite = "Display a text" PythonUniform = "Floating point number in [a,b]" PythonImportTime = "Import time module" PythonImportOs = "Import os module" +PythonImportSys = "Import sys module" PythonOsUname = "Get infos about the system" PythonOsGetlogin = "Get username" PythonOsRemove = "Remove file named filename" PythonOsRename = "Rename file oldname to newname" PythonOsListdir = "List files in memory" +PythonSysExit = "Terminate current program" +PythonSysPrintexception = "Print exception" +PythonSysByteorder = "The byte order of the system" +PythonSysImplementation = "Information about Python" +PythonSysModules = "Dictionary of loaded modules" +PythonSysVersion = "Python language version (string)" +PythonSysVersioninfo = "Python language version (tuple)" PythonTimePrefix = "time module function prefix" PythonTimeSleep = "Wait for n second" PythonMonotonic = "Return monotonic time" diff --git a/apps/code/catalog.es.i18n b/apps/code/catalog.es.i18n index c312acbb1..e8c62d967 100644 --- a/apps/code/catalog.es.i18n +++ b/apps/code/catalog.es.i18n @@ -176,11 +176,19 @@ PythonTurtleWrite = "Display a text" PythonUniform = "Floating point number in [a,b]" PythonImportTime = "Import time module" PythonImportOs = "Import os module" +PythonImportSys = "Import sys module" PythonOsUname = " Información del sistema " PythonOsGetlogin = "Get username" PythonOsRemove = "Eliminar un archivo" PythonOsRename = "Renombrar archivo" PythonOsListdir = "Archivos de la lista" +PythonSysExit = "Terminate current program" +PythonSysPrintexception = "Print exception" +PythonSysByteorder = "The byte order of the system" +PythonSysImplementation = "Information about Python" +PythonSysModules = "Dictionary of loaded modules" +PythonSysVersion = "Python language version (string)" +PythonSysVersioninfo = "Python language version (tuple)" PythonTimePrefix = "time module function prefix" PythonTimeSleep = "Esperar n segundos" PythonMonotonic = "Tiempo monótono de retorno" diff --git a/apps/code/catalog.fr.i18n b/apps/code/catalog.fr.i18n index 1de09846e..0fc97fd74 100644 --- a/apps/code/catalog.fr.i18n +++ b/apps/code/catalog.fr.i18n @@ -176,11 +176,19 @@ PythonTurtleWrite = "Affiche un texte" PythonUniform = "Nombre décimal dans [a,b]" PythonImportTime = "Importation du module temps" PythonImportOs = "Importation du module os" +PythonImportSys = "Importation du module sys" PythonOsUname = "Donne des infos sur le système" PythonOsGetlogin = "Donne le nom d'utilisateur" PythonOsRemove = "Supprime le fichier nommé filename" PythonOsRename = "Renomme oldname en newname" PythonOsListdir = "Liste les fichiers" +PythonSysExit = "Termine le programme" +PythonSysPrintexception = "Imprime une exception" +PythonSysByteorder = "L'ordre des octets du système" +PythonSysImplementation = "Information sur Python" +PythonSysModules = "Dictionnaire des modules chargés" +PythonSysVersion = "Version du langage Python (string)" +PythonSysVersioninfo = "Version du langage Python (tuple)" PythonTimePrefix = "Préfixe fonction du module temps" PythonTimeSleep = "Attendre n secondes" PythonMonotonic = "Retourne le temps monotone" diff --git a/apps/code/catalog.hu.i18n b/apps/code/catalog.hu.i18n index 432dccedb..1c78c3b13 100644 --- a/apps/code/catalog.hu.i18n +++ b/apps/code/catalog.hu.i18n @@ -200,3 +200,11 @@ PythonOsGetlogin = "Get username" PythonOsRemove = "Fájl törlése" PythonOsRename = "Fájl átnevezése" PythonOsListdir = "Fájlok listája" +PythonImportSys = "sys modul importálása" +PythonSysExit = "Terminate current program" +PythonSysPrintexception = "Print exception" +PythonSysByteorder = "The byte order of the system" +PythonSysImplementation = "Information about Python" +PythonSysModules = "Dictionary of loaded modules" +PythonSysVersion = "Python language version (string)" +PythonSysVersioninfo = "Python language version (tuple)" diff --git a/apps/code/catalog.it.i18n b/apps/code/catalog.it.i18n index 691e79137..5d14e7cdc 100644 --- a/apps/code/catalog.it.i18n +++ b/apps/code/catalog.it.i18n @@ -85,6 +85,14 @@ PythonOsGetlogin = "Get username" PythonOsRemove = "Rimuovere un file" PythonOsRename = "Rinomina file" PythonOsListdir = "Elenca file" +PythonImportSys = "Importa modulo sys" +PythonSysExit = "Terminate current program" +PythonSysPrintexception = "Print exception" +PythonSysByteorder = "The byte order of the system" +PythonSysImplementation = "Information about Python" +PythonSysModules = "Dictionary of loaded modules" +PythonSysVersion = "Python language version (string)" +PythonSysVersioninfo = "Python language version (tuple)" PythonIndex = "Indice prima occorrenza di x" PythonInput = "Inserire un valore" PythonInsert = "Inserire x in posizione i-esima" diff --git a/apps/code/catalog.nl.i18n b/apps/code/catalog.nl.i18n index 0947a8f55..503cb9873 100644 --- a/apps/code/catalog.nl.i18n +++ b/apps/code/catalog.nl.i18n @@ -84,6 +84,15 @@ PythonOsGetlogin = "Get username" PythonOsRemove = "Een bestand verwijderen" PythonOsRename = "Hernoem bestand" PythonOsListdir = "Lijstbestanden" +PythonImportSys = "Importeer sys module" +PythonImportSys = "Importeer sys module" +PythonSysExit = "Terminate current program" +PythonSysPrintexception = "Print exception" +PythonSysByteorder = "The byte order of the system" +PythonSysImplementation = "Information about Python" +PythonSysModules = "Dictionary of loaded modules" +PythonSysVersion = "Python language version (string)" +PythonSysVersioninfo = "Python language version (tuple)" PythonImportTurtle = "Importeer turtle module" PythonIndex = "Index van de eerste x aanwezigheden" PythonInput = "Wijs een waarde toe" diff --git a/apps/code/catalog.pt.i18n b/apps/code/catalog.pt.i18n index 7a566ddc0..fd043ba0a 100644 --- a/apps/code/catalog.pt.i18n +++ b/apps/code/catalog.pt.i18n @@ -181,6 +181,14 @@ PythonOsGetlogin = "Get username" PythonOsRemove = "Remover um ficheiro" PythonOsRename = "Renomear ficheiro" PythonOsListdir = "Listar ficheiros" +PythonImportSys = "Import sys module" +PythonSysExit = "Terminate current program" +PythonSysPrintexception = "Print exception" +PythonSysByteorder = "The byte order of the system" +PythonSysImplementation = "Information about Python" +PythonSysModules = "Dictionary of loaded modules" +PythonSysVersion = "Python language version (string)" +PythonSysVersioninfo = "Python language version (tuple)" PythonTimePrefix = "time module function prefix" PythonTimeSleep = "Wait for n second" PythonMonotonic = "Return monotonic time" diff --git a/apps/code/catalog.universal.i18n b/apps/code/catalog.universal.i18n index 50f41778f..be9ca2f03 100644 --- a/apps/code/catalog.universal.i18n +++ b/apps/code/catalog.universal.i18n @@ -96,6 +96,8 @@ PythonCommandImportFromScipy = "from ulab import scipy as spy" PythonCommandImportRandom = "import random" PythonCommandImportOs = "import os" PythonCommandImportFromOs = "from os import *" +PythonCommandImportSys = "import sys" +PythonCommandImportFromSys = "from sys import *" PythonCommandImportTime = "import time" PythonCommandImportTurtle = "import turtle" PythonCommandIndex = "list.index(x)" @@ -373,6 +375,14 @@ PythonOsCommandRename = "rename(oldname, newname)" PythonOsCommandRemoveWithoutArg = "remove(\x11)" PythonOsCommandRenameWithoutArg = "rename(\x11,)" PythonOsCommandListdir = "listdir()" +PythonSysCommandExit = "exit()" +PythonSysCommandPrintexception = "print_exception(exc)" +PythonSysCommandPrintexceptionWithoutArg = "print_exception(\x11)" +PythonSysCommandByteorder = "byteorder" +PythonSysCommandImplementation = "implementation" +PythonSysCommandModules = "modules" +PythonSysCommandVersion = "version" +PythonSysCommandVersioninfo = "version_info" PythonTurtleCommandBackward = "backward(x)" PythonTurtleCommandCircle = "circle(r)" PythonTurtleCommandColor = "color('c')" diff --git a/apps/code/python_toolbox.cpp b/apps/code/python_toolbox.cpp index 57e40f013..339be8840 100644 --- a/apps/code/python_toolbox.cpp +++ b/apps/code/python_toolbox.cpp @@ -403,6 +403,18 @@ const ToolboxMessageTree OsModuleChildren[] = { ToolboxMessageTree::Leaf(I18n::Message::PythonOsCommandListdir, I18n::Message::PythonOsListdir, false) }; +const ToolboxMessageTree SysModuleChildren[] = { + ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportSys, I18n::Message::PythonImportSys, false), + ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportFromSys, I18n::Message::PythonImportSys, false), + ToolboxMessageTree::Leaf(I18n::Message::PythonSysCommandExit, I18n::Message::PythonSysExit, false), + ToolboxMessageTree::Leaf(I18n::Message::PythonSysCommandPrintexception, I18n::Message::PythonSysPrintexception, false, I18n::Message::PythonSysCommandPrintexceptionWithoutArg), + ToolboxMessageTree::Leaf(I18n::Message::PythonSysCommandByteorder, I18n::Message::PythonSysByteorder, false), + ToolboxMessageTree::Leaf(I18n::Message::PythonSysCommandImplementation, I18n::Message::PythonSysImplementation, false), + ToolboxMessageTree::Leaf(I18n::Message::PythonSysCommandModules, I18n::Message::PythonSysModules, false), + ToolboxMessageTree::Leaf(I18n::Message::PythonSysCommandVersion, I18n::Message::PythonSysVersion, false), + ToolboxMessageTree::Leaf(I18n::Message::PythonSysCommandVersioninfo, I18n::Message::PythonSysVersioninfo, false) +}; + const ToolboxMessageTree modulesChildren[] = { ToolboxMessageTree::Node(I18n::Message::MathModule, MathModuleChildren), ToolboxMessageTree::Node(I18n::Message::CmathModule, CMathModuleChildren), @@ -415,6 +427,7 @@ const ToolboxMessageTree modulesChildren[] = { ToolboxMessageTree::Node(I18n::Message::KandinskyModule, KandinskyModuleChildren), ToolboxMessageTree::Node(I18n::Message::IonModule, IonModuleChildren), ToolboxMessageTree::Node(I18n::Message::OsModule, OsModuleChildren), + ToolboxMessageTree::Node(I18n::Message::SysModule, SysModuleChildren), ToolboxMessageTree::Node(I18n::Message::TimeModule, TimeModuleChildren) }; diff --git a/apps/code/toolbox.universal.i18n b/apps/code/toolbox.universal.i18n index 99810151a..e7664f96c 100644 --- a/apps/code/toolbox.universal.i18n +++ b/apps/code/toolbox.universal.i18n @@ -13,6 +13,7 @@ ScipySignalModule = "signal" ScipySpecialModule = "special" NumpyNdarray = "ndarray" OsModule = "os" +SysModule = "sys" TimeModule = "time" TurtleModule = "turtle" UlabModule = "ulab"