Skip to content

Instantly share code, notes, and snippets.

@SEVEZ
Forked from mikebourbeauart/Maya PySide- Tab as hotkey
Last active August 11, 2017 18:55
Show Gist options
  • Save SEVEZ/6cf73baa5071599b67f5 to your computer and use it in GitHub Desktop.
Save SEVEZ/6cf73baa5071599b67f5 to your computer and use it in GitHub Desktop.
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)
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