Browse Source

Some bugfixes. Updated to ruamel.yaml

sisyphus
JezerM 4 years ago
parent
commit
b98c1a67fe
No known key found for this signature in database
GPG Key ID: 66BBC5D01388C6B5
  1. 3
      build/utils.sh
  2. 14
      web-greeter/globals.py
  3. 26
      web-greeter/greeter.py
  4. 2
      web-greeter/utils/errorPrompt.py
  5. 8
      web-greeter/whither.yml

3
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"

14
web-greeter/globals.py

@ -26,7 +26,6 @@
# along with Web Greeter; If not, see <http://www.gnu.org/licenses/>.
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": {}
}
}

26
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":

2
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

8
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

Loading…
Cancel
Save