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, 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)