create improved server/client commandline launching method

This commit is contained in:
Xevion
2021-01-10 11:44:31 -06:00
parent 8027a80196
commit 065a4dc313
3 changed files with 20 additions and 6 deletions

View File

@@ -1,8 +1,17 @@
from PyQt5.QtWidgets import QApplication
from client.gui import MainWindow
import sys
app = QApplication([])
app.setApplicationName("TCPChat Client")
m = MainWindow()
if __name__ == "__main__":
if len(sys.argv) != 2:
print('Please provide one argument besides the file describing whether to launch the client or server.')
print('Client/C/1 to launch the client. Server/S/2 to launch the server.')
else:
if str(sys.argv[1]).lower() in ['client', 'c', '1']:
from PyQt5.QtWidgets import QApplication
from client.gui import MainWindow
app.exec_()
app = QApplication([])
app.setApplicationName("TCPChat Client")
m = MainWindow()
app.exec_()
elif str(sys.argv[1]).lower() == ['server', 's', '2']:
from server import main