Adding color schemes for expressions

This commit is contained in:
Adsooi 2023-05-22 05:56:34 +02:00
parent 7ec80e6682
commit 5ef8cac1c0
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160
3 changed files with 150 additions and 133 deletions

View file

@ -17,7 +17,7 @@
""" """
from shutil import which from shutil import which
__VERSION__ = "0.3.0" __VERSION__ = "0.4.0"
is_release = True is_release = True

View file

@ -194,11 +194,12 @@ MenuBar {
} }
Menu { Menu {
id: colorSchemeSetting
title: qsTr("Color Scheme") title: qsTr("Color Scheme")
property var schemes: ["Breeze Light", "Breeze Dark", "Solarized", "Github Light", "Github Dark", "Nord", "Monokai"] property var schemes: ["Breeze Light", "Breeze Dark", "Solarized", "Github Light", "Github Dark", "Nord", "Monokai"]
Repeater { Repeater {
model: ["Breeze Light", "Breeze Dark", "Solarized", "Github Light", "Github Dark", "Nord", "Monokai"] model: colorSchemeSetting.schemes
MenuItem { MenuItem {
text: modelData text: modelData

View file

@ -37,143 +37,159 @@ Popup {
height: Math.min(parent.height-40, 700) height: Math.min(parent.height-40, 700)
modal: true modal: true
focus: true focus: true
clip: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
Item { ScrollView {
id: welcome anchors.left: parent.left
height: logo.height anchors.right: parent.right
width: logo.width + 10 + welcomeText.width
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: (parent.width-width)/2 anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter anchors.bottomMargin: bottomButtons.height + 20
clip: true
Image { Column {
id: logo width: greetingPopup.width - 25
source: "../icons/logarithmplotter.svg" spacing: 10
sourceSize.width: 48 clip: true
sourceSize.height: 48 topPadding: 35
width: 48
height: 48
}
Label { Row {
id: welcomeText id: welcome
anchors.verticalCenter: parent.verticalCenter height: logo.height
anchors.left: logo.right spacing: 10
anchors.leftMargin: 10 anchors.horizontalCenter: parent.horizontalCenter
//width: parent.width
wrapMode: Text.WordWrap
font.pixelSize: 32
text: qsTr("Welcome to LogarithmPlotter")
}
}
Label { Image {
id: versionText id: logo
anchors.horizontalCenter: parent.horizontalCenter source: "../icons/logarithmplotter.svg"
anchors.top: welcome.bottom sourceSize.width: 48
anchors.topMargin: 10 sourceSize.height: 48
//width: parent.width width: 48
wrapMode: Text.WordWrap height: 48
width: implicitWidth }
font.pixelSize: 18
font.italic: true
text: qsTr("Version %1").arg(Helper.getVersion())
}
Label { Label {
id: helpText id: welcomeText
anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter
anchors.top: versionText.bottom wrapMode: Text.WordWrap
anchors.topMargin: 40 font.pixelSize: 32
//width: parent.width text: qsTr("Welcome to LogarithmPlotter")
wrapMode: Text.WordWrap }
font.pixelSize: 14 }
width: parent.width - 50
text: qsTr("Take a few seconds to configure LogarithmPlotter.\nThese settings can be changed at any time from the \"Settings\" menu.")
}
CheckBox { Label {
id: checkForUpdatesSetting id: versionText
anchors.left: parent.left anchors.horizontalCenter: parent.horizontalCenter
//anchors.horizontalCenter: parent.horizontalCenter wrapMode: Text.WordWrap
anchors.top: helpText.bottom width: implicitWidth
anchors.topMargin: 10 font.pixelSize: 18
checked: Helper.getSettingBool("check_for_updates") font.italic: true
text: qsTr('Check for updates on startup (requires online connectivity)') text: qsTr("Version %1").arg(Helper.getVersion())
onClicked: { }
Helper.setSettingBool("check_for_updates", checked)
// Set in the menu bar
appMenu.settingsMenu.children[0].checked = checked
}
}
CheckBox { Label {
id: resetRedoStackSetting id: helpText
anchors.left: parent.left anchors.horizontalCenter: parent.horizontalCenter
//anchors.horizontalCenter: parent.horizontalCenter wrapMode: Text.WordWrap
anchors.top: checkForUpdatesSetting.bottom font.pixelSize: 14
checked: Helper.getSettingBool("reset_redo_stack") width: parent.width - 50
text: qsTr('Reset redo stack when a new action is added to history') text: qsTr("Take a few seconds to configure LogarithmPlotter.\nThese settings can be changed at any time from the \"Settings\" menu.")
onClicked: { }
Helper.setSettingBool("reset_redo_stack", checked)
appMenu.settingsMenu.children[1].checked = checked
}
}
CheckBox { CheckBox {
id: enableLatexSetting id: checkForUpdatesSetting
anchors.left: parent.left anchors.left: parent.left
//anchors.horizontalCenter: parent.horizontalCenter checked: Helper.getSettingBool("check_for_updates")
anchors.top: resetRedoStackSetting.bottom text: qsTr('Check for updates on startup (requires online connectivity)')
checked: Helper.getSettingBool("enable_latex") onClicked: {
text: qsTr('Enable LaTeX rendering') Helper.setSettingBool("check_for_updates", checked)
onClicked: { // Set in the menu bar
Helper.setSettingBool("enable_latex", checked) appMenu.settingsMenu.children[0].checked = checked
appMenu.settingsMenu.children[2].checked = checked }
} }
}
CheckBox { CheckBox {
id: autocloseFormulaSetting id: resetRedoStackSetting
anchors.left: parent.left anchors.left: parent.left
//anchors.horizontalCenter: parent.horizontalCenter checked: Helper.getSettingBool("reset_redo_stack")
anchors.top: enableLatexSetting.bottom text: qsTr('Reset redo stack when a new action is added to history')
checked: Helper.getSettingBool("expression_editor.autoclose") onClicked: {
text: qsTr('Automatically close parenthesises and brackets in expressions') Helper.setSettingBool("reset_redo_stack", checked)
onClicked: { appMenu.settingsMenu.children[1].checked = checked
Helper.setSettingBool("expression_editor.autoclose", checked) }
appMenu.settingsMenu.children[3].children[0].checked = checked }
}
}
CheckBox { CheckBox {
id: colorizeFormulaSetting id: enableLatexSetting
anchors.left: parent.left anchors.left: parent.left
//anchors.horizontalCenter: parent.horizontalCenter checked: Helper.getSettingBool("enable_latex")
anchors.top: autocloseFormulaSetting.bottom text: qsTr('Enable LaTeX rendering')
checked: Helper.getSettingBool("expression_editor.colorize") onClicked: {
text: qsTr('Enable syntax highlighting for expressions') Helper.setSettingBool("enable_latex", checked)
onClicked: { appMenu.settingsMenu.children[2].checked = checked
Helper.setSettingBool("expression_editor.colorize", checked) }
appMenu.settingsMenu.children[3].children[1].checked = checked }
}
}
CheckBox { CheckBox {
id: autocompleteFormulaSetting id: autocloseFormulaSetting
anchors.left: parent.left anchors.left: parent.left
//anchors.horizontalCenter: parent.horizontalCenter checked: Helper.getSettingBool("expression_editor.autoclose")
anchors.top: colorizeFormulaSetting.bottom text: qsTr('Automatically close parenthesises and brackets in expressions')
checked: Helper.getSettingBool("autocompletion.enabled") onClicked: {
text: qsTr('Enable autocompletion interface in expression editor') Helper.setSettingBool("expression_editor.autoclose", checked)
onClicked: { appMenu.settingsMenu.children[3].children[0].checked = checked
Helper.setSettingBool("autocompletion.enabled", checked) }
appMenu.settingsMenu.children[3].children[2].checked = checked }
CheckBox {
id: colorizeFormulaSetting
anchors.left: parent.left
checked: Helper.getSettingBool("expression_editor.colorize")
text: qsTr('Enable syntax highlighting for expressions')
onClicked: {
Helper.setSettingBool("expression_editor.colorize", checked)
appMenu.settingsMenu.children[3].children[1].checked = checked
}
}
CheckBox {
id: autocompleteFormulaSetting
anchors.left: parent.left
checked: Helper.getSettingBool("autocompletion.enabled")
text: qsTr('Enable autocompletion interface in expression editor')
onClicked: {
Helper.setSettingBool("autocompletion.enabled", checked)
appMenu.settingsMenu.children[3].children[2].checked = checked
}
}
Row {
anchors.left: parent.left
anchors.leftMargin: 10
spacing: 10
Label {
id: colorSchemeLabel
anchors.verticalCenter: parent.verticalCenter
wrapMode: Text.WordWrap
text: qsTr("Color scheme:")
}
ComboBox {
model: ["Breeze Light", "Breeze Dark", "Solarized", "Github Light", "Github Dark", "Nord", "Monokai"]
currentIndex: Helper.getSettingInt("expression_editor.color_scheme")
onActivated: function(index) {
Helper.setSettingInt("expression_editor.color_scheme", index)
}
}
}
} }
} }
Row { Row {
id: bottomButtons
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: 10 anchors.bottomMargin: 10
spacing: 10 spacing: 10
@ -201,7 +217,7 @@ Popup {
} }
} }
Component.onCompleted: if(Helper.getSetting("last_install_greet") != Helper.getVersion()) { Component.onCompleted: if(Helper.getSetting("last_install_greet") +1 != Helper.getVersion()) {
greetingPopup.open() greetingPopup.open()
} }