mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[apps/code] Added exceptions handling in toolbox
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -3,3 +3,4 @@ Catalog = "Katalog"
|
||||
Modules = "Module"
|
||||
LoopsAndTests = "Schleifen und Tests"
|
||||
Files = "Dateien"
|
||||
Exceptions = "Ausnahmen"
|
||||
|
||||
@@ -3,3 +3,4 @@ Catalog = "Catalog"
|
||||
Modules = "Modules"
|
||||
LoopsAndTests = "Loops and tests"
|
||||
Files = "Files"
|
||||
Exceptions = "Exceptions"
|
||||
|
||||
@@ -3,3 +3,4 @@ Catalog = "Catalog"
|
||||
Modules = "Modules"
|
||||
LoopsAndTests = "Loops and tests"
|
||||
Files = "Files"
|
||||
Exceptions = "Exceptions"
|
||||
|
||||
@@ -3,3 +3,4 @@ Catalog = "Catalogue"
|
||||
Modules = "Modules"
|
||||
LoopsAndTests = "Boucles et tests"
|
||||
Files = "Fichiers"
|
||||
Exceptions = "Exceptions"
|
||||
|
||||
@@ -3,3 +3,4 @@ Catalog = "Katalógus"
|
||||
Modules = "Modulok"
|
||||
LoopsAndTests = "Hurkok és tesztek"
|
||||
Files = "Fájlok"
|
||||
Exceptions = "Kivételek"
|
||||
|
||||
@@ -3,3 +3,4 @@ Catalog = "Catalog"
|
||||
Modules = "Modules"
|
||||
LoopsAndTests = "Loops and tests"
|
||||
Files = "Files"
|
||||
Exceptions = "Exceptions"
|
||||
|
||||
@@ -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 "
|
||||
|
||||
Reference in New Issue
Block a user