mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-08 13:14:17 +02:00
refactoring based on the new api concepts
This commit is contained in:
@@ -10,10 +10,10 @@ from bauh_api.util.cache import Cache
|
||||
|
||||
class HistoryDialog(QDialog):
|
||||
|
||||
def __init__(self, app_history: PackageHistory, icon_cache: Cache, locale_keys: dict):
|
||||
def __init__(self, history: PackageHistory, icon_cache: Cache, locale_keys: dict):
|
||||
super(HistoryDialog, self).__init__()
|
||||
|
||||
self.setWindowTitle('{} - {} '.format(locale_keys['popup.history.title'], app_history.app.base_data.name))
|
||||
self.setWindowTitle('{} - {} '.format(locale_keys['popup.history.title'], history.pkg.base_data.name))
|
||||
|
||||
layout = QVBoxLayout()
|
||||
self.setLayout(layout)
|
||||
@@ -24,13 +24,13 @@ class HistoryDialog(QDialog):
|
||||
table_history.verticalHeader().setVisible(False)
|
||||
table_history.setAlternatingRowColors(True)
|
||||
|
||||
table_history.setColumnCount(len(app_history.history[0]))
|
||||
table_history.setRowCount(len(app_history.history))
|
||||
table_history.setHorizontalHeaderLabels([locale_keys.get(app_history.app.get_type() + '.history.' + key, key).capitalize() for key in sorted(app_history.history[0].keys())])
|
||||
table_history.setColumnCount(len(history.history[0]))
|
||||
table_history.setRowCount(len(history.history))
|
||||
table_history.setHorizontalHeaderLabels([locale_keys.get(history.pkg.get_type() + '.history.' + key, key).capitalize() for key in sorted(history.history[0].keys())])
|
||||
|
||||
for row, commit in enumerate(app_history.history):
|
||||
for row, commit in enumerate(history.history):
|
||||
|
||||
current_status = app_history.app_status_idx == row
|
||||
current_status = history.pkg_status_idx == row
|
||||
|
||||
for col, key in enumerate(sorted(commit.keys())):
|
||||
item = QTableWidgetItem()
|
||||
@@ -54,7 +54,7 @@ class HistoryDialog(QDialog):
|
||||
new_width = reduce(operator.add, [table_history.columnWidth(i) for i in range(table_history.columnCount())])
|
||||
self.resize(new_width, table_history.height())
|
||||
|
||||
icon_data = icon_cache.get(app_history.app.base_data.icon_url)
|
||||
icon_data = icon_cache.get(history.pkg.base_data.icon_url)
|
||||
|
||||
if icon_data and icon_data.get('icon'):
|
||||
self.setWindowIcon(icon_data.get('icon'))
|
||||
|
||||
@@ -9,7 +9,7 @@ from bauh_api.abstract.model import PackageUpdate
|
||||
|
||||
from bauh import __app_name__
|
||||
from bauh.core import resource
|
||||
from bauh_api.abstract.controller import ApplicationManager
|
||||
from bauh_api.abstract.controller import SoftwareManager
|
||||
from bauh.util import util
|
||||
from bauh.view.qt.about import AboutDialog
|
||||
from bauh.view.qt.window import ManageWindow
|
||||
@@ -19,7 +19,7 @@ class UpdateCheck(QThread):
|
||||
|
||||
signal = pyqtSignal(list)
|
||||
|
||||
def __init__(self, manager: ApplicationManager, check_interval: int, parent=None):
|
||||
def __init__(self, manager: SoftwareManager, check_interval: int, parent=None):
|
||||
super(UpdateCheck, self).__init__(parent)
|
||||
self.check_interval = check_interval
|
||||
self.manager = manager
|
||||
@@ -34,7 +34,7 @@ class UpdateCheck(QThread):
|
||||
|
||||
class TrayIcon(QSystemTrayIcon):
|
||||
|
||||
def __init__(self, locale_keys: dict, manager: ApplicationManager, manage_window: ManageWindow, check_interval: int = 60, update_notification: bool = True):
|
||||
def __init__(self, locale_keys: dict, manager: SoftwareManager, manage_window: ManageWindow, check_interval: int = 60, update_notification: bool = True):
|
||||
super(TrayIcon, self).__init__()
|
||||
self.locale_keys = locale_keys
|
||||
self.manager = manager
|
||||
|
||||
@@ -5,7 +5,7 @@ from typing import List
|
||||
|
||||
import requests
|
||||
from PyQt5.QtCore import QThread, pyqtSignal
|
||||
from bauh_api.abstract.controller import ApplicationManager
|
||||
from bauh_api.abstract.controller import SoftwareManager
|
||||
from bauh_api.abstract.handler import ProcessWatcher
|
||||
from bauh_api.abstract.model import PackageStatus
|
||||
from bauh_api.abstract.view import InputViewComponent, MessageType
|
||||
@@ -62,7 +62,7 @@ class AsyncAction(QThread, ProcessWatcher):
|
||||
|
||||
class UpdateSelectedApps(AsyncAction):
|
||||
|
||||
def __init__(self, manager: ApplicationManager, locale_keys: dict, apps_to_update: List[PackageView] = None):
|
||||
def __init__(self, manager: SoftwareManager, locale_keys: dict, apps_to_update: List[PackageView] = None):
|
||||
super(UpdateSelectedApps, self).__init__()
|
||||
self.apps_to_update = apps_to_update
|
||||
self.manager = manager
|
||||
@@ -92,7 +92,7 @@ class UpdateSelectedApps(AsyncAction):
|
||||
|
||||
class RefreshApps(AsyncAction):
|
||||
|
||||
def __init__(self, manager: ApplicationManager, app: PackageView = None):
|
||||
def __init__(self, manager: SoftwareManager, app: PackageView = None):
|
||||
super(RefreshApps, self).__init__()
|
||||
self.manager = manager
|
||||
self.app = app # app that should be on list top
|
||||
@@ -118,7 +118,7 @@ class RefreshApps(AsyncAction):
|
||||
|
||||
class UninstallApp(AsyncAction):
|
||||
|
||||
def __init__(self, manager: ApplicationManager, icon_cache: Cache, app: PackageView = None):
|
||||
def __init__(self, manager: SoftwareManager, icon_cache: Cache, app: PackageView = None):
|
||||
super(UninstallApp, self).__init__()
|
||||
self.app = app
|
||||
self.manager = manager
|
||||
@@ -140,7 +140,7 @@ class UninstallApp(AsyncAction):
|
||||
|
||||
class DowngradeApp(AsyncAction):
|
||||
|
||||
def __init__(self, manager: ApplicationManager, locale_keys: dict, app: PackageView = None):
|
||||
def __init__(self, manager: SoftwareManager, locale_keys: dict, app: PackageView = None):
|
||||
super(DowngradeApp, self).__init__()
|
||||
self.manager = manager
|
||||
self.app = app
|
||||
@@ -163,7 +163,7 @@ class DowngradeApp(AsyncAction):
|
||||
|
||||
class GetAppInfo(AsyncAction):
|
||||
|
||||
def __init__(self, manager: ApplicationManager, app: PackageView = None):
|
||||
def __init__(self, manager: SoftwareManager, app: PackageView = None):
|
||||
super(GetAppInfo, self).__init__()
|
||||
self.app = app
|
||||
self.manager = manager
|
||||
@@ -178,7 +178,7 @@ class GetAppInfo(AsyncAction):
|
||||
|
||||
class GetAppHistory(AsyncAction):
|
||||
|
||||
def __init__(self, manager: ApplicationManager, locale_keys: dict, app: PackageView = None):
|
||||
def __init__(self, manager: SoftwareManager, locale_keys: dict, app: PackageView = None):
|
||||
super(GetAppHistory, self).__init__()
|
||||
self.app = app
|
||||
self.manager = manager
|
||||
@@ -196,7 +196,7 @@ class GetAppHistory(AsyncAction):
|
||||
|
||||
class SearchApps(AsyncAction):
|
||||
|
||||
def __init__(self, manager: ApplicationManager):
|
||||
def __init__(self, manager: SoftwareManager):
|
||||
super(SearchApps, self).__init__()
|
||||
self.word = None
|
||||
self.manager = manager
|
||||
@@ -214,7 +214,7 @@ class SearchApps(AsyncAction):
|
||||
|
||||
class InstallApp(AsyncAction):
|
||||
|
||||
def __init__(self, manager: ApplicationManager, disk_cache: bool, icon_cache: Cache, locale_keys: dict, app: PackageView = None):
|
||||
def __init__(self, manager: SoftwareManager, disk_cache: bool, icon_cache: Cache, locale_keys: dict, app: PackageView = None):
|
||||
super(InstallApp, self).__init__()
|
||||
self.app = app
|
||||
self.manager = manager
|
||||
@@ -314,7 +314,7 @@ class VerifyModels(QThread):
|
||||
|
||||
class RefreshApp(AsyncAction):
|
||||
|
||||
def __init__(self, manager: ApplicationManager, app: PackageView = None):
|
||||
def __init__(self, manager: SoftwareManager, app: PackageView = None):
|
||||
super(RefreshApp, self).__init__()
|
||||
self.app = app
|
||||
self.manager = manager
|
||||
@@ -337,7 +337,7 @@ class RefreshApp(AsyncAction):
|
||||
|
||||
class FindSuggestions(AsyncAction):
|
||||
|
||||
def __init__(self, man: ApplicationManager):
|
||||
def __init__(self, man: SoftwareManager):
|
||||
super(FindSuggestions, self).__init__()
|
||||
self.man = man
|
||||
|
||||
@@ -350,7 +350,7 @@ class ListWarnings(QThread):
|
||||
|
||||
signal_warnings = pyqtSignal(list)
|
||||
|
||||
def __init__(self, man: ApplicationManager, locale_keys: dict):
|
||||
def __init__(self, man: SoftwareManager, locale_keys: dict):
|
||||
super(QThread, self).__init__()
|
||||
self.locale_keys = locale_keys
|
||||
self.man = man
|
||||
|
||||
@@ -6,7 +6,7 @@ from PyQt5.QtCore import QEvent, Qt, QSize, pyqtSignal
|
||||
from PyQt5.QtGui import QIcon, QWindowStateChangeEvent, QPixmap
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QApplication, QCheckBox, QHeaderView, QToolButton, QToolBar, \
|
||||
QLabel, QPlainTextEdit, QLineEdit, QProgressBar, QHBoxLayout, QPushButton, QComboBox
|
||||
from bauh_api.abstract.controller import ApplicationManager
|
||||
from bauh_api.abstract.controller import SoftwareManager
|
||||
from bauh_api.abstract.model import SoftwarePackage
|
||||
from bauh_api.abstract.view import MessageType
|
||||
from bauh_api.util.cache import Cache
|
||||
@@ -37,7 +37,7 @@ class ManageWindow(QWidget):
|
||||
def _toolbar_button_style(self, bg: str):
|
||||
return 'QPushButton { color: white; font-weight: bold; background: ' + bg + '}'
|
||||
|
||||
def __init__(self, locale_keys: dict, icon_cache: Cache, manager: ApplicationManager, disk_cache: bool, download_icons: bool, screen_size, suggestions: bool, tray_icon=None):
|
||||
def __init__(self, locale_keys: dict, icon_cache: Cache, manager: SoftwareManager, disk_cache: bool, download_icons: bool, screen_size, suggestions: bool, tray_icon=None):
|
||||
super(ManageWindow, self).__init__()
|
||||
self.locale_keys = locale_keys
|
||||
self.manager = manager
|
||||
|
||||
Reference in New Issue
Block a user