From 0ae836a0464dba83fee270e2b2a2ce7c87af3e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Moreira?= Date: Wed, 22 Jan 2020 12:59:39 -0300 Subject: [PATCH] [improvement][ui] hdpi settings on the config file --- CHANGELOG.md | 6 ++++++ README.md | 1 + bauh/app.py | 6 ++++-- bauh/app_args.py | 8 -------- bauh/view/core/config.py | 4 +++- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64738a0c..de7a1f3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Improvements - Flatpak: - configuration file ( **flatpak.yml** ) will be created during the initialization ( on 0.8.1 it would only be created during the first app installation ) +- UI: + - it's possible to disabled the HDPI improvements via the main configuration file ( **~/.config/bauh/config.yml** ): + ``` + ui: + hdpi: true # 'false' will disable them + ``` ### Fixes - AUR: - not treating **makedepends** as a list during dependency checking ( **anbox-git** installation was crashing ) diff --git a/README.md b/README.md index de95a480..d79cca40 100644 --- a/README.md +++ b/README.md @@ -242,6 +242,7 @@ ui: tray: # system tray settings default_icon: null # defines a path to a custom icon updates_icon: null # defines a path to a custom icon indicating updates + hdpi: true # enables HDPI rendering improvements. Use 'false' to disable them if you think the interface looks strange. updates: check_interval: 30 # the updates checking interval in SECONDS diff --git a/bauh/app.py b/bauh/app.py index 460b3688..c8e4b61b 100755 --- a/bauh/app.py +++ b/bauh/app.py @@ -31,7 +31,6 @@ def main(): args = app_args.read() logger = logs.new_logger(__app_name__, bool(args.logs)) - app_args.validate(args, logger) local_config = config.read_config(update_file=True) @@ -71,7 +70,10 @@ def main(): app.setApplicationVersion(__version__) app_icon = util.get_default_icon()[1] app.setWindowIcon(app_icon) - app.setAttribute(Qt.AA_UseHighDpiPixmaps) # This fix images on HDPI resolution, not tested on non HDPI + + if local_config['ui']['hdpi']: + logger.info("HDPI settings activated") + app.setAttribute(Qt.AA_UseHighDpiPixmaps) # This fix images on HDPI resolution, not tested on non HDPI if local_config['ui']['style']: app.setStyle(str(local_config['ui']['style'])) diff --git a/bauh/app_args.py b/bauh/app_args.py index 19d2b898..52fbdbfe 100644 --- a/bauh/app_args.py +++ b/bauh/app_args.py @@ -15,11 +15,3 @@ def read() -> Namespace: parser.add_argument('--show-panel', action="store_true", help='Shows the management panel after the app icon is attached to the tray.') parser.add_argument('--reset', action="store_true", help='Removes all configuration and cache files') return parser.parse_args() - - -def validate(args: Namespace, logger: logging.Logger): - - if args.logs == 1: - logger.info("Logs are enabled") - - return args diff --git a/bauh/view/core/config.py b/bauh/view/core/config.py index df00a272..14716bc7 100644 --- a/bauh/view/core/config.py +++ b/bauh/view/core/config.py @@ -43,7 +43,9 @@ def read_config(update_file: bool = False) -> dict: 'default_icon': None, 'updates_icon': None }, - 'style': None + 'style': None, + 'hdpi': True + }, 'download': { 'multithreaded': True,