from PySide2 import QtGui, QtCore, QtWidgetsfrom maya import OpenMayaUI as omuifrom shiboken2 import wrapInstance
class MyEventFilter(QtCore.QObject): def eventFilter(self, obj, event): if event.type() is event.KeyPress: print("Ate key press", event.key()) event.accept() return True elif event.type() is event.DragEnter: print('DragEnter') event.accept() elif event.type() is event.Drop: print('Drop') event.accept() else: # standard event processing return QtCore.QObject.eventFilter(self, obj, event) main_win = wrapInstance(long(omui.MQtUtil.mainWindow()), QtWidgets.QWidget) my_filter = MyEventFilter()main_win.installEventFilter(my_filter)#main_win.removeEventFilter(my_filter)/J
--
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/180b8d68-8f17-4dd2-a96e-068027de2e77%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
ptr = MQtUtil.findControl('modelPanel4')model_panel_4 = wrapInstance(long(ptr), QtWidgets.QWidget)
my_filter = MyEventFilter()model_panel_4.installEventFilter(my_filter)To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
Thanks for your answer Justin,I tried to install the event filter directly on the perspective view panel using snippet below. Got the same result, key press events captured but not the drop. I guess that means that the event is processed "higher up"
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/180b8d68-8f17-4dd2-a96e-068027de2e77%40googlegroups.com.
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/a8a12ecb-4104-4454-a0ce-3d73e42b0da9%40googlegroups.com.