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
__VERSION__ = "0.3.0"
__VERSION__ = "0.4.0"
is_release = True

View file

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

View file

@ -37,14 +37,27 @@ Popup {
height: Math.min(parent.height-40, 700)
modal: true
focus: true
clip: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
Item {
ScrollView {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.bottomMargin: bottomButtons.height + 20
clip: true
Column {
width: greetingPopup.width - 25
spacing: 10
clip: true
topPadding: 35
Row {
id: welcome
height: logo.height
width: logo.width + 10 + welcomeText.width
anchors.top: parent.top
anchors.topMargin: (parent.width-width)/2
spacing: 10
anchors.horizontalCenter: parent.horizontalCenter
Image {
@ -59,9 +72,6 @@ Popup {
Label {
id: welcomeText
anchors.verticalCenter: parent.verticalCenter
anchors.left: logo.right
anchors.leftMargin: 10
//width: parent.width
wrapMode: Text.WordWrap
font.pixelSize: 32
text: qsTr("Welcome to LogarithmPlotter")
@ -71,9 +81,6 @@ Popup {
Label {
id: versionText
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: welcome.bottom
anchors.topMargin: 10
//width: parent.width
wrapMode: Text.WordWrap
width: implicitWidth
font.pixelSize: 18
@ -84,9 +91,6 @@ Popup {
Label {
id: helpText
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: versionText.bottom
anchors.topMargin: 40
//width: parent.width
wrapMode: Text.WordWrap
font.pixelSize: 14
width: parent.width - 50
@ -96,9 +100,6 @@ Popup {
CheckBox {
id: checkForUpdatesSetting
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: {
@ -111,8 +112,6 @@ Popup {
CheckBox {
id: resetRedoStackSetting
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: {
@ -124,8 +123,6 @@ Popup {
CheckBox {
id: enableLatexSetting
anchors.left: parent.left
//anchors.horizontalCenter: parent.horizontalCenter
anchors.top: resetRedoStackSetting.bottom
checked: Helper.getSettingBool("enable_latex")
text: qsTr('Enable LaTeX rendering')
onClicked: {
@ -137,8 +134,6 @@ Popup {
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: {
@ -150,8 +145,6 @@ Popup {
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: {
@ -163,8 +156,6 @@ Popup {
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: {
@ -174,6 +165,31 @@ Popup {
}
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 {
id: bottomButtons
anchors.bottom: parent.bottom
anchors.bottomMargin: 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()
}