diff --git a/apps/code/python_toolbox.cpp b/apps/code/python_toolbox.cpp index 8ee79fbf1..9c30d04d6 100644 --- a/apps/code/python_toolbox.cpp +++ b/apps/code/python_toolbox.cpp @@ -441,12 +441,20 @@ const ToolboxMessageTree fileChildren[] { ToolboxMessageTree::Leaf(I18n::Message::PythonCommandFileWritelines, I18n::Message::PythonFileWritelines, false, I18n::Message::PythonCommandFileWritelinesWithoutArg), }; +const ToolboxMessageTree exceptionsChildren[] = { + ToolboxMessageTree::Leaf(I18n::Message::TryExcept1ErrorWithArg, I18n::Message::Default, false, I18n::Message::TryExcept1Error), + ToolboxMessageTree::Leaf(I18n::Message::TryExcept1ErrorElseWithArg, I18n::Message::Default, false, I18n::Message::TryExcept1ErrorElse), + ToolboxMessageTree::Leaf(I18n::Message::TryExcept2ErrorWithArg, I18n::Message::Default, false, I18n::Message::TryExcept2Error), + ToolboxMessageTree::Leaf(I18n::Message::WithInstructionWithArg, I18n::Message::Default, false, I18n::Message::WithInstruction), +}; + const ToolboxMessageTree menu[] = { ToolboxMessageTree::Node(I18n::Message::LoopsAndTests, loopsAndTestsChildren), ToolboxMessageTree::Node(I18n::Message::Modules, modulesChildren), ToolboxMessageTree::Node(I18n::Message::Catalog, catalogChildren), ToolboxMessageTree::Node(I18n::Message::Functions, functionsChildren), - ToolboxMessageTree::Node(I18n::Message::Files, fileChildren) + ToolboxMessageTree::Node(I18n::Message::Files, fileChildren), + ToolboxMessageTree::Node(I18n::Message::Exceptions, exceptionsChildren) }; const ToolboxMessageTree toolboxModel = ToolboxMessageTree::Node(I18n::Message::Toolbox, menu); @@ -472,7 +480,7 @@ bool PythonToolbox::handleEvent(Ion::Events::Event event) { } KDCoordinate PythonToolbox::rowHeight(int j) { - if (typeAtLocation(0, j) == Toolbox::LeafCellType && m_messageTreeModel->label() == I18n::Message::IfStatementMenu) { + if (typeAtLocation(0, j) == Toolbox::LeafCellType && (m_messageTreeModel->label() == I18n::Message::IfStatementMenu || m_messageTreeModel->label() == I18n::Message::Exceptions)) { /* To get the exact height needed for each cell, we have to compute its * text size, which means scan the text char by char to look for '\n' * chars. This is very costly and ruins the speed performance when diff --git a/apps/code/toolbox.de.i18n b/apps/code/toolbox.de.i18n index fedc22d19..34840329b 100644 --- a/apps/code/toolbox.de.i18n +++ b/apps/code/toolbox.de.i18n @@ -3,3 +3,4 @@ Catalog = "Katalog" Modules = "Module" LoopsAndTests = "Schleifen und Tests" Files = "Dateien" +Exceptions = "Ausnahmen" diff --git a/apps/code/toolbox.en.i18n b/apps/code/toolbox.en.i18n index 40c50d42d..81e60c7da 100644 --- a/apps/code/toolbox.en.i18n +++ b/apps/code/toolbox.en.i18n @@ -3,3 +3,4 @@ Catalog = "Catalog" Modules = "Modules" LoopsAndTests = "Loops and tests" Files = "Files" +Exceptions = "Exceptions" diff --git a/apps/code/toolbox.es.i18n b/apps/code/toolbox.es.i18n index 40c50d42d..81e60c7da 100644 --- a/apps/code/toolbox.es.i18n +++ b/apps/code/toolbox.es.i18n @@ -3,3 +3,4 @@ Catalog = "Catalog" Modules = "Modules" LoopsAndTests = "Loops and tests" Files = "Files" +Exceptions = "Exceptions" diff --git a/apps/code/toolbox.fr.i18n b/apps/code/toolbox.fr.i18n index 0b16add7c..724abb7a5 100644 --- a/apps/code/toolbox.fr.i18n +++ b/apps/code/toolbox.fr.i18n @@ -3,3 +3,4 @@ Catalog = "Catalogue" Modules = "Modules" LoopsAndTests = "Boucles et tests" Files = "Fichiers" +Exceptions = "Exceptions" diff --git a/apps/code/toolbox.hu.i18n b/apps/code/toolbox.hu.i18n index 8730fb185..890151220 100644 --- a/apps/code/toolbox.hu.i18n +++ b/apps/code/toolbox.hu.i18n @@ -3,3 +3,4 @@ Catalog = "Katalógus" Modules = "Modulok" LoopsAndTests = "Hurkok és tesztek" Files = "Fájlok" +Exceptions = "Kivételek" diff --git a/apps/code/toolbox.pt.i18n b/apps/code/toolbox.pt.i18n index 40c50d42d..81e60c7da 100644 --- a/apps/code/toolbox.pt.i18n +++ b/apps/code/toolbox.pt.i18n @@ -3,3 +3,4 @@ Catalog = "Catalog" Modules = "Modules" LoopsAndTests = "Loops and tests" Files = "Files" +Exceptions = "Exceptions" diff --git a/apps/code/toolbox.universal.i18n b/apps/code/toolbox.universal.i18n index 5a5072475..0600a4dfd 100644 --- a/apps/code/toolbox.universal.i18n +++ b/apps/code/toolbox.universal.i18n @@ -44,6 +44,14 @@ ForInRange2ArgsLoop = "for i in range(\x11,):\n " ForInRange2ArgsLoopWithArg = "for i in range(start, stop):\n instruction" ForInRange1ArgLoop = "for i in range(\x11):\n " ForInRange1ArgLoopWithArg = "for i in range(size):\n instruction" +TryExcept1Error = "try:\n \nexcept \x11:\n " +TryExcept1ErrorWithArg = "try:\n instruction\nexcept Error:\n reaction" +TryExcept1ErrorElse = "try:\n \nexcept \x11:\n \nelse:\n " +TryExcept1ErrorElseWithArg = "try:\n instruction\nexcept Error:\n reaction\nelse:\n clean" +TryExcept2Error = "try:\n \nexcept (\x11):\n " +TryExcept2ErrorWithArg = "try:\n instruction\nexcept (Error1, Error2):\n reaction" +WithInstruction = "with \x11 as :\n " +WithInstructionWithArg = "with expression as target:\n instructions" PythonCommandDef = "def \x11():\n " PythonCommandDefWithArg = "def function(x):" PythonCommandReturn = "return "