Skip to content
This repository was archived by the owner on Jan 4, 2025. It is now read-only.

Commit 59646da

Browse files
committed
finished the endscreen
1 parent 96f11b0 commit 59646da

4 files changed

Lines changed: 29 additions & 7 deletions

File tree

client/client.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,12 @@ def start_check(self):
9898
self.show_info()
9999
self.main_page.count = int(fetched[3])
100100
self.main_page.start_timer()
101-
self.main_page.participants = json.loads(fetched[2])
102-
self.main_page.update_board()
101+
if not self.main_page.sent:
102+
self.main_page.participants = json.loads(fetched[2])
103+
self.main_page.update_board()
104+
else:
105+
self.end_screen.participants = json.loads(fetched[2])
106+
self.end_screen.update_board()
103107

104108
def start_mainPage(self):
105109
MainPageWindow = QtWidgets.QMainWindow()
@@ -114,12 +118,28 @@ def start_mainPage(self):
114118
time_thread.start()
115119

116120
if not self.app.exec_():
121+
self.app.closeAllWindows()
122+
123+
if not self.main_page.sent:
117124
self.send(self.DISCONNECT_MESSAGE)
118125
sys.exit()
126+
else:
127+
self.show_EndScreen()
119128

120129
def show_EndScreen(self):
121-
pass
130+
EndScreenWindow = QtWidgets.QMainWindow()
131+
info = {
132+
"mode": self.main_page.mode,
133+
"participants": self.main_page.participants,
134+
'username': self.username
135+
}
136+
self.end_screen = EndScreen(**info)
137+
self.end_screen.setupUi(EndScreenWindow)
138+
EndScreenWindow.show()
139+
140+
if not self.app.exec_():
141+
self.send(self.DISCONNECT_MESSAGE)
142+
sys.exit()
122143

123144
if __name__ == "__main__":
124145
Client()
125-

client/endScreen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def setupUi(self, MainWindow):
8686

8787
def retranslateUi(self, MainWindow):
8888
self._translate = QtCore.QCoreApplication.translate
89-
MainWindow.setWindowTitle(self._translate("MainWindow", "Clash of Code | Admin"))
89+
MainWindow.setWindowTitle(self._translate("MainWindow", "Clash of Code | Finish"))
9090
self.mode_label.setText(self._translate("MainWindow", f"Mode : {self.mode.title()}"))
9191
self.player_label.setText(self._translate("MainWindow", "Players"))
9292
self.update_board()

client/mainPage.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
class MainPage(object):
66
def __init__(self, **kwargs):
7+
self.app = kwargs["app"]
78
self.DISCONNECT_MESSAGE = kwargs["DISCONNECT_MESSAGE"]
89
self.SEPARATOR = kwargs["SEPARATOR"]
910
self.LOGIN_MESSAGE = kwargs["LOGIN_MESSAGE"]
@@ -199,7 +200,7 @@ def showDialog(self, MainWindow):
199200
self.file.setText(fname[0])
200201

201202
def showTime(self):
202-
if not self.started:
203+
if not self.started and self.start:
203204
self.countdown -= 1
204205
if self.countdown == 0:
205206
self.started = True
@@ -225,6 +226,7 @@ def file_func(self):
225226
if self.start and not self.sent and self.started:
226227
self.send_file(self.file.text())
227228
self.sent = True
229+
self.app.quit()
228230

229231

230232
if __name__ == "__main__":

server/serverGui.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def update_board(self):
115115
self.playres.setText(self.participant_list)
116116

117117
def showTime(self):
118-
if not self.started:
118+
if not self.started and self.start:
119119
self.countdown -= 1
120120
if self.countdown == 0:
121121
self.started = True

0 commit comments

Comments
 (0)