mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 22:04:15 +02:00
[fix][app] settings HDPI improvements before the applications is initialized
This commit is contained in:
14
bauh/app.py
14
bauh/app.py
@@ -3,7 +3,7 @@ import sys
|
|||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
import urllib3
|
import urllib3
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt, QCoreApplication
|
||||||
from PyQt5.QtWidgets import QApplication
|
from PyQt5.QtWidgets import QApplication
|
||||||
|
|
||||||
from bauh import __version__, __app_name__, app_args, ROOT_DIR
|
from bauh import __version__, __app_name__, app_args, ROOT_DIR
|
||||||
@@ -36,7 +36,12 @@ def main():
|
|||||||
|
|
||||||
if local_config['ui']['auto_scale']:
|
if local_config['ui']['auto_scale']:
|
||||||
os.environ['QT_AUTO_SCREEN_SCALE_FACTOR'] = '1'
|
os.environ['QT_AUTO_SCREEN_SCALE_FACTOR'] = '1'
|
||||||
logger.info("Auto screen scale factor enabled")
|
logger.info("Auto screen scale factor activated")
|
||||||
|
|
||||||
|
if local_config['ui']['hdpi']:
|
||||||
|
logger.info("HDPI settings activated")
|
||||||
|
QCoreApplication.setAttribute(Qt.AA_UseHighDpiPixmaps)
|
||||||
|
QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
|
||||||
|
|
||||||
i18n_key, current_i18n = translation.get_locale_keys(local_config['locale'])
|
i18n_key, current_i18n = translation.get_locale_keys(local_config['locale'])
|
||||||
default_i18n = translation.get_locale_keys(DEFAULT_I18N_KEY)[1] if i18n_key != DEFAULT_I18N_KEY else {}
|
default_i18n = translation.get_locale_keys(DEFAULT_I18N_KEY)[1] if i18n_key != DEFAULT_I18N_KEY else {}
|
||||||
@@ -76,11 +81,6 @@ def main():
|
|||||||
app_icon = util.get_default_icon()[1]
|
app_icon = util.get_default_icon()[1]
|
||||||
app.setWindowIcon(app_icon)
|
app.setWindowIcon(app_icon)
|
||||||
|
|
||||||
if local_config['ui']['hdpi']:
|
|
||||||
logger.info("HDPI settings activated")
|
|
||||||
app.setAttribute(Qt.AA_UseHighDpiPixmaps)
|
|
||||||
app.setAttribute(Qt.AA_EnableHighDpiScaling)
|
|
||||||
|
|
||||||
if local_config['ui']['style']:
|
if local_config['ui']['style']:
|
||||||
app.setStyle(str(local_config['ui']['style']))
|
app.setStyle(str(local_config['ui']['style']))
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user