update dialog to accept faker default nickname launch sys.argv, prepare_json fix typehint/arg name, commit sizeof helper func, update launch.py for new client/main.py

This commit is contained in:
Xevion
2021-01-25 12:11:41 -06:00
parent 9c3bc4378a
commit 5f2b2aa733
4 changed files with 30 additions and 14 deletions

View File

@@ -1,18 +1,24 @@
import sys
from faker import Faker
if __name__ == "__main__":
if len(sys.argv) != 2:
arg_count = len(sys.argv) - 1
if arg_count < 1:
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
nick = None
if arg_count >= 2:
if sys.argv[2] == 'random':
fake = Faker()
nick = fake.user_name()
else:
nick = sys.argv[2]
app = QApplication([])
app.setApplicationName("TCPChat Client")
m = MainWindow()
app.exec_()
from client.main import main
main(nick)
elif str(sys.argv[1]).lower() in ['server', 's', '2']:
from server import main
main.receive()