Move a bunch of class attributes to instance attributes
This commit is contained in:
parent
9ca879e0fc
commit
5029921b09
|
@ -71,6 +71,7 @@ class App(RareApp):
|
|||
# set Application name for settings
|
||||
self.mainwindow: Optional[MainWindow] = None
|
||||
self.launch_dialog: Optional[LaunchDialog] = None
|
||||
self.timer = QTimer()
|
||||
|
||||
# launch app
|
||||
self.launch_dialog = LaunchDialog(parent=None)
|
||||
|
@ -84,7 +85,6 @@ class App(RareApp):
|
|||
dt_exp = datetime.fromisoformat(self.core.lgd.userdata['expires_at'][:-1])
|
||||
dt_now = datetime.utcnow()
|
||||
td = abs(dt_exp - dt_now)
|
||||
self.timer = QTimer()
|
||||
self.timer.timeout.connect(self.re_login)
|
||||
self.timer.start(int(td.total_seconds() - 60) * 1000)
|
||||
|
||||
|
|
|
@ -309,6 +309,9 @@ class InstallDialog(QDialog):
|
|||
self.show()
|
||||
|
||||
def error_box(self, label: str = "", message: str = ""):
|
||||
if message.startswith("403 Client Error: Forbidden for url:"):
|
||||
message = self.tr("403 Client Error: Wait a few seconds and try <b>Verify</b> again")
|
||||
self.options_changed = True
|
||||
self.ui.warn_label.setVisible(bool(label))
|
||||
self.ui.warn_label.setText(label)
|
||||
self.ui.warn_message.setVisible(bool(message))
|
||||
|
|
|
@ -11,7 +11,7 @@ from rare.shared import LegendaryCoreSingleton, ArgumentsSingleton, ApiResultsSi
|
|||
from rare.ui.components.dialogs.launch_dialog import Ui_LaunchDialog
|
||||
from rare.utils.misc import CloudWorker
|
||||
|
||||
logger = getLogger("LoginDialog")
|
||||
logger = getLogger("LaunchDialog")
|
||||
|
||||
|
||||
class LaunchWorker(QRunnable):
|
||||
|
|
|
@ -12,7 +12,7 @@ from rare.widgets.sliding_stack import SlidingStackedWidget
|
|||
from .browser_login import BrowserLogin
|
||||
from .import_login import ImportLogin
|
||||
|
||||
logger = getLogger("Login")
|
||||
logger = getLogger("LoginDialog")
|
||||
|
||||
|
||||
@dataclass
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
from logging import getLogger
|
||||
from typing import Tuple, Dict, Union, List
|
||||
from typing import Tuple, Dict, Union, List, Set
|
||||
|
||||
from PyQt5.QtCore import QSettings, Qt, pyqtSlot
|
||||
from PyQt5.QtWidgets import QStackedWidget, QVBoxLayout, QWidget, QScrollArea, QFrame
|
||||
from legendary.models.game import InstalledGame, Game
|
||||
|
||||
from rare.shared import ImageManagerSingleton
|
||||
from rare.shared import (
|
||||
LegendaryCoreSingleton,
|
||||
GlobalSignalsSingleton,
|
||||
ArgumentsSingleton,
|
||||
ApiResultsSingleton,
|
||||
ImageManagerSingleton,
|
||||
)
|
||||
from rare.widgets.library_layout import LibraryLayout
|
||||
from rare.widgets.sliding_stack import SlidingStackedWidget
|
||||
|
@ -32,10 +32,6 @@ logger = getLogger("GamesTab")
|
|||
|
||||
|
||||
class GamesTab(QStackedWidget):
|
||||
|
||||
updates = set()
|
||||
active_filter = 0
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super(GamesTab, self).__init__(parent=parent)
|
||||
self.core = LegendaryCoreSingleton()
|
||||
|
@ -47,6 +43,8 @@ class GamesTab(QStackedWidget):
|
|||
|
||||
self.widgets: Dict[str, Tuple[
|
||||
Union[InstalledIconWidget, UninstalledIconWidget], Union[InstalledListWidget, UninstalledListWidget]]] = {}
|
||||
self.updates: Set = set()
|
||||
self.active_filter: int = 0
|
||||
self.uninstalled_games: List[Game] = []
|
||||
|
||||
self.game_list: List[Game] = self.api_results.game_list
|
||||
|
|
|
@ -38,17 +38,13 @@ logger = getLogger("ImageManager")
|
|||
|
||||
class ImageSize:
|
||||
class Preset:
|
||||
__img_factor = 67
|
||||
__size: QSize
|
||||
__divisor: float = 1.0
|
||||
__pixel_ratio: float = 1.0
|
||||
# lk: for prettier images set this to true
|
||||
__smooth_transform: bool = False
|
||||
|
||||
def __init__(self, divisor: float, pixel_ratio: float):
|
||||
self.__pixel_ratio = pixel_ratio
|
||||
self.__img_factor = 67
|
||||
self.__divisor = divisor
|
||||
self.__pixel_ratio = pixel_ratio
|
||||
self.__size = QSize(self.__img_factor * 3, self.__img_factor * 4) * pixel_ratio / divisor
|
||||
# lk: for prettier images set this to true
|
||||
self.__smooth_transform: bool = False
|
||||
if divisor > 2:
|
||||
self.__smooth_transform = False
|
||||
|
||||
|
@ -107,12 +103,11 @@ class ImageManager(QObject):
|
|||
logger.debug(f" Emitting singal for game {self.game.app_name} - {self.game.app_title}")
|
||||
self.signals.completed.emit(self.game.app_name)
|
||||
|
||||
# lk: the ordering in __img_types matters for the order of fallbacks
|
||||
__img_types: List = ["DieselGameBoxTall", "Thumbnail", "DieselGameBoxLogo"]
|
||||
__dl_retries = 1
|
||||
__worker_app_names: List[str] = list()
|
||||
|
||||
def __init__(self, signals: GlobalSignals, core: LegendaryCore):
|
||||
# lk: the ordering in __img_types matters for the order of fallbacks
|
||||
self.__img_types: Tuple = ("DieselGameBoxTall", "Thumbnail", "DieselGameBoxLogo")
|
||||
self.__dl_retries = 1
|
||||
self.__worker_app_names: List[str] = []
|
||||
super(QObject, self).__init__()
|
||||
self.signals = signals
|
||||
self.core = core
|
||||
|
|
Loading…
Reference in a new issue