mirror of
https://github.com/Xevion/tcp-chat.git
synced 2025-12-06 01:16:32 -06:00
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:
20
launch.py
20
launch.py
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user