[core] improvement -> new settings property 'boot.load_apps' to prevent loading apps after the startup process

This commit is contained in:
Vinicius Moreira
2020-12-24 11:42:40 -03:00
parent c978c499dd
commit cdcb2bac0b
16 changed files with 71 additions and 14 deletions

View File

@@ -116,10 +116,12 @@ class PreparePanel(QWidget, TaskManager):
signal_status = pyqtSignal(int)
signal_password_response = pyqtSignal(bool, str)
def __init__(self, context: ApplicationContext, manager: SoftwareManager, screen_size: QSize, i18n: I18n, manage_window: QWidget):
def __init__(self, context: ApplicationContext, manager: SoftwareManager, screen_size: QSize,
i18n: I18n, manage_window: QWidget, app_config: dict):
super(PreparePanel, self).__init__(flags=Qt.CustomizeWindowHint | Qt.WindowTitleHint)
self.i18n = i18n
self.context = context
self.app_config = app_config
self.manage_window = manage_window
self.setWindowTitle('{} ({})'.format(__app_name__, self.i18n['prepare_panel.title.start'].lower()))
self.setMinimumWidth(screen_size.width() * 0.5)
@@ -406,6 +408,11 @@ class PreparePanel(QWidget, TaskManager):
def finish(self):
if self.isVisible():
self.manage_window.show()
self.manage_window.begin_refresh_packages()
if self.app_config['boot']['load_apps']:
self.manage_window.begin_refresh_packages()
else:
self.manage_window.load_without_packages()
self.self_close = True
self.close()

View File

@@ -103,6 +103,7 @@ class ManageWindow(QWidget):
self.logger = logger
self.manager = manager
self.working = False # restrict the number of threaded actions
self.installed_loaded = False # used to control the state when the interface is set to not load the apps on startup
self.pkgs = [] # packages current loaded in the table
self.pkgs_available = [] # all packages loaded in memory
self.pkgs_installed = [] # cached installed packages
@@ -572,14 +573,18 @@ class ManageWindow(QWidget):
self.thread_warnings.start()
def _begin_loading_installed(self):
self.search_bar.clear()
self.input_name.set_text('')
self._begin_action(self.i18n['manage_window.status.installed'])
self._handle_console_option(False)
self.comp_manager.set_components_visible(False)
self.suggestions_requested = False
self.search_performed = False
self.thread_load_installed.start()
if self.installed_loaded:
self.search_bar.clear()
self.input_name.set_text('')
self._begin_action(self.i18n['manage_window.status.installed'])
self._handle_console_option(False)
self.comp_manager.set_components_visible(False)
self.suggestions_requested = False
self.search_performed = False
self.thread_load_installed.start()
else:
self.load_suggestions = False
self.begin_refresh_packages()
def _finish_loading_installed(self):
self._finish_action()
@@ -668,7 +673,7 @@ class ManageWindow(QWidget):
self.check_details.setChecked(False)
self.textarea_details.hide()
def begin_refresh_packages(self, pkg_types: Set[Type[SoftwarePackage]] = None):
def begin_refresh_packages(self, pkg_types: Optional[Set[Type[SoftwarePackage]]] = None):
self.search_bar.clear()
self._begin_action(self.i18n['manage_window.status.refreshing'])
@@ -699,6 +704,11 @@ class ManageWindow(QWidget):
self.load_suggestions = False
self.types_changed = False
def load_without_packages(self):
self.load_suggestions = False
self._handle_console_option(False)
self._finish_refresh_packages({'installed': None, 'types': None}, as_installed=False)
def _begin_load_suggestions(self, filter_installed: bool):
self.search_bar.clear()
self._begin_action(self.i18n['manage_window.status.suggestions'])
@@ -887,7 +897,7 @@ class ManageWindow(QWidget):
'display_limit': None if self.filter_updates else self.display_limit
}
def update_pkgs(self, new_pkgs: List[SoftwarePackage], as_installed: bool, types: Set[type] = None, ignore_updates: bool = False, keep_filters: bool = False) -> bool:
def update_pkgs(self, new_pkgs: Optional[List[SoftwarePackage]], as_installed: bool, types: Optional[Set[type]] = None, ignore_updates: bool = False, keep_filters: bool = False) -> bool:
self.input_name.set_text('')
pkgs_info = commons.new_pkgs_info()
filters = self._gen_filters(ignore_updates=ignore_updates)
@@ -958,6 +968,9 @@ class ManageWindow(QWidget):
qt_utils.centralize(self)
self.first_refresh = False
if not self.installed_loaded and as_installed:
self.installed_loaded = True
return True
def _apply_filters(self, pkgs_info: dict, ignore_updates: bool):