1
0
Fork 0
mirror of synced 2024-06-02 18:54:41 +12:00
Rare/rare/components/tabs/store/__init__.py

48 lines
1.7 KiB
Python
Raw Normal View History

2023-09-24 06:24:28 +13:00
from PyQt5.QtGui import QShowEvent, QHideEvent
from legendary.core import LegendaryCore
from rare.widgets.side_tab import SideTabWidget
from .api.models.response import CatalogOfferModel
2023-09-24 06:24:28 +13:00
from .landing import LandingWidget, LandingPage
from .search import SearchPage
from .store_api import StoreAPI
from .widgets.details import DetailsWidget
from .wishlist import WishlistPage
2021-06-04 09:23:55 +12:00
class StoreTab(SideTabWidget):
def __init__(self, core: LegendaryCore, parent=None):
super(StoreTab, self).__init__(parent=parent)
self.init = False
2021-06-05 04:16:27 +12:00
2021-06-15 08:30:57 +12:00
self.core = core
# self.rcore = RareCore.instance()
2023-09-24 06:24:28 +13:00
self.api = StoreAPI(
2021-12-24 22:09:50 +13:00
self.core.egs.session.headers["Authorization"],
self.core.language_code,
self.core.country_code,
2023-09-24 06:24:28 +13:00
[] # [i.asset_infos["Windows"].namespace for i in self.rcore.game_list if bool(i.asset_infos)]
2021-12-24 22:09:50 +13:00
)
2023-09-24 06:24:28 +13:00
self.landing = LandingPage(self.api, parent=self)
self.landing_index = self.addTab(self.landing, self.tr("Store"))
2021-06-04 09:23:55 +12:00
2024-02-13 05:29:39 +13:00
self.search = SearchPage(self.api, parent=self)
2023-09-24 06:24:28 +13:00
self.search_index = self.addTab(self.search, self.tr("Search"))
2021-06-04 09:23:55 +12:00
2023-09-24 06:24:28 +13:00
self.wishlist = WishlistPage(self.api, parent=self)
self.wishlist_index = self.addTab(self.wishlist, self.tr("Wishlist"))
2021-08-23 08:22:17 +12:00
def showEvent(self, a0: QShowEvent) -> None:
if a0.spontaneous() or self.init:
return super().showEvent(a0)
self.init = True
return super().showEvent(a0)
def hideEvent(self, a0: QHideEvent) -> None:
if a0.spontaneous():
return super().hideEvent(a0)
# TODO: Implement store unloading
return super().hideEvent(a0)