forked from andrewfullard/PyGCEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
43 lines (32 loc) · 1.48 KB
/
main.py
File metadata and controls
43 lines (32 loc) · 1.48 KB
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
import sys
from PyQt6.QtWidgets import QApplication
from commands.ShowTradeCreatorDialogCommand import ShowTradeRouteCreatorDialogCommand
from commands.ShowCampaignPropertiesDialogCommand import ShowCampaignCreatorDialogCommand
from commands.ShowAutoConnectionSettingsCommand import AutoConnectionSettingsCommand
from config import Config
from ui.DialogFactory import DialogFactory
from ui.mainwindow_presenter import MainWindow, MainWindowPresenter
from ui.planetcontextmenu import PlanetContextMenu
from ui.qtmainwindow import QtMainWindow
from RepositoryCreator import RepositoryCreator
config: Config = Config()
numArgs = len(sys.argv)
if numArgs > 1:
path = sys.argv[1]
else:
path = config.dataPath
app = QApplication([])
repositoryCreator: RepositoryCreator = RepositoryCreator()
repository = repositoryCreator.constructRepository(
path, config.startingForcesLibraryURL
)
dialogFactory = DialogFactory(repository)
qtMainWindow: QtMainWindow = QtMainWindow()
presenter: MainWindowPresenter = MainWindowPresenter(qtMainWindow, repository, config)
presenter.newTradeRouteCommand = ShowTradeRouteCreatorDialogCommand(presenter, dialogFactory)
presenter.campaignPropertiesCommand = ShowCampaignCreatorDialogCommand(presenter, dialogFactory)
presenter.planetContextMenu = PlanetContextMenu(presenter)
presenter.autoConnectionSettingsCommand = AutoConnectionSettingsCommand(presenter, dialogFactory)
qtMainWindow.setMainWindowPresenter(presenter)
qtMainWindow.getWindow().show()
app.exec()