Thank you for the response. The issue I'm looking into happens also when clicking menu items in the top level window, so maybe I'll start there. Thanks again.
On Sat, Oct 13, 2018 at 5:21 PM Justin Israel <[email protected]> wrote: > > > On Sun, Oct 14, 2018, 12:31 PM Ravi Jagannadhan <[email protected]> wrote: > >> 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) >> > > This is only going to catch events that aren't handled by child widgets > and bubble up to the window. If you want to catch every mouse click in the > whole app, you would have to install it on the QApplication. Note this will > slow Maya down because of a python function being called for every event in > the system. > > >> 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 [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/python_inside_maya/CADHeb2aesfCHOSOzeSXbKC5qvB6GebR3FG5yHN0OkYEnzpPcBw%40mail.gmail.com >> <https://groups.google.com/d/msgid/python_inside_maya/CADHeb2aesfCHOSOzeSXbKC5qvB6GebR3FG5yHN0OkYEnzpPcBw%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0w1tUhnVgQeMsUToaVACkqvcMLE1fuvqtYB37VPoQ3sA%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0w1tUhnVgQeMsUToaVACkqvcMLE1fuvqtYB37VPoQ3sA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CADHeb2ZfLociZt7DbV6cDG1jnJr_8Z%2BFAdyuV-uhitCxSvezVA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
