Forked from mikebourbeauart/Maya PySide- Tab as hotkey
Last active
August 11, 2017 18:55
-
-
Save SEVEZ/6cf73baa5071599b67f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PySide import QtCore, QtGui | |
from shiboken import wrapInstance | |
import maya.OpenMayaUI as mui | |
mainWin = wrapInstance(long(mui.MQtUtil.mainWindow()), QtGui.QWidget) | |
action = QtGui.QAction(mainWin) | |
action.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Tab)) | |
action.setShortcutContext(QtCore.Qt.ApplicationShortcut) | |
def foo(): | |
import mb_pandora_master | |
reload(mb_pandora_master) | |
mb_pandora_master.run() | |
print "tabbed" | |
action.triggered.connect(foo) | |
mainWin.addAction(action) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
from PySide.QtCore import * | |
from PySide.QtGui import * | |
from PySide.QtWidgets import * | |
import shiboken as shiboken | |
except: | |
from PySide2.QtCore import * | |
from PySide2.QtGui import * | |
from PySide2.QtWidgets import * | |
import shiboken2 as shiboken | |
import maya.OpenMayaUI as mui | |
import maya.cmds as mc | |
mainWin = shiboken.wrapInstance(long(mui.MQtUtil.mainWindow()), QWidget) | |
action = QAction(mainWin) | |
action.setShortcut(QKeySequence(Qt.Key_Tab)) | |
action.setShortcutContext(Qt.ApplicationShortcut) | |
def foo(): | |
print "tabbed" | |
action.triggered.connect(foo) | |
mainWin.addAction(action) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment