-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.pyw
68 lines (47 loc) · 1.76 KB
/
app.pyw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import sys
from PySide6.QtCore import *
from PySide6.QtWidgets import QApplication
from window_main import MainWindow
from systray import SystrayCustomWidget, GameAction
from icons import Icons
from games_controller import GamesController, Game
from static import *
app = QApplication(sys.argv)
app.setWindowIcon(Icons.appIcon())
class Main():
def __init__(self):
self.games_controller = GamesController(settings_path=SETTINGS_PATH)
self.mainwindow = MainWindow()
self.systray = SystrayCustomWidget()
# Signals
self.mainwindow.game_added.connect(self._addGameSlot)
self.mainwindow.game_deleted.connect(self._deleteGameSlot)
self.mainwindow.game_edited.connect(self._editGameSlot)
self.mainwindow.launch_game.connect(self.games_controller.launchGame)
self.systray.show_mainwindow.connect(self.mainwindow.show)
self.systray.quit.connect(self.mainwindow.quit)
# Events
self.mainwindow.retreiveGame = self.games_controller.getGameFromIndex
GameAction.launchGame = self.games_controller.launchGame
self._refreshGames()
self.systray.show()
# self.mainwindow.show() # DEBUG
sys.exit(app.exec())
@Slot(str, str, str)
def _addGameSlot(self, name: str, path: str, args: str):
self.games_controller.addGame(name, path, args)
self._refreshGames()
@Slot(int)
def _deleteGameSlot(self, index: int):
self.games_controller.deleteGame(index)
self._refreshGames()
@Slot(int, Game)
def _editGameSlot(self, index: int, game: Game):
self.games_controller.editGame(index, game)
self._refreshGames()
def _refreshGames(self):
self.mainwindow.refresh(self.games_controller.games)
self.systray.refresh(self.games_controller.games)
if __name__ == '__main__':
app.setStyle("Fusion")
Main()