Skip to content

Commit

Permalink
fix the new constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
danghoangnhan committed Nov 29, 2023
1 parent d2ed31c commit 0c86e06
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 32 deletions.
6 changes: 3 additions & 3 deletions component/modal.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from PyQt6.QtWidgets import QApplication, QWidget, QPushButton, QVBoxLayout, QDialog, QHBoxLayout, QLabel
from PyQt6.QtWidgets import QPushButton, QDialog, QHBoxLayout

class ConfirmDialog(QDialog):
def __init__(self, parent=None):
Expand All @@ -21,7 +21,7 @@ def initUI(self):
self.setLayout(layout)

def confirm(self):
self.accept() # Closes the dialog and returns QDialog.Accepted
self.accept()

def cancel(self):
self.reject() # Closes the dialog and returns QDialog.Rejected
self.reject()
3 changes: 2 additions & 1 deletion component/screen/end_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def __init__(self,navigator,screen_height,screen_width, result):

self.result = result
self.initUI()
self.saveResult(result)
if(result is not None):
self.saveResult(result)

def initUI(self):
layout = QVBoxLayout(self)
Expand Down
2 changes: 1 addition & 1 deletion component/screen/test_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from pydub.playback import play
from config.dir import audio_dir
from config.constant import pofomopo_consonants,similarity_list
from pydub import AudioSegment


# TestScreen
Expand Down Expand Up @@ -129,7 +130,6 @@ def update_button_states(self):
def handling_submit_button(self):
self.submit_test()
self.navigator.navigate_to_end_screen()
self.navigate_end_screen()

def submit_test(self):
for question in self.answerList:
Expand Down
9 changes: 1 addition & 8 deletions component/screen/user_information_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ def initUI(self)->None:
def save_data(self):
user_info = {label: edit.text() for label, edit in self.fields.items()}
print("User Info Saved:", user_info)

def navigate_test_screen(self):
logging.info("Open the TestScreen")
self.test_screen = TestScreen(self.screen_height,self.screen_width)
self.test_screen.show()
self.close()

def show_confirm_dialog(self):
dialog = ConfirmDialog(self)
Expand All @@ -58,7 +52,6 @@ def show_confirm_dialog(self):
if result == QDialog.DialogCode.Accepted:
print("Save confirmed")
self.save_data()
# self.navigator
self.navigate_test_screen()
self.navigator.navigate_to_test_screen()
else:
print("Save cancelled")
13 changes: 0 additions & 13 deletions component/text.py

This file was deleted.

14 changes: 8 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from controller import Navigator
import logging

if __name__ == "__main__":
try:
navigator = Navigator()
navigator.start()
except Exception as e:
logging.error("An error occurred: %s", str(e))
# if __name__ == "__main__":
# try:
# navigator = Navigator()
# navigator.start()
# except Exception as e:
# logging.error("An error occurred: %s", str(e))
navigator = Navigator()
navigator.start()

0 comments on commit 0c86e06

Please sign in to comment.