From b98c1a67feae74cad34b3d95883ecbbb79da7851 Mon Sep 17 00:00:00 2001 From: JezerM Date: Sat, 10 Jul 2021 14:37:18 -0600 Subject: [PATCH] Some bugfixes. Updated to ruamel.yaml --- build/utils.sh | 3 ++- web-greeter/globals.py | 14 +++++++++++--- web-greeter/greeter.py | 26 +++++++++++++++----------- web-greeter/utils/errorPrompt.py | 2 +- web-greeter/whither.yml | 8 ++++---- 5 files changed, 33 insertions(+), 20 deletions(-) diff --git a/build/utils.sh b/build/utils.sh index e275a80..8f6691b 100755 --- a/build/utils.sh +++ b/build/utils.sh @@ -46,6 +46,7 @@ do_install_dev() { cp -RH "${REPO_DIR}/whither/whither" /usr/lib/python3.6/site-packages } +# Not used generate_pot_file() { REPO_ROOT="$(dirname "${REPO_DIR}")" xgettext --from-code UTF-8 -o "${REPO_ROOT}/po/web-greeter.pot" -d web-greeter "${REPO_ROOT}"/src/*.c @@ -79,7 +80,7 @@ prepare_install() { cp "${BUILD_DIR}/dist/${PKGNAME}.yml" "${INSTALL_ROOT}/etc/lightdm" # AppData File - cp "${BUILD_DIR}/dist/com.antergos.${PKGNAME}.appdata.xml" "${INSTALL_ROOT}${PREFIX}/share/metainfo" + cp "${BUILD_DIR}/dist/${PKGNAME}.appdata.xml" "${INSTALL_ROOT}${PREFIX}/share/metainfo" # Desktop File cp "${BUILD_DIR}/dist/${PKGNAME}.desktop" "${INSTALL_ROOT}${PREFIX}/share/xgreeters" diff --git a/web-greeter/globals.py b/web-greeter/globals.py index 3625c6d..d851469 100644 --- a/web-greeter/globals.py +++ b/web-greeter/globals.py @@ -26,7 +26,6 @@ # along with Web Greeter; If not, see . import sys -import yaml import pkg_resources import os from typing import ( @@ -159,7 +158,7 @@ class WebGreeter(App): greeter_config = ConfigLoader('greeter', config_file).config features_config = ConfigLoader('features', config_file).config - greeter_config.update(custom_config) + greeter_config.update(custom_config["app"]["greeter"]) self.config.branding.update(branding_config) self.config.greeter.update(greeter_config) @@ -169,6 +168,8 @@ class WebGreeter(App): self._config.debug_mode = greeter_config['debug_mode'] self._config.allow_remote_urls = not greeter_config['secure_mode'] + self._config.context_menu.enabled = greeter_config['debug_mode'] + self._config.window.update(custom_config["whither"]["window"]) def load_theme(self): self.logger.debug('Loading theme...') @@ -177,5 +178,12 @@ class WebGreeter(App): global custom_config global greeter -custom_config = {} +custom_config = { + "whither": { + "window": {} + }, + "app": { + "greeter": {} + } +} diff --git a/web-greeter/greeter.py b/web-greeter/greeter.py index 2b982db..ca12cfe 100644 --- a/web-greeter/greeter.py +++ b/web-greeter/greeter.py @@ -28,7 +28,7 @@ # Standard Lib import sys -import yaml +import ruamel.yaml as yaml import pkg_resources import os from typing import ( @@ -85,21 +85,25 @@ def changeConfig(option: str, value): return def debugMode(value: bool): + window = {} + greeter = {} if value: - custom_config["debug_mode"] = True - custom_config["decorated"] = True - custom_config["stays_on_top"] = False + greeter["debug_mode"] = True + window["decorated"] = True + window["stays_on_top"] = False + window["initial_state"] = "normal" else: - custom_config["debug_mode"] = False - custom_config["decorated"] = False - custom_config["stays_on_top"] = True - pass + greeter["debug_mode"] = False + window["decorated"] = False + window["stays_on_top"] = True + custom_config["whither"]["window"] = window + custom_config["app"]["greeter"] = greeter def changeTheme(theme: str): dirlist = listThemes(True) if theme in dirlist: - custom_config["theme"] = theme + custom_config["app"]["greeter"]["theme"] = theme else: logger.error("Theme not found. Going with config theme") return @@ -136,11 +140,11 @@ def yargs(args: List[str]): used+=1 exit() elif args[0] == "--debug": - changeConfig("debug_mode", True) + debugMode(True) used+=1 pass elif args[0] == "--normal": - changeConfig("debug_mode", False) + debugMode(False) used+=1 pass elif args[0] == "--theme": diff --git a/web-greeter/utils/errorPrompt.py b/web-greeter/utils/errorPrompt.py index aa50aa8..a887846 100644 --- a/web-greeter/utils/errorPrompt.py +++ b/web-greeter/utils/errorPrompt.py @@ -126,7 +126,7 @@ def errorPrompt(err): if result == 0: # Cancel return elif result == 1: # Default theme - globals.custom_config["theme"] = "default" + globals.custom_config["app"]["greeter"]["theme"] = "gruvbox" globals.greeter.get_and_apply_user_config() globals.greeter.load_theme() return diff --git a/web-greeter/whither.yml b/web-greeter/whither.yml index 7051d77..a7451f4 100644 --- a/web-greeter/whither.yml +++ b/web-greeter/whither.yml @@ -9,7 +9,7 @@ WebGreeter: enabled: '@at_spi_service@' command: /usr/lib/at-spi2-core/at-spi-bus-launcher arg: --launch-immediately - app_id: com.antergos.web-greeter + app_id: web-greeter context_menu: enabled: False debug_mode: '@debug_mode@' @@ -36,7 +36,7 @@ WebGreeter: detect_theme_errors: True screensaver_timeout: 300 secure_mode: True - theme: default + theme: gruvbox icon_theme: Adwaita time_language: "" features: @@ -49,10 +49,10 @@ WebGreeter: locale_dir: '@locale_dir@' themes_dir: '@themes_dir@' version: - full: '3.0.0rc4' + full: '3.0.0rc5' major: 3 minor: 0 micro: 0 alpha: False beta: False - rc: 4 + rc: 5