diff --git a/CHANGELOG.md b/CHANGELOG.md index b27a1a21..f26c2c15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,7 +31,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - AppImage - Categories are now translated on the Info window -- minor UI changes +- UI + - only centralizing the apps table after the initialization process + - defining a minimum width and height based on the screen size + - minor changes ### Fixes - Flatpak diff --git a/bauh/view/qt/apps_table.py b/bauh/view/qt/apps_table.py index 166cb2d9..db4e70df 100644 --- a/bauh/view/qt/apps_table.py +++ b/bauh/view/qt/apps_table.py @@ -516,7 +516,7 @@ class AppsTable(QTableWidget): header_horizontal = self.horizontalHeader() for i in range(self.columnCount()): if maximized: - if i in (1, 2): + if i in (0, 1, 2): header_horizontal.setSectionResizeMode(i, QHeaderView.ResizeToContents) else: header_horizontal.setSectionResizeMode(i, QHeaderView.Stretch) diff --git a/bauh/view/qt/window.py b/bauh/view/qt/window.py index 2cda6248..26af5e9b 100755 --- a/bauh/view/qt/window.py +++ b/bauh/view/qt/window.py @@ -57,8 +57,6 @@ def toolbar_button_style(bg: str = None, color: str = None): class ManageWindow(QWidget): - __BASE_HEIGHT__ = 400 - signal_user_res = pyqtSignal(bool) signal_root_password = pyqtSignal(str, bool) signal_table_update = pyqtSignal() @@ -81,7 +79,6 @@ class ManageWindow(QWidget): self.http_client = http_client self.icon_app = icon - self.resize(ManageWindow.__BASE_HEIGHT__, ManageWindow.__BASE_HEIGHT__) self.setWindowIcon(self.icon_app) self.layout = QVBoxLayout() @@ -376,7 +373,8 @@ class ManageWindow(QWidget): self.types_changed = False self.dialog_about = None - self.first_refresh = bool(config['suggestions']['enabled']) + self.load_suggestions = bool(config['suggestions']['enabled']) + self.first_refresh = True self.thread_warnings = ListWarnings(man=manager, i18n=i18n) self.thread_warnings.signal_warnings.connect(self._show_warnings) @@ -385,6 +383,8 @@ class ManageWindow(QWidget): self.thread_load_installed = NotifyInstalledLoaded() self.thread_load_installed.signal_loaded.connect(self._finish_loading_installed) + self.setMinimumHeight(int(screen_size.height() * 0.4)) + self.setMinimumWidth(int(screen_size.width() * 0.6)) def update_custom_actions(self): self.custom_actions = self.manager.get_custom_actions() @@ -495,6 +495,8 @@ class ManageWindow(QWidget): if not self.thread_warnings.isFinished(): self.thread_warnings.start() + qt_utils.centralize(self) + def verify_warnings(self): self.thread_warnings.start() @@ -542,7 +544,7 @@ class ManageWindow(QWidget): if not self.recent_installation: self._reload_categories() - self.resize_and_center() + self._resize() def _update_package_data(self, idx: int): if self.table_apps.isEnabled(): @@ -613,7 +615,7 @@ class ManageWindow(QWidget): self.ref_checkbox_only_apps.setVisible(bool(res['installed'])) self.ref_bt_upgrade.setVisible(True) self.update_pkgs(res['installed'], as_installed=as_installed, types=res['types'], keep_filters=self.recent_uninstall and res['types']) - self.first_refresh = False + self.load_suggestions = False self.recent_uninstall = False self.types_changed = False self._hide_fields_after_recent_installation() @@ -695,7 +697,7 @@ class ManageWindow(QWidget): if not self._maximized: self.table_apps.change_headers_policy(QHeaderView.Stretch) self.table_apps.change_headers_policy() - self.resize_and_center(accept_lower_width=len(self.pkgs) > 0) + self._resize(accept_lower_width=len(self.pkgs) > 0) self.label_displayed.setText('{} / {}'.format(len(self.pkgs), len(self.pkgs_available))) else: self.label_displayed.setText('') @@ -783,7 +785,7 @@ class ManageWindow(QWidget): commons.apply_filters(pkgv, filters, pkgs_info) if pkgs_info['apps_count'] == 0: - if self.first_refresh or self.types_changed: + if self.load_suggestions or self.types_changed: self._begin_search('') self.thread_suggestions.filter_installed = False self.thread_suggestions.start() @@ -822,7 +824,11 @@ class ManageWindow(QWidget): if self.pkgs_installed: self.ref_bt_installed.setVisible(not as_installed and not self.recent_installation) - self.resize_and_center(accept_lower_width=self.pkgs_installed) + self._resize(accept_lower_width=self.pkgs_installed) + + if self.first_refresh: + qt_utils.centralize(self) + self.first_refresh = False def _apply_filters(self, pkgs_info: dict, ignore_updates: bool): pkgs_info['pkgs_displayed'] = [] @@ -900,7 +906,7 @@ class ManageWindow(QWidget): else: self.ref_combo_categories.setVisible(False) - def resize_and_center(self, accept_lower_width: bool = True): + def _resize(self, accept_lower_width: bool = True): table_width = self.table_apps.get_width() toolbar_width = self.toolbar.sizeHint().width() topbar_width = self.toolbar_top.sizeHint().width() @@ -911,8 +917,6 @@ class ManageWindow(QWidget): if (self.pkgs and accept_lower_width) or new_width > self.width(): self.resize(new_width, self.height()) - qt_utils.centralize(self) - def set_progress_controll(self, enabled: bool): self.progress_controll_enabled = enumerate @@ -1272,16 +1276,6 @@ class ManageWindow(QWidget): if res['success']: self.apply_filters_async() - # if self.ref_checkbox_updates.isVisible() and self.filter_updates: - # self.table_apps.model().removeRow(res['pkg'].table_index) - # del self.pkgs[res['pkg'].table_index] - # - # if self.pkgs: - # for idx, p in enumerate(self.pkgs): - # p.table_index = idx - # - # else: - # self.table_apps.update_package(res['pkg'], change_update_col=True) dialog.show_message(title=self.i18n['success'].capitalize(), body=self.i18n['action.{}.success'.format(res['action'])].format(bold(res['pkg'].model.name)), @@ -1290,3 +1284,4 @@ class ManageWindow(QWidget): dialog.show_message(title=self.i18n['fail'].capitalize(), body=self.i18n['action.{}.fail'.format(res['action'])].format(bold(res['pkg'].model.name)), type_=MessageType.ERROR) +