From a429713c64473b694fef159e00ac8571a2de5e5b Mon Sep 17 00:00:00 2001 From: krathjen Date: Thu, 27 Apr 2017 09:51:00 +0100 Subject: [PATCH] Fix the mayadockwidgetmixin not working outside of maya Remove "Take snapshot" annotation from the preview icon --- .../studiolibrarymaya/mayadockwidgetmixin.py | 19 +++++++++++-------- .../resource/ui/AnimPreviewWidget.ui | 2 +- .../resource/ui/MirrorPreviewWidget.ui | 2 +- .../resource/ui/PosePreviewWidget.ui | 2 +- .../resource/ui/SetsPreviewWidget.ui | 2 +- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/studiolibrary/packages/studiolibrarymaya/mayadockwidgetmixin.py b/src/studiolibrary/packages/studiolibrarymaya/mayadockwidgetmixin.py index bac106fd..7b6548d4 100644 --- a/src/studiolibrary/packages/studiolibrarymaya/mayadockwidgetmixin.py +++ b/src/studiolibrary/packages/studiolibrarymaya/mayadockwidgetmixin.py @@ -171,18 +171,21 @@ def dockWidget(self): def mayaWindow(self): """ - :rtype: QMainWindow + :rtype: QMainWindow or None """ - mainWindowPtr = omui.MQtUtil.mainWindow() - return wrapInstance(long(mainWindowPtr), QtWidgets.QMainWindow) + try: + mainWindowPtr = omui.MQtUtil.mainWindow() + return wrapInstance(long(mainWindowPtr), QtWidgets.QMainWindow) + except NameError, e: + logger.exception(e) def mapDockAreaToStr(self, dockArea): """ :type dockArea: QtCore.Qt.QDockArea :rtype: str """ - map = self.dockAreaMap() - return map[dockArea] + areaMap = self.dockAreaMap() + return areaMap[dockArea] def mapDockAreaFromStr(self, dockAreaStr): """ @@ -196,9 +199,9 @@ def dockArea(self): """ :rtype: QtCore.Qt.DockWidgetAreas """ - if self.isFloating(): - dockArea = QtCore.Qt.NoDockWidgetArea - else: + dockArea = QtCore.Qt.NoDockWidgetArea + + if self.mayaWindow() and not self.isFloating(): dockArea = self.mayaWindow().dockWidgetArea(self.dockWidget()) return dockArea diff --git a/src/studiolibrary/packages/studiolibrarymaya/resource/ui/AnimPreviewWidget.ui b/src/studiolibrary/packages/studiolibrarymaya/resource/ui/AnimPreviewWidget.ui index c0ec2e0a..360d7d54 100644 --- a/src/studiolibrary/packages/studiolibrarymaya/resource/ui/AnimPreviewWidget.ui +++ b/src/studiolibrary/packages/studiolibrarymaya/resource/ui/AnimPreviewWidget.ui @@ -292,7 +292,7 @@ QPushButton:!Checked { - Take snapshot + Qt::LeftToRight diff --git a/src/studiolibrary/packages/studiolibrarymaya/resource/ui/MirrorPreviewWidget.ui b/src/studiolibrary/packages/studiolibrarymaya/resource/ui/MirrorPreviewWidget.ui index 33f8bd2d..39864d7e 100644 --- a/src/studiolibrary/packages/studiolibrarymaya/resource/ui/MirrorPreviewWidget.ui +++ b/src/studiolibrary/packages/studiolibrarymaya/resource/ui/MirrorPreviewWidget.ui @@ -283,7 +283,7 @@ QPushButton:!Checked { - Take snapshot + Qt::LeftToRight diff --git a/src/studiolibrary/packages/studiolibrarymaya/resource/ui/PosePreviewWidget.ui b/src/studiolibrary/packages/studiolibrarymaya/resource/ui/PosePreviewWidget.ui index 09e132bc..0ca04a34 100644 --- a/src/studiolibrary/packages/studiolibrarymaya/resource/ui/PosePreviewWidget.ui +++ b/src/studiolibrary/packages/studiolibrarymaya/resource/ui/PosePreviewWidget.ui @@ -286,7 +286,7 @@ QPushButton:!Checked { - Take snapshot + Qt::LeftToRight diff --git a/src/studiolibrary/packages/studiolibrarymaya/resource/ui/SetsPreviewWidget.ui b/src/studiolibrary/packages/studiolibrarymaya/resource/ui/SetsPreviewWidget.ui index 8fc32843..3aed1c07 100644 --- a/src/studiolibrary/packages/studiolibrarymaya/resource/ui/SetsPreviewWidget.ui +++ b/src/studiolibrary/packages/studiolibrarymaya/resource/ui/SetsPreviewWidget.ui @@ -283,7 +283,7 @@ QPushButton:!Checked { - Take snapshot + Qt::LeftToRight