Adding error handling for function argument errors.
This commit is contained in:
parent
75e70903f1
commit
35ce1c4824
9 changed files with 112 additions and 3 deletions
|
@ -1046,6 +1046,14 @@ Evaluated expression: %3</source>
|
|||
|
||||
Ausdruck analysiert: %3</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/eu/ad5001/LogarithmPlotter/LogGraphCanvas.qml" line="179"/>
|
||||
<source>Error while attempting to draw %1 %2:
|
||||
%3
|
||||
|
||||
Undoing last change.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>expression</name>
|
||||
|
@ -1066,6 +1074,11 @@ Evaluated expression: %3</source>
|
|||
|
||||
Ausdruck analysiert: %3</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/eu/ad5001/LogarithmPlotter/LogGraphCanvas.qml" line="176"/>
|
||||
<source>LogarithmPlotter - Drawing error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>function</name>
|
||||
|
|
|
@ -1046,6 +1046,14 @@ Evaluated expression: %3</source>
|
|||
|
||||
Evaluated expression: %3</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/eu/ad5001/LogarithmPlotter/LogGraphCanvas.qml" line="179"/>
|
||||
<source>Error while attempting to draw %1 %2:
|
||||
%3
|
||||
|
||||
Undoing last change.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>expression</name>
|
||||
|
@ -1066,6 +1074,11 @@ Evaluated expression: %3</source>
|
|||
|
||||
Evaluated expression: %3</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/eu/ad5001/LogarithmPlotter/LogGraphCanvas.qml" line="176"/>
|
||||
<source>LogarithmPlotter - Drawing error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>function</name>
|
||||
|
|
|
@ -991,6 +991,14 @@ These settings can be changed at any time from the "Settings" menu.</s
|
|||
Evaluated expression: %3</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/eu/ad5001/LogarithmPlotter/LogGraphCanvas.qml" line="179"/>
|
||||
<source>Error while attempting to draw %1 %2:
|
||||
%3
|
||||
|
||||
Undoing last change.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>expression</name>
|
||||
|
@ -1008,6 +1016,11 @@ Evaluated expression: %3</source>
|
|||
Evaluated expression: %3</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/eu/ad5001/LogarithmPlotter/LogGraphCanvas.qml" line="176"/>
|
||||
<source>LogarithmPlotter - Drawing error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>function</name>
|
||||
|
|
|
@ -1055,6 +1055,14 @@ Evaluated expression: %3</source>
|
|||
|
||||
Formule analysée : %3</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/eu/ad5001/LogarithmPlotter/LogGraphCanvas.qml" line="179"/>
|
||||
<source>Error while attempting to draw %1 %2:
|
||||
%3
|
||||
|
||||
Undoing last change.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>expression</name>
|
||||
|
@ -1075,6 +1083,11 @@ Evaluated expression: %3</source>
|
|||
|
||||
Formule analysée : %3</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/eu/ad5001/LogarithmPlotter/LogGraphCanvas.qml" line="176"/>
|
||||
<source>LogarithmPlotter - Drawing error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>function</name>
|
||||
|
|
|
@ -1046,6 +1046,14 @@ Evaluated expression: %3</source>
|
|||
|
||||
Kiértékelt kifejezés: %3</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/eu/ad5001/LogarithmPlotter/LogGraphCanvas.qml" line="179"/>
|
||||
<source>Error while attempting to draw %1 %2:
|
||||
%3
|
||||
|
||||
Undoing last change.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>expression</name>
|
||||
|
@ -1066,6 +1074,11 @@ Evaluated expression: %3</source>
|
|||
|
||||
Kiértékelt kifejezés: %3</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/eu/ad5001/LogarithmPlotter/LogGraphCanvas.qml" line="176"/>
|
||||
<source>LogarithmPlotter - Drawing error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>function</name>
|
||||
|
|
|
@ -1043,6 +1043,14 @@ Disse innstillingene kan endres når som helst fra «Innstillinger»-menyen.</tr
|
|||
Evaluated expression: %3</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/eu/ad5001/LogarithmPlotter/LogGraphCanvas.qml" line="179"/>
|
||||
<source>Error while attempting to draw %1 %2:
|
||||
%3
|
||||
|
||||
Undoing last change.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>expression</name>
|
||||
|
@ -1060,6 +1068,11 @@ Evaluated expression: %3</source>
|
|||
Evaluated expression: %3</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/eu/ad5001/LogarithmPlotter/LogGraphCanvas.qml" line="176"/>
|
||||
<source>LogarithmPlotter - Drawing error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>function</name>
|
||||
|
|
|
@ -991,6 +991,14 @@ These settings can be changed at any time from the "Settings" menu.</s
|
|||
Evaluated expression: %3</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/eu/ad5001/LogarithmPlotter/LogGraphCanvas.qml" line="179"/>
|
||||
<source>Error while attempting to draw %1 %2:
|
||||
%3
|
||||
|
||||
Undoing last change.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>expression</name>
|
||||
|
@ -1008,6 +1016,11 @@ Evaluated expression: %3</source>
|
|||
Evaluated expression: %3</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/eu/ad5001/LogarithmPlotter/LogGraphCanvas.qml" line="176"/>
|
||||
<source>LogarithmPlotter - Drawing error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>function</name>
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import QtQuick
|
||||
import QtQuick
|
||||
import Qt.labs.platform as Native
|
||||
import "js/objects.js" as Objects
|
||||
import "js/utils.js" as Utils
|
||||
import "js/mathlib.js" as MathLib
|
||||
|
@ -170,6 +171,16 @@ Canvas {
|
|||
|
||||
Component.onCompleted: imageLoaders = {}
|
||||
|
||||
Native.MessageDialog {
|
||||
id: drawingErrorDialog
|
||||
title: qsTranslate("expression", "LogarithmPlotter - Drawing error")
|
||||
text: ""
|
||||
function showDialog(objType, objName, error) {
|
||||
text = qsTranslate("error", "Error while attempting to draw %1 %2:\n%3\n\nUndoing last change.").arg(objType).arg(objName).arg(error)
|
||||
open()
|
||||
}
|
||||
}
|
||||
|
||||
onPaint: function(rect) {
|
||||
//console.log('Redrawing')
|
||||
if(rect.width == canvas.width) { // Redraw full canvas
|
||||
|
@ -183,7 +194,14 @@ Canvas {
|
|||
for(var obj of Objects.currentObjects[objType]){
|
||||
ctx.strokeStyle = obj.color
|
||||
ctx.fillStyle = obj.color
|
||||
if(obj.visible) obj.draw(canvas, ctx)
|
||||
if(obj.visible)
|
||||
try {
|
||||
obj.draw(canvas, ctx)
|
||||
} catch(e) {
|
||||
// Drawing throws an error. Generally, it's due to a new modification (or the opening of a file)
|
||||
drawingErrorDialog.showDialog(objType, obj.name, e.message)
|
||||
history.undo()
|
||||
}
|
||||
}
|
||||
}
|
||||
ctx.lineWidth = 1
|
||||
|
|
|
@ -91,7 +91,7 @@ Repeater {
|
|||
root.changed()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue