[ui][settings] auto screen scale factor

This commit is contained in:
Vinícius Moreira
2020-01-29 10:56:07 -03:00
parent fb16c755b9
commit fdbe989a6f
10 changed files with 35 additions and 7 deletions

View File

@@ -10,12 +10,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- configuration file ( **flatpak.yml** ) will be created during the initialization ( on 0.8.1 it would only be created during the first app installation )
- AUR:
- downgrading time reduced due to the fix described in ***Fixes***.
- UI:
- it's possible to disabled the HDPI improvements via the main configuration file ( **~/.config/bauh/config.yml** ):
- Configuration ( **~/.config/bauh/config.yml** )
- new property **hdpi** allowing to disable HDPI improvements
```
ui:
hdpi: true # 'false' will disable them
hdpi: true # enabled by default
```
- new property **auto_scale** that activates Qt auto screen scale factor (QT_AUTO_SCREEN_SCALE_FACTOR). It fixes scaling issues
for some desktop environments ( like Gnome ) [#1](https://github.com/vinifmor/bauh/issues/1)
```
ui:
auto_scale: false # disabled by default
### Fixes
- AUR:
- not treating **makedepends** as a list during dependency checking ( **anbox-git** installation was crashing )

View File

@@ -34,6 +34,10 @@ def main():
local_config = config.read_config(update_file=True)
if local_config['ui']['auto_scale']:
os.environ['QT_AUTO_SCREEN_SCALE_FACTOR'] = '1'
logger.info("Auto screen scale factor enabled")
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 {}
i18n = I18n(i18n_key, current_i18n, DEFAULT_I18N_KEY, default_i18n)

View File

@@ -44,7 +44,8 @@ def read_config(update_file: bool = False) -> dict:
'updates_icon': None
},
'style': None,
'hdpi': True
'hdpi': True,
"auto_scale": False
},
'download': {

View File

@@ -535,12 +535,17 @@ class GenericSoftwareManager(SoftwareManager):
default_width = floor(0.11 * screen_width)
select_hdpi = self._gen_bool_component(label=self.i18n['core.config.ui.hdpi'],
tooltip=self.i18n['core.config.ui.hdpi.tip'].format(
app=self.context.app_name),
tooltip=self.i18n['core.config.ui.hdpi.tip'],
value=bool(core_config['ui']['hdpi']),
max_width=default_width,
id_='hdpi')
select_ascale = self._gen_bool_component(label=self.i18n['core.config.ui.auto_scale'],
tooltip=self.i18n['core.config.ui.auto_scale.tip'].format('QT_AUTO_SCREEN_SCALE_FACTOR'),
value=bool(core_config['ui']['auto_scale']),
max_width=default_width,
id_='auto_scale')
cur_style = QApplication.instance().style().objectName().lower() if not core_config['ui']['style'] else core_config['ui']['style']
style_opts = [InputOption(label=s.capitalize(), value=s.lower()) for s in QStyleFactory.keys()]
select_style = SingleSelectComponent(label=self.i18n['style'].capitalize(),
@@ -563,7 +568,7 @@ class GenericSoftwareManager(SoftwareManager):
max_width=default_width,
value=core_config['download']['icons'])
sub_comps = [FormComponent([select_hdpi, select_dicons, select_style, input_maxd], spaces=False)]
sub_comps = [FormComponent([select_hdpi, select_ascale, select_dicons, select_style, input_maxd], spaces=False)]
return TabComponent(self.i18n['core.config.tab.ui'].capitalize(), PanelComponent(sub_comps), None, 'core.ui')
def _save_settings(self, general: PanelComponent,
@@ -618,6 +623,7 @@ class GenericSoftwareManager(SoftwareManager):
core_config['download']['icons'] = ui_form.get_component('down_icons').get_selected()
core_config['ui']['hdpi'] = ui_form.get_component('hdpi').get_selected()
core_config['ui']['auto_scale'] = ui_form.get_component('auto_scale').get_selected()
core_config['ui']['table']['max_displayed'] = ui_form.get_component('table_max').get_int_value()
style = ui_form.get_component('style').get_selected()

View File

@@ -252,6 +252,8 @@ core.config.system.dep_checking.tip=If the availability checking of your system
core.config.suggestions.by_type=Suggestions by type
core.config.suggestions.by_type.tip=Maximum number of suggestions that should be displayed by application type
core.config.types.tip=Check the application types you want to manage
core.config.ui.auto_scale=Auto scale
core.config.ui.auto_scale.tip=It activates the auto screen scale factor ( {} ). It fixes scaling issues for some desktop environments.
settings.changed.success.warning=Settings successfully changed. Some of them will only take effect after a restart.
settings.changed.success.reboot=Restart now ?
settings.error=It was not possible to properly change all the settings

View File

@@ -207,6 +207,8 @@ core.config.system.dep_checking.tip=If the availability checking of your system
core.config.suggestions.by_type=Suggestions by type
core.config.suggestions.by_type.tip=Maximum number of suggestions that should be displayed by application type
core.config.types.tip=Check the application types you want to manage
core.config.ui.auto_scale=Auto scale
core.config.ui.auto_scale.tip=It activates the auto screen scale factor ( {} ). It fixes scaling issues for some desktop environments.
settings.changed.success.warning=Settings successfully changed. Some of them will only take effect after a restart.
settings.changed.success.reboot=Restart now ?
settings.error=It was not possible to properly change all the settings

View File

@@ -214,6 +214,8 @@ core.config.system.dep_checking.tip=If the availability checking of your system
core.config.suggestions.by_type=Suggestions by type
core.config.suggestions.by_type.tip=Maximum number of suggestions that should be displayed by application type
core.config.types.tip=Check the application types you want to manage
core.config.ui.auto_scale=Auto scale
core.config.ui.auto_scale.tip=It activates the auto screen scale factor ( {} ). It fixes scaling issues for some desktop environments.
settings.changed.success.warning=Settings successfully changed. Some of them will only take effect after a restart.
settings.changed.success.reboot=Restart now ?
settings.error=It was not possible to properly change all the settings

View File

@@ -255,6 +255,8 @@ core.config.system.dep_checking.tip=Si la verificación de disponibilidad de las
core.config.suggestions.by_type=Sugerencias por tipo
core.config.suggestions.by_type.tip=Número máximo de sugerencias que deberían mostrarse por tipo de aplicación
core.config.types.tip=Marque los tipos de aplicaciones que desea administrar
core.config.ui.auto_scale=Escala automática
core.config.ui.auto_scale.tip=Activa el factor de escala de pantalla automática ( {} ). Soluciona problemas de escala para algunos ambientes desktop.
settings.changed.success.warning=Las configuraciones se cambiaron con éxito. Algunas solo tendrán efecto después del reinicio.
settings.changed.success.reboot=¿Reiniciar ahora?
settings.error=No fue posible cambiar correctamente todas las configuraciones

View File

@@ -207,6 +207,8 @@ core.config.system.dep_checking.tip=If the availability checking of your system
core.config.suggestions.by_type=Suggestions by type
core.config.suggestions.by_type.tip=Maximum number of suggestions that should be displayed by application type
core.config.types.tip=Check the application types you want to manage
core.config.ui.auto_scale=Auto scale
core.config.ui.auto_scale.tip=It activates the auto screen scale factor ( {} ). It fixes scaling issues for some desktop environments.
settings.changed.success.warning=Settings successfully changed. Some of them will only take effect after a restart.
settings.changed.success.reboot=Restart now ?
settings.error=It was not possible to properly change all the settings

View File

@@ -258,6 +258,8 @@ core.config.system.dep_checking.tip=Se a verificação da disponibilidade das te
core.config.suggestions.by_type=Sugestões por tipo
core.config.suggestions.by_type.tip=Número máximo de sugestões que devem ser exibidas por tipo de aplicativo
core.config.types.tip=Marque os tipos de aplicativo que você quer gerenciar
core.config.ui.auto_scale=Escala automática
core.config.ui.auto_scale.tip=Ativa o fator de escala automático ( {} ). Corrige problemas de escala para alguns ambientes desktop.
settings.changed.success.warning=Configurações alteradas com sucesso ! Algumas delas só surtirão após a reinicialização.
settings.changed.success.reboot=Reiniciar agora ?
settings.error=Não foi possível alterar todas as configurações adequadamente