mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 01:14:15 +02:00
fix: apps table not showing empty descriptions
This commit is contained in:
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
- new environment variable / argument to enable / disable the tray icon and update-check daemon: FPAKMAN_TRAY (--tray)
|
||||
- search results sorting takes an average of 35% less time, reaching 60% in some scenarios
|
||||
### Fixes:
|
||||
- apps table not showing empty descriptions
|
||||
- replacing default app icons by null icons
|
||||
- i18n fixes
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ from fpakman_api.abstract.model import ApplicationStatus
|
||||
|
||||
from fpakman.core import resource
|
||||
from fpakman_api.util.cache import Cache
|
||||
|
||||
from fpakman.util import util
|
||||
from fpakman.view.qt import dialog
|
||||
from fpakman.view.qt.view_model import ApplicationView, ApplicationViewStatus
|
||||
|
||||
@@ -292,10 +294,16 @@ class AppsTable(QTableWidget):
|
||||
def _set_col_description(self, idx: int, app_v: ApplicationView):
|
||||
col = QTableWidgetItem()
|
||||
col.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
|
||||
desc = app_v.get_async_attr('description', strip_html=True)
|
||||
|
||||
if desc:
|
||||
col.setText(desc[0:25] + '...')
|
||||
if app_v.model.base_data.description is not None or app_v.model.is_library() or app_v.model.status == ApplicationStatus.READY:
|
||||
desc = app_v.model.base_data.description
|
||||
else:
|
||||
desc = '...'
|
||||
|
||||
if desc and desc != '...':
|
||||
desc = util.strip_html(desc[0:25]) + '...'
|
||||
|
||||
col.setText(desc)
|
||||
|
||||
if app_v.model.status == ApplicationStatus.READY:
|
||||
col.setToolTip(desc)
|
||||
|
||||
@@ -17,12 +17,3 @@ class ApplicationView:
|
||||
self.update_checked = model.update
|
||||
self.visible = visible
|
||||
self.status = ApplicationViewStatus.LOADING
|
||||
|
||||
def get_async_attr(self, attr: str, strip_html: bool = False, default: str = '...'):
|
||||
|
||||
if getattr(self.model.base_data, attr) is not None or self.model.is_library():
|
||||
res = getattr(self.model.base_data, attr)
|
||||
else:
|
||||
res = getattr(self.model.base_data, attr) if self.model.status == ApplicationStatus.READY and getattr(self.model.base_data, attr) else default
|
||||
|
||||
return util.strip_html(res) if res and strip_html else res
|
||||
|
||||
Reference in New Issue
Block a user