Ravi Jagannadhan
2018-10-13 23:30:54 UTC
Hi all, I'm trying to detect when a mouse button is clicked anywhere in
Maya as part of an event filter. I currently have this as an event filter:
from PySide2 import QtCore, QtWidgets
from shiboken2 import wrapInstance
from maya import OpenMayaUI
win_ptr = OpenMayaUI.MQtUtil.mainWindow()
win = wrapInstance(long(win_ptr), QtWidgets.QMainWindow)
class MyEventFilter(QtCore.QObject):
def eventFilter(self, watched, event):
print event.type(), watched, event
filter = MyEventFilter()
win.installEventFilter(filter)
But it doesn't seem to trap a mouse button press/release event (or at least
I don't see it in the output). What am I missing from this in order to
trap the mouse button events?
Thank you for your time,
Ravi
Maya as part of an event filter. I currently have this as an event filter:
from PySide2 import QtCore, QtWidgets
from shiboken2 import wrapInstance
from maya import OpenMayaUI
win_ptr = OpenMayaUI.MQtUtil.mainWindow()
win = wrapInstance(long(win_ptr), QtWidgets.QMainWindow)
class MyEventFilter(QtCore.QObject):
def eventFilter(self, watched, event):
print event.type(), watched, event
filter = MyEventFilter()
win.installEventFilter(filter)
But it doesn't seem to trap a mouse button press/release event (or at least
I don't see it in the output). What am I missing from this in order to
trap the mouse button events?
Thank you for your time,
Ravi
--
Where we have strong emotions, we're liable to fool ourselves - Carl Sagan
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CADHeb2aesfCHOSOzeSXbKC5qvB6GebR3FG5yHN0OkYEnzpPcBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Where we have strong emotions, we're liable to fool ourselves - Carl Sagan
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CADHeb2aesfCHOSOzeSXbKC5qvB6GebR3FG5yHN0OkYEnzpPcBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.