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 cp -RH "${REPO_DIR}/whither/whither" /usr/lib/python3.6/site-packages
} }
# Not used
generate_pot_file() { generate_pot_file() {
REPO_ROOT="$(dirname "${REPO_DIR}")" REPO_ROOT="$(dirname "${REPO_DIR}")"
xgettext --from-code UTF-8 -o "${REPO_ROOT}/po/web-greeter.pot" -d web-greeter "${REPO_ROOT}"/src/*.c 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" cp "${BUILD_DIR}/dist/${PKGNAME}.yml" "${INSTALL_ROOT}/etc/lightdm"
# AppData File # 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 # Desktop File
cp "${BUILD_DIR}/dist/${PKGNAME}.desktop" "${INSTALL_ROOT}${PREFIX}/share/xgreeters" 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/>. # along with Web Greeter; If not, see <http://www.gnu.org/licenses/>.
import sys import sys
import yaml
import pkg_resources import pkg_resources
import os import os
from typing import ( from typing import (
@ -159,7 +158,7 @@ class WebGreeter(App):
greeter_config = ConfigLoader('greeter', config_file).config greeter_config = ConfigLoader('greeter', config_file).config
features_config = ConfigLoader('features', 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.branding.update(branding_config)
self.config.greeter.update(greeter_config) self.config.greeter.update(greeter_config)
@ -169,6 +168,8 @@ class WebGreeter(App):
self._config.debug_mode = greeter_config['debug_mode'] self._config.debug_mode = greeter_config['debug_mode']
self._config.allow_remote_urls = not greeter_config['secure_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): def load_theme(self):
self.logger.debug('Loading theme...') self.logger.debug('Loading theme...')
@ -177,5 +178,12 @@ class WebGreeter(App):
global custom_config global custom_config
global greeter global greeter
custom_config = {} custom_config = {
"whither": {
"window": {}
},
"app": {
"greeter": {}
}
}

26
web-greeter/greeter.py

@ -28,7 +28,7 @@
# Standard Lib # Standard Lib
import sys import sys
import yaml import ruamel.yaml as yaml
import pkg_resources import pkg_resources
import os import os
from typing import ( from typing import (
@ -85,21 +85,25 @@ def changeConfig(option: str, value):
return return
def debugMode(value: bool): def debugMode(value: bool):
window = {}
greeter = {}
if value: if value:
custom_config["debug_mode"] = True greeter["debug_mode"] = True
custom_config["decorated"] = True window["decorated"] = True
custom_config["stays_on_top"] = False window["stays_on_top"] = False
window["initial_state"] = "normal"
else: else:
custom_config["debug_mode"] = False greeter["debug_mode"] = False
custom_config["decorated"] = False window["decorated"] = False
custom_config["stays_on_top"] = True window["stays_on_top"] = True
pass custom_config["whither"]["window"] = window
custom_config["app"]["greeter"] = greeter
def changeTheme(theme: str): def changeTheme(theme: str):
dirlist = listThemes(True) dirlist = listThemes(True)
if theme in dirlist: if theme in dirlist:
custom_config["theme"] = theme custom_config["app"]["greeter"]["theme"] = theme
else: else:
logger.error("Theme not found. Going with config theme") logger.error("Theme not found. Going with config theme")
return return
@ -136,11 +140,11 @@ def yargs(args: List[str]):
used+=1 used+=1
exit() exit()
elif args[0] == "--debug": elif args[0] == "--debug":
changeConfig("debug_mode", True) debugMode(True)
used+=1 used+=1
pass pass
elif args[0] == "--normal": elif args[0] == "--normal":
changeConfig("debug_mode", False) debugMode(False)
used+=1 used+=1
pass pass
elif args[0] == "--theme": elif args[0] == "--theme":

2
web-greeter/utils/errorPrompt.py

@ -126,7 +126,7 @@ def errorPrompt(err):
if result == 0: # Cancel if result == 0: # Cancel
return return
elif result == 1: # Default theme 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.get_and_apply_user_config()
globals.greeter.load_theme() globals.greeter.load_theme()
return return

8
web-greeter/whither.yml

@ -9,7 +9,7 @@ WebGreeter:
enabled: '@at_spi_service@' enabled: '@at_spi_service@'
command: /usr/lib/at-spi2-core/at-spi-bus-launcher command: /usr/lib/at-spi2-core/at-spi-bus-launcher
arg: --launch-immediately arg: --launch-immediately
app_id: com.antergos.web-greeter app_id: web-greeter
context_menu: context_menu:
enabled: False enabled: False
debug_mode: '@debug_mode@' debug_mode: '@debug_mode@'
@ -36,7 +36,7 @@ WebGreeter:
detect_theme_errors: True detect_theme_errors: True
screensaver_timeout: 300 screensaver_timeout: 300
secure_mode: True secure_mode: True
theme: default theme: gruvbox
icon_theme: Adwaita icon_theme: Adwaita
time_language: "" time_language: ""
features: features:
@ -49,10 +49,10 @@ WebGreeter:
locale_dir: '@locale_dir@' locale_dir: '@locale_dir@'
themes_dir: '@themes_dir@' themes_dir: '@themes_dir@'
version: version:
full: '3.0.0rc4' full: '3.0.0rc5'
major: 3 major: 3
minor: 0 minor: 0
micro: 0 micro: 0
alpha: False alpha: False
beta: False beta: False
rc: 4 rc: 5

Loading…
Cancel
Save