Skip to content

Commit

Permalink
Use Qt enums for new dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
phw committed Jul 6, 2023
1 parent e6923d3 commit c2e7cf9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions picard/ui/newuserdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(self):
show_again_text = _("Show this message again the next time you start Picard.")

self.msg = QtWidgets.QMessageBox()
self.msg.setIcon(QtWidgets.QMessageBox.Warning)
self.msg.setIcon(QtWidgets.QMessageBox.Icon.Warning)
self.msg.setText(dialog_text)
self.msg.setWindowTitle(_("New User Information"))

Expand All @@ -60,7 +60,7 @@ def __init__(self):
self.cb.toggled.connect(self._set_state)

self.msg.setCheckBox(self.cb)
self.msg.setStandardButtons(QtWidgets.QMessageBox.Ok)
self.msg.setStandardButtons(QtWidgets.QMessageBox.StandardButton.Ok)

def _set_state(self):
self.show_again = not self.show_again
Expand Down
6 changes: 3 additions & 3 deletions picard/ui/savewarningdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def __init__(self, file_count=None):

self.disable = False
self.msg = QtWidgets.QMessageBox()
self.msg.setIcon(QtWidgets.QMessageBox.Warning)
self.msg.setIcon(QtWidgets.QMessageBox.Icon.Warning)
self.msg.setText(warning_text)
self.msg.setWindowTitle(_("File Save Warning"))

Expand All @@ -66,10 +66,10 @@ def __init__(self, file_count=None):
self.cb.toggled.connect(self._set_state)

self.msg.setCheckBox(self.cb)
self.msg.setStandardButtons(QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel)
self.msg.setStandardButtons(QtWidgets.QMessageBox.StandardButton.Ok | QtWidgets.QMessageBox.StandardButton.Cancel)

def _set_state(self):
self.disable = not self.disable

def show(self):
return self.msg.exec_() == QtWidgets.QMessageBox.Ok, self.disable
return self.msg.exec_() == QtWidgets.QMessageBox.StandardButton.Ok, self.disable

0 comments on commit c2e7cf9

Please sign in to comment.