From 6b15c0f2cf7473d2b61ace615472d88c42fdd0d0 Mon Sep 17 00:00:00 2001 From: loathingKernel <142770+loathingKernel@users.noreply.github.com> Date: Mon, 30 Jan 2023 01:56:29 +0200 Subject: [PATCH] Store: Clean up store UI by using library widgets --- rare/components/tabs/__init__.py | 4 +- rare/components/tabs/store/__init__.py | 59 +- rare/components/tabs/store/constants.py | 539 +++++++++++++++--- rare/components/tabs/store/game_info.py | 157 +++-- rare/components/tabs/store/game_widgets.py | 42 +- rare/components/tabs/store/image_widget.py | 76 +++ rare/components/tabs/store/search_results.py | 109 ++-- rare/components/tabs/store/shop_api_core.py | 3 +- rare/components/tabs/store/shop_models.py | 97 ++-- rare/components/tabs/store/shop_widget.py | 97 ++-- rare/components/tabs/store/wishlist.py | 22 +- .../components/tabs/store/shop_game_info.py | 168 +++--- .../components/tabs/store/shop_game_info.ui | 184 +++--- rare/ui/components/tabs/store/store.py | 224 ++++---- rare/ui/components/tabs/store/store.ui | 476 ++++++++-------- rare/ui/components/tabs/store/wishlist.py | 49 +- rare/ui/components/tabs/store/wishlist.ui | 315 +++++----- .../components/tabs/store/wishlist_widget.py | 4 +- .../components/tabs/store/wishlist_widget.ui | 2 +- rare/utils/extra_widgets.py | 2 +- 20 files changed, 1536 insertions(+), 1093 deletions(-) create mode 100644 rare/components/tabs/store/image_widget.py diff --git a/rare/components/tabs/__init__.py b/rare/components/tabs/__init__.py index 688d0ea7..a8025a02 100644 --- a/rare/components/tabs/__init__.py +++ b/rare/components/tabs/__init__.py @@ -8,7 +8,7 @@ from .downloads import DownloadsTab from .games import GamesTab from .settings import SettingsTab from .settings.debug import DebugSettings -from .store import Shop +from .store import StoreTab from .tab_widgets import MainTabBar, TabButtonWidget @@ -39,7 +39,7 @@ class MainTabWidget(QTabWidget): self.setTabEnabled(self.downloads_index, not self.args.offline) if not self.args.offline: - self.store_tab = Shop(self.core) + self.store_tab = StoreTab(self.core, parent=self) self.store_index = self.addTab(self.store_tab, self.tr("Store (Beta)")) self.setTabEnabled(self.store_index, not self.args.offline) diff --git a/rare/components/tabs/store/__init__.py b/rare/components/tabs/store/__init__.py index 1c9493fe..c72e88d9 100644 --- a/rare/components/tabs/store/__init__.py +++ b/rare/components/tabs/store/__init__.py @@ -1,9 +1,8 @@ -from PyQt5.QtGui import QShowEvent, QHideEvent -from PyQt5.QtWidgets import QStackedWidget, QTabWidget from legendary.core import LegendaryCore -from rare.shared.rare_core import RareCore +from rare.shared import RareCore from rare.utils.paths import cache_dir +from rare.widgets.side_tab import SideTabWidget from .game_info import ShopGameInfo from .search_results import SearchResults from .shop_api_core import ShopApiCore @@ -11,11 +10,12 @@ from .shop_widget import ShopWidget from .wishlist import WishlistWidget, Wishlist -class Shop(QStackedWidget): - init = False +class StoreTab(SideTabWidget): + + def __init__(self, core: LegendaryCore, parent=None): + super(StoreTab, self).__init__(parent=parent) + self.init = False - def __init__(self, core: LegendaryCore): - super(Shop, self).__init__() self.core = core self.rcore = RareCore.instance() self.api_core = ShopApiCore( @@ -24,32 +24,32 @@ class Shop(QStackedWidget): self.core.country_code, ) - self.shop = ShopWidget(cache_dir(), self.core, self.api_core) - self.wishlist_widget = Wishlist(self.api_core) + self.shop = ShopWidget(cache_dir(), self.core, self.api_core, parent=self) + self.shop_index = self.addTab(self.shop, self.tr("Games")) + self.shop.show_game.connect(self.show_game) + self.shop.show_info.connect(self.show_search) - self.store_tabs = QTabWidget(parent=self) - self.store_tabs.addTab(self.shop, self.tr("Games")) - self.store_tabs.addTab(self.wishlist_widget, self.tr("Wishlist")) + self.search = SearchResults(self.api_core, parent=self) + self.search_index = self.addTab(self.search, self.tr("Search")) + self.search.show_info.connect(self.show_game) + # self.search.back_button.clicked.connect(lambda: self.setCurrentIndex(self.shop_index)) - self.addWidget(self.store_tabs) - - self.search_results = SearchResults(self.api_core) - self.addWidget(self.search_results) - self.search_results.show_info.connect(self.show_game_info) self.info = ShopGameInfo( [i.asset_infos["Windows"].namespace for i in self.rcore.game_list if bool(i.asset_infos)], self.api_core, + parent=self ) - self.addWidget(self.info) - self.info.back_button.clicked.connect(lambda: self.setCurrentIndex(0)) + self.info_index = self.addTab(self.info, self.tr("Information")) + # self.info.back_button.clicked.connect(lambda: self.setCurrentIndex(self.previous_index)) - self.search_results.back_button.clicked.connect(lambda: self.setCurrentIndex(0)) - self.shop.show_info.connect(self.show_search_results) + self.wishlist = Wishlist(self.api_core, parent=self) + self.wishlist_index = self.addTab(self.wishlist, self.tr("Wishlist")) + self.wishlist.update_wishlist_signal.connect(self.update_wishlist) + self.wishlist.show_game_info.connect(self.show_game) - self.wishlist_widget.show_game_info.connect(self.show_game_info) - self.shop.show_game.connect(self.show_game_info) self.api_core.update_wishlist.connect(self.update_wishlist) - self.wishlist_widget.update_wishlist_signal.connect(self.update_wishlist) + + self.previous_index = self.shop_index def showEvent(self, a0: QShowEvent) -> None: if a0.spontaneous() or self.init: @@ -68,10 +68,11 @@ class Shop(QStackedWidget): def update_wishlist(self): self.shop.update_wishlist() - def show_game_info(self, data): + def show_game(self, data): + self.previous_index = self.currentIndex() self.info.update_game(data) - self.setCurrentIndex(2) + self.setCurrentIndex(self.info_index) - def show_search_results(self, text: str): - self.search_results.load_results(text) - self.setCurrentIndex(1) + def show_search(self, text: str): + self.search.load_results(text) + self.setCurrentIndex(self.search_index) diff --git a/rare/components/tabs/store/constants.py b/rare/components/tabs/store/constants.py index 246729ef..e254dbd3 100644 --- a/rare/components/tabs/store/constants.py +++ b/rare/components/tabs/store/constants.py @@ -44,74 +44,475 @@ class Constants(QObject): ] -game_query = ( - "query searchStoreQuery($allowCountries: String, $category: String, $count: Int, $country: String!, " - "$keywords: String, $locale: String, $namespace: String, $withMapping: Boolean = false, $itemNs: String, " - "$sortBy: String, $sortDir: String, $start: Int, $tag: String, $releaseDate: String, $withPrice: Boolean " - "= false, $withPromotions: Boolean = false, $priceRange: String, $freeGame: Boolean, $onSale: Boolean, " - "$effectiveDate: String) {\n Catalog {\n searchStore(\n allowCountries: $allowCountries\n " - "category: $category\n count: $count\n country: $country\n keywords: $keywords\n " - "locale: $locale\n namespace: $namespace\n itemNs: $itemNs\n sortBy: $sortBy\n " - "sortDir: $sortDir\n releaseDate: $releaseDate\n start: $start\n tag: $tag\n " - "priceRange: $priceRange\n freeGame: $freeGame\n onSale: $onSale\n effectiveDate: " - "$effectiveDate\n ) {\n elements {\n title\n id\n namespace\n " - "description\n effectiveDate\n keyImages {\n type\n url\n }\n " - " currentPrice\n seller {\n id\n name\n }\n productSlug\n " - " urlSlug\n url\n tags {\n id\n }\n items {\n id\n " - " namespace\n }\n customAttributes {\n key\n value\n }\n " - "categories {\n path\n }\n catalogNs @include(if: $withMapping) {\n " - 'mappings(pageType: "productHome") {\n pageSlug\n pageType\n }\n ' - "}\n offerMappings @include(if: $withMapping) {\n pageSlug\n pageType\n " - "}\n price(country: $country) @include(if: $withPrice) {\n totalPrice {\n " - "discountPrice\n originalPrice\n voucherDiscount\n discount\n " - " currencyCode\n currencyInfo {\n decimals\n }\n fmtPrice(" - "locale: $locale) {\n originalPrice\n discountPrice\n " - "intermediatePrice\n }\n }\n lineOffers {\n appliedRules {\n " - " id\n endDate\n discountSetting {\n discountType\n " - " }\n }\n }\n }\n promotions(category: $category) @include(if: " - "$withPromotions) {\n promotionalOffers {\n promotionalOffers {\n " - "startDate\n endDate\n discountSetting {\n discountType\n " - " discountPercentage\n }\n }\n }\n " - "upcomingPromotionalOffers {\n promotionalOffers {\n startDate\n " - "endDate\n discountSetting {\n discountType\n " - "discountPercentage\n }\n }\n }\n }\n }\n paging {\n " - " count\n total\n }\n }\n }\n}\n " -) +game_query = """ +query searchStoreQuery($allowCountries: String, $category: String, $count: Int, $country: String!, $keywords: String, $locale: String, $namespace: String, $withMapping: Boolean = false, $itemNs: String, $sortBy: String, $sortDir: String, $start: Int, $tag: String, $releaseDate: String, $withPrice: Boolean = false, $withPromotions: Boolean = false, $priceRange: String, $freeGame: Boolean, $onSale: Boolean, $effectiveDate: String) { + Catalog { + searchStore( + allowCountries: $allowCountries + category: $category + count: $count + country: $country + keywords: $keywords + locale: $locale + namespace: $namespace + itemNs: $itemNs + sortBy: $sortBy + sortDir: $sortDir + releaseDate: $releaseDate + start: $start + tag: $tag + priceRange: $priceRange + freeGame: $freeGame + onSale: $onSale + effectiveDate: $effectiveDate + ) { + elements { + title + id + namespace + description + effectiveDate + keyImages { + type + url + } + currentPrice + seller { + id + name + } + productSlug + urlSlug + url + tags { + id + } + items { + id + namespace + } + customAttributes { + key + value + } + categories { + path + } + catalogNs @include(if: $withMapping) { + mappings(pageType: "productHome") { + pageSlug + pageType + } + } + offerMappings @include(if: $withMapping) { + pageSlug + pageType + } + price(country: $country) @include(if: $withPrice) { + totalPrice { + discountPrice + originalPrice + voucherDiscount + discount + currencyCode + currencyInfo { + decimals + } + fmtPrice(locale: $locale) { + originalPrice + discountPrice + intermediatePrice + } + } + lineOffers { + appliedRules { + id + endDate + discountSetting { + discountType + } + } + } + } + promotions(category: $category) @include(if: $withPromotions) { + promotionalOffers { + promotionalOffers { + startDate + endDate + discountSetting { + discountType + discountPercentage + } + } + } + upcomingPromotionalOffers { + promotionalOffers { + startDate + endDate + discountSetting { + discountType + discountPercentage + } + } + } + } + } + paging { + count + total + } + } + } +} +""" -search_query = ( - "query searchStoreQuery($allowCountries: String, $category: String, $count: Int, $country: String!, " - "$keywords: String, $locale: String, $namespace: String, $withMapping: Boolean = false, $itemNs: String, " - "$sortBy: String, $sortDir: String, $start: Int, $tag: String, $releaseDate: String, $withPrice: Boolean = " - "false, $withPromotions: Boolean = false, $priceRange: String, $freeGame: Boolean, $onSale: Boolean, " - "$effectiveDate: String) {\n Catalog {\n searchStore(\n allowCountries: $allowCountries\n " - "category: $category\n count: $count\n country: $country\n keywords: $keywords\n locale: " - "$locale\n namespace: $namespace\n itemNs: $itemNs\n sortBy: $sortBy\n sortDir: " - "$sortDir\n releaseDate: $releaseDate\n start: $start\n tag: $tag\n priceRange: " - "$priceRange\n freeGame: $freeGame\n onSale: $onSale\n effectiveDate: $effectiveDate\n ) {" - "\n elements {\n title\n id\n namespace\n description\n " - "effectiveDate\n keyImages {\n type\n url\n }\n currentPrice\n " - "seller {\n id\n name\n }\n productSlug\n urlSlug\n url\n " - " tags {\n id\n }\n items {\n id\n namespace\n }\n " - "customAttributes {\n key\n value\n }\n categories {\n path\n " - '}\n catalogNs @include(if: $withMapping) {\n mappings(pageType: "productHome") {\n ' - " pageSlug\n pageType\n }\n }\n offerMappings @include(if: $withMapping) " - "{\n pageSlug\n pageType\n }\n price(country: $country) @include(if: " - "$withPrice) {\n totalPrice {\n discountPrice\n originalPrice\n " - "voucherDiscount\n discount\n currencyCode\n currencyInfo {\n " - "decimals\n }\n fmtPrice(locale: $locale) {\n originalPrice\n " - "discountPrice\n intermediatePrice\n }\n }\n lineOffers {\n " - " appliedRules {\n id\n endDate\n discountSetting {\n " - "discountType\n }\n }\n }\n }\n promotions(category: " - "$category) @include(if: $withPromotions) {\n promotionalOffers {\n promotionalOffers {\n " - " startDate\n endDate\n discountSetting {\n " - "discountType\n discountPercentage\n }\n }\n }\n " - "upcomingPromotionalOffers {\n promotionalOffers {\n startDate\n " - "endDate\n discountSetting {\n discountType\n discountPercentage\n " - " }\n }\n }\n }\n }\n paging {\n count\n " - "total\n }\n }\n }\n}\n " -) +search_query = """ +query searchStoreQuery($allowCountries: String, $category: String, $count: Int, $country: String!, $keywords: String, $locale: String, $namespace: String, $itemNs: String, $sortBy: String, $sortDir: String, $start: Int, $tag: String, $releaseDate: String, $withPrice: Boolean = false, $withPromotions: Boolean = false, $priceRange: String, $freeGame: Boolean, $onSale: Boolean, $effectiveDate: String) { + Catalog { + searchStore( + allowCountries: $allowCountries + category: $category + count: $count + country: $country + keywords: $keywords + locale: $locale + namespace: $namespace + itemNs: $itemNs + sortBy: $sortBy + sortDir: $sortDir + releaseDate: $releaseDate + start: $start + tag: $tag + priceRange: $priceRange + freeGame: $freeGame + onSale: $onSale + effectiveDate: $effectiveDate + ) { + elements { + title + id + namespace + description + effectiveDate + keyImages { + type + url + } + currentPrice + seller { + id + name + } + productSlug + urlSlug + url + tags { + id + } + items { + id + namespace + } + customAttributes { + key + value + } + categories { + path + } + catalogNs { + mappings(pageType: "productHome") { + pageSlug + pageType + } + } + offerMappings { + pageSlug + pageType + } + price(country: $country) @include(if: $withPrice) { + totalPrice { + discountPrice + originalPrice + voucherDiscount + discount + currencyCode + currencyInfo { + decimals + } + fmtPrice(locale: $locale) { + originalPrice + discountPrice + intermediatePrice + } + } + lineOffers { + appliedRules { + id + endDate + discountSetting { + discountType + } + } + } + } + promotions(category: $category) @include(if: $withPromotions) { + promotionalOffers { + promotionalOffers { + startDate + endDate + discountSetting { + discountType + discountPercentage + } + } + } + upcomingPromotionalOffers { + promotionalOffers { + startDate + endDate + discountSetting { + discountType + discountPercentage + } + } + } + } + } + paging { + count + total + } + } + } +} +""" -wishlist_query = '\n query wishlistQuery($country:String!, $locale:String) {\n Wishlist {\n wishlistItems {\n elements {\n id\n order\n created\n offerId\n updated\n namespace\n \n offer {\n productSlug\n urlSlug\n title\n id\n namespace\n offerType\n expiryDate\n status\n isCodeRedemptionOnly\n description\n effectiveDate\n keyImages {\n type\n url\n }\n seller {\n id\n name\n }\n productSlug\n urlSlug\n items {\n id\n namespace\n }\n customAttributes {\n key\n value\n }\n catalogNs {\n mappings(pageType: "productHome") {\n pageSlug\n pageType\n }\n }\n offerMappings {\n pageSlug\n pageType\n }\n categories {\n path\n }\n price(country: $country) {\n totalPrice {\n discountPrice\n originalPrice\n voucherDiscount\n discount\n fmtPrice(locale: $locale) {\n originalPrice\n discountPrice\n intermediatePrice\n }\n currencyCode\n currencyInfo {\n decimals\n symbol\n }\n }\n lineOffers {\n appliedRules {\n id\n endDate\n }\n }\n }\n }\n\n }\n }\n }\n }\n' -add_to_wishlist_query = "\n mutation removeFromWishlistMutation($namespace: String!, $offerId: String!, $operation: RemoveOperation!) {\n Wishlist {\n removeFromWishlist(namespace: $namespace, offerId: $offerId, operation: $operation) {\n success\n }\n }\n }\n" -remove_from_wishlist_query = "\n mutation removeFromWishlistMutation($namespace: String!, $offerId: String!, $operation: RemoveOperation!) {\n Wishlist {\n removeFromWishlist(namespace: $namespace, offerId: $offerId, operation: $operation) {\n success\n }\n }\n }\n" -coupon_query = "\n query getCoupons($currencyCountry: String!, $identityId: String!, $locale: String) {\n CodeRedemption {\n coupons(currencyCountry: $currencyCountry, identityId: $identityId, includeSalesEventInfo: true) {\n code\n codeStatus\n codeType\n consumptionMetadata {\n amountDisplay {\n amount\n currency\n placement\n symbol\n }\n minSalesPriceDisplay {\n amount\n currency\n placement\n symbol\n }\n }\n endDate\n namespace\n salesEvent(locale: $locale) {\n eventName\n eventSlug\n voucherImages {\n type\n url\n }\n voucherLink\n }\n startDate\n }\n }\n }\n" +wishlist_query = """ +query wishlistQuery($country:String!, $locale:String) { + Wishlist { + wishlistItems { + elements { + id + order + created + offerId + updated + namespace + offer(locale: $locale) { + productSlug + urlSlug + title + id + namespace + offerType + expiryDate + status + isCodeRedemptionOnly + description + effectiveDate + keyImages { + type + url + } + seller { + id + name + } + productSlug + urlSlug + items { + id + namespace + } + customAttributes { + key + value + } + catalogNs { + mappings(pageType: "productHome") { + pageSlug + pageType + } + } + offerMappings { + pageSlug + pageType + } + categories { + path + } + price(country: $country) { + totalPrice { + discountPrice + originalPrice + voucherDiscount + discount + fmtPrice(locale: $locale) { + originalPrice + discountPrice + intermediatePrice + } + currencyCode + currencyInfo { + decimals + symbol + } + } + lineOffers { + appliedRules { + id + endDate + } + } + } + } + } + } + } +} +""" + +add_to_wishlist_query = """ +mutation addWishlistMutation($namespace: String!, $offerId: String!, $country:String!, $locale:String) { + Wishlist { + addToWishlist(namespace: $namespace, offerId: $offerId) { + wishlistItem { + id, + order, + created, + offerId, + updated, + namespace, + isFirstTime + offer { + productSlug + urlSlug + title + id + namespace + offerType + expiryDate + status + isCodeRedemptionOnly + description + effectiveDate + keyImages { + type + url + } + seller { + id + name + } + productSlug + urlSlug + items { + id + namespace + } + customAttributes { + key + value + } + catalogNs { + mappings(pageType: "productHome") { + pageSlug + pageType + } + } + offerMappings { + pageSlug + pageType + } + categories { + path + } + price(country: $country) { + totalPrice { + discountPrice + originalPrice + voucherDiscount + discount + fmtPrice(locale: $locale) { + originalPrice + discountPrice + intermediatePrice + } + currencyCode + currencyInfo { + decimals + symbol + } + } + lineOffers { + appliedRules { + id + endDate + } + } + } + } + + } + success + } + } +} +""" + +remove_from_wishlist_query = """ +mutation removeFromWishlistMutation($namespace: String!, $offerId: String!, $operation: RemoveOperation!) { + Wishlist { + removeFromWishlist(namespace: $namespace, offerId: $offerId, operation: $operation) { + success + } + } +} +""" + +coupon_query = """ +query getCoupons($currencyCountry: String!, $identityId: String!, $locale: String) { + CodeRedemption { + coupons(currencyCountry: $currencyCountry, identityId: $identityId, includeSalesEventInfo: true) { + code + codeStatus + codeType + consumptionMetadata { + amountDisplay { + amount + currency + placement + symbol + } + minSalesPriceDisplay { + amount + currency + placement + symbol + } + } + endDate + namespace + salesEvent(locale: $locale) { + eventName + eventSlug + voucherImages { + type + url + } + voucherLink + } + startDate + } + } +} +""" + + +# if __name__ == "__main__": +# from sgqlc import introspection, codegen +# +# coupon = codegen.operation.parse_graphql(coupon_query) +# codegen.schema. +# print(coupon.) diff --git a/rare/components/tabs/store/game_info.py b/rare/components/tabs/store/game_info.py index 263f91e9..0df65d85 100644 --- a/rare/components/tabs/store/game_info.py +++ b/rare/components/tabs/store/game_info.py @@ -1,53 +1,53 @@ import logging from PyQt5.QtCore import Qt, QUrl -from PyQt5.QtGui import QPixmap, QFont, QDesktopServices +from PyQt5.QtGui import QFont, QDesktopServices from PyQt5.QtWidgets import ( QWidget, QLabel, QPushButton, - QHBoxLayout, - QSpacerItem, - QGroupBox, - QTabWidget, QGridLayout, + QSizePolicy, ) from rare.components.tabs.store.shop_models import ShopGame from rare.shared import LegendaryCoreSingleton -from rare.ui.components.tabs.store.shop_game_info import Ui_shop_info -from rare.utils.extra_widgets import ImageLabel -from rare.utils.misc import qta_icon as icon -from rare.widgets.loading_widget import LoadingWidget +from rare.shared.image_manager import ImageSize +from rare.ui.components.tabs.store.shop_game_info import Ui_ShopGameInfo +from rare.utils.misc import icon +from rare.widgets.side_tab import SideTabWidget +from .image_widget import ShopImageWidget logger = logging.getLogger("ShopInfo") -class ShopGameInfo(QWidget, Ui_shop_info): - game: ShopGame - data: dict +class ShopGameInfo(QWidget, Ui_ShopGameInfo): # TODO Design - def __init__(self, installed_titles: list, api_core): - super(ShopGameInfo, self).__init__() + def __init__(self, installed_titles: list, api_core, parent=None): + super(ShopGameInfo, self).__init__(parent=parent) self.setupUi(self) self.core = LegendaryCoreSingleton() self.api_core = api_core self.installed = installed_titles self.open_store_button.clicked.connect(self.button_clicked) - self.image = ImageLabel() - self.image_stack.addWidget(self.image) - self.image_stack.addWidget(LoadingWidget()) - warn_label = QLabel() - warn_label.setPixmap( - icon("fa.warning").pixmap(160, 160).scaled(240, 320, Qt.IgnoreAspectRatio) - ) - self.image_stack.addWidget(warn_label) + self.image = ShopImageWidget(self) + self.image.setFixedSize(ImageSize.Normal) + self.image_info_layout.insertWidget(0, self.image) + + self.game: ShopGame = None + self.data: dict = {} self.wishlist_button.clicked.connect(self.add_to_wishlist) self.in_wishlist = False self.wishlist = [] + self.requirements_tabs: SideTabWidget = SideTabWidget(parent=self.requirements_group) + self.requirements_tabs.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) + self.requirements_layout.addWidget(self.requirements_tabs) + + self.setDisabled(True) + def handle_wishlist_update(self, data): if data and data[0] == "error": return @@ -61,12 +61,15 @@ class ShopGameInfo(QWidget, Ui_shop_info): self.wishlist_button.setVisible(False) def update_game(self, data: dict): - self.image_stack.setCurrentIndex(1) self.title.setText(data["title"]) self.title_str = data["title"] + self.id_str = data["id"] self.api_core.get_wishlist(self.handle_wishlist_update) - for i in reversed(range(self.req_group_box.layout().count())): - self.req_group_box.layout().itemAt(i).widget().deleteLater() + # lk: delete tabs in inverse order because indices are updated on deletion + while self.requirements_tabs.count(): + self.requirements_tabs.widget(0).deleteLater() + self.requirements_tabs.removeTab(0) + self.requirements_tabs.clear() slug = data["productSlug"] if not slug: for mapping in data["offerMappings"]: @@ -87,13 +90,10 @@ class ShopGameInfo(QWidget, Ui_shop_info): self.open_store_button.setText(self.tr("Buy Game in Epic Games Store")) self.owned_label.setVisible(False) - for i in range(self.req_group_box.layout().count()): - self.req_group_box.layout().itemAt(i).widget().deleteLater() - self.price.setText(self.tr("Loading")) self.wishlist_button.setVisible(False) # self.title.setText(self.tr("Loading")) - self.image.setPixmap(QPixmap()) + # self.image.setPixmap(QPixmap()) self.data = data is_bundle = False for i in data["categories"]: @@ -103,8 +103,8 @@ class ShopGameInfo(QWidget, Ui_shop_info): # init API request if slug: self.api_core.get_game(slug, is_bundle, self.data_received) - else: - self.data_received({}) + # else: + # self.data_received({}) def add_to_wishlist(self): if not self.in_wishlist: @@ -125,9 +125,10 @@ class ShopGameInfo(QWidget, Ui_shop_info): try: self.game = ShopGame.from_json(game, self.data) except Exception as e: + raise e logger.error(str(e)) self.price.setText("Error") - self.req_group_box.setVisible(False) + self.requirements_tabs.setEnabled(False) for img in self.data.get("keyImages"): if img["type"] in [ "DieselStoreFrontWide", @@ -135,14 +136,11 @@ class ShopGameInfo(QWidget, Ui_shop_info): "VaultClosed", "ProductLogo", ]: - self.image.update_image(img["url"], self.title_str, size=(240, 320)) - self.image_stack.setCurrentIndex(0) + self.image.fetchPixmap(img["url"], self.id_str, self.title_str) break - else: - self.image_stack.setCurrentIndex(2) self.price.setText("") self.discount_price.setText("") - self.social_link_gb.setVisible(False) + self.social_group.setEnabled(False) self.tags.setText("") self.dev.setText(self.data.get("seller", {}).get("name", "")) return @@ -170,33 +168,34 @@ class ShopGameInfo(QWidget, Ui_shop_info): bold_font.setBold(True) if self.game.reqs: - req_tabs = QTabWidget() for system in self.game.reqs: - min_label = QLabel(self.tr("Minimum")) + req_widget = QWidget(self.requirements_tabs) + req_layout = QGridLayout(req_widget) + req_layout.setSizeConstraint(QGridLayout.SetFixedSize) + req_widget.layout().setAlignment(Qt.AlignTop) + req_widget.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) + min_label = QLabel(self.tr("Minimum"), parent=req_widget) min_label.setFont(bold_font) - rec_label = QLabel(self.tr("Recommend")) + rec_label = QLabel(self.tr("Recommend"), parent=req_widget) rec_label.setFont(bold_font) - req_widget = QWidget() - req_widget.setLayout(QGridLayout()) - req_widget.layout().addWidget(min_label, 0, 1) - req_widget.layout().addWidget(rec_label, 0, 2) - for i, (key, value) in enumerate( - self.game.reqs.get(system, {}).items() - ): - req_widget.layout().addWidget(QLabel(key), i + 1, 0) - min_label = QLabel(value[0]) - min_label.setWordWrap(True) - req_widget.layout().addWidget(min_label, i + 1, 1) - rec_label = QLabel(value[1]) - rec_label.setWordWrap(True) - req_widget.layout().addWidget(rec_label, i + 1, 2) - req_tabs.addTab(req_widget, system) - self.req_group_box.layout().addWidget(req_tabs) - else: - self.req_group_box.layout().addWidget( - QLabel(self.tr("Could not get requirements")) - ) - self.req_group_box.setVisible(True) + req_layout.addWidget(min_label, 0, 1) + req_layout.addWidget(rec_label, 0, 2) + for i, (key, value) in enumerate(self.game.reqs.get(system, {}).items()): + req_layout.addWidget(QLabel(key, parent=req_widget), i + 1, 0) + min_label = QLabel(value[0], parent=req_widget) + min_label.setWordWrap(False) + req_layout.addWidget(min_label, i + 1, 1) + rec_label = QLabel(value[1], parent=req_widget) + rec_label.setWordWrap(False) + req_layout.addWidget(rec_label, i + 1, 2) + self.requirements_tabs.addTab(req_widget, system) + # self.req_group_box.layout().addWidget(req_tabs) + # self.req_group_box.layout().setAlignment(Qt.AlignTop) + # else: + # self.req_group_box.layout().addWidget( + # QLabel(self.tr("Could not get requirements")) + # ) + self.requirements_tabs.setEnabled(True) if self.game.image_urls.front_tall: img_url = self.game.image_urls.front_tall elif self.game.image_urls.offer_image_tall: @@ -205,9 +204,9 @@ class ShopGameInfo(QWidget, Ui_shop_info): img_url = self.game.image_urls.product_logo else: img_url = "" - self.image.update_image(img_url, self.game.title, (240, 320)) + self.image.fetchPixmap(img_url, self.game.id, self.game.title) - self.image_stack.setCurrentIndex(0) + # self.image_stack.setCurrentIndex(0) try: if isinstance(self.game.developer, list): self.dev.setText(", ".join(self.game.developer)) @@ -218,19 +217,10 @@ class ShopGameInfo(QWidget, Ui_shop_info): self.tags.setText(", ".join(self.game.tags)) # clear Layout - for widget in ( - self.social_link_gb.layout().itemAt(i) - for i in range(self.social_link_gb.layout().count()) - ): - if not isinstance(widget, QSpacerItem): - widget.widget().deleteLater() - self.social_link_gb.deleteLater() - self.social_link_gb = QGroupBox(self.tr("Social Links")) - self.social_link_gb.setLayout(QHBoxLayout()) + for b in self.social_group.findChildren(SocialButton, options=Qt.FindDirectChildrenOnly): + self.social_layout.removeWidget(b) + b.deleteLater() - self.layout().insertWidget(3, self.social_link_gb) - - self.social_link_gb.layout().addStretch(1) link_count = 0 for name, url in self.game.links: @@ -243,16 +233,13 @@ class ShopGameInfo(QWidget, Ui_shop_info): logger.error(str(e)) continue - button = SocialButton(icn, url) - self.social_link_gb.layout().addWidget(button) + button = SocialButton(icn, url, parent=self.social_group) + self.social_layout.addWidget(button) link_count += 1 - self.social_link_gb.layout().addStretch(1) - if link_count == 0: - self.social_link_gb.setVisible(False) - else: - self.social_link_gb.setVisible(True) - self.social_link_gb.layout().addStretch(1) + self.social_group.setEnabled(bool(link_count)) + + self.setEnabled(True) def add_wishlist_items(self, wishlist): wishlist = wishlist["data"]["Wishlist"]["wishlistItems"]["elements"] @@ -264,8 +251,8 @@ class ShopGameInfo(QWidget, Ui_shop_info): class SocialButton(QPushButton): - def __init__(self, icn, url): - super(SocialButton, self).__init__(icn, "") + def __init__(self, icn, url, parent=None): + super(SocialButton, self).__init__(icn, "", parent=parent) self.url = url self.clicked.connect(lambda: QDesktopServices.openUrl(QUrl(url))) self.setToolTip(url) diff --git a/rare/components/tabs/store/game_widgets.py b/rare/components/tabs/store/game_widgets.py index 8085965b..e5c164d4 100644 --- a/rare/components/tabs/store/game_widgets.py +++ b/rare/components/tabs/store/game_widgets.py @@ -1,15 +1,18 @@ import logging from PyQt5 import QtGui -from PyQt5.QtCore import pyqtSignal +from PyQt5.QtCore import pyqtSignal, Qt from PyQt5.QtGui import QFont from PyQt5.QtNetwork import QNetworkAccessManager -from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QHBoxLayout +from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QHBoxLayout, QSizePolicy from rare.components.tabs.store.shop_models import ImageUrlModel +from rare.shared.image_manager import ImageSize from rare.ui.components.tabs.store.wishlist_widget import Ui_WishlistWidget from rare.utils.extra_widgets import ImageLabel -from rare.utils.misc import qta_icon as icon +from rare.utils.misc import qta_icon +from rare.widgets.elide_label import ElideLabel +from .image_widget import ShopImageWidget logger = logging.getLogger("GameWidgets") @@ -17,17 +20,18 @@ logger = logging.getLogger("GameWidgets") class GameWidget(QWidget): show_info = pyqtSignal(dict) - def __init__(self, path, json_info=None, width=300): + def __init__(self, path, json_info=None): super(GameWidget, self).__init__() self.manager = QNetworkAccessManager() - self.width = width self.path = path if json_info: self.init_ui(json_info) def init_ui(self, json_info): self.layout = QVBoxLayout() - self.image = ImageLabel() + self.layout.setSizeConstraint(QVBoxLayout.SetFixedSize) + self.image = ShopImageWidget(self) + self.image.setFixedSize(ImageSize.Wide) self.layout.addWidget(self.image) mini_layout = QHBoxLayout() self.layout.addLayout(mini_layout) @@ -37,10 +41,10 @@ class GameWidget(QWidget): self.setLayout(self.layout) return - self.title_label = QLabel(json_info.get("title")) - self.title_label.setWordWrap(True) + self.title_label = ElideLabel(json_info.get("title"), parent=self) + self.title_label.setWordWrap(False) mini_layout.addWidget(self.title_label) - mini_layout.addStretch(1) + # mini_layout.addStretch(1) price = json_info["price"]["totalPrice"]["fmtPrice"]["originalPrice"] discount_price = json_info["price"]["totalPrice"]["fmtPrice"]["discountPrice"] @@ -49,14 +53,16 @@ class GameWidget(QWidget): font = QFont() font.setStrikeOut(True) price_label.setFont(font) - mini_layout.addWidget( - QLabel(discount_price if discount_price != "0" else self.tr("Free")) - ) - mini_layout.addWidget(price_label) + free_label = QLabel(discount_price if discount_price != "0" else self.tr("Free")) + free_label.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) + free_label.setAlignment(Qt.AlignRight) + mini_layout.addWidget(free_label) else: if price == "0": price_label.setText(self.tr("Free")) - mini_layout.addWidget(price_label) + price_label.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) + price_label.setAlignment(Qt.AlignRight) + mini_layout.addWidget(price_label) for c in r'<>?":|\/*': json_info["title"] = json_info["title"].replace(c, "") @@ -74,19 +80,13 @@ class GameWidget(QWidget): ]: if img["type"] == "VaultClosed" and self.title != "Mystery Game": continue - self.image.update_image( - img["url"], - json_info["title"], - (self.width, int(self.width * 9 / 16)), - ) + self.image.fetchPixmap(img["url"], json_info["id"], json_info["title"]) break else: logger.info(", ".join([img["type"] for img in json_info["keyImages"]])) self.setLayout(self.layout) - self.setFixedSize(self.width + 10, self.width * 9 // 16 + 50) - def mousePressEvent(self, a0: QtGui.QMouseEvent) -> None: self.show_info.emit(self.json_info) diff --git a/rare/components/tabs/store/image_widget.py b/rare/components/tabs/store/image_widget.py new file mode 100644 index 00000000..38ee56fb --- /dev/null +++ b/rare/components/tabs/store/image_widget.py @@ -0,0 +1,76 @@ +from typing import Dict + +from PyQt5.QtCore import Qt, QRect +from PyQt5.QtGui import ( + QPixmap, + QImage, QMovie, +) +from PyQt5.QtWidgets import QLabel + +from rare.utils.qt_requests import QtRequestManager +from rare.widgets.image_widget import ImageWidget + + +class WaitingSpinner(QLabel): + def __init__(self, autostart=False, parent=None): + super(WaitingSpinner, self).__init__(parent=parent) + self.setObjectName(type(self).__name__) + self.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) + self.movie = QMovie(":/images/loader.gif") + self.setMovie(self.movie) + if autostart: + self.movie.start() + + def setGeometry(self, a0: QRect) -> None: + self.rect().moveCenter(self.parent().rect().center()) + super(WaitingSpinner, self).setGeometry(self.rect()) + + def start(self): + self.movie.start() + + def stop(self): + self.movie.stop() + + +class ShopImageWidget(ImageWidget): + __image_cache: Dict[str, Dict[str, QPixmap]] = {} + + def __init__(self, parent=None): + super(ShopImageWidget, self).__init__(parent=parent) + self.spinner = WaitingSpinner(parent=self) + self.spinner.setVisible(False) + self.manager = QtRequestManager("bytes") + self.app_id = "" + self.orientation = "" + + def fetchPixmap(self, url, app_id: str, title: str = ""): + self.setPixmap(QPixmap()) + self.app_id = app_id + if self._image_size.size.width() > self._image_size.size.height(): + self.orientation = "wide" + else: + self.orientation = "tall" + + if ShopImageWidget.__image_cache.get(self.app_id, None) is not None: + if pixmap := ShopImageWidget.__image_cache[self.app_id].get(self.orientation, None): + self.setPixmap(pixmap) + return + self.spinner.setFixedSize(self._image_size.size) + self.spinner.setVisible(True) + self.spinner.start() + self.manager.get( + url, self.__on_image_ready, payload={ + "resize": 1, "w": self._image_size.size.width(), "h": self._image_size.size.height() + } + ) + + def __on_image_ready(self, data): + cover = QImage() + cover.loadFromData(data) + cover = cover.scaled(self._image_size.size, Qt.KeepAspectRatio, Qt.SmoothTransformation) + cover = cover.convertToFormat(QImage.Format_ARGB32_Premultiplied) + cover = QPixmap(cover) + ShopImageWidget.__image_cache.update({self.app_id: {self.orientation: cover}}) + super(ShopImageWidget, self).setPixmap(cover) + self.spinner.stop() + self.spinner.setVisible(False) diff --git a/rare/components/tabs/store/search_results.py b/rare/components/tabs/store/search_results.py index 763aac3e..ff3baa59 100644 --- a/rare/components/tabs/store/search_results.py +++ b/rare/components/tabs/store/search_results.py @@ -6,105 +6,106 @@ from PyQt5.QtWidgets import ( QVBoxLayout, QHBoxLayout, QLabel, - QScrollArea, - QGroupBox, - QPushButton, - QStackedWidget, + QFrame, + QSizePolicy, ) -from rare.utils.extra_widgets import ImageLabel, WaitingSpinner +from rare.shared.image_manager import ImageSize from rare.widgets.flow_layout import FlowLayout +from widgets.elide_label import ElideLabel +from .image_widget import ShopImageWidget -class SearchResults(QStackedWidget): +class SearchResults(QWidget): show_info = pyqtSignal(dict) - def __init__(self, api_core): - super(SearchResults, self).__init__() - self.search_result_widget = QWidget() + def __init__(self, api_core, parent=None): + super(SearchResults, self).__init__(parent=parent) self.api_core = api_core - self.addWidget(self.search_result_widget) + + self.results_frame = QFrame(self) + self.results_frame.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) + self.results_frame.setFrameStyle(QFrame.StyledPanel) + self.resutls_layout = FlowLayout(self.results_frame) + self.results_frame.setLayout(self.resutls_layout) + self.main_layout = QVBoxLayout() - self.back_button = QPushButton(self.tr("Back")) - self.main_layout.addWidget(self.back_button) - self.main_layout.addWidget(self.back_button) - self.result_area = QScrollArea() - self.widget = QWidget() - self.result_area.setWidgetResizable(True) - self.main_layout.addWidget(self.result_area) - self.result_area.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) + self.main_layout.setContentsMargins(0, 0, 0, 0) + self.main_layout.addWidget(self.results_frame) - self.result_area.setWidget(self.widget) - self.layout = FlowLayout() - self.widget.setLayout(self.layout) - - self.search_result_widget.setLayout(self.main_layout) - - self.addWidget(WaitingSpinner()) - self.setCurrentIndex(1) + self.setLayout(self.main_layout) + self.setEnabled(False) def load_results(self, text: str): - self.setCurrentIndex(1) + self.setEnabled(False) if text != "": self.api_core.search_game(text, self.show_results) def show_results(self, results: dict): - self.widget.deleteLater() - self.widget = QWidget() - self.layout = FlowLayout() + for w in self.results_frame.findChildren(QLabel, options=Qt.FindDirectChildrenOnly): + self.results_frame.layout().removeWidget(w) + w.deleteLater() + for w in self.results_frame.findChildren(_SearchResultItem, options=Qt.FindDirectChildrenOnly): + self.results_frame.layout().removeWidget(w) + w.deleteLater() + if not results: - self.layout.addWidget(QLabel(self.tr("No results found"))) + self.results_frame.layout().addWidget(QLabel(self.tr("No results found"))) else: for res in results: - w = _SearchResultItem(res) + w = _SearchResultItem(res, parent=self.results_frame) w.show_info.connect(self.show_info.emit) - self.layout.addWidget(w) - self.widget.setLayout(self.layout) - self.result_area.setWidget(self.widget) - self.setCurrentIndex(0) + self.results_frame.layout().addWidget(w) + self.setEnabled(True) -class _SearchResultItem(QGroupBox): +class _SearchResultItem(QFrame): res: dict show_info = pyqtSignal(dict) - def __init__(self, result: dict): - super(_SearchResultItem, self).__init__() - self.layout = QVBoxLayout() - self.image = ImageLabel() + def __init__(self, result: dict, parent=None): + super(_SearchResultItem, self).__init__(parent=parent) + self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) + self.widget_layout = QVBoxLayout() + self.widget_layout.setSizeConstraint(QVBoxLayout.SetFixedSize) + self.image = ShopImageWidget(parent=self) + self.image.setFixedSize(ImageSize.Normal) for img in result["keyImages"]: - if img["type"] == "DieselStoreFrontTall": - width = 240 - self.image.update_image(img["url"], result["title"], (width, 360)) + if img["type"] in ["DieselStoreFrontTall", "OfferImageTall", "Thumbnail", "ProductLogo"]: + self.image.fetchPixmap(img["url"], result["id"], result["title"]) break else: print("No image found") - self.layout.addWidget(self.image) + self.widget_layout.addWidget(self.image) self.res = result - self.title = QLabel(self.res["title"]) + self.title = ElideLabel(self.res["title"], parent=self) title_font = QFont() title_font.setPixelSize(15) self.title.setFont(title_font) - self.title.setWordWrap(True) - self.layout.addWidget(self.title) + self.title.setWordWrap(False) + self.widget_layout.addWidget(self.title) price = result["price"]["totalPrice"]["fmtPrice"]["originalPrice"] discount_price = result["price"]["totalPrice"]["fmtPrice"]["discountPrice"] price_layout = QHBoxLayout() - price_label = QLabel(price if price != "0" else self.tr("Free")) + price_layout.addStretch(1) + price_label = QLabel(price if price != "0" else self.tr("Free"), parent=self) + price_label.setAlignment(Qt.AlignRight) + price_label.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) price_layout.addWidget(price_label) if price != discount_price: font = QFont() font.setStrikeOut(True) price_label.setFont(font) - price_layout.addWidget(QLabel(discount_price)) + discount_label = QLabel(discount_price if discount_price != "0" else self.tr("Free"), parent=self) + discount_label.setAlignment(Qt.AlignRight) + discount_label.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) + price_layout.addWidget(discount_label) # self.discount_price = QLabel(f"{self.tr('Discount price: ')}{discount_price}") - self.layout.addLayout(price_layout) + self.widget_layout.addLayout(price_layout) - self.setLayout(self.layout) - - self.setFixedWidth(260) + self.setLayout(self.widget_layout) def mousePressEvent(self, a0: QtGui.QMouseEvent) -> None: if a0.button() == 1: diff --git a/rare/components/tabs/store/shop_api_core.py b/rare/components/tabs/store/shop_api_core.py index f1368b43..906ef814 100644 --- a/rare/components/tabs/store/shop_api_core.py +++ b/rare/components/tabs/store/shop_api_core.py @@ -173,8 +173,9 @@ class ShopApiCore(QObject): try: handle_func(data) except Exception as e: + raise e logger.error(str(e)) - handle_func({}) + # handle_func({}) # needs a captcha def add_to_wishlist(self, namespace, offer_id, handle_func: callable): diff --git a/rare/components/tabs/store/shop_models.py b/rare/components/tabs/store/shop_models.py index b850a71f..d6bb0054 100644 --- a/rare/components/tabs/store/shop_models.py +++ b/rare/components/tabs/store/shop_models.py @@ -1,5 +1,6 @@ import datetime from dataclasses import dataclass +from typing import List, Dict class ImageUrlModel: @@ -43,19 +44,21 @@ class ShopGame: def __init__( self, title: str = "", + id: str = "", image_urls: ImageUrlModel = None, - social_links: dict = None, - langs: list = None, - reqs: dict = None, + social_links: Dict = None, + langs: Dict = None, + reqs: Dict = None, publisher: str = "", developer: str = "", original_price: str = "", discount_price: str = "", - tags: list = None, + tags: List = None, namespace: str = "", offer_id: str = "", ): self.title = title + self.id = id self.image_urls = image_urls self.links = [] if social_links: @@ -66,13 +69,13 @@ class ShopGame: ) else: self.links = [] - self.languages = langs - self.reqs = reqs + self.languages = langs if langs is not None else {} + self.reqs = reqs if reqs is not None else {} self.publisher = publisher self.developer = developer self.price = original_price self.discount_price = discount_price - self.tags = tags + self.tags = tags if tags is not None else [] self.namespace = namespace self.offer_id = offer_id @@ -89,46 +92,50 @@ class ShopGame: api_data = page break tmp = cls() - tmp.title = search_data.get("title", "Fail") - tmp.image_urls = ImageUrlModel.from_json(search_data["keyImages"]) - links = api_data["data"]["socialLinks"] - tmp.links = [] - for item in links: - if item.startswith("link"): - tmp.links.append(tuple((item.replace("link", ""), links[item]))) - tmp.available_voice_langs = api_data["data"]["requirements"].get( - "languages", "Failed" - ) - tmp.reqs = {} - for i, system in enumerate(api_data["data"]["requirements"].get("systems", [])): - try: - tmp.reqs[system["systemType"]] = {} - except KeyError: - continue - for req in system["details"]: + if search_data: + tmp.title = search_data.get("title", "Fail") + tmp.id = search_data.get("id") + tmp.image_urls = ImageUrlModel.from_json(search_data["keyImages"]) + if not tmp.developer: + for i in search_data["customAttributes"]: + if i["key"] == "developerName": + tmp.developer = i["value"] + tmp.price = search_data["price"]["totalPrice"]["fmtPrice"]["originalPrice"] + tmp.discount_price = search_data["price"]["totalPrice"]["fmtPrice"][ + "discountPrice" + ] + tmp.namespace = search_data["namespace"] + tmp.offer_id = search_data["id"] + + if api_data: + links = api_data["data"]["socialLinks"] + tmp.links = [] + for item in links: + if item.startswith("link"): + tmp.links.append(tuple((item.replace("link", ""), links[item]))) + tmp.available_voice_langs = api_data["data"]["requirements"].get( + "languages", "Failed" + ) + tmp.reqs = {} + for i, system in enumerate(api_data["data"]["requirements"].get("systems", [])): try: - tmp.reqs[system["systemType"]][req["title"]] = ( - req["minimum"], - req["recommended"], - ) + tmp.reqs[system["systemType"]] = {} except KeyError: - pass - tmp.publisher = api_data["data"]["meta"].get("publisher", "") - tmp.developer = api_data["data"]["meta"].get("developer", "") - if not tmp.developer: - for i in search_data["customAttributes"]: - if i["key"] == "developerName": - tmp.developer = i["value"] - tmp.price = search_data["price"]["totalPrice"]["fmtPrice"]["originalPrice"] - tmp.discount_price = search_data["price"]["totalPrice"]["fmtPrice"][ - "discountPrice" - ] - tmp.tags = [ - i.replace("_", " ").capitalize() - for i in api_data["data"]["meta"].get("tags", []) - ] - tmp.namespace = search_data["namespace"] - tmp.offer_id = search_data["id"] + continue + for req in system["details"]: + try: + tmp.reqs[system["systemType"]][req["title"]] = ( + req["minimum"], + req["recommended"], + ) + except KeyError: + pass + tmp.publisher = api_data["data"]["meta"].get("publisher", "") + tmp.developer = api_data["data"]["meta"].get("developer", "") + tmp.tags = [ + i.replace("_", " ").capitalize() + for i in api_data["data"]["meta"].get("tags", []) + ] return tmp diff --git a/rare/components/tabs/store/shop_widget.py b/rare/components/tabs/store/shop_widget.py index af5a02ce..f72d111e 100644 --- a/rare/components/tabs/store/shop_widget.py +++ b/rare/components/tabs/store/shop_widget.py @@ -1,14 +1,15 @@ import datetime import logging +from typing import List -from PyQt5.QtCore import pyqtSignal +from PyQt5.QtCore import pyqtSignal, Qt from PyQt5.QtWidgets import ( QGroupBox, - QScrollArea, QCheckBox, QLabel, QPushButton, QHBoxLayout, + QWidget, QSizePolicy, ) from legendary.core import LegendaryCore @@ -24,17 +25,12 @@ logger = logging.getLogger("Shop") # noinspection PyAttributeOutsideInit,PyBroadException -class ShopWidget(QScrollArea, Ui_ShopWidget): +class ShopWidget(QWidget, Ui_ShopWidget): show_info = pyqtSignal(str) show_game = pyqtSignal(dict) - free_game_widgets = [] - active_search_request = False - next_search = "" - wishlist: list = [] - def __init__(self, path, core: LegendaryCore, shop_api: ShopApiCore): - super(ShopWidget, self).__init__() - self.setWidgetResizable(True) + def __init__(self, path, core: LegendaryCore, shop_api: ShopApiCore, parent=None): + super(ShopWidget, self).__init__(parent=parent) self.setupUi(self) self.path = path self.core = core @@ -43,10 +39,17 @@ class ShopWidget(QScrollArea, Ui_ShopWidget): self.tags = [] self.types = [] self.update_games_allowed = True - self.free_widget.setLayout(FlowLayout()) + free_games_container_layout = QHBoxLayout(self.free_games_container) + free_games_container_layout.setContentsMargins(0, 0, 0, 3) + self.free_games_container.setLayout(free_games_container_layout) + self.free_games_container.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) + self.free_games_scrollarea.setDisabled(True) + self.free_games_scrollarea.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) - self.free_stack.addWidget(WaitingSpinner()) - self.free_stack.setCurrentIndex(1) + self.free_game_widgets = [] + self.active_search_request = False + self.next_search = "" + self.wishlist: List = [] self.discount_widget.setLayout(FlowLayout()) self.discount_stack.addWidget(WaitingSpinner()) @@ -59,7 +62,7 @@ class ShopWidget(QScrollArea, Ui_ShopWidget): self.search_bar = ButtonLineEdit( "fa.search", placeholder_text=self.tr("Search Games") ) - self.layout().insertWidget(0, self.search_bar) + self.games_container_layout.insertWidget(0, self.search_bar) # self.search_bar.textChanged.connect(self.search_games) @@ -110,42 +113,47 @@ class ShopWidget(QScrollArea, Ui_ShopWidget): try: if game["offer"]["price"]["totalPrice"]["discount"] > 0: w = GameWidget(self.path, game["offer"]) - w.show_info.connect(self.show_game.emit) + w.show_info.connect(self.show_game) self.discount_widget.layout().addWidget(w) discounts += 1 except Exception as e: logger.warning(f"{game} {e}") continue - self.discounts_gb.setVisible(discounts > 0) + self.discounts_group.setVisible(discounts > 0) self.discount_stack.setCurrentIndex(0) # fix widget overlay self.discount_widget.layout().update() def add_free_games(self, free_games: list): - for i in range(self.free_widget.layout().count()): - item = self.free_widget.layout().itemAt(i) - if item: - item.widget().deleteLater() + for w in self.free_games_container.layout().findChildren(QGroupBox, options=Qt.FindDirectChildrenOnly): + self.free_games_container.layout().removeWidget(w) + w.deleteLater() if free_games and free_games[0] == "error": - self.free_widget.layout().addWidget( + self.free_games_container.layout().addWidget( QLabel(self.tr("Failed to fetch free games: {}").format(free_games[1])) ) btn = QPushButton(self.tr("Reload")) - self.free_widget.layout().addWidget(btn) + self.free_games_container.layout().addWidget(btn) btn.clicked.connect( lambda: self.api_core.get_free_games(self.add_free_games) ) - self.free_stack.setCurrentIndex(0) + self.free_games_container.setEnabled(True) return - self.free_games_now = QGroupBox(self.tr("Now Free")) - self.free_games_now.setLayout(QHBoxLayout()) - self.free_widget.layout().addWidget(self.free_games_now) + self.free_games_now = QGroupBox(self.tr("Free now"), parent=self.free_games_container) + free_games_now_layout = QHBoxLayout(self.free_games_now) + free_games_now_layout.setContentsMargins(0, 0, 0, 0) + self.free_games_now.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) + self.free_games_now.setLayout(free_games_now_layout) + self.free_games_container.layout().addWidget(self.free_games_now) - self.coming_free_games = QGroupBox(self.tr("Free Games next week")) - self.coming_free_games.setLayout(QHBoxLayout()) - self.free_widget.layout().addWidget(self.coming_free_games) + self.free_games_next = QGroupBox(self.tr("Free next week"), parent=self.free_games_container) + free_games_next_layout = QHBoxLayout(self.free_games_next) + free_games_next_layout.setContentsMargins(0, 0, 0, 0) + self.free_games_next.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) + self.free_games_next.setLayout(free_games_next_layout) + self.free_games_container.layout().addWidget(self.free_games_next) date = datetime.datetime.now() free_games_now = [] @@ -197,7 +205,7 @@ class ShopWidget(QScrollArea, Ui_ShopWidget): now_free = 0 for free_game in free_games_now: w = GameWidget(self.path, free_game) - w.show_info.connect(self.show_game.emit) + w.show_info.connect(self.show_game) self.free_games_now.layout().addWidget(w) self.free_game_widgets.append(w) now_free += 1 @@ -210,10 +218,15 @@ class ShopWidget(QScrollArea, Ui_ShopWidget): for free_game in coming_free_games: w = GameWidget(self.path, free_game) if free_game["title"] != "Mystery Game": - w.show_info.connect(self.show_game.emit) - self.coming_free_games.layout().addWidget(w) + w.show_info.connect(self.show_game) + self.free_games_next.layout().addWidget(w) # self.coming_free_games.setFixedWidth(int(40 + len(coming_free_games) * 300)) - self.free_stack.setCurrentIndex(0) + + self.free_games_scrollarea.setMinimumHeight( + self.free_games_now.sizeHint().height() + self.free_games_scrollarea.horizontalScrollBar().sizeHint().height() + ) + self.free_games_scrollarea.update() + self.free_games_scrollarea.setEnabled(True) def show_search_results(self): if self.search_bar.text(): @@ -255,10 +268,10 @@ class ShopWidget(QScrollArea, Ui_ShopWidget): self.checkboxes = [] for groupbox, variables in [ - (self.genre_gb, constants.categories), - (self.platform_gb, constants.platforms), - (self.others_gb, constants.others), - (self.type_gb, constants.types), + (self.genre_group, constants.categories), + (self.platform_group, constants.platforms), + (self.others_group, constants.others), + (self.type_group, constants.types), ]: for text, tag in variables: @@ -307,12 +320,12 @@ class ShopWidget(QScrollArea, Ui_ShopWidget): if removed_type and removed_type in self.types: self.types.remove(removed_type) if (self.types or self.price) or self.tags or self.on_discount.isChecked(): - self.free_game_group_box.setVisible(False) - self.discounts_gb.setVisible(False) + self.free_games_scrollarea.setVisible(False) + self.discounts_group.setVisible(False) else: - self.free_game_group_box.setVisible(True) - if len(self.discounts_gb.layout().children()) > 0: - self.discounts_gb.setVisible(True) + self.free_games_scrollarea.setVisible(True) + if len(self.discounts_group.layout().children()) > 0: + self.discounts_group.setVisible(True) self.game_stack.setCurrentIndex(1) diff --git a/rare/components/tabs/store/wishlist.py b/rare/components/tabs/store/wishlist.py index fbac0713..48ac9d18 100644 --- a/rare/components/tabs/store/wishlist.py +++ b/rare/components/tabs/store/wishlist.py @@ -1,23 +1,21 @@ from PyQt5.QtCore import pyqtSignal -from PyQt5.QtWidgets import QStackedWidget, QMessageBox +from PyQt5.QtWidgets import QMessageBox, QWidget -from rare.components.tabs.store import ShopApiCore -from rare.components.tabs.store.game_widgets import WishlistWidget from rare.ui.components.tabs.store.wishlist import Ui_Wishlist -from rare.utils.extra_widgets import WaitingSpinner -from rare.utils.misc import qta_icon as icon +from rare.utils.misc import icon +from .shop_api_core import ShopApiCore +from .game_widgets import WishlistWidget -class Wishlist(QStackedWidget, Ui_Wishlist): +class Wishlist(QWidget, Ui_Wishlist): show_game_info = pyqtSignal(dict) update_wishlist_signal = pyqtSignal() - def __init__(self, api_core: ShopApiCore): - super(Wishlist, self).__init__() + def __init__(self, api_core: ShopApiCore, parent=None): + super(Wishlist, self).__init__(parent=parent) self.api_core = api_core self.setupUi(self) - self.addWidget(WaitingSpinner()) - self.setCurrentIndex(1) + self.setEnabled(False) self.wishlist = [] self.widgets = [] @@ -33,7 +31,7 @@ class Wishlist(QStackedWidget, Ui_Wishlist): ) def update_wishlist(self): - self.setCurrentIndex(1) + self.setEnabled(False) self.api_core.get_wishlist(self.set_wishlist) def delete_from_wishlist(self, game): @@ -116,4 +114,4 @@ class Wishlist(QStackedWidget, Ui_Wishlist): self.list_layout.addWidget(w) w.open_game.connect(self.show_game_info.emit) w.delete_from_wishlist.connect(self.delete_from_wishlist) - self.setCurrentIndex(0) + self.setEnabled(True) diff --git a/rare/ui/components/tabs/store/shop_game_info.py b/rare/ui/components/tabs/store/shop_game_info.py index 9e010bc7..710a5b69 100644 --- a/rare/ui/components/tabs/store/shop_game_info.py +++ b/rare/ui/components/tabs/store/shop_game_info.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'rare/ui/components/tabs/store/shop_game_info.ui' # -# Created by: PyQt5 UI code generator 5.15.6 +# Created by: PyQt5 UI code generator 5.15.7 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. @@ -11,113 +11,105 @@ from PyQt5 import QtCore, QtGui, QtWidgets -class Ui_shop_info(object): - def setupUi(self, shop_info): - shop_info.setObjectName("shop_info") - shop_info.resize(702, 468) - shop_info.setWindowTitle("Form") - self.verticalLayout = QtWidgets.QVBoxLayout(shop_info) - self.verticalLayout.setObjectName("verticalLayout") - self.back_button = QtWidgets.QPushButton(shop_info) - self.back_button.setObjectName("back_button") - self.verticalLayout.addWidget(self.back_button) - self.horizontalLayout = QtWidgets.QHBoxLayout() - self.horizontalLayout.setObjectName("horizontalLayout") - self.image_stack = QtWidgets.QStackedWidget(shop_info) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.image_stack.sizePolicy().hasHeightForWidth()) - self.image_stack.setSizePolicy(sizePolicy) - self.image_stack.setObjectName("image_stack") - self.horizontalLayout.addWidget(self.image_stack) - self.verticalLayout_2 = QtWidgets.QVBoxLayout() - self.verticalLayout_2.setObjectName("verticalLayout_2") - self.title = QtWidgets.QLabel(shop_info) +class Ui_ShopGameInfo(object): + def setupUi(self, ShopGameInfo): + ShopGameInfo.setObjectName("ShopGameInfo") + ShopGameInfo.resize(702, 468) + ShopGameInfo.setWindowTitle("ShopGameInfo") + self.shop_game_info_layout = QtWidgets.QVBoxLayout(ShopGameInfo) + self.shop_game_info_layout.setObjectName("shop_game_info_layout") + self.image_info_layout = QtWidgets.QHBoxLayout() + self.image_info_layout.setObjectName("image_info_layout") + self.info_layout = QtWidgets.QGridLayout() + self.info_layout.setObjectName("info_layout") + spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.info_layout.addItem(spacerItem, 6, 1, 1, 1) + self.tags = QtWidgets.QLabel(ShopGameInfo) + self.tags.setText("tags") + self.tags.setObjectName("tags") + self.info_layout.addWidget(self.tags, 5, 0, 1, 2) + self.discount_price = QtWidgets.QLabel(ShopGameInfo) + self.discount_price.setText("discount") + self.discount_price.setObjectName("discount_price") + self.info_layout.addWidget(self.discount_price, 4, 0, 1, 2) + self.title = QtWidgets.QLabel(ShopGameInfo) font = QtGui.QFont() font.setPointSize(18) self.title.setFont(font) - self.title.setText("") - self.title.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse | QtCore.Qt.TextSelectableByMouse) + self.title.setText("title") + 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) + self.info_layout.addWidget(self.title, 0, 0, 1, 2) + self.button_layout = QtWidgets.QVBoxLayout() + self.button_layout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize) + self.button_layout.setObjectName("button_layout") + self.open_store_button = QtWidgets.QPushButton(ShopGameInfo) + self.open_store_button.setObjectName("open_store_button") + self.button_layout.addWidget(self.open_store_button) + self.wishlist_button = QtWidgets.QPushButton(ShopGameInfo) + self.wishlist_button.setObjectName("wishlist_button") + self.button_layout.addWidget(self.wishlist_button) + self.info_layout.addLayout(self.button_layout, 6, 0, 1, 1) + self.dev = QtWidgets.QLabel(ShopGameInfo) font = QtGui.QFont() font.setPointSize(14) self.dev.setFont(font) - self.dev.setText("") - self.dev.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse | QtCore.Qt.TextSelectableByMouse) + self.dev.setText("dev") + 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.info_layout.addWidget(self.dev, 1, 0, 1, 2) + self.owned_label = QtWidgets.QLabel(ShopGameInfo) self.owned_label.setObjectName("owned_label") - self.verticalLayout_2.addWidget(self.owned_label) - self.price = QtWidgets.QLabel(shop_info) - self.price.setText("") - self.price.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse | QtCore.Qt.TextSelectableByMouse) + self.info_layout.addWidget(self.owned_label, 2, 0, 1, 2) + self.price = QtWidgets.QLabel(ShopGameInfo) + self.price.setText("price") + 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) - self.discount_price.setText("") - self.discount_price.setObjectName("discount_price") - self.verticalLayout_2.addWidget(self.discount_price) - self.tags = QtWidgets.QLabel(shop_info) - self.tags.setText("") - self.tags.setObjectName("tags") - self.verticalLayout_2.addWidget(self.tags) - self.open_store_button = QtWidgets.QPushButton(shop_info) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed) + self.info_layout.addWidget(self.price, 3, 0, 1, 2) + self.social_group = QtWidgets.QGroupBox(ShopGameInfo) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.open_store_button.sizePolicy().hasHeightForWidth()) - self.open_store_button.setSizePolicy(sizePolicy) - self.open_store_button.setObjectName("open_store_button") - self.verticalLayout_2.addWidget(self.open_store_button) - self.wishlist_button = QtWidgets.QPushButton(shop_info) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.wishlist_button.sizePolicy().hasHeightForWidth()) - self.wishlist_button.setSizePolicy(sizePolicy) - self.wishlist_button.setObjectName("wishlist_button") - self.verticalLayout_2.addWidget(self.wishlist_button) - spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) - self.verticalLayout_2.addItem(spacerItem) - self.horizontalLayout.addLayout(self.verticalLayout_2) + sizePolicy.setHeightForWidth(self.social_group.sizePolicy().hasHeightForWidth()) + self.social_group.setSizePolicy(sizePolicy) + self.social_group.setObjectName("social_group") + self.social_layout = QtWidgets.QHBoxLayout(self.social_group) + self.social_layout.setObjectName("social_layout") + self.info_layout.addWidget(self.social_group, 7, 0, 1, 2) + self.image_info_layout.addLayout(self.info_layout) spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout.addItem(spacerItem1) - self.verticalLayout.addLayout(self.horizontalLayout) - self.req_group_box = QtWidgets.QGroupBox(shop_info) - self.req_group_box.setObjectName("req_group_box") - self.gridLayout_2 = QtWidgets.QGridLayout(self.req_group_box) - self.gridLayout_2.setObjectName("gridLayout_2") - self.verticalLayout.addWidget(self.req_group_box) - self.social_link_gb = QtWidgets.QGroupBox(shop_info) - self.social_link_gb.setObjectName("social_link_gb") - self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.social_link_gb) - self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.verticalLayout.addWidget(self.social_link_gb) + self.image_info_layout.addItem(spacerItem1) + self.shop_game_info_layout.addLayout(self.image_info_layout) + self.requirements_group = QtWidgets.QGroupBox(ShopGameInfo) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.requirements_group.sizePolicy().hasHeightForWidth()) + self.requirements_group.setSizePolicy(sizePolicy) + self.requirements_group.setObjectName("requirements_group") + self.requirements_layout = QtWidgets.QHBoxLayout(self.requirements_group) + self.requirements_layout.setContentsMargins(0, 0, 0, 0) + self.requirements_layout.setObjectName("requirements_layout") + self.shop_game_info_layout.addWidget(self.requirements_group) spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) - self.verticalLayout.addItem(spacerItem2) + self.shop_game_info_layout.addItem(spacerItem2) - self.retranslateUi(shop_info) - self.image_stack.setCurrentIndex(-1) + self.retranslateUi(ShopGameInfo) - def retranslateUi(self, shop_info): + def retranslateUi(self, ShopGameInfo): _translate = QtCore.QCoreApplication.translate - self.back_button.setText(_translate("shop_info", "Back")) - self.owned_label.setText(_translate("shop_info", "You already own this game")) - self.open_store_button.setText(_translate("shop_info", "Buy Game in Epic Games Store")) - self.wishlist_button.setText(_translate("shop_info", "Add to wishlist")) - self.req_group_box.setTitle(_translate("shop_info", "Requirements")) - self.social_link_gb.setTitle(_translate("shop_info", "Social Links")) + self.open_store_button.setText(_translate("ShopGameInfo", "Buy in Epic Games Store")) + self.wishlist_button.setText(_translate("ShopGameInfo", "Add to wishlist")) + self.owned_label.setText(_translate("ShopGameInfo", "You already own this game")) + self.social_group.setTitle(_translate("ShopGameInfo", "Links")) + self.requirements_group.setTitle(_translate("ShopGameInfo", "System requirements")) if __name__ == "__main__": import sys app = QtWidgets.QApplication(sys.argv) - shop_info = QtWidgets.QWidget() - ui = Ui_shop_info() - ui.setupUi(shop_info) - shop_info.show() + ShopGameInfo = QtWidgets.QWidget() + ui = Ui_ShopGameInfo() + ui.setupUi(ShopGameInfo) + ShopGameInfo.show() sys.exit(app.exec_()) diff --git a/rare/ui/components/tabs/store/shop_game_info.ui b/rare/ui/components/tabs/store/shop_game_info.ui index b1dd7dfb..5c2223c6 100644 --- a/rare/ui/components/tabs/store/shop_game_info.ui +++ b/rare/ui/components/tabs/store/shop_game_info.ui @@ -1,7 +1,7 @@ - shop_info - + ShopGameInfo + 0 @@ -11,34 +11,41 @@ - Form + ShopGameInfo - + - - - Back - - - - - + - - - - 0 - 0 - - - - -1 - - - - - - + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + tags + + + + + + + discount + + + + @@ -46,14 +53,35 @@ - + title Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - + + + + QLayout::SetFixedSize + + + + + Buy in Epic Games Store + + + + + + + Add to wishlist + + + + + + @@ -61,87 +89,48 @@ - + dev Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - + You already own this game - + - + price Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - - - - - - - - - - + + - + 0 0 - - Buy Game in Epic Games Store + + Links + - - - - - 0 - 0 - - - - Add to wishlist - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - + Qt::Horizontal @@ -156,23 +145,34 @@ - - - Requirements + + + + 0 + 0 + - + + System requirements + + + + 0 + + + 0 + + + 0 + + + 0 + + - - - Social Links - - - - - - + Qt::Vertical diff --git a/rare/ui/components/tabs/store/store.py b/rare/ui/components/tabs/store/store.py index 75e5e72e..0e74a204 100644 --- a/rare/ui/components/tabs/store/store.py +++ b/rare/ui/components/tabs/store/store.py @@ -2,153 +2,145 @@ # Form implementation generated from reading ui file 'rare/ui/components/tabs/store/store.ui' # -# Created by: PyQt5 UI code generator 5.15.6 +# Created by: PyQt5 UI code generator 5.15.7 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # 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): def setupUi(self, ShopWidget): ShopWidget.setObjectName("ShopWidget") - ShopWidget.resize(850, 572) - ShopWidget.setWindowTitle("Form") - self.verticalLayout_7 = QtWidgets.QVBoxLayout(ShopWidget) - self.verticalLayout_7.setObjectName("verticalLayout_7") - self.horizontalLayout_2 = QtWidgets.QHBoxLayout() - self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.scrollArea = QtWidgets.QScrollArea(ShopWidget) - self.scrollArea.setWidgetResizable(True) - self.scrollArea.setObjectName("scrollArea") - self.scrollAreaWidgetContents = QtWidgets.QWidget() - self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 828, 550)) - self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents") - self.horizontalLayout = QtWidgets.QHBoxLayout(self.scrollAreaWidgetContents) - self.horizontalLayout.setObjectName("horizontalLayout") - self.widget = QtWidgets.QWidget(self.scrollAreaWidgetContents) - self.widget.setObjectName("widget") - self.verticalLayout = QtWidgets.QVBoxLayout(self.widget) - self.verticalLayout.setObjectName("verticalLayout") - self.free_game_group_box = QtWidgets.QGroupBox(self.widget) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.free_game_group_box.sizePolicy().hasHeightForWidth()) - self.free_game_group_box.setSizePolicy(sizePolicy) - self.free_game_group_box.setObjectName("free_game_group_box") - self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.free_game_group_box) - self.verticalLayout_3.setObjectName("verticalLayout_3") - self.free_stack = QtWidgets.QStackedWidget(self.free_game_group_box) - self.free_stack.setObjectName("free_stack") - self.free_widget = QtWidgets.QWidget() - self.free_widget.setObjectName("free_widget") - self.free_stack.addWidget(self.free_widget) - self.verticalLayout_3.addWidget(self.free_stack) - self.verticalLayout.addWidget(self.free_game_group_box) - self.discounts_gb = QtWidgets.QGroupBox(self.widget) - self.discounts_gb.setObjectName("discounts_gb") - self.verticalLayout_6 = QtWidgets.QVBoxLayout(self.discounts_gb) - self.verticalLayout_6.setObjectName("verticalLayout_6") - self.discount_stack = QtWidgets.QStackedWidget(self.discounts_gb) + ShopWidget.resize(843, 569) + ShopWidget.setWindowTitle("Store") + self.shop_layout = QtWidgets.QHBoxLayout(ShopWidget) + self.shop_layout.setObjectName("shop_layout") + self.games_scrollarea = QtWidgets.QScrollArea(ShopWidget) + self.games_scrollarea.setFrameShape(QtWidgets.QFrame.NoFrame) + self.games_scrollarea.setFrameShadow(QtWidgets.QFrame.Plain) + self.games_scrollarea.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents) + self.games_scrollarea.setWidgetResizable(True) + self.games_scrollarea.setObjectName("games_scrollarea") + self.games_container = QtWidgets.QWidget() + self.games_container.setGeometry(QtCore.QRect(0, 0, 659, 557)) + self.games_container.setObjectName("games_container") + self.games_container_layout = QtWidgets.QVBoxLayout(self.games_container) + self.games_container_layout.setContentsMargins(0, 0, 3, 0) + self.games_container_layout.setObjectName("games_container_layout") + self.free_games_scrollarea = QtWidgets.QScrollArea(self.games_container) + self.free_games_scrollarea.setFrameShape(QtWidgets.QFrame.NoFrame) + self.free_games_scrollarea.setFrameShadow(QtWidgets.QFrame.Plain) + self.free_games_scrollarea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.free_games_scrollarea.setWidgetResizable(True) + self.free_games_scrollarea.setObjectName("free_games_scrollarea") + self.free_games_container = QtWidgets.QWidget() + self.free_games_container.setGeometry(QtCore.QRect(0, 0, 656, 182)) + self.free_games_container.setObjectName("free_games_container") + self.free_games_scrollarea.setWidget(self.free_games_container) + self.games_container_layout.addWidget(self.free_games_scrollarea) + self.discounts_group = QtWidgets.QGroupBox(self.games_container) + self.discounts_group.setObjectName("discounts_group") + self.discounts_layout = QtWidgets.QVBoxLayout(self.discounts_group) + self.discounts_layout.setObjectName("discounts_layout") + self.discount_stack = QtWidgets.QStackedWidget(self.discounts_group) self.discount_stack.setObjectName("discount_stack") self.discount_widget = QtWidgets.QWidget() self.discount_widget.setObjectName("discount_widget") self.discount_stack.addWidget(self.discount_widget) - self.verticalLayout_6.addWidget(self.discount_stack) - self.verticalLayout.addWidget(self.discounts_gb) - self.filter_game_gb = QtWidgets.QGroupBox(self.widget) - self.filter_game_gb.setObjectName("filter_game_gb") - self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.filter_game_gb) - self.verticalLayout_4.setObjectName("verticalLayout_4") - self.game_stack = QtWidgets.QStackedWidget(self.filter_game_gb) + self.discounts_layout.addWidget(self.discount_stack) + self.games_container_layout.addWidget(self.discounts_group) + self.games_group = QtWidgets.QGroupBox(self.games_container) + self.games_group.setObjectName("games_group") + self.games_layout = QtWidgets.QVBoxLayout(self.games_group) + self.games_layout.setObjectName("games_layout") + self.game_stack = QtWidgets.QStackedWidget(self.games_group) self.game_stack.setObjectName("game_stack") self.game_widget = QtWidgets.QWidget() self.game_widget.setObjectName("game_widget") self.game_stack.addWidget(self.game_widget) - self.verticalLayout_4.addWidget(self.game_stack) - self.verticalLayout.addWidget(self.filter_game_gb) - self.horizontalLayout.addWidget(self.widget) - self.filter_gb = QtWidgets.QGroupBox(self.scrollAreaWidgetContents) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) + self.games_layout.addWidget(self.game_stack) + self.games_container_layout.addWidget(self.games_group) + self.games_scrollarea.setWidget(self.games_container) + self.shop_layout.addWidget(self.games_scrollarea) + self.filter_scrollarea = QtWidgets.QScrollArea(ShopWidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.filter_gb.sizePolicy().hasHeightForWidth()) - self.filter_gb.setSizePolicy(sizePolicy) - self.filter_gb.setMinimumSize(QtCore.QSize(150, 0)) - self.filter_gb.setMaximumSize(QtCore.QSize(16777215, 16777215)) - self.filter_gb.setObjectName("filter_gb") - self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.filter_gb) - self.verticalLayout_2.setObjectName("verticalLayout_2") - self.reset_button = QtWidgets.QPushButton(self.filter_gb) + sizePolicy.setHeightForWidth(self.filter_scrollarea.sizePolicy().hasHeightForWidth()) + self.filter_scrollarea.setSizePolicy(sizePolicy) + self.filter_scrollarea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.filter_scrollarea.setWidgetResizable(True) + self.filter_scrollarea.setObjectName("filter_scrollarea") + self.filter_container = QtWidgets.QWidget() + self.filter_container.setGeometry(QtCore.QRect(0, 0, 162, 553)) + self.filter_container.setObjectName("filter_container") + self.filter_container_layout = QtWidgets.QVBoxLayout(self.filter_container) + self.filter_container_layout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize) + self.filter_container_layout.setObjectName("filter_container_layout") + self.reset_button = QtWidgets.QPushButton(self.filter_container) self.reset_button.setObjectName("reset_button") - self.verticalLayout_2.addWidget(self.reset_button) - self.price_gb = QtWidgets.QGroupBox(self.filter_gb) - self.price_gb.setObjectName("price_gb") - self.verticalLayout_9 = QtWidgets.QVBoxLayout(self.price_gb) - self.verticalLayout_9.setObjectName("verticalLayout_9") - self.none_price = QtWidgets.QRadioButton(self.price_gb) + self.filter_container_layout.addWidget(self.reset_button) + self.price_group = QtWidgets.QGroupBox(self.filter_container) + self.price_group.setObjectName("price_group") + self.price_layout = QtWidgets.QVBoxLayout(self.price_group) + self.price_layout.setObjectName("price_layout") + self.none_price = QtWidgets.QRadioButton(self.price_group) self.none_price.setChecked(True) self.none_price.setObjectName("none_price") - self.verticalLayout_9.addWidget(self.none_price) - self.free_button = QtWidgets.QRadioButton(self.price_gb) + self.price_layout.addWidget(self.none_price) + self.free_button = QtWidgets.QRadioButton(self.price_group) self.free_button.setObjectName("free_button") - self.verticalLayout_9.addWidget(self.free_button) - self.under10 = QtWidgets.QRadioButton(self.price_gb) + self.price_layout.addWidget(self.free_button) + self.under10 = QtWidgets.QRadioButton(self.price_group) self.under10.setObjectName("under10") - self.verticalLayout_9.addWidget(self.under10) - self.under20 = QtWidgets.QRadioButton(self.price_gb) + self.price_layout.addWidget(self.under10) + self.under20 = QtWidgets.QRadioButton(self.price_group) self.under20.setObjectName("under20") - self.verticalLayout_9.addWidget(self.under20) - self.under30 = QtWidgets.QRadioButton(self.price_gb) + self.price_layout.addWidget(self.under20) + self.under30 = QtWidgets.QRadioButton(self.price_group) self.under30.setObjectName("under30") - self.verticalLayout_9.addWidget(self.under30) - self.above = QtWidgets.QRadioButton(self.price_gb) + self.price_layout.addWidget(self.under30) + self.above = QtWidgets.QRadioButton(self.price_group) self.above.setObjectName("above") - self.verticalLayout_9.addWidget(self.above) - self.on_discount = QtWidgets.QCheckBox(self.price_gb) + self.price_layout.addWidget(self.above) + self.on_discount = QtWidgets.QCheckBox(self.price_group) self.on_discount.setObjectName("on_discount") - self.verticalLayout_9.addWidget(self.on_discount) - self.verticalLayout_2.addWidget(self.price_gb) - self.platform_gb = QtWidgets.QGroupBox(self.filter_gb) - self.platform_gb.setObjectName("platform_gb") - self.verticalLayout_13 = QtWidgets.QVBoxLayout(self.platform_gb) - self.verticalLayout_13.setObjectName("verticalLayout_13") - self.verticalLayout_2.addWidget(self.platform_gb) - self.genre_gb = QtWidgets.QGroupBox(self.filter_gb) - self.genre_gb.setObjectName("genre_gb") - self.verticalLayout_12 = QtWidgets.QVBoxLayout(self.genre_gb) - self.verticalLayout_12.setObjectName("verticalLayout_12") - self.verticalLayout_2.addWidget(self.genre_gb) - self.type_gb = QtWidgets.QGroupBox(self.filter_gb) - self.type_gb.setObjectName("type_gb") - self.verticalLayout_11 = QtWidgets.QVBoxLayout(self.type_gb) - self.verticalLayout_11.setObjectName("verticalLayout_11") - self.verticalLayout_2.addWidget(self.type_gb) - self.others_gb = QtWidgets.QGroupBox(self.filter_gb) - self.others_gb.setObjectName("others_gb") - self.verticalLayout_10 = QtWidgets.QVBoxLayout(self.others_gb) - self.verticalLayout_10.setObjectName("verticalLayout_10") - self.verticalLayout_2.addWidget(self.others_gb) - spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) - self.verticalLayout_2.addItem(spacerItem) - self.horizontalLayout.addWidget(self.filter_gb) - self.scrollArea.setWidget(self.scrollAreaWidgetContents) - self.horizontalLayout_2.addWidget(self.scrollArea) - self.verticalLayout_7.addLayout(self.horizontalLayout_2) + self.price_layout.addWidget(self.on_discount) + self.filter_container_layout.addWidget(self.price_group) + self.platform_group = QtWidgets.QGroupBox(self.filter_container) + self.platform_group.setObjectName("platform_group") + self.platfrom_layout = QtWidgets.QVBoxLayout(self.platform_group) + self.platfrom_layout.setObjectName("platfrom_layout") + self.filter_container_layout.addWidget(self.platform_group) + self.genre_group = QtWidgets.QGroupBox(self.filter_container) + self.genre_group.setObjectName("genre_group") + self.genre_layout = QtWidgets.QVBoxLayout(self.genre_group) + self.genre_layout.setObjectName("genre_layout") + self.filter_container_layout.addWidget(self.genre_group) + self.type_group = QtWidgets.QGroupBox(self.filter_container) + self.type_group.setObjectName("type_group") + self.type_layout = QtWidgets.QVBoxLayout(self.type_group) + self.type_layout.setObjectName("type_layout") + self.filter_container_layout.addWidget(self.type_group) + self.others_group = QtWidgets.QGroupBox(self.filter_container) + self.others_group.setObjectName("others_group") + self.others_layout = QtWidgets.QVBoxLayout(self.others_group) + self.others_layout.setObjectName("others_layout") + self.filter_container_layout.addWidget(self.others_group) + self.filter_scrollarea.setWidget(self.filter_container) + self.shop_layout.addWidget(self.filter_scrollarea) self.retranslateUi(ShopWidget) def retranslateUi(self, ShopWidget): _translate = QtCore.QCoreApplication.translate - self.free_game_group_box.setTitle(_translate("ShopWidget", "Free Games")) - self.discounts_gb.setTitle(_translate("ShopWidget", "Discounts from your wishlist")) - self.filter_game_gb.setTitle(_translate("ShopWidget", "Games")) - self.filter_gb.setTitle(_translate("ShopWidget", "Filter")) + self.discounts_group.setTitle(_translate("ShopWidget", "Discounts from your wishlist")) + self.games_group.setTitle(_translate("ShopWidget", "Games")) self.reset_button.setText(_translate("ShopWidget", "Reset")) - self.price_gb.setTitle(_translate("ShopWidget", "Price")) + self.price_group.setTitle(_translate("ShopWidget", "Price")) self.none_price.setText(_translate("ShopWidget", "None")) self.free_button.setText(_translate("ShopWidget", "Free")) self.under10.setText(_translate("ShopWidget", "Under 10")) @@ -156,10 +148,10 @@ class Ui_ShopWidget(object): self.under30.setText(_translate("ShopWidget", "Under 30")) self.above.setText(_translate("ShopWidget", "14.99 and above")) self.on_discount.setText(_translate("ShopWidget", "Discount")) - self.platform_gb.setTitle(_translate("ShopWidget", "Platform")) - self.genre_gb.setTitle(_translate("ShopWidget", "Genre")) - self.type_gb.setTitle(_translate("ShopWidget", "Type")) - self.others_gb.setTitle(_translate("ShopWidget", "Other Tags")) + self.platform_group.setTitle(_translate("ShopWidget", "Platform")) + self.genre_group.setTitle(_translate("ShopWidget", "Genre")) + self.type_group.setTitle(_translate("ShopWidget", "Type")) + self.others_group.setTitle(_translate("ShopWidget", "Other Tags")) if __name__ == "__main__": diff --git a/rare/ui/components/tabs/store/store.ui b/rare/ui/components/tabs/store/store.ui index 4f61053f..1e38513a 100644 --- a/rare/ui/components/tabs/store/store.ui +++ b/rare/ui/components/tabs/store/store.ui @@ -1,238 +1,246 @@ - ShopWidget - - - - 0 - 0 - 850 - 572 - - - - Form - - - - - - - - true - - - - - 0 - 0 - 828 - 550 - - - - - - - - - - - 0 - 0 - - - - Free Games - - - - - - - - - - - - - - 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 + 843 + 569 + + + + Store + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + QAbstractScrollArea::AdjustToContents + + + true + + + + + 0 + 0 + 659 + 557 + + + + + 0 + + + 0 + + + 3 + + + 0 + + + + + QFrame::NoFrame + + + QFrame::Plain + + + Qt::ScrollBarAlwaysOff + + + true + + + + + 0 + 0 + 656 + 182 + + + + + + + + + Discounts from your wishlist + + + + + + + + + + + + + + Games + + + + + + + + + + + + - - + + + + + + 0 + 0 + + + + Qt::ScrollBarAlwaysOff + + + true + + + + + 0 + 0 + 162 + 553 + + + + + QLayout::SetFixedSize + + + + + Reset + + + + + + + Price + + + + + + None + + + true + + + + + + + Free + + + + + + + Under 10 + + + + + + + Under 20 + + + + + + + Under 30 + + + + + + + 14.99 and above + + + + + + + Discount + + + + + + + + + + Platform + + + + + + + + Genre + + + + + + + + Type + + + + + + + + Other Tags + + + + + + + + + + + + diff --git a/rare/ui/components/tabs/store/wishlist.py b/rare/ui/components/tabs/store/wishlist.py index e45475f4..4e9fd461 100644 --- a/rare/ui/components/tabs/store/wishlist.py +++ b/rare/ui/components/tabs/store/wishlist.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'rare/ui/components/tabs/store/wishlist.ui' # -# Created by: PyQt5 UI code generator 5.15.4 +# Created by: PyQt5 UI code generator 5.15.7 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. @@ -14,29 +14,19 @@ from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Wishlist(object): def setupUi(self, Wishlist): Wishlist.setObjectName("Wishlist") - Wishlist.resize(736, 398) - Wishlist.setWindowTitle("StackedWidget") - self.page = QtWidgets.QWidget() - self.page.setObjectName("page") - self.verticalLayout = QtWidgets.QVBoxLayout(self.page) + Wishlist.resize(527, 328) + Wishlist.setWindowTitle("Wishlist") + self.verticalLayout = QtWidgets.QVBoxLayout(Wishlist) self.verticalLayout.setObjectName("verticalLayout") - self.scroll_area = QtWidgets.QScrollArea(self.page) - self.scroll_area.setWidgetResizable(True) - self.scroll_area.setObjectName("scroll_area") - self.scroll_widget = QtWidgets.QWidget() - self.scroll_widget.setGeometry(QtCore.QRect(0, 0, 716, 378)) - self.scroll_widget.setObjectName("scroll_widget") - self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.scroll_widget) - self.verticalLayout_2.setObjectName("verticalLayout_2") - self.title_label = QtWidgets.QLabel(self.scroll_widget) + self.title_label = QtWidgets.QLabel(Wishlist) font = QtGui.QFont() font.setPointSize(15) self.title_label.setFont(font) self.title_label.setObjectName("title_label") - self.verticalLayout_2.addWidget(self.title_label) + self.verticalLayout.addWidget(self.title_label) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") - self.sort_label = QtWidgets.QLabel(self.scroll_widget) + self.sort_label = QtWidgets.QLabel(Wishlist) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) @@ -44,29 +34,29 @@ class Ui_Wishlist(object): self.sort_label.setSizePolicy(sizePolicy) self.sort_label.setObjectName("sort_label") self.horizontalLayout.addWidget(self.sort_label) - self.sort_cb = QtWidgets.QComboBox(self.scroll_widget) + self.sort_cb = QtWidgets.QComboBox(Wishlist) self.sort_cb.setObjectName("sort_cb") self.sort_cb.addItem("") self.sort_cb.addItem("") self.sort_cb.addItem("") self.sort_cb.addItem("") self.horizontalLayout.addWidget(self.sort_cb) - self.reverse = QtWidgets.QCheckBox(self.scroll_widget) + self.reverse = QtWidgets.QCheckBox(Wishlist) self.reverse.setObjectName("reverse") self.horizontalLayout.addWidget(self.reverse) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) - self.filter_label = QtWidgets.QLabel(self.scroll_widget) + self.filter_label = QtWidgets.QLabel(Wishlist) self.filter_label.setObjectName("filter_label") self.horizontalLayout.addWidget(self.filter_label) - self.filter_cb = QtWidgets.QComboBox(self.scroll_widget) + self.filter_cb = QtWidgets.QComboBox(Wishlist) self.filter_cb.setObjectName("filter_cb") self.filter_cb.addItem("") self.filter_cb.addItem("") self.horizontalLayout.addWidget(self.filter_cb) spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem1) - self.reload_button = QtWidgets.QPushButton(self.scroll_widget) + self.reload_button = QtWidgets.QPushButton(Wishlist) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) @@ -75,18 +65,15 @@ class Ui_Wishlist(object): self.reload_button.setText("") self.reload_button.setObjectName("reload_button") self.horizontalLayout.addWidget(self.reload_button) - self.verticalLayout_2.addLayout(self.horizontalLayout) + self.verticalLayout.addLayout(self.horizontalLayout) self.list_layout = QtWidgets.QVBoxLayout() self.list_layout.setObjectName("list_layout") - self.verticalLayout_2.addLayout(self.list_layout) - self.no_games_label = QtWidgets.QLabel(self.scroll_widget) + self.verticalLayout.addLayout(self.list_layout) + self.no_games_label = QtWidgets.QLabel(Wishlist) self.no_games_label.setObjectName("no_games_label") - self.verticalLayout_2.addWidget(self.no_games_label) + self.verticalLayout.addWidget(self.no_games_label) spacerItem2 = QtWidgets.QSpacerItem(379, 218, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) - self.verticalLayout_2.addItem(spacerItem2) - self.scroll_area.setWidget(self.scroll_widget) - self.verticalLayout.addWidget(self.scroll_area) - Wishlist.addWidget(self.page) + self.verticalLayout.addItem(spacerItem2) self.retranslateUi(Wishlist) @@ -108,7 +95,7 @@ class Ui_Wishlist(object): if __name__ == "__main__": import sys app = QtWidgets.QApplication(sys.argv) - Wishlist = QtWidgets.QStackedWidget() + Wishlist = QtWidgets.QWidget() ui = Ui_Wishlist() ui.setupUi(Wishlist) Wishlist.show() diff --git a/rare/ui/components/tabs/store/wishlist.ui b/rare/ui/components/tabs/store/wishlist.ui index b10eea91..1b341623 100644 --- a/rare/ui/components/tabs/store/wishlist.ui +++ b/rare/ui/components/tabs/store/wishlist.ui @@ -1,184 +1,163 @@ Wishlist - + 0 0 - 736 - 398 + 527 + 328 - StackedWidget + Wishlist - - - - - - true - - - - - 0 - 0 - 716 - 378 - + + + + + + 15 + + + + Wishlist + + + + + + + + + + 0 + 0 + + + + Sort by - - - - - - 15 - - - - Wishlist - - - - - - - - - - 0 - 0 - - - - Sort by - - - - - - - - Name - - - - - Price - - - - - Developer - - - - - Discount - - - - - - - - Reverse - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Filter: - - - - - - - - None - - - - - Discount - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - - No games matching your filter - - - - - - - Qt::Vertical - - - - 379 - 218 - - - - - - - - - + + + + + + Name + + + + + Price + + + + + Developer + + + + + Discount + + + + + + + + Reverse + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Filter: + + + + + + + + None + + + + + Discount + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + + No games matching your filter + + + + + + + Qt::Vertical + + + + 379 + 218 + + + + + diff --git a/rare/ui/components/tabs/store/wishlist_widget.py b/rare/ui/components/tabs/store/wishlist_widget.py index 5fbb2d69..47119608 100644 --- a/rare/ui/components/tabs/store/wishlist_widget.py +++ b/rare/ui/components/tabs/store/wishlist_widget.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'rare/ui/components/tabs/store/wishlist_widget.ui' # -# Created by: PyQt5 UI code generator 5.15.5 +# Created by: PyQt5 UI code generator 5.15.7 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. @@ -15,7 +15,7 @@ class Ui_WishlistWidget(object): def setupUi(self, WishlistWidget): WishlistWidget.setObjectName("WishlistWidget") WishlistWidget.resize(523, 172) - WishlistWidget.setWindowTitle("Form") + WishlistWidget.setWindowTitle("WishlistWIdget") self.horizontalLayout = QtWidgets.QHBoxLayout(WishlistWidget) self.horizontalLayout.setObjectName("horizontalLayout") self.widget = QtWidgets.QWidget(WishlistWidget) diff --git a/rare/ui/components/tabs/store/wishlist_widget.ui b/rare/ui/components/tabs/store/wishlist_widget.ui index 136ff704..63dc3640 100644 --- a/rare/ui/components/tabs/store/wishlist_widget.ui +++ b/rare/ui/components/tabs/store/wishlist_widget.ui @@ -11,7 +11,7 @@ - Form + WishlistWIdget diff --git a/rare/utils/extra_widgets.py b/rare/utils/extra_widgets.py index f126f769..a1719765 100644 --- a/rare/utils/extra_widgets.py +++ b/rare/utils/extra_widgets.py @@ -17,7 +17,7 @@ from rare.utils.qt_requests import QtRequests logger = getLogger("ExtraWidgets") - +# FIXME: move this? class WaitingSpinner(QLabel): def __init__(self, parent=None): super(WaitingSpinner, self).__init__(parent=parent)