1 | import random |
---|
2 | import string |
---|
3 | |
---|
4 | |
---|
5 | import MainWindow |
---|
6 | import MainMenu |
---|
7 | import PopupMenu |
---|
8 | import DetailsBox |
---|
9 | import ScreenshotViewer |
---|
10 | import LoadingBox |
---|
11 | import SearchBox |
---|
12 | import LliurexStoreManager |
---|
13 | import ResourcesManager |
---|
14 | import CategoriesManager |
---|
15 | |
---|
16 | |
---|
17 | |
---|
18 | RSRC_DIR="./" |
---|
19 | |
---|
20 | |
---|
21 | class Core: |
---|
22 | |
---|
23 | singleton=None |
---|
24 | DEBUG=True |
---|
25 | |
---|
26 | @classmethod |
---|
27 | def get_core(self): |
---|
28 | |
---|
29 | if Core.singleton==None: |
---|
30 | Core.singleton=Core() |
---|
31 | Core.singleton.init() |
---|
32 | |
---|
33 | return Core.singleton |
---|
34 | |
---|
35 | @classmethod |
---|
36 | def get_random_id(self): |
---|
37 | |
---|
38 | chars=string.ascii_lowercase |
---|
39 | size=10 |
---|
40 | |
---|
41 | return ''.join(random.choice(chars) for _ in range(size)) |
---|
42 | |
---|
43 | #def get_random_id |
---|
44 | |
---|
45 | |
---|
46 | |
---|
47 | def __init__(self,args=None): |
---|
48 | |
---|
49 | self.id = random.random() |
---|
50 | self.ui_path=RSRC_DIR+"lliurex-store.ui" |
---|
51 | |
---|
52 | self.dprint("INIT...") |
---|
53 | |
---|
54 | #def __init__ |
---|
55 | |
---|
56 | def init(self): |
---|
57 | |
---|
58 | |
---|
59 | |
---|
60 | self.dprint("Creating categories manager...") |
---|
61 | self.categories_manager=CategoriesManager.CategoriesManager() |
---|
62 | self.dprint("Creating resources manager...") |
---|
63 | self.resources=ResourcesManager.ResourcesManager() |
---|
64 | self.dprint("Creating store manager...") |
---|
65 | self.store=LliurexStoreManager.LliurexStoreManager() |
---|
66 | self.dprint("Creating loading screen...") |
---|
67 | self.loading_box=LoadingBox.LoadingBox() |
---|
68 | self.dprint("Creating main menu...") |
---|
69 | self.main_menu=MainMenu.MainMenu() |
---|
70 | self.dprint("Creating popup menu...") |
---|
71 | self.popup_menu=PopupMenu.PopupMenu() |
---|
72 | self.dprint("Creating details box...") |
---|
73 | self.details_box=DetailsBox.DetailsBox() |
---|
74 | self.dprint("Creating screenshot viewer...") |
---|
75 | self.screenshot_viewer=ScreenshotViewer.ScreenshotViewer() |
---|
76 | self.dprint("Creating search box...") |
---|
77 | self.search_box=SearchBox.SearchBox() |
---|
78 | |
---|
79 | |
---|
80 | self.dprint("Creating main window...") |
---|
81 | self.main_window=MainWindow.MainWindow() |
---|
82 | |
---|
83 | |
---|
84 | |
---|
85 | |
---|
86 | #def |
---|
87 | |
---|
88 | def dprint(self,msg): |
---|
89 | |
---|
90 | if Core.DEBUG: |
---|
91 | |
---|
92 | print("[CORE] %s"%msg) |
---|
93 | |
---|
94 | #def dprint |
---|
95 | |
---|
96 | |
---|
97 | |
---|