Skip to content

Commit

Permalink
possible fix of issue #6
Browse files Browse the repository at this point in the history
  • Loading branch information
arterialist committed May 25, 2018
1 parent 200b4b3 commit 8c6abc5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,5 @@ venv.bak/
.mypy_cache/

# project-specific
files/storage.db
files/storage.db
/.idea/
10 changes: 5 additions & 5 deletions callback/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,19 @@ def new_message_callback(packet, window):
break


def invalid_message_callback(reason, message, window):
alert_box = QMessageBox(window)
def invalid_message_callback(reason, message):
alert_box = QMessageBox()
alert_box.setWindowTitle("Invalid message received")
alert_box.setText("Reason:\n{}".format(reason))
alert_box.addButton("View", QMessageBox.ActionRole)
alert_box.setStandardButtons(QMessageBox.Ok)
alert_box.buttonClicked.connect(lambda btn: view_button_clicked_callback(btn, message, window))
alert_box.buttonClicked.connect(lambda btn: view_button_clicked_callback(btn, message))
alert_box.exec_()


def view_button_clicked_callback(button, message, window):
def view_button_clicked_callback(button, message):
if button.text() == "View":
alert_box = QMessageBox(window)
alert_box = QMessageBox()
alert_box.setWindowTitle("Message")
alert_box.setText(message)
alert_box.addButton("Ok", QMessageBox.YesRole)
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def init_ui(self):

client_base.init_socket()
client_base.new_message_callback = lambda message: new_message_callback(message, window)
client_base.invalid_message_callback = lambda reason, message: invalid_message_callback(reason, message, window)
client_base.invalid_message_callback = lambda reason, message: invalid_message_callback(reason, message)

def closeEvent(self, a0: QCloseEvent):
client_base.finish()
Expand Down

0 comments on commit 8c6abc5

Please sign in to comment.