diff --git a/rare/__init__.py b/rare/__init__.py index 8e5552e0..31f3d859 100644 --- a/rare/__init__.py +++ b/rare/__init__.py @@ -27,4 +27,3 @@ if not os.path.exists(data_dir): os.makedirs(data_dir) image_dir = os.path.join(data_dir, "images") - diff --git a/rare/__main__.py b/rare/__main__.py index 0757fe98..c9e0930d 100644 --- a/rare/__main__.py +++ b/rare/__main__.py @@ -66,6 +66,7 @@ def main(): if __name__ == '__main__': # fix error in cx_freeze import multiprocessing + multiprocessing.freeze_support() sys.path.insert(0, os.path.join(pathlib.Path(__file__).parent.parent.absolute(), "legendary")) main() diff --git a/rare/app.py b/rare/app.py index 2468cf86..7dba8cd7 100644 --- a/rare/app.py +++ b/rare/app.py @@ -15,7 +15,7 @@ from rare import languages_path, resources_path, cache_dir from rare.components.dialogs.launch_dialog import LaunchDialog from rare.components.main_window import MainWindow from rare.components.tray_icon import TrayIcon -from rare.utils.utils import get_lang, load_color_scheme +from rare.utils.utils import load_color_scheme start_time = time.strftime('%y-%m-%d--%H-%M') # year-month-day-hour-minute file_name = os.path.join(cache_dir, f"logs/Rare_{start_time}.log") @@ -74,7 +74,7 @@ class App(QApplication): # Translator self.translator = QTranslator() - lang = settings.value("language", get_lang(), type=str) + lang = settings.value("language", self.core.language_code, type=str) if os.path.exists(p := os.path.join(languages_path, lang + ".qm")): self.translator.load(p) logger.info("Your language is supported: " + lang) diff --git a/rare/components/dialogs/launch_dialog.py b/rare/components/dialogs/launch_dialog.py index 4c623d68..03283e34 100644 --- a/rare/components/dialogs/launch_dialog.py +++ b/rare/components/dialogs/launch_dialog.py @@ -7,7 +7,6 @@ from requests.exceptions import ConnectionError from legendary.core import LegendaryCore from rare import image_dir - from rare.components.dialogs.login import LoginDialog from rare.ui.components.dialogs.launch_dialog import Ui_LaunchDialog from rare.utils.utils import download_images @@ -27,7 +26,6 @@ class ImageThread(QThread): self.download_progess.emit(100) - class LaunchDialog(QDialog, Ui_LaunchDialog): quit_app = pyqtSignal(int) start_app = pyqtSignal(bool) @@ -68,7 +66,6 @@ class LaunchDialog(QDialog, Ui_LaunchDialog): if not os.path.exists(image_dir): os.makedirs(image_dir) - if not self.offline: self.image_info.setText(self.tr("Downloading Images")) self.image_thread = ImageThread(self.core, self) diff --git a/rare/components/tab_widget.py b/rare/components/tab_widget.py index de253ca6..87bfdc50 100644 --- a/rare/components/tab_widget.py +++ b/rare/components/tab_widget.py @@ -119,9 +119,10 @@ class TabWidget(QTabWidget): if tab_num == 0: self.games_tab.layout.setCurrentIndex(0) if tab_num == 3: - self.store.load() - - # TODO; maybe pass InstallOptionsModel only, not split arguments + self.store.load() + + # TODO; maybe pass InstallOptionsModel only, not split arguments + def install_game(self, options: InstallOptionsModel, update=False, silent=False): install_dialog = InstallDialog(self.core, diff --git a/rare/components/tabs/games/game_info/game_info.py b/rare/components/tabs/games/game_info/game_info.py index e8c6f05a..3b905f78 100644 --- a/rare/components/tabs/games/game_info/game_info.py +++ b/rare/components/tabs/games/game_info/game_info.py @@ -7,8 +7,8 @@ from PyQt5.QtWidgets import QWidget, QMessageBox from legendary.core import LegendaryCore from legendary.models.game import Game, InstalledGame -from rare.ui.components.tabs.games.game_info.game_info import Ui_GameInfo from rare import data_dir +from rare.ui.components.tabs.games.game_info.game_info import Ui_GameInfo from rare.utils.legendary_utils import VerifyThread from rare.utils.steam_grades import SteamWorker from rare.utils.utils import get_size, get_pixmap diff --git a/rare/components/tabs/games/game_info/uninstalled_info.py b/rare/components/tabs/games/game_info/uninstalled_info.py index df48f118..2febd86a 100644 --- a/rare/components/tabs/games/game_info/uninstalled_info.py +++ b/rare/components/tabs/games/game_info/uninstalled_info.py @@ -9,7 +9,6 @@ from qtawesome import icon from legendary.core import LegendaryCore from legendary.models.game import Game -from rare import data_dir from rare.ui.components.tabs.games.game_info.game_info import Ui_GameInfo from rare.utils.extra_widgets import SideTabBar from rare.utils.json_formatter import QJsonModel @@ -72,7 +71,6 @@ class UninstalledInfo(QWidget, Ui_GameInfo): self.steam_worker.rating_signal.connect(self.grade.setText) if platform.system() == "Windows": - self.lbl_grade.setVisible(False) self.grade.setVisible(False) diff --git a/rare/components/tabs/games/game_list.py b/rare/components/tabs/games/game_list.py index b4162332..a0cf1c67 100644 --- a/rare/components/tabs/games/game_list.py +++ b/rare/components/tabs/games/game_list.py @@ -5,7 +5,6 @@ from PyQt5.QtCore import Qt, pyqtSignal, QSettings, QTimer from PyQt5.QtWidgets import QScrollArea, QWidget, QLabel, QVBoxLayout, QStackedWidget from legendary.core import LegendaryCore -from rare import data_dir from rare.components.tabs.games.game_widgets.base_installed_widget import BaseInstalledWidget from rare.components.tabs.games.game_widgets.installed_icon_widget import GameWidgetInstalled from rare.components.tabs.games.game_widgets.installed_list_widget import InstalledListWidget diff --git a/rare/components/tabs/games/game_widgets/installed_list_widget.py b/rare/components/tabs/games/game_widgets/installed_list_widget.py index e3ccace9..28898f8b 100644 --- a/rare/components/tabs/games/game_widgets/installed_list_widget.py +++ b/rare/components/tabs/games/game_widgets/installed_list_widget.py @@ -1,6 +1,6 @@ from logging import getLogger -from PyQt5.QtCore import QProcess, pyqtSignal, Qt +from PyQt5.QtCore import QProcess, pyqtSignal from PyQt5.QtWidgets import QHBoxLayout, QLabel, QPushButton, QVBoxLayout from qtawesome import icon diff --git a/rare/components/tabs/settings/__init__.py b/rare/components/tabs/settings/__init__.py index bc51f360..9f88ff4d 100644 --- a/rare/components/tabs/settings/__init__.py +++ b/rare/components/tabs/settings/__init__.py @@ -15,7 +15,7 @@ class SettingsTab(QTabWidget): self.core = core self.setTabBar(SideTabBar()) self.setTabPosition(QTabWidget.West) - self.rare_settings = RareSettings() + self.rare_settings = RareSettings(self.core) self.addTab(self.rare_settings, "Rare") self.addTab(LegendarySettings(core), "Legendary") if platform.system() != "Windows": diff --git a/rare/components/tabs/settings/legendary.py b/rare/components/tabs/settings/legendary.py index 5d888551..b6564a52 100644 --- a/rare/components/tabs/settings/legendary.py +++ b/rare/components/tabs/settings/legendary.py @@ -3,7 +3,6 @@ import platform import re from logging import getLogger -from PyQt5.QtCore import QSize from PyQt5.QtWidgets import QFileDialog, QMessageBox, QVBoxLayout, QDialog, QCheckBox, QLabel, \ QHBoxLayout, QPushButton, QGroupBox, QWidget from qtawesome import icon @@ -54,7 +53,8 @@ class LegendarySettings(QWidget, Ui_LegendarySettings): lambda: self.cleanup(True) ) - self.manifest_path_info.setText(self.tr("EGL path is at C:\\ProgramData\\Epic\\EpicGamesLauncher\\Data\\Manifests")) + self.manifest_path_info.setText( + self.tr("EGL path is at C:\\ProgramData\\Epic\\EpicGamesLauncher\\Data\\Manifests")) path = os.path.expanduser("~/") if self.core.egl.programdata_path: path = self.core.egl.programdata_path diff --git a/rare/components/tabs/settings/rare.py b/rare/components/tabs/settings/rare.py index 75cacf38..4214994f 100644 --- a/rare/components/tabs/settings/rare.py +++ b/rare/components/tabs/settings/rare.py @@ -7,11 +7,12 @@ from logging import getLogger from PyQt5.QtCore import QSettings, Qt from PyQt5.QtWidgets import QWidget +from legendary.core import LegendaryCore from rare import cache_dir from rare.components.tabs.settings.rpc_settings import RPCSettings from rare.ui.components.tabs.settings.rare import Ui_RareSettings from rare.utils import utils -from rare.utils.utils import get_lang, get_possible_langs, get_color_schemes, get_style_sheets +from rare.utils.utils import get_possible_langs, get_color_schemes, get_style_sheets logger = getLogger("RareSettings") @@ -23,10 +24,10 @@ languages = [ class RareSettings(QWidget, Ui_RareSettings): - def __init__(self): + def __init__(self, core: LegendaryCore): super(RareSettings, self).__init__() self.setupUi(self) - + self.core = core # (widget_name, option_name, default) self.checkboxes = [ (self.sys_tray, "sys_tray", True), @@ -39,7 +40,7 @@ class RareSettings(QWidget, Ui_RareSettings): ] self.settings = QSettings() - language = self.settings.value("language", get_lang(), type=str) + language = self.settings.value("language", self.core.language_code, type=str) self.logdir = os.path.join(cache_dir, "logs") # Select lang diff --git a/rare/components/tabs/shop/__init__.py b/rare/components/tabs/shop/__init__.py index c3ea3484..9ac8a6c0 100644 --- a/rare/components/tabs/shop/__init__.py +++ b/rare/components/tabs/shop/__init__.py @@ -15,7 +15,8 @@ class Shop(QStackedWidget): def __init__(self, core: LegendaryCore): super(Shop, self).__init__() self.core = core - self.api_core = ShopApiCore(self.core.egs.session.headers["Authorization"]) + self.api_core = ShopApiCore(self.core.egs.session.headers["Authorization"], self.core.language_code, + self.core.country_code) self.shop = ShopWidget(cache_dir, core, self.api_core) self.wishlist_widget = Wishlist(self.api_core) diff --git a/rare/components/tabs/shop/game_info.py b/rare/components/tabs/shop/game_info.py index 3b9189f1..770cf693 100644 --- a/rare/components/tabs/shop/game_info.py +++ b/rare/components/tabs/shop/game_info.py @@ -9,7 +9,6 @@ from qtawesome import icon from rare.components.tabs.shop.shop_models import ShopGame from rare.ui.components.tabs.store.shop_game_info import Ui_shop_info from rare.utils.extra_widgets import WaitingSpinner, ImageLabel -from rare.utils.utils import get_lang logger = logging.getLogger("ShopInfo") @@ -32,7 +31,6 @@ class ShopGameInfo(QWidget, Ui_shop_info): warn_label.setPixmap(icon("fa.warning").pixmap(160, 160).scaled(240, 320, Qt.IgnoreAspectRatio)) self.image_stack.addWidget(warn_label) - self.locale = get_lang() self.wishlist_button.clicked.connect(self.add_to_wishlist) self.in_wishlist = False self.wishlist = [] diff --git a/rare/components/tabs/shop/shop_api_core.py b/rare/components/tabs/shop/shop_api_core.py index 1b031b03..87de54c5 100644 --- a/rare/components/tabs/shop/shop_api_core.py +++ b/rare/components/tabs/shop/shop_api_core.py @@ -6,7 +6,6 @@ from rare.components.tabs.shop.constants import wishlist_query, search_query, ga remove_from_wishlist_query from rare.components.tabs.shop.shop_models import BrowseModel from rare.utils.qt_requests import QtRequestManager -from rare.utils.utils import get_lang logger = getLogger("ShopAPICore") graphql_url = "https://www.epicgames.com/graphql" @@ -15,12 +14,14 @@ graphql_url = "https://www.epicgames.com/graphql" class ShopApiCore(QObject): update_wishlist = pyqtSignal() - def __init__(self, auth_token): + def __init__(self, auth_token, lc: str, cc: str): super(ShopApiCore, self).__init__() self.token = auth_token + self.language_code: str = lc + self.country_code: str = cc + self.locale = self.language_code + "-" + self.country_code self.manager = QtRequestManager() self.auth_manager = QtRequestManager(authorization_token=auth_token) - self.locale = get_lang() self.browse_active = False self.next_browse_request = tuple(()) @@ -40,8 +41,8 @@ class ShopApiCore(QObject): self.auth_manager.post(graphql_url, { "query": wishlist_query, "variables": { - "country": self.locale.upper(), - "locale": self.locale + "country": self.country_code, + "locale": self.language_code + "-" + self.country_code } }, lambda data: self._handle_wishlist(data, handle_func)) @@ -52,8 +53,8 @@ class ShopApiCore(QObject): payload = { "query": search_query, "variables": {"category": "games/edition/base|bundles/games|editors|software/edition/base", "count": 1, - "country": "DE", "keywords": name, "locale": self.locale, "sortDir": "DESC", - "allowCountries": self.locale.upper(), + "country": self.country_code, "keywords": name, "locale": self.locale, "sortDir": "DESC", + "allowCountries": self.country_code, "start": 0, "tag": "", "withMapping": False, "withPrice": True} } @@ -102,7 +103,7 @@ class ShopApiCore(QObject): "variables": { "offerId": offer_id, "namespace": namespace, - "country": self.locale.upper(), + "country": self.country_code, "locale": self.locale }, "query": add_to_wishlist_query diff --git a/rare/components/tabs/shop/shop_models.py b/rare/components/tabs/shop/shop_models.py index b220e8d1..3ab4ea78 100644 --- a/rare/components/tabs/shop/shop_models.py +++ b/rare/components/tabs/shop/shop_models.py @@ -2,8 +2,6 @@ import datetime import random from dataclasses import dataclass -from rare.utils.utils import get_lang - class ImageUrlModel: def __init__(self, front_tall: str = "", offer_image_tall: str = "", @@ -111,7 +109,8 @@ class ShopGame: class BrowseModel: category: str = "games/edition/base|bundles/games|editors|software/edition/base" count: int = 30 - locale: str = get_lang() + language_code: str = "en" + country_code: str = "US" keywords: str = "" sortDir: str = "DESC" start: int = 0 @@ -126,11 +125,11 @@ class BrowseModel: def __dict__(self): payload = {"category": self.category, "count": self.count, - "country": self.locale.upper(), + "country": self.country_code, "keywords": self.keywords, - "locale": self.locale, + "locale": self.language_code + "-" + self.country_code, "sortDir": self.sortDir, - "allowCountries": self.locale.upper(), + "allowCountries": self.country_code, "start": self.start, "tag": self.tag, "withMapping": self.withMapping, diff --git a/rare/components/tabs/shop/shop_widget.py b/rare/components/tabs/shop/shop_widget.py index 2ec84466..b4769783 100644 --- a/rare/components/tabs/shop/shop_widget.py +++ b/rare/components/tabs/shop/shop_widget.py @@ -12,7 +12,6 @@ from rare.components.tabs.shop.game_widgets import GameWidget from rare.components.tabs.shop.shop_models import BrowseModel from rare.ui.components.tabs.store.store import Ui_ShopWidget from rare.utils.extra_widgets import WaitingSpinner, FlowLayout, ButtonLineEdit -from rare.utils.utils import get_lang logger = logging.getLogger("Shop") @@ -36,7 +35,6 @@ class ShopWidget(QScrollArea, Ui_ShopWidget): self.price = "" self.tags = [] self.types = [] - self.locale = get_lang() self.update_games_allowed = True self.free_widget.setLayout(FlowLayout()) self.free_games_now = QGroupBox(self.tr("Now Free")) @@ -106,7 +104,9 @@ class ShopWidget(QScrollArea, Ui_ShopWidget): coming_free_games = [] for game in free_games: try: - if game['price']['totalPrice']['fmtPrice']['discountPrice'] == "0" and game['price']['totalPrice']['fmtPrice']['originalPrice'] != game['price']['totalPrice']['fmtPrice']['discountPrice']: + if game['price']['totalPrice']['fmtPrice']['discountPrice'] == "0" and \ + game['price']['totalPrice']['fmtPrice']['originalPrice'] != \ + game['price']['totalPrice']['fmtPrice']['discountPrice']: free_games_now.append(game) continue @@ -224,7 +224,8 @@ class ShopWidget(QScrollArea, Ui_ShopWidget): self.game_stack.setCurrentIndex(1) date = f"[,{datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%dT%X')}.{str(random.randint(0, 999)).zfill(3)}Z]" - browse_model = BrowseModel(locale=self.locale, date=date, count=20, price=self.price, + browse_model = BrowseModel(language_code=self.core.language_code, country_code=self.core.country_code, + date=date, count=20, price=self.price, onSale=self.on_discount.isChecked()) browse_model.tag = "|".join(self.tags) @@ -237,11 +238,7 @@ class ShopWidget(QScrollArea, Ui_ShopWidget): child.deleteLater() del child - QWidget().setLayout(self.game_widget.layout()) - if data: - self.game_widget.setLayout(FlowLayout()) - for game in data: w = GameWidget(self.path, game, 275) self.game_widget.layout().addWidget(w) diff --git a/rare/components/tabs/shop/wishlist.py b/rare/components/tabs/shop/wishlist.py index e1d825b2..a1a27c94 100644 --- a/rare/components/tabs/shop/wishlist.py +++ b/rare/components/tabs/shop/wishlist.py @@ -67,7 +67,8 @@ class Wishlist(QStackedWidget, Ui_Wishlist): if sort == 0: sorted_list = sorted(self.wishlist, key=lambda x: x["offer"]["title"]) elif sort == 1: - sorted_list = sorted(self.wishlist, key=lambda x: x["offer"]['price']['totalPrice']['fmtPrice']['discountPrice']) + sorted_list = sorted(self.wishlist, + key=lambda x: x["offer"]['price']['totalPrice']['fmtPrice']['discountPrice']) elif sort == 2: sorted_list = sorted(self.wishlist, key=lambda x: x["offer"]["seller"]["name"]) elif sort == 3: diff --git a/rare/ui/components/dialogs/login/login_dialog.py b/rare/ui/components/dialogs/login/login_dialog.py index c4a31d92..cf20d716 100644 --- a/rare/ui/components/dialogs/login/login_dialog.py +++ b/rare/ui/components/dialogs/login/login_dialog.py @@ -124,6 +124,7 @@ class Ui_LoginDialog(object): if __name__ == "__main__": import sys + app = QtWidgets.QApplication(sys.argv) LoginDialog = QtWidgets.QDialog() ui = Ui_LoginDialog() diff --git a/rare/ui/components/tabs/settings/legendary.py b/rare/ui/components/tabs/settings/legendary.py index f75f5344..6ee414e8 100644 --- a/rare/ui/components/tabs/settings/legendary.py +++ b/rare/ui/components/tabs/settings/legendary.py @@ -27,7 +27,7 @@ class Ui_LegendarySettings(object): self.download_group = QtWidgets.QGroupBox(LegendarySettings) self.download_group.setObjectName("download_group") self.download_layout = QtWidgets.QFormLayout(self.download_group) - self.download_layout.setLabelAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.download_layout.setLabelAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.download_layout.setObjectName("download_layout") self.max_workers_label = QtWidgets.QLabel(self.download_group) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred) @@ -267,6 +267,7 @@ class Ui_LegendarySettings(object): if __name__ == "__main__": import sys + app = QtWidgets.QApplication(sys.argv) LegendarySettings = QtWidgets.QWidget() ui = Ui_LegendarySettings() diff --git a/rare/ui/components/tabs/settings/linux.ui b/rare/ui/components/tabs/settings/linux.ui index b88295e9..96c2eddf 100644 --- a/rare/ui/components/tabs/settings/linux.ui +++ b/rare/ui/components/tabs/settings/linux.ui @@ -1,75 +1,75 @@ - LinuxSettings - - - - 0 - 0 - 569 - 454 - - - - LinuxSettings - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Wine Settings - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - Prefix + LinuxSettings + + + + 0 + 0 + 569 + 454 + - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + LinuxSettings - - - - - - - - - Executable - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Wine Settings + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + Prefix + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + Executable + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + + - - - - - - - - + + diff --git a/rare/ui/components/tabs/settings/rare.ui b/rare/ui/components/tabs/settings/rare.ui index a14e256d..d02476f1 100644 --- a/rare/ui/components/tabs/settings/rare.ui +++ b/rare/ui/components/tabs/settings/rare.ui @@ -1,285 +1,285 @@ - RareSettings - - - - 0 - 0 - 674 - 532 - - - - RareSettings - - - - - - - - - 0 - 0 - - - - Interface - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + RareSettings + + + + 0 + 0 + 674 + 532 + - - - - Language - - - - - - - - 0 - 0 - - - - - - - - Color Scheme - - - - - - - - 0 - 0 - - - - - None - - - - - - - - Style Sheet - - - - - - - - 0 - 0 - - - - - None - - - - - - - - - true - - - - Restart Rare to apply. - - - true - - - - - - - - - - Behavior - - - - - - Restore window size on application startup - - - - - - - Show notification on download completion - - - - - - - Show console for game debug - - - - - - - Exit to System tray - - - - - - - Update games on application startup - - - - - - - Confirm game launch - - - - - - - Automatically sync with cloud - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - Logs - - - - - - Open Log directory - - - - - - - Clean Log directory - - - - - - - - 0 - 0 - - - - - - - true - - - - - - - - - - - - - Shortcuts - - - - - - Create Desktop link - - - - - - - Create start menu link - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - + + RareSettings + + + + + + + + + 0 + 0 + + + + Interface + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + Language + + + + + + + + 0 + 0 + + + + + + + + Color Scheme + + + + + + + + 0 + 0 + + + + + None + + + + + + + + Style Sheet + + + + + + + + 0 + 0 + + + + + None + + + + + + + + + true + + + + Restart Rare to apply. + + + true + + + + + + + + + + Behavior + + + + + + Restore window size on application startup + + + + + + + Show notification on download completion + + + + + + + Show console for game debug + + + + + + + Exit to System tray + + + + + + + Update games on application startup + + + + + + + Confirm game launch + + + + + + + Automatically sync with cloud + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + Logs + + + + + + Open Log directory + + + + + + + Clean Log directory + + + + + + + + 0 + 0 + + + + + + + true + + + + + + + + + + + + + Shortcuts + + + + + + Create Desktop link + + + + + + + Create start menu link + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + diff --git a/rare/ui/components/tabs/store/shop_game_info.py b/rare/ui/components/tabs/store/shop_game_info.py index 589d8ed0..c9611258 100644 --- a/rare/ui/components/tabs/store/shop_game_info.py +++ b/rare/ui/components/tabs/store/shop_game_info.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'shop_game_info.ui' +# Form implementation generated from reading ui file 'rare/ui/components/tabs/store/shop_game_info.ui' # # Created by: PyQt5 UI code generator 5.15.4 # @@ -36,21 +36,21 @@ class Ui_shop_info(object): font = QtGui.QFont() font.setPointSize(18) self.title.setFont(font) - self.title.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse | QtCore.Qt.TextSelectableByMouse) + self.title.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse) self.title.setObjectName("title") self.verticalLayout_2.addWidget(self.title) self.dev = QtWidgets.QLabel(shop_info) font = QtGui.QFont() font.setPointSize(14) self.dev.setFont(font) - self.dev.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse | QtCore.Qt.TextSelectableByMouse) + self.dev.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse) self.dev.setObjectName("dev") self.verticalLayout_2.addWidget(self.dev) self.owned_label = QtWidgets.QLabel(shop_info) self.owned_label.setObjectName("owned_label") self.verticalLayout_2.addWidget(self.owned_label) self.price = QtWidgets.QLabel(shop_info) - self.price.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse | QtCore.Qt.TextSelectableByMouse) + self.price.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse) self.price.setObjectName("price") self.verticalLayout_2.addWidget(self.price) self.discount_price = QtWidgets.QLabel(shop_info) diff --git a/rare/ui/components/tabs/store/shop_game_info.ui b/rare/ui/components/tabs/store/shop_game_info.ui index 3e49291d..fb6e3314 100644 --- a/rare/ui/components/tabs/store/shop_game_info.ui +++ b/rare/ui/components/tabs/store/shop_game_info.ui @@ -1,191 +1,191 @@ - shop_info - - - - 0 - 0 - 702 - 468 - - - - Form - - - - - - Back - + shop_info + + + + 0 + 0 + 702 + 468 + + + + Form + + + + + + Back + + + + + + + + + + 0 + 0 + + + + -1 + + + + + + + + + + 18 + + + + Error + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + + 14 + + + + TextLabel + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + You already own this game + + + + + + + TextLabel + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + TextLabel + + + + + + + TextLabel + + + + + + + + 0 + 0 + + + + Buy Game in Epic Games Store + + + + + + + + 0 + 0 + + + + Add to wishlist + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Requirements + + + + + + + + Social Links + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + - - - - - - - - 0 - 0 - - - - -1 - - - - - - - - - - 18 - - - - Error - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - - 14 - - - - TextLabel - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - You already own this game - - - - - - - TextLabel - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - TextLabel - - - - - - - TextLabel - - - - - - - - 0 - 0 - - - - Buy Game in Epic Games Store - - - - - - - - 0 - 0 - - - - Add to wishlist - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Requirements - - - - - - - - Social Links - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - + + diff --git a/rare/ui/components/tabs/store/store.py b/rare/ui/components/tabs/store/store.py index 00f33e1d..08c3df0e 100644 --- a/rare/ui/components/tabs/store/store.py +++ b/rare/ui/components/tabs/store/store.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'store.ui' +# Form implementation generated from reading ui file 'rare/ui/components/tabs/store/store.ui' # # Created by: PyQt5 UI code generator 5.15.4 # @@ -8,7 +8,7 @@ # run again. Do not edit this file unless you know what you are doing. -from PyQt5 import QtCore, QtWidgets +from PyQt5 import QtCore, QtGui, QtWidgets class Ui_ShopWidget(object): diff --git a/rare/ui/components/tabs/store/store.ui b/rare/ui/components/tabs/store/store.ui index b1ddb6ae..773c8286 100644 --- a/rare/ui/components/tabs/store/store.ui +++ b/rare/ui/components/tabs/store/store.ui @@ -1,248 +1,248 @@ - ShopWidget - - - - 0 - 0 - 850 - 572 - - - - Form - - - - - - - - true - - - - - 0 - 0 - 828 - 550 - - - - - - - - - - - 0 - 0 - - - - Free Games - - - - - - - - 0 - 0 - - - - - - - - - - - - - Discounts from your wishlist - - - - - - - - - - - - - - Games - - - - - - - - - - - - - - - - - - 0 - 0 - - - - - 150 - 0 - - - - - 16777215 - 16777215 - - - - Filter - - - - - - Reset - - - - - - - Price - - - - - - None - - - true - - - - - - - Free - - - - - - - Under 10 - - - - - - - Under 20 - - - - - - - Under 30 - - - - - - - 14.99 and above - - - - - - - Discount - - - - - - - - - - Platform - - - - - - - - Genre - - - - - - - - Type - - - - - - - - Other Tags - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - - - - + ShopWidget + + + + 0 + 0 + 850 + 572 + + + + Form + + + + + + + + true + + + + + 0 + 0 + 828 + 550 + + + + + + + + + + + 0 + 0 + + + + Free Games + + + + + + + + 0 + 0 + + + + + + + + + + + + + Discounts from your wishlist + + + + + + + + + + + + + + Games + + + + + + + + + + + + + + + + + + 0 + 0 + + + + + 150 + 0 + + + + + 16777215 + 16777215 + + + + Filter + + + + + + Reset + + + + + + + Price + + + + + + None + + + true + + + + + + + Free + + + + + + + Under 10 + + + + + + + Under 20 + + + + + + + Under 30 + + + + + + + 14.99 and above + + + + + + + Discount + + + + + + + + + + Platform + + + + + + + + Genre + + + + + + + + Type + + + + + + + + Other Tags + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + + + + diff --git a/rare/ui/components/tabs/store/wishlist.py b/rare/ui/components/tabs/store/wishlist.py index 85963d12..f5532ace 100644 --- a/rare/ui/components/tabs/store/wishlist.py +++ b/rare/ui/components/tabs/store/wishlist.py @@ -108,6 +108,7 @@ class Ui_Wishlist(object): if __name__ == "__main__": import sys + app = QtWidgets.QApplication(sys.argv) Wishlist = QtWidgets.QStackedWidget() ui = Ui_Wishlist() diff --git a/rare/ui/utils/pathedit.ui b/rare/ui/utils/pathedit.ui index 636ff75e..ce0f08b3 100644 --- a/rare/ui/utils/pathedit.ui +++ b/rare/ui/utils/pathedit.ui @@ -1,53 +1,53 @@ - PathEdit - - - - 0 - 0 - 385 - 30 - - - - PathEdit - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 300 - 0 - - - - Default - + PathEdit + + + + 0 + 0 + 385 + 30 + + + + PathEdit + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 300 + 0 + + + + Default + + + + + + + Browse... + + + + - - - - - Browse... - - - - - - - + + diff --git a/rare/utils/extra_widgets.py b/rare/utils/extra_widgets.py index 744fa919..0bcc3953 100644 --- a/rare/utils/extra_widgets.py +++ b/rare/utils/extra_widgets.py @@ -4,7 +4,7 @@ from logging import getLogger import PIL from PIL import Image -from PyQt5.QtCore import Qt, QRect, QSize, QPoint, pyqtSignal, QSettings +from PyQt5.QtCore import Qt, QRect, QSize, QPoint, pyqtSignal from PyQt5.QtGui import QMovie, QPixmap from PyQt5.QtWidgets import QLayout, QStyle, QSizePolicy, QLabel, QFileDialog, QHBoxLayout, QWidget, QPushButton, \ QStyleOptionTab, QStylePainter, QTabBar, QLineEdit, QToolButton diff --git a/rare/utils/steam_grades.py b/rare/utils/steam_grades.py index 100f1bb4..b863e602 100644 --- a/rare/utils/steam_grades.py +++ b/rare/utils/steam_grades.py @@ -7,7 +7,6 @@ import requests from PyQt5.QtCore import QThread, pyqtSignal from legendary.core import LegendaryCore - from rare import data_dir, cache_dir replace_chars = ",;.:-_ " @@ -24,14 +23,14 @@ class SteamWorker(QThread): super(SteamWorker, self).__init__() self.core = core self.ratings = { - "platinum": self.tr("Platinum"), - "gold": self.tr("Gold"), - "silver": self.tr("Silver"), - "bronze": self.tr("Bronze"), - "fail": self.tr("Could not get grade"), - "borked": self.tr("unplayable"), - "pending": self.tr("Could not get grade") - } + "platinum": self.tr("Platinum"), + "gold": self.tr("Gold"), + "silver": self.tr("Silver"), + "bronze": self.tr("Bronze"), + "fail": self.tr("Could not get grade"), + "borked": self.tr("unplayable"), + "pending": self.tr("Could not get grade") + } def set_app_name(self, app_name: str): self.app_name = app_name diff --git a/rare/utils/utils.py b/rare/utils/utils.py index 8b6f5367..8e3ed8e8 100644 --- a/rare/utils/utils.py +++ b/rare/utils/utils.py @@ -9,7 +9,7 @@ from typing import Tuple import requests from PIL import Image, UnidentifiedImageError -from PyQt5.QtCore import pyqtSignal, QLocale, QSettings +from PyQt5.QtCore import pyqtSignal, QSettings from PyQt5.QtGui import QPalette, QColor, QPixmap # Windows @@ -26,7 +26,6 @@ logger = getLogger("Utils") settings = QSettings("Rare", "Rare") - def download_images(signal: pyqtSignal, core: LegendaryCore): if not os.path.isdir(image_dir): os.makedirs(image_dir) @@ -121,16 +120,6 @@ def download_image(game, force=False): logger.warning(f"File {image_dir}/{game.app_name}/DieselGameBoxTall.png doesn't exist") -def get_lang(): - core = LegendaryCore() - if "Legendary" in core.lgd.config.sections() and "locale" in core.lgd.config["Legendary"]: - logger.info("Found locale in Legendary config: " + core.lgd.config.get("Legendary", "locale")) - return core.lgd.config.get("Legendary", "locale").split("-")[0] - else: - logger.info("Found locale in system config: " + QLocale.system().name().split("_")[0]) - return QLocale.system().name().split("_")[0] - - color_role_map = { 0: "WindowText", 1: "Button", @@ -289,7 +278,6 @@ def create_rare_desktop_link(type_of_link): def create_desktop_link(app_name, core: LegendaryCore, type_of_link="desktop") -> bool: igame = core.get_installed_game(app_name) - if os.path.exists(p := os.path.join(image_dir, igame.app_name, 'Thumbnail.png')): icon = p elif os.path.exists(p := os.path.join(image_dir, igame.app_name, "DieselGameBoxLogo.png")): @@ -390,7 +378,6 @@ def get_uninstalled_pixmap(app_name: str) -> QPixmap: return pixmap - def optimal_text_background(image: list) -> Tuple[int, int, int]: """ Finds an optimal background color for text on the image by calculating the @@ -423,4 +410,3 @@ def text_color_for_background(background: Tuple[int, int, int]) -> Tuple[int, return 255, 255, 255 else: return 0, 0, 0 -