mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-06 22:54:16 +02:00
[improvement][flatpak] application name tooltip now displays the installation level
This commit is contained in:
@@ -15,6 +15,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
### Improvements
|
### Improvements
|
||||||
- All icons are now SVG files
|
- All icons are now SVG files
|
||||||
- HDPI support improvements ( by [octopusSD](https://github.com/octopusSD) )
|
- HDPI support improvements ( by [octopusSD](https://github.com/octopusSD) )
|
||||||
|
- Flatpak:
|
||||||
|
- the application name tooltip now displays the installation level. e.g: **gedit ( system )**
|
||||||
|
- info window displaying the installation level
|
||||||
- Web:
|
- Web:
|
||||||
- not using HTTP sessions anymore to perform the searches. It seems to avoid URLs not being found after an internet drop event.
|
- not using HTTP sessions anymore to perform the searches. It seems to avoid URLs not being found after an internet drop event.
|
||||||
- supporting JPEG images as custom icons
|
- supporting JPEG images as custom icons
|
||||||
|
|||||||
@@ -175,6 +175,12 @@ class SoftwarePackage(ABC):
|
|||||||
"""
|
"""
|
||||||
return not self.installed
|
return not self.installed
|
||||||
|
|
||||||
|
def get_name_tooltip(self) -> str:
|
||||||
|
"""
|
||||||
|
:return: the application name that should be displayed on the UI tooltips.
|
||||||
|
"""
|
||||||
|
return self.name
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '{} (id={}, name={})'.format(self.__class__.__name__, self.id, self.name)
|
return '{} (id={}, name={})'.format(self.__class__.__name__, self.id, self.name)
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class FlatpakManager(SoftwareManager):
|
|||||||
|
|
||||||
def _map_to_model(self, app_json: dict, installed: bool, disk_loader: DiskCacheLoader, internet: bool = True) -> FlatpakApplication:
|
def _map_to_model(self, app_json: dict, installed: bool, disk_loader: DiskCacheLoader, internet: bool = True) -> FlatpakApplication:
|
||||||
|
|
||||||
app = FlatpakApplication(**app_json)
|
app = FlatpakApplication(**app_json, i18n=self.i18n)
|
||||||
app.installed = installed
|
app.installed = installed
|
||||||
api_data = self.api_cache.get(app_json['id'])
|
api_data = self.api_cache.get(app_json['id'])
|
||||||
|
|
||||||
|
|||||||
@@ -3,13 +3,14 @@ import copy
|
|||||||
from bauh.api.abstract.model import SoftwarePackage
|
from bauh.api.abstract.model import SoftwarePackage
|
||||||
from bauh.commons import resource
|
from bauh.commons import resource
|
||||||
from bauh.gems.flatpak import ROOT_DIR
|
from bauh.gems.flatpak import ROOT_DIR
|
||||||
|
from bauh.view.util.translation import I18n
|
||||||
|
|
||||||
|
|
||||||
class FlatpakApplication(SoftwarePackage):
|
class FlatpakApplication(SoftwarePackage):
|
||||||
|
|
||||||
def __init__(self, id: str = None, name: str = None, version: str = None, latest_version: str = None, description: str = None,
|
def __init__(self, id: str = None, name: str = None, version: str = None, latest_version: str = None, description: str = None,
|
||||||
branch: str = None, arch: str = None, origin: str = None, runtime: bool = False, ref: str = None, commit: str = None,
|
branch: str = None, arch: str = None, origin: str = None, runtime: bool = False, ref: str = None, commit: str = None,
|
||||||
installation: str = None):
|
installation: str = None, i18n: I18n = None):
|
||||||
super(FlatpakApplication, self).__init__(id=id, name=name, version=version,
|
super(FlatpakApplication, self).__init__(id=id, name=name, version=version,
|
||||||
latest_version=latest_version, description=description)
|
latest_version=latest_version, description=description)
|
||||||
self.ref = ref
|
self.ref = ref
|
||||||
@@ -20,6 +21,7 @@ class FlatpakApplication(SoftwarePackage):
|
|||||||
self.commit = commit
|
self.commit = commit
|
||||||
self.partial = False
|
self.partial = False
|
||||||
self.installation = installation if installation else 'system'
|
self.installation = installation if installation else 'system'
|
||||||
|
self.i18n = i18n
|
||||||
|
|
||||||
if runtime:
|
if runtime:
|
||||||
self.categories = ['runtime']
|
self.categories = ['runtime']
|
||||||
@@ -81,3 +83,9 @@ class FlatpakApplication(SoftwarePackage):
|
|||||||
|
|
||||||
partial.partial = True
|
partial.partial = True
|
||||||
return partial
|
return partial
|
||||||
|
|
||||||
|
def get_name_tooltip(self) -> str:
|
||||||
|
if self.installation and self.i18n is not None:
|
||||||
|
return '{} ( {} )'.format(self.name, self.i18n[self.installation.lower()])
|
||||||
|
|
||||||
|
return self.name
|
||||||
|
|||||||
@@ -333,7 +333,7 @@ class AppsTable(QTableWidget):
|
|||||||
|
|
||||||
if pkg.model.name:
|
if pkg.model.name:
|
||||||
name = pkg.model.name
|
name = pkg.model.name
|
||||||
item.setToolTip('{}: {}'.format(self.i18n['app.name'].lower(), name))
|
item.setToolTip('{}: {}'.format(self.i18n['app.name'].lower(), pkg.model.get_name_tooltip()))
|
||||||
else:
|
else:
|
||||||
name = '...'
|
name = '...'
|
||||||
item.setToolTip(self.i18n['app.name'].lower())
|
item.setToolTip(self.i18n['app.name'].lower())
|
||||||
|
|||||||
Reference in New Issue
Block a user