[improvement][trim] 'disk.trim_after_update' changed to 'disk.trim.after_upgrade'

This commit is contained in:
Vinicius Moreira
2020-04-22 14:01:36 -03:00
parent 700a6ca9ce
commit 827d31e495
12 changed files with 48 additions and 38 deletions

View File

@@ -15,6 +15,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Internet availability checking code - Internet availability checking code
- Arch - Arch
- displaying on the details if the AUR package was successfully upgraded [#89](https://github.com/vinifmor/bauh/issues/89) - displaying on the details if the AUR package was successfully upgraded [#89](https://github.com/vinifmor/bauh/issues/89)
- Settings
- **disk.trim_after_update** has changed to **disk.trim.after_upgrade** and accepts 3 possible values: **false** (No): disabled, **true** (Yes): automatically trims, **null** (Ask): displays a confirmation dialog
### Fixes ### Fixes
- Arch - Arch

View File

@@ -296,7 +296,9 @@ ui:
updates: updates:
check_interval: 30 # the updates checking interval in SECONDS check_interval: 30 # the updates checking interval in SECONDS
disk: disk:
trim_after_update: false # it trims the hard disk after a successfull packages upgrade ( `fstrim -a -v` ) trim:
after_upgrade: false # it trims the hard disk after a successfull packages upgrade ( `fstrim -a -v` ). 'true' will automatically perform the trim and 'null' will display a confirmation dialog
backup: backup:
enabled: true # generate timeshift snapshots before an action ( if timeshift is installed on the system ) enabled: true # generate timeshift snapshots before an action ( if timeshift is installed on the system )
mode: 'incremental' # incremental=generates a new snapshot based on another pre-exising one. 'only_one'=deletes all pre-existing snapshots and generates a fresh one. mode: 'incremental' # incremental=generates a new snapshot based on another pre-exising one. 'only_one'=deletes all pre-existing snapshots and generates a fresh one.

View File

@@ -47,7 +47,9 @@ def read_config(update_file: bool = False) -> dict:
}, },
'store_root_password': True, 'store_root_password': True,
'disk': { 'disk': {
'trim_after_update': False 'trim': {
'after_upgrade': False
}
}, },
'backup': { 'backup': {
'enabled': True, 'enabled': True,

View File

@@ -81,7 +81,7 @@ class GenericSettingsManager:
return TabGroupComponent(tabs) return TabGroupComponent(tabs)
def _gen_adv_settings(self, core_config: dict, screen_width: int, screen_height: int) -> TabComponent: def _gen_adv_settings(self, core_config: dict, screen_width: int, screen_height: int) -> TabComponent:
default_width = floor(0.11 * screen_width) default_width = floor(0.22 * screen_width)
input_data_exp = TextInputComponent(label=self.i18n['core.config.mem_cache.data_exp'], input_data_exp = TextInputComponent(label=self.i18n['core.config.mem_cache.data_exp'],
tooltip=self.i18n['core.config.mem_cache.data_exp.tip'], tooltip=self.i18n['core.config.mem_cache.data_exp.tip'],
@@ -97,11 +97,14 @@ class GenericSettingsManager:
max_width=default_width, max_width=default_width,
id_="icon_exp") id_="icon_exp")
select_trim_up = self._gen_bool_component(label=self.i18n['core.config.trim_after_update'], select_trim_up = self._gen_select(label=self.i18n['core.config.trim.after_upgrade'],
tooltip=self.i18n['core.config.trim_after_update.tip'], tip=self.i18n['core.config.trim.after_upgrade.tip'],
value=bool(core_config['disk']['trim_after_update']), value=core_config['disk']['trim']['after_upgrade'],
max_width=default_width, max_width=default_width,
id_='trim_after_update') opts=[(self.i18n['yes'].capitalize(), True, None),
(self.i18n['no'].capitalize(), False, None),
(self.i18n['ask'].capitalize(), None, None)],
id_='trim_after_upgrade')
select_dep_check = self._gen_bool_component(label=self.i18n['core.config.system.dep_checking'], select_dep_check = self._gen_bool_component(label=self.i18n['core.config.system.dep_checking'],
tooltip=self.i18n['core.config.system.dep_checking.tip'], tooltip=self.i18n['core.config.system.dep_checking.tip'],
@@ -291,7 +294,7 @@ class GenericSettingsManager:
icon_exp = adv_form.get_component('icon_exp').get_int_value() icon_exp = adv_form.get_component('icon_exp').get_int_value()
core_config['memory_cache']['icon_expiration'] = icon_exp core_config['memory_cache']['icon_expiration'] = icon_exp
core_config['disk']['trim_after_update'] = adv_form.get_component('trim_after_update').get_selected() core_config['disk']['trim']['after_upgrade'] = adv_form.get_component('trim_after_upgrade').get_selected()
# backup # backup
if backup: if backup:
@@ -434,19 +437,21 @@ class GenericSettingsManager:
id_='downgrade') id_='downgrade')
mode = self._gen_select(label=self.i18n['core.config.backup.mode'], mode = self._gen_select(label=self.i18n['core.config.backup.mode'],
tip=None, tip=None,
value=core_config['backup']['mode'], value=core_config['backup']['mode'],
opts=[ opts=[
(self.i18n['core.config.backup.mode.incremental'], 'incremental', self.i18n['core.config.backup.mode.incremental.tip']), (self.i18n['core.config.backup.mode.incremental'], 'incremental',
(self.i18n['core.config.backup.mode.only_one'], 'only_one', self.i18n['core.config.backup.mode.only_one.tip']) self.i18n['core.config.backup.mode.incremental.tip']),
], (self.i18n['core.config.backup.mode.only_one'], 'only_one',
max_width=default_width, self.i18n['core.config.backup.mode.only_one.tip'])
id_='mode') ],
max_width=default_width,
id_='mode')
sub_comps = [FormComponent([enabled_opt, mode, install_mode, uninstall_mode, upgrade_mode, downgrade_mode], spaces=False)] sub_comps = [FormComponent([enabled_opt, mode, install_mode, uninstall_mode, upgrade_mode, downgrade_mode], spaces=False)]
return TabComponent(self.i18n['core.config.tab.backup'].capitalize(), PanelComponent(sub_comps), None, 'core.bkp') return TabComponent(self.i18n['core.config.tab.backup'].capitalize(), PanelComponent(sub_comps), None, 'core.bkp')
def _gen_select(self, label: str, tip: str, id_: str, opts: List[tuple], value: str, max_width: int, type_: SelectViewType = SelectViewType.RADIO): def _gen_select(self, label: str, tip: str, id_: str, opts: List[tuple], value: object, max_width: int, type_: SelectViewType = SelectViewType.RADIO):
inp_opts = [InputOption(label=o[0].capitalize(), value=o[1], tooltip=o[2]) for o in opts] inp_opts = [InputOption(label=o[0].capitalize(), value=o[1], tooltip=o[2]) for o in opts]
def_opt = [o for o in inp_opts if o.value == value] def_opt = [o for o in inp_opts if o.value == value]
return SingleSelectComponent(label=label, return SingleSelectComponent(label=label,

View File

@@ -284,9 +284,8 @@ class UpgradeSelected(AsyncAction):
return FormComponent(label=lb, components=comps), (required_size, extra_size) return FormComponent(label=lb, components=comps), (required_size, extra_size)
def _trim_disk(self, root_password: str): def _trim_disk(self, root_password: str, ask: bool):
if self.request_confirmation(title=self.i18n['confirmation'].capitalize(), if not ask or self.request_confirmation(title=self.i18n['confirmation'].capitalize(), body=self.i18n['action.trim_disk.ask']):
body=self.i18n['action.trim_disk.ask']):
pwd = root_password pwd = root_password
@@ -296,7 +295,7 @@ class UpgradeSelected(AsyncAction):
if not success: if not success:
return return
self.change_status(self.i18n['action.disk_trim'].capitalize()) self.change_status('{}...'.format(self.i18n['action.disk_trim'].capitalize()))
self.change_substatus('') self.change_substatus('')
success, output = ProcessHandler(self).handle_simple(SimpleProcess(['fstrim', '/', '-v'], root_password=pwd)) success, output = ProcessHandler(self).handle_simple(SimpleProcess(['fstrim', '/', '-v'], root_password=pwd))
@@ -461,8 +460,8 @@ class UpgradeSelected(AsyncAction):
updated = len(requirements.to_upgrade) updated = len(requirements.to_upgrade)
updated_types.update((req.pkg.__class__ for req in requirements.to_upgrade)) updated_types.update((req.pkg.__class__ for req in requirements.to_upgrade))
if bool(app_config['disk']['trim_after_update']): if app_config['disk']['trim']['after_upgrade'] is not False:
self._trim_disk(root_password) self._trim_disk(root_password, ask=app_config['disk']['trim']['after_upgrade'] is None)
msg = '<p>{}</p>{}</p><br/><p>{}</p>'.format(self.i18n['action.update.success.reboot.line1'], msg = '<p>{}</p>{}</p><br/><p>{}</p>'.format(self.i18n['action.update.success.reboot.line1'],
self.i18n['action.update.success.reboot.line2'], self.i18n['action.update.success.reboot.line2'],

View File

@@ -207,8 +207,8 @@ core.config.tab.general=General
core.config.tab.tray=Tray core.config.tab.tray=Tray
core.config.tab.types=Types core.config.tab.types=Types
core.config.tab.ui=Interface core.config.tab.ui=Interface
core.config.trim_after_update=Optimize disc after upgrading core.config.trim.after_upgrade=Optimize disc after upgrading
core.config.trim_after_update.tip=It optimizes the disc after a successful upgrade using "trim". Do not enable this option if your disk is not a SSD that allows trim. core.config.trim.after_upgrade.tip=It optimizes the disc after a successful upgrade using "trim". Do not enable this option if your disk is not a SSD that allows trim.
core.config.types.tip=Check the application types you want to manage core.config.types.tip=Check the application types you want to manage
core.config.ui.auto_scale=Auto scale 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. core.config.ui.auto_scale.tip=It activates the auto screen scale factor ( {} ). It fixes scaling issues for some desktop environments.

View File

@@ -206,8 +206,8 @@ core.config.tab.general=Allgemein
core.config.tab.tray=Statusleiste core.config.tab.tray=Statusleiste
core.config.tab.types=Typen core.config.tab.types=Typen
core.config.tab.ui=Oberfläche core.config.tab.ui=Oberfläche
core.config.trim_after_update=Optimize disc after upgrading core.config.trim.after_upgrade=Optimize disc after upgrading
core.config.trim_after_update.tip=It optimizes the disc after a successful upgrade using "trim". Do not enable this option if your disk is not a SSD that allows trim. core.config.trim.after_upgrade.tip=It optimizes the disc after a successful upgrade using "trim". Do not enable this option if your disk is not a SSD that allows trim.
core.config.types.tip=Wählen Sie die Anwendungstypen, die Sie verwalten wollen core.config.types.tip=Wählen Sie die Anwendungstypen, die Sie verwalten wollen
core.config.ui.auto_scale=Automatische Skalierung core.config.ui.auto_scale=Automatische Skalierung
core.config.ui.auto_scale.tip=Aktiviert den automatischen Skalierungsfaktor ({}), welcher bei einigen Umgebungen Skalierungsprobleme behebt core.config.ui.auto_scale.tip=Aktiviert den automatischen Skalierungsfaktor ({}), welcher bei einigen Umgebungen Skalierungsprobleme behebt

View File

@@ -206,8 +206,8 @@ core.config.tab.general=General
core.config.tab.tray=Tray core.config.tab.tray=Tray
core.config.tab.types=Types core.config.tab.types=Types
core.config.tab.ui=Interface core.config.tab.ui=Interface
core.config.trim_after_update.tip=It optimizes the disc after a successfull upgrade using "trim". Do not enable this option if your disk is not a SSD that allows trim. core.config.trim.after_upgrade=Optimize disc after upgrading
core.config.trim_after_update=Optimize disc after upgrading core.config.trim.after_upgrade.tip=It optimizes the disc after a successful upgrade using "trim". Do not enable this option if your disk is not a SSD that allows trim.
core.config.types.tip=Check the application types you want to manage core.config.types.tip=Check the application types you want to manage
core.config.ui.auto_scale.tip=It activates the auto screen scale factor ( {} ). It fixes scaling issues for some desktop environments. core.config.ui.auto_scale.tip=It activates the auto screen scale factor ( {} ). It fixes scaling issues for some desktop environments.
core.config.ui.auto_scale=Auto scale core.config.ui.auto_scale=Auto scale

View File

@@ -207,8 +207,8 @@ core.config.tab.general=Generales
core.config.tab.tray=Bandeja core.config.tab.tray=Bandeja
core.config.tab.types=Tipos core.config.tab.types=Tipos
core.config.tab.ui=Interfaz core.config.tab.ui=Interfaz
core.config.trim_after_update=Optimizar disco después de actualizar core.config.trim.after_upgrade=Optimizar disco después de actualizar
core.config.trim_after_update.tip=Optimiza el disco después de una actualización exitosa usando "trim". No habilite esta opción si su disco no es un SSD que permita trim. core.config.trim.after_upgrade.tip=Optimiza el disco después de una actualización exitosa usando "trim". No habilite esta opción si su disco no es un SSD que permita trim.
core.config.types.tip=Marque los tipos de aplicaciones que desea administrar 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=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. core.config.ui.auto_scale.tip=Activa el factor de escala de pantalla automática ( {} ). Soluciona problemas de escala para algunos ambientes desktop.

View File

@@ -207,8 +207,8 @@ core.config.tab.tray=Tray
core.config.tab.types=Types core.config.tab.types=Types
core.config.tab.ui=Interface core.config.tab.ui=Interface
core.config.tab_label=general core.config.tab_label=general
core.config.trim_after_update=Optimize disc after upgrading core.config.trim.after_upgrade=Optimize disc after upgrading
core.config.trim_after_update.tip=It optimizes the disc after a successfull upgrade using "trim". Do not enable this option if your disk is not a SSD that allows trim. core.config.trim.after_upgrade.tip=It optimizes the disc after a successful upgrade using "trim". Do not enable this option if your disk is not a SSD that allows trim.
core.config.types.tip=Check the application types you want to manage core.config.types.tip=Check the application types you want to manage
core.config.ui.auto_scale=Auto scale 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. core.config.ui.auto_scale.tip=It activates the auto screen scale factor ( {} ). It fixes scaling issues for some desktop environments.

View File

@@ -206,8 +206,8 @@ core.config.tab.general=Gerais
core.config.tab.tray=Bandeja core.config.tab.tray=Bandeja
core.config.tab.types=Tipos core.config.tab.types=Tipos
core.config.tab.ui=Interface core.config.tab.ui=Interface
core.config.trim_after_update.tip=Otimiza o disco após uma atualização bem sucedida utilizando "trim". Não habilite essa opção se o seu disco não for um SSD que permite trim. core.config.trim.after_upgrade=Otimizar disco após atualizar
core.config.trim_after_update=Otimizar disco após atualizar core.config.trim.after_upgrade.tip=Otimiza o disco após uma atualização bem sucedida utilizando "trim". Não habilite essa opção se o seu disco não for um SSD que permite trim.
core.config.types.tip=Marque os tipos de aplicativo que você quer gerenciar core.config.types.tip=Marque os tipos de aplicativo que você quer gerenciar
core.config.ui.auto_scale.tip=Ativa o fator de escala automático ( {} ). Corrige problemas de escala para alguns ambientes desktop. core.config.ui.auto_scale.tip=Ativa o fator de escala automático ( {} ). Corrige problemas de escala para alguns ambientes desktop.
core.config.ui.auto_scale=Escala automática core.config.ui.auto_scale=Escala automática

View File

@@ -206,8 +206,8 @@ core.config.tab.general=Основные
core.config.tab.tray=Трей core.config.tab.tray=Трей
core.config.tab.types=Типы core.config.tab.types=Типы
core.config.tab.ui=Интерфейс core.config.tab.ui=Интерфейс
core.config.trim_after_update=Optimize disc after upgrading core.config.trim.after_upgrade=Optimize disc after upgrading
core.config.trim_after_update.tip=It optimizes the disc after a successfull upgrade using "trim". Do not enable this option if your disk is not a SSD that allows trim. core.config.trim.after_upgrade.tip=It optimizes the disc after a successful upgrade using "trim". Do not enable this option if your disk is not a SSD that allows trim.
core.config.types.tip=Отметьте типы приложений, которыми вы хотите управлять core.config.types.tip=Отметьте типы приложений, которыми вы хотите управлять
core.config.ui.auto_scale=Автоматическое масштабирование core.config.ui.auto_scale=Автоматическое масштабирование
core.config.ui.auto_scale.tip=Он активирует автоматический коэффициент масштабирования экрана ({}),тем самым устраняет проблемы масштабирования для некоторых сред рабочего стола core.config.ui.auto_scale.tip=Он активирует автоматический коэффициент масштабирования экрана ({}),тем самым устраняет проблемы масштабирования для некоторых сред рабочего стола