mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 03:34:15 +02:00
Merge branch 'staging' into modules
# Conflicts: # fpakman/core/controller.py # fpakman/util/memory.py
This commit is contained in:
@@ -12,8 +12,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
|
|
||||||
## [0.5.1]
|
## [0.5.1]
|
||||||
### Improvements:
|
### Improvements:
|
||||||
- suggestions are now retrieved asynchronously. Response time takes 45% less.
|
- suggestions are now retrieved asynchronously taking 45% less time.
|
||||||
- search response time takes an average of 20% less ( reaching 35% for several results )
|
- search response takes an average of 20% less time ( reaching 35% for several results )
|
||||||
|
- app boot takes 98% less time when snapd is installed, but disabled
|
||||||
### Fixes:
|
### Fixes:
|
||||||
- [flatpak dependency](https://github.com/vinifmor/fpakman/issues/36)
|
- [flatpak dependency](https://github.com/vinifmor/fpakman/issues/36)
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ from fpakman.core import resource, extensions
|
|||||||
from fpakman.core.controller import GenericApplicationManager
|
from fpakman.core.controller import GenericApplicationManager
|
||||||
from fpakman.util import util
|
from fpakman.util import util
|
||||||
from fpakman.util.memory import CacheCleaner
|
from fpakman.util.memory import CacheCleaner
|
||||||
from fpakman.view.qt import dialog
|
|
||||||
from fpakman.view.qt.systray import TrayIcon
|
from fpakman.view.qt.systray import TrayIcon
|
||||||
from fpakman.view.qt.window import ManageWindow
|
from fpakman.view.qt.window import ManageWindow
|
||||||
|
|
||||||
@@ -54,18 +53,11 @@ if args.tray:
|
|||||||
manage_window=manage_window,
|
manage_window=manage_window,
|
||||||
check_interval=args.check_interval,
|
check_interval=args.check_interval,
|
||||||
update_notification=bool(args.update_notification))
|
update_notification=bool(args.update_notification))
|
||||||
|
|
||||||
manage_window.tray_icon = trayIcon
|
manage_window.tray_icon = trayIcon
|
||||||
trayIcon.show()
|
trayIcon.show()
|
||||||
else:
|
else:
|
||||||
manage_window.refresh_apps()
|
manage_window.refresh_apps()
|
||||||
manage_window.show()
|
manage_window.show()
|
||||||
|
|
||||||
warnings = manager.list_warnings()
|
|
||||||
|
|
||||||
if warnings:
|
|
||||||
for warning in warnings:
|
|
||||||
dialog.show_warning(title=locale_keys['warning'].capitalize(), body=warning)
|
|
||||||
|
|
||||||
CacheCleaner(caches).start()
|
CacheCleaner(caches).start()
|
||||||
sys.exit(app.exec_())
|
sys.exit(app.exec_())
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ class GenericApplicationManager(ApplicationManager):
|
|||||||
res['new'].extend(apps_found['new'])
|
res['new'].extend(apps_found['new'])
|
||||||
|
|
||||||
def search(self, word: str, disk_loader: DiskCacheLoader = None) -> Dict[str, List[Application]]:
|
def search(self, word: str, disk_loader: DiskCacheLoader = None) -> Dict[str, List[Application]]:
|
||||||
|
self._wait_to_be_ready()
|
||||||
|
|
||||||
res = {'installed': [], 'new': []}
|
res = {'installed': [], 'new': []}
|
||||||
|
|
||||||
norm_word = word.strip().lower()
|
norm_word = word.strip().lower()
|
||||||
@@ -89,6 +91,8 @@ class GenericApplicationManager(ApplicationManager):
|
|||||||
return res
|
return res
|
||||||
|
|
||||||
def read_installed(self, disk_loader: DiskCacheLoader = None) -> List[Application]:
|
def read_installed(self, disk_loader: DiskCacheLoader = None) -> List[Application]:
|
||||||
|
self._wait_to_be_ready()
|
||||||
|
|
||||||
installed = []
|
installed = []
|
||||||
|
|
||||||
disk_loader = None
|
disk_loader = None
|
||||||
@@ -180,18 +184,26 @@ class GenericApplicationManager(ApplicationManager):
|
|||||||
return man.requires_root(action, app)
|
return man.requires_root(action, app)
|
||||||
|
|
||||||
def refresh(self, app: Application, root_password: str) -> FpakmanProcess:
|
def refresh(self, app: Application, root_password: str) -> FpakmanProcess:
|
||||||
|
self._wait_to_be_ready()
|
||||||
|
|
||||||
man = self._get_manager_for(app)
|
man = self._get_manager_for(app)
|
||||||
|
|
||||||
if man:
|
if man:
|
||||||
return man.refresh(app, root_password)
|
return man.refresh(app, root_password)
|
||||||
|
|
||||||
def prepare(self):
|
def _prepare(self):
|
||||||
if self.managers:
|
if self.managers:
|
||||||
for man in self.managers:
|
for man in self.managers:
|
||||||
if self._is_enabled(man):
|
if self._is_enabled(man):
|
||||||
man.prepare()
|
man.prepare()
|
||||||
|
|
||||||
|
def prepare(self):
|
||||||
|
self.thread_prepare = Thread(target=self._prepare)
|
||||||
|
self.thread_prepare.start()
|
||||||
|
|
||||||
def list_updates(self) -> List[ApplicationUpdate]:
|
def list_updates(self) -> List[ApplicationUpdate]:
|
||||||
|
self._wait_to_be_ready()
|
||||||
|
|
||||||
updates = []
|
updates = []
|
||||||
|
|
||||||
if self.managers:
|
if self.managers:
|
||||||
@@ -220,15 +232,16 @@ class GenericApplicationManager(ApplicationManager):
|
|||||||
|
|
||||||
def _fill_suggestions(self, suggestions: list, man: ApplicationManager, limit: int):
|
def _fill_suggestions(self, suggestions: list, man: ApplicationManager, limit: int):
|
||||||
if self._is_enabled(man):
|
if self._is_enabled(man):
|
||||||
man_suges = man.list_suggestions(limit)
|
man_sugs = man.list_suggestions(limit)
|
||||||
if man_suges:
|
|
||||||
suggestions.extend(man_suges)
|
if man_sugs:
|
||||||
|
suggestions.extend(man_sugs)
|
||||||
|
|
||||||
def list_suggestions(self, limit: int) -> List[Application]:
|
def list_suggestions(self, limit: int) -> List[Application]:
|
||||||
if self.managers:
|
if self.managers:
|
||||||
suggestions, threads = [], []
|
suggestions, threads = [], []
|
||||||
for man in self.managers:
|
for man in self.managers:
|
||||||
t = Thread(target=self._fill_suggestions, args=(suggestions, man, limit))
|
t = Thread(target=self._fill_suggestions, args=(suggestions, man, SUGGESTIONS_LIMIT))
|
||||||
t.start()
|
t.start()
|
||||||
threads.append(t)
|
threads.append(t)
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ from threading import Thread
|
|||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from fpakman_api.util.cache import Cache
|
from fpakman_api.util.cache import Cache
|
||||||
import gc
|
|
||||||
|
|
||||||
|
|
||||||
class CacheCleaner(Thread):
|
class CacheCleaner(Thread):
|
||||||
@@ -20,6 +19,5 @@ class CacheCleaner(Thread):
|
|||||||
for cache in self.caches:
|
for cache in self.caches:
|
||||||
cache.clean_expired()
|
cache.clean_expired()
|
||||||
|
|
||||||
gc.collect()
|
|
||||||
time.sleep(self.check_interval)
|
time.sleep(self.check_interval)
|
||||||
|
|
||||||
|
|||||||
@@ -346,4 +346,18 @@ class FindSuggestions(AsyncAction):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.signal_finished.emit(self.man.list_suggestions(limit=-1))
|
self.signal_finished.emit(self.man.list_suggestions(limit=-1))
|
||||||
|
|
||||||
|
|
||||||
|
class ListWarnings(QThread):
|
||||||
|
|
||||||
|
signal_warnings = pyqtSignal(list)
|
||||||
|
|
||||||
|
def __init__(self, man: ApplicationManager, locale_keys: dict):
|
||||||
|
super(QThread, self).__init__()
|
||||||
|
self.locale_keys = locale_keys
|
||||||
|
self.man = man
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
warnings = self.man.list_warnings()
|
||||||
|
if warnings:
|
||||||
|
self.signal_warnings.emit(warnings)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ from fpakman.view.qt.history import HistoryDialog
|
|||||||
from fpakman.view.qt.info import InfoDialog
|
from fpakman.view.qt.info import InfoDialog
|
||||||
from fpakman.view.qt.root import is_root, ask_root_password
|
from fpakman.view.qt.root import is_root, ask_root_password
|
||||||
from fpakman.view.qt.thread import UpdateSelectedApps, RefreshApps, UninstallApp, DowngradeApp, GetAppInfo, \
|
from fpakman.view.qt.thread import UpdateSelectedApps, RefreshApps, UninstallApp, DowngradeApp, GetAppInfo, \
|
||||||
GetAppHistory, SearchApps, InstallApp, AnimateProgress, VerifyModels, RefreshApp, FindSuggestions
|
GetAppHistory, SearchApps, InstallApp, AnimateProgress, VerifyModels, RefreshApp, FindSuggestions, ListWarnings
|
||||||
from fpakman.view.qt.view_model import ApplicationView
|
from fpakman.view.qt.view_model import ApplicationView
|
||||||
|
|
||||||
DARK_ORANGE = '#FF4500'
|
DARK_ORANGE = '#FF4500'
|
||||||
@@ -214,6 +214,19 @@ class ManageWindow(QWidget):
|
|||||||
self.dialog_about = None
|
self.dialog_about = None
|
||||||
self.first_refresh = suggestions
|
self.first_refresh = suggestions
|
||||||
|
|
||||||
|
self.thread_warnings = ListWarnings(man=manager, locale_keys=locale_keys)
|
||||||
|
self.thread_warnings.signal_warnings.connect(self._show_warnings)
|
||||||
|
|
||||||
|
def _show_warnings(self, warnings: List[str]):
|
||||||
|
if warnings:
|
||||||
|
for warning in warnings:
|
||||||
|
dialog.show_warning(title=self.locale_keys['warning'].capitalize(), body=warning)
|
||||||
|
|
||||||
|
def show(self):
|
||||||
|
super(ManageWindow, self).show()
|
||||||
|
if not self.thread_warnings.isFinished():
|
||||||
|
self.thread_warnings.start()
|
||||||
|
|
||||||
def _show_about(self):
|
def _show_about(self):
|
||||||
if self.dialog_about is None:
|
if self.dialog_about is None:
|
||||||
self.dialog_about = AboutDialog(self.locale_keys)
|
self.dialog_about = AboutDialog(self.locale_keys)
|
||||||
|
|||||||
Reference in New Issue
Block a user