From 6d8a80a0c6b0087ca85d6223acccd5a79d2345c6 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 5 Dec 2021 21:02:21 +0000 Subject: [PATCH] Boolean theme values on designer screen --- daemon.py | 7 ++++++- webapp_themeDesigner.py | 34 +++++++++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/daemon.py b/daemon.py index 4dba9f72b..e5ccdb137 100644 --- a/daemon.py +++ b/daemon.py @@ -2173,7 +2173,12 @@ class PubServer(BaseHTTPRequestHandler): for fieldStr in fieldsList: if '=' not in fieldStr: continue - fields[fieldStr.split('=')[0]] = fieldStr.split('=')[1].strip() + fieldValue = fieldStr.split('=')[1].strip() + if fieldValue == 'on': + fieldValue = 'True' + if not fieldValue: + fieldValue = 'False' + fields[fieldStr.split('=')[0]] = fieldValue # get the parameters from the theme designer screen themeDesignerParams = {} diff --git a/webapp_themeDesigner.py b/webapp_themeDesigner.py index 6ab648bcf..5c3ac3797 100644 --- a/webapp_themeDesigner.py +++ b/webapp_themeDesigner.py @@ -232,6 +232,8 @@ def htmlThemeDesigner(cssCache: {}, baseDir: str, fontStr = '
\n' + tableStr colorStr = '
\n' + tableStr + dimensionStr = '
\n' + tableStr + switchStr = '
\n' + tableStr for variableName, value in themeJson.items(): if 'font-size' in variableName: variableNameStr = variableName.replace('-', ' ') @@ -242,7 +244,7 @@ def htmlThemeDesigner(cssCache: {}, baseDir: str, fontStr += \ '

\n' + '" title="' + variableNameStr + '">\n' elif ('-color' in variableName or '-background' in variableName or variableName.endswith('-text')): @@ -268,11 +270,37 @@ def htmlThemeDesigner(cssCache: {}, baseDir: str, colorStr += \ '

\n' + '" title="' + variableNameStr + '">\n' + elif ('-width' in variableName or + '-height' in variableName): + variableNameStr = variableName.replace('-', ' ') + variableNameStr = variableNameStr.title() + dimensionStr += \ + ' ' + dimensionStr += \ + '\n' + elif value == 'True' or value == 'False': + variableNameStr = variableName.replace('-', ' ') + variableNameStr = variableNameStr.title() + switchStr += \ + ' ' + checkedStr = '' + if value == 'True': + checkedStr = ' checked' + switchStr += \ + '\n' colorStr += ' \n
\n' fontStr += ' \n
\n' - themeForm += colorStr + fontStr + dimensionStr += ' \n
\n' + switchStr += ' \n
\n' + themeForm += colorStr + fontStr + dimensionStr + switchStr themeForm += ' \n' themeForm += '\n' themeForm += htmlFooter()