1
1
from PyQt5 .QtGui import QShowEvent , QHideEvent
2
- from PyQt5 .QtWidgets import QStackedWidget , QTabWidget
3
2
from legendary .core import LegendaryCore
4
3
5
- from rare .shared . rare_core import RareCore
6
- from rare . utils . paths import cache_dir
7
- from .game_info import ShopGameInfo
8
- from .search_results import SearchResults
9
- from .shop_api_core import ShopApiCore
10
- from .shop_widget import ShopWidget
11
- from .wishlist import WishlistWidget , Wishlist
4
+ from rare .widgets . side_tab import SideTabWidget
5
+ from . api . models . response import CatalogOfferModel
6
+ from .landing import LandingWidget , LandingPage
7
+ from .search import SearchPage
8
+ from .store_api import StoreAPI
9
+ from .widgets . details import DetailsWidget
10
+ from .wishlist import WishlistPage
12
11
13
12
14
- class Shop (QStackedWidget ):
15
- init = False
13
+ class StoreTab (SideTabWidget ):
14
+
15
+ def __init__ (self , core : LegendaryCore , parent = None ):
16
+ super (StoreTab , self ).__init__ (parent = parent )
17
+ self .init = False
16
18
17
- def __init__ (self , core : LegendaryCore ):
18
- super (Shop , self ).__init__ ()
19
19
self .core = core
20
- self .rcore = RareCore .instance ()
21
- self .api_core = ShopApiCore (
20
+ # self.rcore = RareCore.instance()
21
+ self .api = StoreAPI (
22
22
self .core .egs .session .headers ["Authorization" ],
23
23
self .core .language_code ,
24
24
self .core .country_code ,
25
+ [] # [i.asset_infos["Windows"].namespace for i in self.rcore.game_list if bool(i.asset_infos)]
25
26
)
26
27
27
- self .shop = ShopWidget (cache_dir (), self .core , self .api_core )
28
- self .wishlist_widget = Wishlist (self .api_core )
29
-
30
- self .store_tabs = QTabWidget (parent = self )
31
- self .store_tabs .addTab (self .shop , self .tr ("Games" ))
32
- self .store_tabs .addTab (self .wishlist_widget , self .tr ("Wishlist" ))
33
-
34
- self .addWidget (self .store_tabs )
35
-
36
- self .search_results = SearchResults (self .api_core )
37
- self .addWidget (self .search_results )
38
- self .search_results .show_info .connect (self .show_game_info )
39
- self .info = ShopGameInfo (
40
- [i .asset_infos ["Windows" ].namespace for i in self .rcore .game_list if bool (i .asset_infos )],
41
- self .api_core ,
42
- )
43
- self .addWidget (self .info )
44
- self .info .back_button .clicked .connect (lambda : self .setCurrentIndex (0 ))
28
+ self .landing = LandingPage (self .api , parent = self )
29
+ self .landing_index = self .addTab (self .landing , self .tr ("Store" ))
45
30
46
- self .search_results . back_button . clicked . connect ( lambda : self .setCurrentIndex ( 0 ) )
47
- self .shop . show_info . connect (self .show_search_results )
31
+ self .search = SearchPage ( self .api , parent = self )
32
+ self .search_index = self . addTab (self .search , self . tr ( "Search" ) )
48
33
49
- self .wishlist_widget .show_game_info .connect (self .show_game_info )
50
- self .shop .show_game .connect (self .show_game_info )
51
- self .api_core .update_wishlist .connect (self .update_wishlist )
52
- self .wishlist_widget .update_wishlist_signal .connect (self .update_wishlist )
34
+ self .wishlist = WishlistPage (self .api , parent = self )
35
+ self .wishlist_index = self .addTab (self .wishlist , self .tr ("Wishlist" ))
53
36
54
37
def showEvent (self , a0 : QShowEvent ) -> None :
55
38
if a0 .spontaneous () or self .init :
56
39
return super ().showEvent (a0 )
57
- self .shop .load ()
58
- self .wishlist_widget .update_wishlist ()
59
40
self .init = True
60
41
return super ().showEvent (a0 )
61
42
@@ -64,14 +45,3 @@ def hideEvent(self, a0: QHideEvent) -> None:
64
45
return super ().hideEvent (a0 )
65
46
# TODO: Implement store unloading
66
47
return super ().hideEvent (a0 )
67
-
68
- def update_wishlist (self ):
69
- self .shop .update_wishlist ()
70
-
71
- def show_game_info (self , data ):
72
- self .info .update_game (data )
73
- self .setCurrentIndex (2 )
74
-
75
- def show_search_results (self , text : str ):
76
- self .search_results .load_results (text )
77
- self .setCurrentIndex (1 )
0 commit comments