Removing typed config functions in Helper.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
2995b2271a
commit
b33e1329db
11 changed files with 53 additions and 149 deletions
|
@ -221,9 +221,9 @@ Item {
|
|||
focus: true
|
||||
selectByMouse: true
|
||||
|
||||
property bool autocompleteEnabled: Helper.getSettingBool("autocompletion.enabled")
|
||||
property bool syntaxHighlightingEnabled: Helper.getSettingBool("expression_editor.colorize")
|
||||
property bool autoClosing: Helper.getSettingBool("expression_editor.autoclose")
|
||||
property bool autocompleteEnabled: Helper.getSetting("autocompletion.enabled")
|
||||
property bool syntaxHighlightingEnabled: Helper.getSetting("expression_editor.colorize")
|
||||
property bool autoClosing: Helper.getSetting("expression_editor.autoclose")
|
||||
property var tokens: autocompleteEnabled || syntaxHighlightingEnabled ? parent.tokens(text) : []
|
||||
|
||||
Keys.priority: Keys.BeforeItem // Required for knowing which key the user presses.
|
||||
|
@ -600,7 +600,7 @@ Item {
|
|||
*/
|
||||
function colorize(tokenList) {
|
||||
let parsedText = ""
|
||||
let scheme = colorSchemes[Helper.getSettingInt("expression_editor.color_scheme")]
|
||||
let scheme = colorSchemes[Helper.getSetting("expression_editor.color_scheme")]
|
||||
for(let token of tokenList) {
|
||||
switch(token.type) {
|
||||
case JS.Parsing.TokenType.VARIABLE:
|
||||
|
|
|
@ -44,25 +44,25 @@ ScrollView {
|
|||
Zoom on the x axis of the diagram, provided from settings.
|
||||
\sa Settings
|
||||
*/
|
||||
property double xzoom: Helper.getSettingInt('default_graph.xzoom')
|
||||
property double xzoom: Helper.getSetting('default_graph.xzoom')
|
||||
/*!
|
||||
\qmlproperty double Settings::yzoom
|
||||
Zoom on the y axis of the diagram, provided from settings.
|
||||
\sa Settings
|
||||
*/
|
||||
property double yzoom: Helper.getSettingInt('default_graph.yzoom')
|
||||
property double yzoom: Helper.getSetting('default_graph.yzoom')
|
||||
/*!
|
||||
\qmlproperty double Settings::xmin
|
||||
Minimum x of the diagram, provided from settings.
|
||||
\sa Settings
|
||||
*/
|
||||
property double xmin: Helper.getSettingInt('default_graph.xmin')
|
||||
property double xmin: Helper.getSetting('default_graph.xmin')
|
||||
/*!
|
||||
\qmlproperty double Settings::ymax
|
||||
Maximum y of the diagram, provided from settings.
|
||||
\sa Settings
|
||||
*/
|
||||
property double ymax: Helper.getSettingInt('default_graph.ymax')
|
||||
property double ymax: Helper.getSetting('default_graph.ymax')
|
||||
/*!
|
||||
\qmlproperty string Settings::xaxisstep
|
||||
Step of the x axis graduation, provided from settings.
|
||||
|
@ -93,34 +93,34 @@ ScrollView {
|
|||
Width of lines that will be drawn into the canvas, provided from settings.
|
||||
\sa Settings
|
||||
*/
|
||||
property double linewidth: Helper.getSettingInt('default_graph.linewidth')
|
||||
property double linewidth: Helper.getSetting('default_graph.linewidth')
|
||||
/*!
|
||||
\qmlproperty double Settings::textsize
|
||||
Font size of the text that will be drawn into the canvas, provided from settings.
|
||||
\sa Settings
|
||||
*/
|
||||
property double textsize: Helper.getSettingInt('default_graph.textsize')
|
||||
property double textsize: Helper.getSetting('default_graph.textsize')
|
||||
/*!
|
||||
\qmlproperty bool Settings::logscalex
|
||||
true if the canvas should be in logarithmic mode, false otherwise.
|
||||
Provided from settings.
|
||||
\sa Settings
|
||||
*/
|
||||
property bool logscalex: Helper.getSettingBool('default_graph.logscalex')
|
||||
property bool logscalex: Helper.getSetting('default_graph.logscalex')
|
||||
/*!
|
||||
\qmlproperty bool Settings::showxgrad
|
||||
true if the x graduation should be shown, false otherwise.
|
||||
Provided from settings.
|
||||
\sa Settings
|
||||
*/
|
||||
property bool showxgrad: Helper.getSettingBool('default_graph.showxgrad')
|
||||
property bool showxgrad: Helper.getSetting('default_graph.showxgrad')
|
||||
/*!
|
||||
\qmlproperty bool Settings::showygrad
|
||||
true if the y graduation should be shown, false otherwise.
|
||||
Provided from settings.
|
||||
\sa Settings
|
||||
*/
|
||||
property bool showygrad: Helper.getSettingBool('default_graph.showygrad')
|
||||
property bool showygrad: Helper.getSetting('default_graph.showygrad')
|
||||
|
||||
Column {
|
||||
spacing: 10
|
||||
|
|
|
@ -15,10 +15,9 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
from PySide6.QtWidgets import QMessageBox, QApplication
|
||||
from PySide6.QtCore import QRunnable, QThreadPool, QThread, QObject, Signal, Slot, QCoreApplication
|
||||
from PySide6.QtQml import QQmlApplicationEngine
|
||||
from PySide6.QtQml import QJSValue
|
||||
from PySide6.QtGui import QImage
|
||||
from PySide6 import __version__ as PySide6_version
|
||||
|
||||
|
@ -135,29 +134,13 @@ class Helper(QObject):
|
|||
def getVersion(self):
|
||||
return __VERSION__
|
||||
|
||||
@Slot(str, result=str)
|
||||
def getSetting(self, namespace):
|
||||
return str(config.getSetting(namespace))
|
||||
@Slot(str, result=QJSValue)
|
||||
def getSetting(self, namespace: str) -> QJSValue:
|
||||
return QJSValue(config.getSetting(namespace))
|
||||
|
||||
@Slot(str, result=float)
|
||||
def getSettingInt(self, namespace):
|
||||
return float(config.getSetting(namespace))
|
||||
|
||||
@Slot(str, result=bool)
|
||||
def getSettingBool(self, namespace):
|
||||
return bool(config.getSetting(namespace))
|
||||
|
||||
@Slot(str, str)
|
||||
def setSetting(self, namespace, value):
|
||||
return config.setSetting(namespace, str(value))
|
||||
|
||||
@Slot(str, bool)
|
||||
def setSettingBool(self, namespace, value):
|
||||
return config.setSetting(namespace, bool(value))
|
||||
|
||||
@Slot(str, float)
|
||||
def setSettingInt(self, namespace, value):
|
||||
return config.setSetting(namespace, float(value))
|
||||
@Slot(str, QJSValue)
|
||||
def setSetting(self, namespace: str, value: QJSValue):
|
||||
return config.setSetting(namespace, value.toPrimitive().toVariant())
|
||||
|
||||
@Slot(result=str)
|
||||
def getDebugInfos(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue