mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 01:14:15 +02:00
0.4.2
This commit is contained in:
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
## [0.4.2] - 2019-07-28
|
||||
### Improvements
|
||||
- showing a warning dialog when the application starts and **snapd** is unavailable
|
||||
### Fixes:
|
||||
- [Snaps read index error](https://github.com/vinifmor/fpakman/issues/30)
|
||||
|
||||
## [0.4.1] - 2019-07-25
|
||||
### Improvements
|
||||
- retrieving some Snaps data (icon, description and confinement) through Ubuntu API instead of Snap Store
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
__version__ = '0.4.1'
|
||||
__version__ = '0.4.2'
|
||||
__app_name__ = 'fpakman'
|
||||
|
||||
import os
|
||||
|
||||
@@ -21,6 +21,7 @@ from fpakman.core.snap.model import SnapApplication
|
||||
from fpakman.util import util
|
||||
from fpakman.util.cache import Cache
|
||||
from fpakman.util.memory import CacheCleaner
|
||||
from fpakman.view.qt import dialog
|
||||
from fpakman.view.qt.systray import TrayIcon
|
||||
|
||||
|
||||
@@ -85,7 +86,7 @@ managers = []
|
||||
if args.flatpak:
|
||||
flatpak_api_cache = Cache(expiration_time=args.cache_exp)
|
||||
cache_map[FlatpakApplication] = flatpak_api_cache
|
||||
managers.append(FlatpakManager(app_args=args, api_cache=flatpak_api_cache, disk_cache=args.disk_cache, http_session=http_session))
|
||||
managers.append(FlatpakManager(app_args=args, api_cache=flatpak_api_cache, disk_cache=args.disk_cache, http_session=http_session, locale_keys=locale_keys))
|
||||
caches.append(flatpak_api_cache)
|
||||
|
||||
if args.disk_cache:
|
||||
@@ -94,7 +95,7 @@ if args.flatpak:
|
||||
if args.snap:
|
||||
snap_api_cache = Cache(expiration_time=args.cache_exp)
|
||||
cache_map[SnapApplication] = snap_api_cache
|
||||
managers.append(SnapManager(app_args=args, disk_cache=args.disk_cache, api_cache=snap_api_cache, http_session=http_session))
|
||||
managers.append(SnapManager(app_args=args, disk_cache=args.disk_cache, api_cache=snap_api_cache, http_session=http_session, locale_keys=locale_keys))
|
||||
caches.append(snap_api_cache)
|
||||
|
||||
if args.disk_cache:
|
||||
@@ -124,4 +125,10 @@ trayIcon.show()
|
||||
|
||||
CacheCleaner(caches).start()
|
||||
|
||||
warnings = manager.list_warnings()
|
||||
|
||||
if warnings:
|
||||
for warning in warnings:
|
||||
dialog.show_warning(title=locale_keys['warning'].capitalize(), body=warning)
|
||||
|
||||
sys.exit(app.exec_())
|
||||
|
||||
@@ -9,8 +9,9 @@ from fpakman.core.system import FpakmanProcess
|
||||
|
||||
class ApplicationManager(ABC):
|
||||
|
||||
def __init__(self, app_args):
|
||||
def __init__(self, app_args, locale_keys: dict):
|
||||
self.app_args = app_args
|
||||
self.locale_keys = locale_keys
|
||||
|
||||
@abstractmethod
|
||||
def search(self, word: str, disk_loader: DiskCacheLoader) -> Dict[str, List[Application]]:
|
||||
@@ -84,6 +85,10 @@ class ApplicationManager(ABC):
|
||||
def list_updates(self) -> List[ApplicationUpdate]:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def list_warnings(self) -> List[str]:
|
||||
pass
|
||||
|
||||
|
||||
class GenericApplicationManager(ApplicationManager):
|
||||
|
||||
@@ -266,3 +271,18 @@ class GenericApplicationManager(ApplicationManager):
|
||||
updates.extend(man.list_updates())
|
||||
|
||||
return updates
|
||||
|
||||
def list_warnings(self) -> List[str]:
|
||||
if self.managers:
|
||||
warnings = None
|
||||
|
||||
for man in self.managers:
|
||||
man_warnings = man.list_warnings()
|
||||
|
||||
if man_warnings:
|
||||
if warnings is None:
|
||||
warnings = []
|
||||
|
||||
warnings.extend(man_warnings)
|
||||
|
||||
return warnings
|
||||
|
||||
@@ -17,8 +17,8 @@ from fpakman.util.cache import Cache
|
||||
|
||||
class FlatpakManager(ApplicationManager):
|
||||
|
||||
def __init__(self, app_args: Namespace, api_cache: Cache, disk_cache: bool, http_session):
|
||||
super(FlatpakManager, self).__init__(app_args=app_args)
|
||||
def __init__(self, app_args: Namespace, api_cache: Cache, disk_cache: bool, http_session, locale_keys: dict):
|
||||
super(FlatpakManager, self).__init__(app_args=app_args, locale_keys=locale_keys)
|
||||
self.api_cache = api_cache
|
||||
self.http_session = http_session
|
||||
self.disk_cache = disk_cache
|
||||
@@ -176,5 +176,7 @@ class FlatpakManager(ApplicationManager):
|
||||
updates.append(ApplicationUpdate(app_id='{}:{}'.format(app['id'], app['branch']),
|
||||
app_type='flatpak',
|
||||
version=app.get('version')))
|
||||
|
||||
return updates
|
||||
|
||||
def list_warnings(self) -> List[str]:
|
||||
return None
|
||||
|
||||
@@ -17,8 +17,8 @@ from fpakman.util.cache import Cache
|
||||
|
||||
class SnapManager(ApplicationManager):
|
||||
|
||||
def __init__(self, app_args: Namespace, api_cache: Cache, disk_cache: bool, http_session):
|
||||
super(SnapManager, self).__init__(app_args=app_args)
|
||||
def __init__(self, app_args: Namespace, api_cache: Cache, disk_cache: bool, http_session, locale_keys: dict):
|
||||
super(SnapManager, self).__init__(app_args=app_args, locale_keys=locale_keys)
|
||||
self.api_cache = api_cache
|
||||
self.http_session = http_session
|
||||
self.disk_cache = disk_cache
|
||||
@@ -133,3 +133,7 @@ class SnapManager(ApplicationManager):
|
||||
|
||||
def list_updates(self) -> List[ApplicationUpdate]:
|
||||
return []
|
||||
|
||||
def list_warnings(self) -> List[str]:
|
||||
if snap.get_snapd_version() == 'unavailable':
|
||||
return [self.locale_keys['snap.notification.snapd_unavailable']]
|
||||
|
||||
@@ -9,7 +9,7 @@ BASE_CMD = 'snap'
|
||||
|
||||
def is_installed():
|
||||
version = get_snapd_version()
|
||||
return False if version is None else True
|
||||
return False if version is None or version == 'unavailable' else True
|
||||
|
||||
|
||||
def get_version():
|
||||
@@ -27,7 +27,7 @@ def get_snapd_version():
|
||||
|
||||
if lines and len(lines) >= 2:
|
||||
version = lines[1].split(' ')[-1].strip()
|
||||
return version if version and version.lower() != 'unavailable' else None
|
||||
return version.lower() if version else None
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -39,8 +39,8 @@ def app_str_to_json(app: str) -> dict:
|
||||
'version': app_data[1],
|
||||
'rev': app_data[2],
|
||||
'tracking': app_data[3],
|
||||
'publisher': app_data[4],
|
||||
'notes': app_data[5]
|
||||
'publisher': app_data[4] if len(app_data) >= 5 else None,
|
||||
'notes': app_data[5] if len(app_data) >= 6 else None
|
||||
}
|
||||
|
||||
app_json.update(get_info(app_json['name'], ('summary', 'type', 'description')))
|
||||
|
||||
@@ -99,4 +99,6 @@ version.installed=installed version
|
||||
version.latest=latest version
|
||||
version.installed_outdated=the installed version is outdated
|
||||
version.unknown=not informed
|
||||
app.name=application name
|
||||
app.name=application name
|
||||
warning=warning
|
||||
snap.notification.snapd_unavailable=snapd seems not to be enabled. snap packages will not be available.
|
||||
@@ -100,4 +100,6 @@ version.installed=versión instalada
|
||||
version.latest=versión más reciente
|
||||
version.installed_outdated=la versión instalada está desactualizada
|
||||
version.unknown=versión no informada
|
||||
app.name=nombre del aplicativo
|
||||
app.name=nombre del aplicativo
|
||||
warning=aviso
|
||||
snap.notification.snapd_unavailable=snapd no parece estar habilitado. los paquetes snap estarán indisponibles.
|
||||
@@ -100,4 +100,6 @@ version.installed=versão instalada
|
||||
version.latest=versão mais recente
|
||||
version.installed_outdated=a versão instalada está desatualizada
|
||||
version.unknown=versão não informada
|
||||
app.name=nome do aplicativo
|
||||
app.name=nome do aplicativo
|
||||
warning=aviso
|
||||
snap.notification.snapd_unavailable=snapd não parece estar habilitado. os pacotes snap estarão indisponíveis.
|
||||
@@ -1,5 +1,5 @@
|
||||
from PyQt5.QtGui import QIcon
|
||||
from PyQt5.QtWidgets import QMessageBox, QSizePolicy
|
||||
from PyQt5.QtWidgets import QMessageBox
|
||||
|
||||
from fpakman.core import resource
|
||||
|
||||
@@ -16,6 +16,18 @@ def show_error(title: str, body: str, icon: QIcon = QIcon(resource.get_path('img
|
||||
error_msg.exec_()
|
||||
|
||||
|
||||
def show_warning(title: str, body: str, icon: QIcon = QIcon(resource.get_path('img/logo.svg'))):
|
||||
msg = QMessageBox()
|
||||
msg.setIcon(QMessageBox.Warning)
|
||||
msg.setWindowTitle(title)
|
||||
msg.setText(body)
|
||||
|
||||
if icon:
|
||||
msg.setWindowIcon(icon)
|
||||
|
||||
msg.exec_()
|
||||
|
||||
|
||||
def ask_confirmation(title: str, body: str, locale_keys: dict, icon: QIcon = QIcon(resource.get_path('img/logo.svg'))):
|
||||
dialog_confirmation = QMessageBox()
|
||||
dialog_confirmation.setIcon(QMessageBox.Question)
|
||||
|
||||
Reference in New Issue
Block a user