Skip to content
Merged
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
17 changes: 14 additions & 3 deletions avalon/maya/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import contextlib

from maya import cmds, OpenMaya
import maya.utils
import maya.api.OpenMaya as om
from pyblish import api as pyblish

Expand Down Expand Up @@ -205,7 +206,11 @@ def deferred():
command=interactive.reset_resolution)

# Allow time for uninstallation to finish.
QtCore.QTimer.singleShot(100, deferred)
# We use Maya's executeDeferred instead of QTimer.singleShot
# so that it only gets called after Maya UI has initialized too.
# This is crucial with Maya 2020+ which initializes without UI
# first as a QCoreApplication
maya.utils.executeDeferred(deferred)


def launch_workfiles_app(*args):
Expand Down Expand Up @@ -267,8 +272,14 @@ def reload_pipeline(*args):


def _uninstall_menu():
app = QtWidgets.QApplication.instance()
widgets = dict((w.objectName(), w) for w in app.allWidgets())

# In Maya 2020+ don't use the QApplication.instance()
# during startup (userSetup.py) as it will return a
# QtCore.QCoreApplication instance which does not have
# the allWidgets method. As such, we call the staticmethod.
all_widgets = QtWidgets.QApplication.allWidgets()

widgets = dict((w.objectName(), w) for w in all_widgets)
menu = widgets.get(self._menu)

if menu:
Expand Down