-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhost.py
48 lines (43 loc) · 1.35 KB
/
host.py
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
"""
This is the main file for running the game as a host. For running the game as a player see play.py.
This file will import the game components: graphics, mechanics, network
and mend these together
The host A game can be hosted and played on the same computer.
"""
# Importing
from sys import argv
from sys import exit as sys_exit
from PyQt5.QtWidgets import QApplication, QMainWindow
from GUI_host import startWindow_host # The GUI window for the host
import globals
def main():
"""
Initializing the neccessary processes
"""
if globals.DEBUGGING:
print("DEBUGGING MODE")
app = QApplication(argv)
MainWindow = QMainWindow()
ui = startWindow_host()
ui.setupUi(MainWindow)
# Set ut the connections
ui.setUpSlots()
# Set up validators
ui.setUpValidators()
ui.setUpMisc()
#ui.setUpImages()
# MainWindow.setWindowState(QtCore.Qt.WindowFullScreen)
MainWindow.show()
app.exit(app.exec_())
# Closing down
try:
ui.serverThread.stop()
print("Server shut down")
except: pass # The server thread has not been started yet (most likely due to termination before creating server)
raise SystemExit
# sys_exit() # Might be solution to properly terminating on exit
if __name__ == "__main__":
"""
Infinite loop
"""
main()