Adding color schemes for expressions

This commit is contained in:
Ad5001 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,14 +37,27 @@ 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 {
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 id: welcome
height: logo.height height: logo.height
width: logo.width + 10 + welcomeText.width spacing: 10
anchors.top: parent.top
anchors.topMargin: (parent.width-width)/2
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
Image { Image {
@ -59,9 +72,6 @@ Popup {
Label { Label {
id: welcomeText id: welcomeText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: logo.right
anchors.leftMargin: 10
//width: parent.width
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
font.pixelSize: 32 font.pixelSize: 32
text: qsTr("Welcome to LogarithmPlotter") text: qsTr("Welcome to LogarithmPlotter")
@ -71,9 +81,6 @@ Popup {
Label { Label {
id: versionText id: versionText
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.top: welcome.bottom
anchors.topMargin: 10
//width: parent.width
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
width: implicitWidth width: implicitWidth
font.pixelSize: 18 font.pixelSize: 18
@ -84,9 +91,6 @@ Popup {
Label { Label {
id: helpText id: helpText
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.top: versionText.bottom
anchors.topMargin: 40
//width: parent.width
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
font.pixelSize: 14 font.pixelSize: 14
width: parent.width - 50 width: parent.width - 50
@ -96,9 +100,6 @@ Popup {
CheckBox { CheckBox {
id: checkForUpdatesSetting id: checkForUpdatesSetting
anchors.left: parent.left anchors.left: parent.left
//anchors.horizontalCenter: parent.horizontalCenter
anchors.top: helpText.bottom
anchors.topMargin: 10
checked: Helper.getSettingBool("check_for_updates") checked: Helper.getSettingBool("check_for_updates")
text: qsTr('Check for updates on startup (requires online connectivity)') text: qsTr('Check for updates on startup (requires online connectivity)')
onClicked: { onClicked: {
@ -111,8 +112,6 @@ Popup {
CheckBox { CheckBox {
id: resetRedoStackSetting id: resetRedoStackSetting
anchors.left: parent.left anchors.left: parent.left
//anchors.horizontalCenter: parent.horizontalCenter
anchors.top: checkForUpdatesSetting.bottom
checked: Helper.getSettingBool("reset_redo_stack") checked: Helper.getSettingBool("reset_redo_stack")
text: qsTr('Reset redo stack when a new action is added to history') text: qsTr('Reset redo stack when a new action is added to history')
onClicked: { onClicked: {
@ -124,8 +123,6 @@ Popup {
CheckBox { CheckBox {
id: enableLatexSetting id: enableLatexSetting
anchors.left: parent.left anchors.left: parent.left
//anchors.horizontalCenter: parent.horizontalCenter
anchors.top: resetRedoStackSetting.bottom
checked: Helper.getSettingBool("enable_latex") checked: Helper.getSettingBool("enable_latex")
text: qsTr('Enable LaTeX rendering') text: qsTr('Enable LaTeX rendering')
onClicked: { onClicked: {
@ -137,8 +134,6 @@ Popup {
CheckBox { CheckBox {
id: autocloseFormulaSetting id: autocloseFormulaSetting
anchors.left: parent.left anchors.left: parent.left
//anchors.horizontalCenter: parent.horizontalCenter
anchors.top: enableLatexSetting.bottom
checked: Helper.getSettingBool("expression_editor.autoclose") checked: Helper.getSettingBool("expression_editor.autoclose")
text: qsTr('Automatically close parenthesises and brackets in expressions') text: qsTr('Automatically close parenthesises and brackets in expressions')
onClicked: { onClicked: {
@ -150,8 +145,6 @@ Popup {
CheckBox { CheckBox {
id: colorizeFormulaSetting id: colorizeFormulaSetting
anchors.left: parent.left anchors.left: parent.left
//anchors.horizontalCenter: parent.horizontalCenter
anchors.top: autocloseFormulaSetting.bottom
checked: Helper.getSettingBool("expression_editor.colorize") checked: Helper.getSettingBool("expression_editor.colorize")
text: qsTr('Enable syntax highlighting for expressions') text: qsTr('Enable syntax highlighting for expressions')
onClicked: { onClicked: {
@ -163,8 +156,6 @@ Popup {
CheckBox { CheckBox {
id: autocompleteFormulaSetting id: autocompleteFormulaSetting
anchors.left: parent.left anchors.left: parent.left
//anchors.horizontalCenter: parent.horizontalCenter
anchors.top: colorizeFormulaSetting.bottom
checked: Helper.getSettingBool("autocompletion.enabled") checked: Helper.getSettingBool("autocompletion.enabled")
text: qsTr('Enable autocompletion interface in expression editor') text: qsTr('Enable autocompletion interface in expression editor')
onClicked: { onClicked: {
@ -174,6 +165,31 @@ Popup {
} }
Row { 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.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()
} }