mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-08 16:44:16 +02:00
[improvements][ui]
This commit is contained in:
@@ -31,7 +31,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- AppImage
|
- AppImage
|
||||||
- Categories are now translated on the Info window
|
- 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
|
### Fixes
|
||||||
- Flatpak
|
- Flatpak
|
||||||
|
|||||||
@@ -516,7 +516,7 @@ class AppsTable(QTableWidget):
|
|||||||
header_horizontal = self.horizontalHeader()
|
header_horizontal = self.horizontalHeader()
|
||||||
for i in range(self.columnCount()):
|
for i in range(self.columnCount()):
|
||||||
if maximized:
|
if maximized:
|
||||||
if i in (1, 2):
|
if i in (0, 1, 2):
|
||||||
header_horizontal.setSectionResizeMode(i, QHeaderView.ResizeToContents)
|
header_horizontal.setSectionResizeMode(i, QHeaderView.ResizeToContents)
|
||||||
else:
|
else:
|
||||||
header_horizontal.setSectionResizeMode(i, QHeaderView.Stretch)
|
header_horizontal.setSectionResizeMode(i, QHeaderView.Stretch)
|
||||||
|
|||||||
@@ -57,8 +57,6 @@ def toolbar_button_style(bg: str = None, color: str = None):
|
|||||||
|
|
||||||
|
|
||||||
class ManageWindow(QWidget):
|
class ManageWindow(QWidget):
|
||||||
__BASE_HEIGHT__ = 400
|
|
||||||
|
|
||||||
signal_user_res = pyqtSignal(bool)
|
signal_user_res = pyqtSignal(bool)
|
||||||
signal_root_password = pyqtSignal(str, bool)
|
signal_root_password = pyqtSignal(str, bool)
|
||||||
signal_table_update = pyqtSignal()
|
signal_table_update = pyqtSignal()
|
||||||
@@ -81,7 +79,6 @@ class ManageWindow(QWidget):
|
|||||||
self.http_client = http_client
|
self.http_client = http_client
|
||||||
|
|
||||||
self.icon_app = icon
|
self.icon_app = icon
|
||||||
self.resize(ManageWindow.__BASE_HEIGHT__, ManageWindow.__BASE_HEIGHT__)
|
|
||||||
self.setWindowIcon(self.icon_app)
|
self.setWindowIcon(self.icon_app)
|
||||||
|
|
||||||
self.layout = QVBoxLayout()
|
self.layout = QVBoxLayout()
|
||||||
@@ -376,7 +373,8 @@ class ManageWindow(QWidget):
|
|||||||
self.types_changed = False
|
self.types_changed = False
|
||||||
|
|
||||||
self.dialog_about = None
|
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 = ListWarnings(man=manager, i18n=i18n)
|
||||||
self.thread_warnings.signal_warnings.connect(self._show_warnings)
|
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 = NotifyInstalledLoaded()
|
||||||
self.thread_load_installed.signal_loaded.connect(self._finish_loading_installed)
|
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):
|
def update_custom_actions(self):
|
||||||
self.custom_actions = self.manager.get_custom_actions()
|
self.custom_actions = self.manager.get_custom_actions()
|
||||||
@@ -495,6 +495,8 @@ class ManageWindow(QWidget):
|
|||||||
if not self.thread_warnings.isFinished():
|
if not self.thread_warnings.isFinished():
|
||||||
self.thread_warnings.start()
|
self.thread_warnings.start()
|
||||||
|
|
||||||
|
qt_utils.centralize(self)
|
||||||
|
|
||||||
def verify_warnings(self):
|
def verify_warnings(self):
|
||||||
self.thread_warnings.start()
|
self.thread_warnings.start()
|
||||||
|
|
||||||
@@ -542,7 +544,7 @@ class ManageWindow(QWidget):
|
|||||||
if not self.recent_installation:
|
if not self.recent_installation:
|
||||||
self._reload_categories()
|
self._reload_categories()
|
||||||
|
|
||||||
self.resize_and_center()
|
self._resize()
|
||||||
|
|
||||||
def _update_package_data(self, idx: int):
|
def _update_package_data(self, idx: int):
|
||||||
if self.table_apps.isEnabled():
|
if self.table_apps.isEnabled():
|
||||||
@@ -613,7 +615,7 @@ class ManageWindow(QWidget):
|
|||||||
self.ref_checkbox_only_apps.setVisible(bool(res['installed']))
|
self.ref_checkbox_only_apps.setVisible(bool(res['installed']))
|
||||||
self.ref_bt_upgrade.setVisible(True)
|
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.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.recent_uninstall = False
|
||||||
self.types_changed = False
|
self.types_changed = False
|
||||||
self._hide_fields_after_recent_installation()
|
self._hide_fields_after_recent_installation()
|
||||||
@@ -695,7 +697,7 @@ class ManageWindow(QWidget):
|
|||||||
if not self._maximized:
|
if not self._maximized:
|
||||||
self.table_apps.change_headers_policy(QHeaderView.Stretch)
|
self.table_apps.change_headers_policy(QHeaderView.Stretch)
|
||||||
self.table_apps.change_headers_policy()
|
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)))
|
self.label_displayed.setText('{} / {}'.format(len(self.pkgs), len(self.pkgs_available)))
|
||||||
else:
|
else:
|
||||||
self.label_displayed.setText('')
|
self.label_displayed.setText('')
|
||||||
@@ -783,7 +785,7 @@ class ManageWindow(QWidget):
|
|||||||
commons.apply_filters(pkgv, filters, pkgs_info)
|
commons.apply_filters(pkgv, filters, pkgs_info)
|
||||||
|
|
||||||
if pkgs_info['apps_count'] == 0:
|
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._begin_search('')
|
||||||
self.thread_suggestions.filter_installed = False
|
self.thread_suggestions.filter_installed = False
|
||||||
self.thread_suggestions.start()
|
self.thread_suggestions.start()
|
||||||
@@ -822,7 +824,11 @@ class ManageWindow(QWidget):
|
|||||||
if self.pkgs_installed:
|
if self.pkgs_installed:
|
||||||
self.ref_bt_installed.setVisible(not as_installed and not self.recent_installation)
|
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):
|
def _apply_filters(self, pkgs_info: dict, ignore_updates: bool):
|
||||||
pkgs_info['pkgs_displayed'] = []
|
pkgs_info['pkgs_displayed'] = []
|
||||||
@@ -900,7 +906,7 @@ class ManageWindow(QWidget):
|
|||||||
else:
|
else:
|
||||||
self.ref_combo_categories.setVisible(False)
|
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()
|
table_width = self.table_apps.get_width()
|
||||||
toolbar_width = self.toolbar.sizeHint().width()
|
toolbar_width = self.toolbar.sizeHint().width()
|
||||||
topbar_width = self.toolbar_top.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():
|
if (self.pkgs and accept_lower_width) or new_width > self.width():
|
||||||
self.resize(new_width, self.height())
|
self.resize(new_width, self.height())
|
||||||
|
|
||||||
qt_utils.centralize(self)
|
|
||||||
|
|
||||||
def set_progress_controll(self, enabled: bool):
|
def set_progress_controll(self, enabled: bool):
|
||||||
self.progress_controll_enabled = enumerate
|
self.progress_controll_enabled = enumerate
|
||||||
|
|
||||||
@@ -1272,16 +1276,6 @@ class ManageWindow(QWidget):
|
|||||||
|
|
||||||
if res['success']:
|
if res['success']:
|
||||||
self.apply_filters_async()
|
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(),
|
dialog.show_message(title=self.i18n['success'].capitalize(),
|
||||||
body=self.i18n['action.{}.success'.format(res['action'])].format(bold(res['pkg'].model.name)),
|
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(),
|
dialog.show_message(title=self.i18n['fail'].capitalize(),
|
||||||
body=self.i18n['action.{}.fail'.format(res['action'])].format(bold(res['pkg'].model.name)),
|
body=self.i18n['action.{}.fail'.format(res['action'])].format(bold(res['pkg'].model.name)),
|
||||||
type_=MessageType.ERROR)
|
type_=MessageType.ERROR)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user