mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-06 22:54:16 +02:00
[view] improvement: only displaying both the installed and latest versions on the 'version' column if its width is no more than 20% of the primary screen width
This commit is contained in:
@@ -16,7 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- table columns width for maximized window
|
- table columns width for maximized window
|
||||||
- settings window size rules moved to stylesheet files
|
- settings window size rules moved to stylesheet files
|
||||||
- enforcing maximum width and height for the management window based on the primary screen resolution [#261](https://github.com/vinifmor/bauh/issues/261)
|
- enforcing maximum width and height for the management window based on the primary screen resolution [#261](https://github.com/vinifmor/bauh/issues/261)
|
||||||
|
- updates: only displaying both the installed and latest versions on the "version" column if its width is no more than 20% of the primary screen width (otherwise just the latest version will be displayed)
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
- Flatpak
|
- Flatpak
|
||||||
|
|||||||
@@ -72,8 +72,9 @@ class PackagesTable(QTableWidget):
|
|||||||
COL_NUMBER = 9
|
COL_NUMBER = 9
|
||||||
DEFAULT_ICON_SIZE = QSize(16, 16)
|
DEFAULT_ICON_SIZE = QSize(16, 16)
|
||||||
|
|
||||||
def __init__(self, parent: QWidget, icon_cache: MemoryCache, download_icons: bool):
|
def __init__(self, parent: QWidget, icon_cache: MemoryCache, download_icons: bool, screen_width: int):
|
||||||
super(PackagesTable, self).__init__()
|
super(PackagesTable, self).__init__()
|
||||||
|
self.screen_width = screen_width
|
||||||
self.setObjectName('table_packages')
|
self.setObjectName('table_packages')
|
||||||
self.setParent(parent)
|
self.setParent(parent)
|
||||||
self.window = parent
|
self.window = parent
|
||||||
@@ -382,8 +383,12 @@ class PackagesTable(QTableWidget):
|
|||||||
tooltip = self.i18n['version.updates_ignored']
|
tooltip = self.i18n['version.updates_ignored']
|
||||||
|
|
||||||
if pkg.model.installed and pkg.model.update and not pkg.model.is_update_ignored() and pkg.model.version and pkg.model.latest_version and pkg.model.version != pkg.model.latest_version:
|
if pkg.model.installed and pkg.model.update and not pkg.model.is_update_ignored() and pkg.model.version and pkg.model.latest_version and pkg.model.version != pkg.model.latest_version:
|
||||||
tooltip = '{}. {}: {}'.format(tooltip, self.i18n['version.latest'], pkg.model.latest_version)
|
tooltip = f"{tooltip} ({self.i18n['version.installed']}: {pkg.model.version} | " \
|
||||||
label_version.setText(label_version.text() + ' > {}'.format(pkg.model.latest_version))
|
f"{self.i18n['version.latest']}: {pkg.model.latest_version})"
|
||||||
|
label_version.setText(f"{label_version.text()} > {pkg.model.latest_version}")
|
||||||
|
|
||||||
|
if label_version.sizeHint().width() / self.screen_width > 0.20:
|
||||||
|
label_version.setText(pkg.model.latest_version)
|
||||||
|
|
||||||
item.setToolTip(tooltip)
|
item.setToolTip(tooltip)
|
||||||
self.setCellWidget(pkg.table_index, col, item)
|
self.setCellWidget(pkg.table_index, col, item)
|
||||||
|
|||||||
@@ -277,7 +277,9 @@ class ManageWindow(QWidget):
|
|||||||
self.table_container.setLayout(QVBoxLayout())
|
self.table_container.setLayout(QVBoxLayout())
|
||||||
self.table_container.layout().setContentsMargins(0, 0, 0, 0)
|
self.table_container.layout().setContentsMargins(0, 0, 0, 0)
|
||||||
|
|
||||||
self.table_apps = PackagesTable(self, self.icon_cache, download_icons=bool(self.config['download']['icons']))
|
self.table_apps = PackagesTable(self, self.icon_cache,
|
||||||
|
download_icons=bool(self.config['download']['icons']),
|
||||||
|
screen_width=int(screen_size.width()))
|
||||||
self.table_apps.change_headers_policy()
|
self.table_apps.change_headers_policy()
|
||||||
self.table_container.layout().addWidget(self.table_apps)
|
self.table_container.layout().addWidget(self.table_apps)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user