From 9ad09904f4eb28a71ca48ebc6863c6d067cfcd22 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Wed, 9 Feb 2022 17:10:35 +0100 Subject: [PATCH 1/2] fix fps validation popup --- openpype/hosts/maya/api/lib.py | 37 ++++++++++++++-------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/openpype/hosts/maya/api/lib.py b/openpype/hosts/maya/api/lib.py index 27a7061f74..1f6c8c1deb 100644 --- a/openpype/hosts/maya/api/lib.py +++ b/openpype/hosts/maya/api/lib.py @@ -2440,34 +2440,27 @@ def validate_fps(): # rounding, we have to round those numbers coming from Maya. current_fps = float_round(mel.eval('currentTimeUnitToFPS()'), 2) - if current_fps != fps: + fps_match = current_fps == fps + if not fps_match and not IS_HEADLESS: + from openpype.widgets import popup - from Qt import QtWidgets - from ...widgets import popup + parent = get_main_window() - # Find maya main window - top_level_widgets = {w.objectName(): w for w in - QtWidgets.QApplication.topLevelWidgets()} + dialog = popup.Popup2(parent=parent) + dialog.setModal(True) + dialog.setWindowTitle("Maya scene not in line with project") + dialog.setMessage("The FPS is out of sync, please fix") - parent = top_level_widgets.get("MayaWindow", None) - if parent is None: - pass - else: - dialog = popup.Popup2(parent=parent) - dialog.setModal(True) - dialog.setWindowTitle("Maya scene not in line with project") - dialog.setMessage("The FPS is out of sync, please fix") + # Set new text for button (add optional argument for the popup?) + toggle = dialog.widgets["toggle"] + update = toggle.isChecked() + dialog.on_show.connect(lambda: set_scene_fps(fps, update)) - # Set new text for button (add optional argument for the popup?) - toggle = dialog.widgets["toggle"] - update = toggle.isChecked() - dialog.on_show.connect(lambda: set_scene_fps(fps, update)) + dialog.show() - dialog.show() + return False - return False - - return True + return fps_match def bake(nodes, From dd004e91429ee9cab7924bff629a647d19b6399b Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Wed, 9 Feb 2022 17:36:47 +0100 Subject: [PATCH 2/2] use static method of QApplication to get deskop --- openpype/widgets/popup.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openpype/widgets/popup.py b/openpype/widgets/popup.py index 3c3f6283c4..e661d3d293 100644 --- a/openpype/widgets/popup.py +++ b/openpype/widgets/popup.py @@ -132,12 +132,12 @@ class Popup2(Popup): """ parent_widget = self.parent() - app = QtWidgets.QApplication.instance() + desktop = QtWidgets.QApplication.desktop() if parent_widget: - screen = app.desktop().screenNumber(parent_widget) + screen = desktop.screenNumber(parent_widget) else: - screen = app.desktop().screenNumber(app.desktop().cursor().pos()) - center_point = app.desktop().screenGeometry(screen).center() + screen = desktop.screenNumber(desktop.cursor().pos()) + center_point = desktop.screenGeometry(screen).center() frame_geo = self.frameGeometry() frame_geo.moveCenter(center_point)