My custom marking menus get stuck after I run a command from them. I have 
all my marking menus setup on alt + q/w/e/r/1/2/3/4 so they are quickly 
accessible. But when I run a command, the key is not released, so when I 
press alt again, the marking menu pops up instead of tumbling the camera, 
which is super annoying. I just have to press q to release it. My solution 
is to send qt a press/release signal automatically with an unstick() 
method, I just put that at the end of my marking menu commands. I thought 
maybe it was just my work computer/version of maya. But now its happening 
on 2013 on another computer.Small problem but I hate it. 
Im wondering if anyone has this problem and has a solution? How do you guys 
set up your commands for quick use?

from PyQt4 import QtGui, QtCore
import sip
import maya.OpenMayaUI as mui

def unstick():
ptr = mui.MQtUtil.mainWindow()
maya_window =  sip.wrapinstance(long(ptr), QtCore.QObject) 
qapp = QtGui.QApplication.instance()
myevent_press = QtGui.QKeyEvent(QtCore.QEvent.KeyPress, QtCore.Qt.Key_Q, 
QtCore.Qt.NoModifier)
myevent_release = QtGui.QKeyEvent(QtCore.QEvent.KeyRelease, 
QtCore.Qt.Key_Q, QtCore.Qt.NoModifier)
myevent_release.prevent_rec = True
qapp.sendEvent(maya_window, myevent_press)
qapp.sendEvent(maya_window, myevent_release)

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to