diff --git a/LogarithmPlotter/i18n/lp_de.ts b/LogarithmPlotter/i18n/lp_de.ts
index 6b28082..e2d67a6 100644
--- a/LogarithmPlotter/i18n/lp_de.ts
+++ b/LogarithmPlotter/i18n/lp_de.ts
@@ -103,52 +103,72 @@
LaTeX-Rendering aktivieren
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
&Hilfe
-
+
&Quellcode
-
+
Fehler &Melden
-
+
&Benutzerhandbuch
-
+
&Changelog
-
+
&Hilfe beim Übersetzen!
-
+
&Danksagungen
-
+
&Übrigens
-
+
Änderungen speichern?
-
+
Diese Grafik enthält ungespeicherte Änderungen. Dadurch gehen alle ungespeicherten Daten verloren. Fortfahren?
@@ -315,32 +335,47 @@ These settings can be changed at any time from the "Settings" menu.
-
+
Beim Start nach Updates suchen (Online-Verbindung erforderlich)
-
+
Redo-Stapel zurücksetzen, wenn eine neue Aktion zur Historie hinzugefügt wird
-
+
LaTeX-Rendering aktivieren
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Benutzerhandbuch
-
+
Changelog
-
+
Schließen
diff --git a/LogarithmPlotter/i18n/lp_en.ts b/LogarithmPlotter/i18n/lp_en.ts
index 9471a63..f324ea6 100644
--- a/LogarithmPlotter/i18n/lp_en.ts
+++ b/LogarithmPlotter/i18n/lp_en.ts
@@ -103,52 +103,72 @@
Enable LaTeX rendering
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
&Help
-
+
&Source code
-
+
&Report a bug
-
+
&User manual
-
+
&Changelog
-
+
&Help translating!
-
+
&Thanks
-
+
&About
-
+
Save unsaved changes?
-
+
This plot contains unsaved changes. By doing this, all unsaved data will be lost. Continue?
@@ -315,32 +335,47 @@ These settings can be changed at any time from the "Settings" menu.
-
+
Check for updates on startup (requires online connectivity)
-
+
Reset redo stack when a new action is added to history
-
+
Enable LaTeX rendering
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
User manual
-
+
Changelog
-
+
Done
diff --git a/LogarithmPlotter/i18n/lp_es.ts b/LogarithmPlotter/i18n/lp_es.ts
index b07230b..8fd7ba8 100644
--- a/LogarithmPlotter/i18n/lp_es.ts
+++ b/LogarithmPlotter/i18n/lp_es.ts
@@ -103,52 +103,72 @@
Activar el renderizado de LaTeX
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
&Ayuda
-
+
&Código fuente
-
+
&Informar de un error
-
+
&Manual del usuario
-
+
&Registro de cambios
-
+
&¡Ayuda a la traducción!
-
+
&Agradecimientos
-
+
&Acerca de
-
+
¿Guardar los cambios no guardados?
-
+
@@ -283,32 +303,47 @@ These settings can be changed at any time from the "Settings" menu.
-
+
-
+
-
+
Activar el renderizado de LaTeX
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
diff --git a/LogarithmPlotter/i18n/lp_fr.ts b/LogarithmPlotter/i18n/lp_fr.ts
index b3fa2a5..7108f13 100644
--- a/LogarithmPlotter/i18n/lp_fr.ts
+++ b/LogarithmPlotter/i18n/lp_fr.ts
@@ -104,52 +104,72 @@
Activer le rendu LaTeX
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
&Aide
-
+
&Code source
-
+
&Rapport de bug
-
+
Manuel d'&utilisation
-
+
&Historique des modifications
-
+
&Aider à la traduction !
-
+
&Remerciements
-
+
&À propos
-
+
Sauvegarder les modifications ?
-
+
Ce graphe contient des modifications non sauvegardées. En faisant cela, toutes les données non sauvegardées seront perdues. Continuer ?
@@ -317,22 +337,37 @@ These settings can be changed at any time from the "Settings" menu.
-
+
Activer le rendu LaTeX
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Manuel d'utilisation
-
+
Historique des modifications
-
+
Fermer
@@ -343,12 +378,12 @@ These settings can always be changed at any time from the "Settings" m
These settings can always be changed at any time from the "Settings" menu.
-
+
Vérifier les mises à jour au démarrage (nécessite d'être connecté à internet)
-
+
Réinitialiser la pile d'action "Rétablir" lorsqu'une nouvelle action est ajoutée à l'historique
diff --git a/LogarithmPlotter/i18n/lp_hu.ts b/LogarithmPlotter/i18n/lp_hu.ts
index e3b5b8c..e70dc44 100644
--- a/LogarithmPlotter/i18n/lp_hu.ts
+++ b/LogarithmPlotter/i18n/lp_hu.ts
@@ -103,52 +103,72 @@
LaTeX-megjelenítés engedélyezése
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
&Súgó
-
+
&Forráskód
-
+
&Hiba bejelentése
-
+
&Használati utasítás
-
+
&Változásnapló
-
+
&Segítség a fordításban!
-
+
&Köszönjük
-
+
&Névjegy
-
+
Menti a változtatásokat?
-
+
Ez az ábra nem mentett változtatásokat tartalmaz. Ezzel az összes nem mentett adat elveszik. Folytatja?
@@ -315,32 +335,47 @@ These settings can be changed at any time from the "Settings" menu.
-
+
Frissítések keresése indításkor (online kapcsolat szükséges)
-
+
Ismétlési verem alaphelyzet visszaállítása, ha új műveletet adnak az előzményekhez
-
+
LaTeX-megjelenítés engedélyezése
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Használati utasítás
-
+
Változásnapló
-
+
Kész
diff --git a/LogarithmPlotter/i18n/lp_nb_NO.ts b/LogarithmPlotter/i18n/lp_nb_NO.ts
index 7dc0b9c..32ca1b4 100644
--- a/LogarithmPlotter/i18n/lp_nb_NO.ts
+++ b/LogarithmPlotter/i18n/lp_nb_NO.ts
@@ -103,52 +103,72 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
&Hjelp
-
+
-
+
-
+
-
+
-
+
-
+
-
+
&Om
-
+
-
+
@@ -315,32 +335,47 @@ These settings can be changed at any time from the "Settings" menu.
-
+
Se etter nye versjoner ved programstart. (Krever tilkobling til Internett.)
-
+
Tilbakesitll angrehistorikk når en ny handling legges til
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
diff --git a/LogarithmPlotter/i18n/lp_template.ts b/LogarithmPlotter/i18n/lp_template.ts
index 40023b7..81a2ed7 100644
--- a/LogarithmPlotter/i18n/lp_template.ts
+++ b/LogarithmPlotter/i18n/lp_template.ts
@@ -103,52 +103,72 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -283,32 +303,47 @@ These settings can be changed at any time from the "Settings" menu.
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml
index 48cf383..748fb4e 100644
--- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml
+++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml
@@ -35,6 +35,7 @@ import "js/math/latex.js" as LatexJS
\sa LogarithmPlotter
*/
MenuBar {
+ property var settings: settingsMenu
Menu {
title: qsTr("&File")
@@ -123,6 +124,7 @@ MenuBar {
}
Menu {
+ id: settingsMenu
title: qsTr("&Settings")
Action {
id: checkForUpdatesMenuSetting
@@ -154,6 +156,43 @@ MenuBar {
}
icon.name: 'Expression'
}
+
+ Menu {
+ title: qsTr("Expression editor")
+
+ Action {
+ id: autocloseFormulaSetting
+ text: qsTr("Automatically close parenthesises and brackets")
+ checkable: true
+ checked: Helper.getSettingBool("expression_editor.autoclose")
+ onTriggered: {
+ Helper.setSettingBool("expression_editor.autoclose", checked)
+ }
+ icon.name: 'Text'
+ }
+
+ Action {
+ id: colorizeFormulaSetting
+ text: qsTr("Enable syntax highlighting")
+ checkable: true
+ checked: Helper.getSettingBool("expression_editor.colorize")
+ onTriggered: {
+ Helper.setSettingBool("expression_editor.colorize", checked)
+ }
+ icon.name: 'appearance'
+ }
+
+ Action {
+ id: autocompleteFormulaSetting
+ text: qsTr("Enable autocompletion")
+ checkable: true
+ checked: Helper.getSettingBool("autocompletion.enabled")
+ onTriggered: {
+ Helper.setSettingBool("autocompletion.enabled", checked)
+ }
+ icon.name: 'label'
+ }
+ }
}
Menu {
diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Popup/GreetScreen.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Popup/GreetScreen.qml
index 15c1587..40f2fde 100644
--- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Popup/GreetScreen.qml
+++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Popup/GreetScreen.qml
@@ -95,39 +95,81 @@ Popup {
CheckBox {
id: checkForUpdatesSetting
- anchors.horizontalCenter: parent.horizontalCenter
+ anchors.left: parent.left
+ //anchors.horizontalCenter: parent.horizontalCenter
anchors.top: helpText.bottom
anchors.topMargin: 10
checked: Helper.getSettingBool("check_for_updates")
text: qsTr('Check for updates on startup (requires online connectivity)')
onClicked: {
Helper.setSettingBool("check_for_updates", checked)
- //checkForUpdatesMenuSetting.checked = checked
+ // Set in the menu bar
+ appMenu.settings.children[0].checked = checked
}
}
CheckBox {
id: resetRedoStackSetting
- anchors.horizontalCenter: parent.horizontalCenter
+ anchors.left: parent.left
+ //anchors.horizontalCenter: parent.horizontalCenter
anchors.top: checkForUpdatesSetting.bottom
checked: Helper.getSettingBool("reset_redo_stack")
text: qsTr('Reset redo stack when a new action is added to history')
onClicked: {
Helper.setSettingBool("reset_redo_stack", checked)
- //resetRedoStackMenuSetting.checked = checked
+ appMenu.settings.children[1].checked = checked
}
}
CheckBox {
id: enableLatexSetting
- anchors.horizontalCenter: parent.horizontalCenter
+ anchors.left: parent.left
+ //anchors.horizontalCenter: parent.horizontalCenter
anchors.top: resetRedoStackSetting.bottom
checked: Helper.getSettingBool("enable_latex")
text: qsTr('Enable LaTeX rendering')
onClicked: {
Helper.setSettingBool("enable_latex", checked)
- Latex.enabled = checked
- drawCanvas.requestPaint()
+ appMenu.settings.children[2].checked = checked
+ }
+ }
+
+ CheckBox {
+ id: autocloseFormulaSetting
+ anchors.left: parent.left
+ //anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: enableLatexSetting.bottom
+ checked: Helper.getSettingBool("expression_editor.autoclose")
+ text: qsTr('Automatically close parenthesises and brackets in expressions')
+ onClicked: {
+ Helper.setSettingBool("expression_editor.autoclose", checked)
+ appMenu.settings.children[3].children[0].checked = checked
+ }
+ }
+
+ CheckBox {
+ id: colorizeFormulaSetting
+ anchors.left: parent.left
+ //anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: autocloseFormulaSetting.bottom
+ checked: Helper.getSettingBool("expression_editor.colorize")
+ text: qsTr('Enable syntax highlighting for expressions')
+ onClicked: {
+ Helper.setSettingBool("expression_editor.colorize", checked)
+ appMenu.settings.children[3].children[1].checked = checked
+ }
+ }
+
+ CheckBox {
+ id: autocompleteFormulaSetting
+ anchors.left: parent.left
+ //anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: colorizeFormulaSetting.bottom
+ checked: Helper.getSettingBool("autocompletion.enabled")
+ text: qsTr('Enable autocompletion interface in expression editor')
+ onClicked: {
+ Helper.setSettingBool("autocompletion.enabled", checked)
+ appMenu.settings.children[3].children[2].checked = checked
}
}
@@ -159,7 +201,7 @@ Popup {
}
}
- Component.onCompleted: if(Helper.getSetting("last_install_greet") != Helper.getVersion()) {
+ Component.onCompleted: if(Helper.getSetting("last_install_greet") != Helper.getVersion()+"a") {
greetingPopup.open()
}
diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/ExpressionEditor.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/ExpressionEditor.qml
index e4b9840..f0d8f17 100644
--- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/ExpressionEditor.qml
+++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/ExpressionEditor.qml
@@ -151,13 +151,15 @@ Item {
height: parent.height
verticalAlignment: TextInput.AlignVCenter
horizontalAlignment: control.label == "" ? TextInput.AlignLeft : TextInput.AlignHCenter
- //font.pixelSize: 14
text: control.defValue
- color: "transparent"//sysPalette.windowText
+ color: syntaxHighlightingEnabled ? "transparent" : sysPalette.windowText
focus: true
selectByMouse: true
- property var tokens: parent.tokens(text)
+ property bool autocompleteEnabled: Helper.getSettingBool("autocompletion.enabled")
+ property bool syntaxHighlightingEnabled: Helper.getSettingBool("expression_editor.colorize")
+ property bool autoClosing: Helper.getSettingBool("expression_editor.autoclose")
+ property var tokens: autocompleteEnabled || syntaxHighlightingEnabled ? parent.tokens(text) : []
Keys.priority: Keys.BeforeItem // Required for knowing which key the user presses.
@@ -176,25 +178,27 @@ Item {
//onTextEdited: acPopupContent.itemSelected = 0
onActiveFocusChanged: {
- if(activeFocus)
+ if(activeFocus && autocompleteEnabled)
autocompletePopup.open()
else
autocompletePopup.close()
}
Keys.onUpPressed: function(event) {
- if(acPopupContent.itemSelected == 0)
- acPopupContent.itemSelected = acPopupContent.itemCount-1
- else
- acPopupContent.itemSelected = acPopupContent.itemSelected-1
+ if(autocompleteEnabled)
+ if(acPopupContent.itemSelected == 0)
+ acPopupContent.itemSelected = acPopupContent.itemCount-1
+ else
+ acPopupContent.itemSelected = acPopupContent.itemSelected-1
event.accepted = true
}
Keys.onDownPressed: function(event) {
- if(acPopupContent.itemSelected == Math.min(acPopupContent.itemCount-1))
- acPopupContent.itemSelected = 0
- else
- acPopupContent.itemSelected = acPopupContent.itemSelected+1
+ if(autocompleteEnabled)
+ if(acPopupContent.itemSelected == Math.min(acPopupContent.itemCount-1))
+ acPopupContent.itemSelected = 0
+ else
+ acPopupContent.itemSelected = acPopupContent.itemSelected+1
event.accepted = true
}
@@ -202,7 +206,7 @@ Item {
// Autocomplete popup events
//console.log(acPopupContent.currentToken.dot, acPopupContent.previousToken.dot, "@", acPopupContent.currentToken.identifier, acPopupContent.previousToken.identifier, acPopupContent.previousToken2.identifier, objectPropertiesList.objectName, JSON.stringify(objectPropertiesList.baseText), objectPropertiesList.model.length, JSON.stringify(objectPropertiesList.categoryItems))
//console.log("Pressed key:", event.key, Qt.Key_Return, Qt.Key_Enter, event.text, acPopupContent.itemCount)
- if((event.key == Qt.Key_Enter || event.key == Qt.Key_Return) && acPopupContent.itemCount > 0) {
+ if(autocompleteEnabled && (event.key == Qt.Key_Enter || event.key == Qt.Key_Return) && acPopupContent.itemCount > 0) {
acPopupContent.autocomplete()
event.accepted = true
} else
@@ -212,7 +216,7 @@ Item {
}*/
- if(event.text in openAndCloseMatches) {
+ if(event.text in openAndCloseMatches && autoClosing) {
let start = selectionStart
insert(selectionStart, event.text)
insert(selectionEnd, openAndCloseMatches[event.text])
@@ -227,8 +231,9 @@ Item {
verticalAlignment: TextInput.AlignVCenter
horizontalAlignment: control.label == "" ? TextInput.AlignLeft : TextInput.AlignHCenter
textFormat: Text.StyledText
- text: colorize(parent.tokens)
+ text: parent.syntaxHighlightingEnabled ? colorize(parent.tokens) : ""
color: sysPalette.windowText
+ visible: parent.syntaxHighlightingEnabled
//font.pixelSize: parent.font.pixelSize
//opacity: editor.activeFocus ? 0 : 1
}
@@ -537,7 +542,7 @@ Item {
parsedText += `${token.value}`
break;
case Parsing.TokenType.FUNCTION:
- parsedText += `${token.value}`
+ parsedText += `${Utils.escapeHTML(token.value)}`
break;
case Parsing.TokenType.OPERATOR:
parsedText += `${Utils.escapeHTML(token.value)}`
diff --git a/LogarithmPlotter/util/config.py b/LogarithmPlotter/util/config.py
index 4f7b20c..4f19fd3 100644
--- a/LogarithmPlotter/util/config.py
+++ b/LogarithmPlotter/util/config.py
@@ -26,7 +26,15 @@ DEFAULT_SETTINGS = {
"check_for_updates": True,
"reset_redo_stack": True,
"last_install_greet": "0",
- "enable_latex": False
+ "enable_latex": False,
+ "expression_editor": {
+ "autoclose": True,
+ "colorize": True,
+ "color_scheme": 0,
+ },
+ "autocompletion": {
+ "enabled": True
+ }
}
# Create config directory
@@ -51,7 +59,11 @@ def init():
if path.exists(CONFIG_FILE):
cfg_data = load(open(CONFIG_FILE, 'r', -1, 'utf8'))
for setting_name in cfg_data:
- setSetting(setting_name, cfg_data[setting_name])
+ if type(cfg_data[setting_name]) == dict:
+ for setting_name2 in cfg_data[setting_name]:
+ setSetting(setting_name+"."+setting_name2, cfg_data[setting_name][setting_name2])
+ else:
+ setSetting(setting_name, cfg_data[setting_name])
def save():
"""