[view] improvement: the app publisher displayed on the management window will be cut based on a percentage over the primary screen width (12%)

This commit is contained in:
Vinicius Moreira
2022-05-17 11:27:56 -03:00
parent 6944560706
commit 9f0956d29e
2 changed files with 12 additions and 7 deletions

View File

@@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- updates: only displaying both the installed and latest versions on the "version" column if its width is no more than 22% of the primary screen width (otherwise just the latest version will be displayed)
- the app name displayed on the management window will be cut based on a percentage over the primary screen width (15%)
- the app description displayed on the management window will be cut based on a percentage over the primary screen width (18%)
- the app publisher displayed on the management window will be cut based on a percentage over the primary screen width (12%)
### Fixes
- Flatpak

View File

@@ -18,8 +18,6 @@ from bauh.view.qt.dialog import ConfirmationDialog
from bauh.view.qt.view_model import PackageView
from bauh.view.util.translation import I18n
PUBLISHER_MAX_SIZE = 25
class UpgradeToggleButton(QToolButton):
@@ -487,15 +485,21 @@ class PackagesTable(QTableWidget):
publisher = pkg.model.get_publisher()
full_publisher = None
lb_name = QLabel()
lb_name.setObjectName('app_publisher')
if publisher:
publisher = publisher.strip()
full_publisher = publisher
if len(publisher) > PUBLISHER_MAX_SIZE:
publisher = full_publisher[0: PUBLISHER_MAX_SIZE - 3] + '...'
if publisher:
lb_name.setText(publisher)
screen_perc = lb_name.sizeHint().width() / self.screen_width
lb_name = QLabel()
lb_name.setObjectName('app_publisher')
if screen_perc > 0.12:
max_chars = int(len(publisher) * 0.12 / screen_perc) - 3
publisher = publisher[0: max_chars] + '...'
lb_name.setText(publisher)
if not publisher:
if not pkg.model.installed:
@@ -503,7 +507,7 @@ class PackagesTable(QTableWidget):
publisher = self.i18n['unknown']
lb_name.setText(' {}'.format(publisher))
lb_name.setText(f' {publisher}')
item.addWidget(lb_name)
if publisher and full_publisher: