Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

General: Use class constants of QMessageBox #4332

Merged
merged 1 commit into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ def repair(cls, instance):
from openpype.hosts.maya.api import lib

# Store namespace in variable, cosmetics thingy
messagebox = QtWidgets.QMessageBox
mode = messagebox.StandardButton.Ok | messagebox.StandardButton.Cancel
choice = messagebox.warning(None,
"Matrix reset",
cls.prompt_message,
mode)
choice = QtWidgets.QMessageBox.warning(
None,
"Matrix reset",
cls.prompt_message,
QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel
)

invalid = cls.get_invalid(instance)
if not invalid:
Expand Down
13 changes: 7 additions & 6 deletions openpype/tools/project_manager/project_manager/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,13 @@ def _on_create_folders(self):
if not project_name:
return

qm = QtWidgets.QMessageBox
ans = qm.question(self,
"OpenPype Project Manager",
"Confirm to create starting project folders?",
qm.Yes | qm.No)
if ans == qm.Yes:
result = QtWidgets.QMessageBox.question(
self,
"OpenPype Project Manager",
"Confirm to create starting project folders?",
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No
)
if result == QtWidgets.QMessageBox.Yes:
try:
# Invoking OpenPype API to create the project folders
create_project_folders(project_name)
Expand Down
15 changes: 9 additions & 6 deletions openpype/tools/workfiles/files_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,22 +525,25 @@ def open_file(self, filepath):

def save_changes_prompt(self):
self._messagebox = messagebox = QtWidgets.QMessageBox(parent=self)
messagebox.setWindowFlags(messagebox.windowFlags() |
QtCore.Qt.FramelessWindowHint)
messagebox.setIcon(messagebox.Warning)
messagebox.setWindowFlags(
messagebox.windowFlags() | QtCore.Qt.FramelessWindowHint
)
messagebox.setIcon(QtWidgets.QMessageBox.Warning)
messagebox.setWindowTitle("Unsaved Changes!")
messagebox.setText(
"There are unsaved changes to the current file."
"\nDo you want to save the changes?"
)
messagebox.setStandardButtons(
messagebox.Yes | messagebox.No | messagebox.Cancel
QtWidgets.QMessageBox.Yes
| QtWidgets.QMessageBox.No
| QtWidgets.QMessageBox.Cancel
)

result = messagebox.exec_()
if result == messagebox.Yes:
if result == QtWidgets.QMessageBox.Yes:
return True
if result == messagebox.No:
if result == QtWidgets.QMessageBox.No:
return False
return None

Expand Down