My mistake in not checking that the constants are also located under that Type namespace. Didn't realize that. I knew they are all equal, and that I was just using less typing to refer to it on the instance. My mistake was trying to suggest that the Type namespace was invalid.
On Wed, 12 Nov 2014 12:18 PM Michael Boon <[email protected]> wrote: > Ugh, sorry, I assumed my response would get threaded. It was a reply to > one of Justin's posts. > > Thanks for everyone's help with this. This group really is priceless. > > > On Wednesday, 12 November 2014 10:15:59 UTC+11, Michael Boon wrote: >> >> Your code is much more concise but I don't think it will change the >> functionality. I think that both forms refer to the same static field of >> the class. >> >> For example: >> from PySide import QtCore >> event = QtCore.QEvent(QtCore.QEvent.ChildPolished) >> QtCore.QEvent.Type.ChildPolished == QtCore.QEvent.ChildPolished # >> Result: True # >> event.type() == event.ChildPolished # Result: True # >> event.ChildPolished == QtCore.QEvent.ChildPolished # Result: True # >> >> >> >> >> On Monday, 10 November 2014 18:39:30 UTC+11, Justin Israel wrote: >>> >>> You seem to have only made a partial change from my other suggestion. I >>> had suggested using event.ChildRemove, yet you have kept that extra .Type. >>> bit in there. Isn't that giving you an error about not existing? >>> >>> >>> On Mon Nov 10 2014 at 8:34:20 PM Marcus Ottosson <[email protected]> >>> wrote: >>> >>>> Is that the full code? I can't see where you're installing the filter. >>>> Don't forget to run installEventFilter() on the target object. >>>> >>>> Have a look at this example. >>>> https://gist.github.com/mottosso/ce114dfe4a264b52e235 >>>> >>>> On 10 November 2014 07:29, Arvid Schneider <[email protected]> >>>> wrote: >>>> >>>>> Thanks for all the help! >>>>> But dont get an error now. But its still not working. >>>>> >>>>> >>>>> class HyperShadeEventFilter(QtCore.QObject): >>>>> def __init__(self): >>>>> super(HyperShadeEventFilter, self).__init__() >>>>> ptr = mui.MQtUtil.mainWindow() >>>>> mainWin = shiboken.wrapInstance(long(ptr), QtGui.QWidget) >>>>> mainWin.installEventFilter(self) >>>>> >>>>> def eventFilter(self, object, event): >>>>> print event.type() >>>>> if event.type() == event.Type.ChildPolished: >>>>> child = event.child() >>>>> print child.objectName() >>>>> if 'hyperShadePanel' in child.objectName(): >>>>> print 'OPEN' >>>>> elif event.type() == event.Type.ChildRemoved: >>>>> child = event.child() >>>>> if 'hyperShadePanel' in child.objectName(): >>>>> print 'CLOSE' >>>>> HyperShadeEventFilter() >>>>> >>>>> -- >>>>> 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/45b59ddf-16ce-4434-a356- >>>>> 0d1179bb6114%40googlegroups.com >>>>> <https://groups.google.com/d/msgid/python_inside_maya/45b59ddf-16ce-4434-a356-0d1179bb6114%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> >>>> >>>> >>>> -- >>>> *Marcus Ottosson* >>>> [email protected] >>>> >>>> -- >>>> 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/CAFRtmODwawJi0dKjmBa% >>>> 3DqGnwgffbzTs9MPXX1MO9g1pQAPNodA%40mail.gmail.com >>>> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODwawJi0dKjmBa%3DqGnwgffbzTs9MPXX1MO9g1pQAPNodA%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/bf5fd23f-a645-4d21-8dfa-f51c2b7e8c70%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/bf5fd23f-a645-4d21-8dfa-f51c2b7e8c70%40googlegroups.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/CAPGFgA2FkBjo9mYuPpN%2B7MtMfb-wr7fmwMcHKJHy1Hvn1mweZg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
