From d3d40c85b65440f631f26c1c37406219e660d297 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 5 Jun 2020 14:37:04 -0300 Subject: [PATCH] [fix] displaying backups action when backup is disabled on the settings --- bauh/view/core/controller.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/bauh/view/core/controller.py b/bauh/view/core/controller.py index f89dbdca..5f1a275a 100755 --- a/bauh/view/core/controller.py +++ b/bauh/view/core/controller.py @@ -2,7 +2,7 @@ import re import re import time import traceback -from subprocess import Popen, PIPE, STDOUT +from subprocess import Popen, STDOUT from threading import Thread from typing import List, Set, Type, Tuple, Dict @@ -17,6 +17,7 @@ from bauh.api.exception import NoInternetException from bauh.commons import internet from bauh.commons.html import bold from bauh.commons.system import run_cmd +from bauh.view.core.config import read_config from bauh.view.core.settings import GenericSettingsManager from bauh.view.core.update import check_for_update from bauh.view.util import resource @@ -65,11 +66,14 @@ class GenericSoftwareManager(SoftwareManager): manager=self, icon_path='timeshift', requires_root=False, - refresh=False): self._is_timeshift_launcher_available} + refresh=False): self.is_backups_action_available} def _is_timeshift_launcher_available(self) -> bool: return bool(run_cmd('which timeshift-launcher', print_error=False)) + def is_backups_action_available(self, app_config: dict) -> bool: + return bool(app_config['backup']['enabled']) and self._is_timeshift_launcher_available() + def reset_cache(self): if self._available_cache is not None: self._available_cache = {} @@ -546,8 +550,10 @@ class GenericSoftwareManager(SoftwareManager): if man_actions: actions.extend(man_actions) + app_config = read_config() + for action, available in self.dynamic_extra_actions.items(): - if available(): + if available(app_config): actions.append(action) actions.extend(self.extra_actions)