Be very careful with your calls to processEvents(). In my experience it can
be a source of bugs if you do it without being aware of the effects. I have
seen situations where it happens in an event call stack which then causes
the event loop to run again and create a deeper stack. Then bugs can either
happen in that deeper stack from new events being triggered or during the
unwind when, say, a model has been invalidated but you go to work with it
in the original stack frames. I have also seen recursion bugs happening
when processEvents is hit in the nested stack frame and continue to
trigger.

Justin

On Tue, Aug 8, 2017, 5:36 AM <[email protected]> wrote:

> For those googling this. I was able to solve this by connecting all
> signals on my widget to a call to `QApplication.processEvents()`. Its not
> exactly elegant but it got the job done.
> Here's the basic code:
>
> from Qt import QtWidgets
> from Qt.QtCore import Signal, Slot
>
> def connectToReload(MyWindow):
>     cls = MyWindow if isinstance(MyWindow, type) else type(MyWindow)
>     signal = type(Signal())
>     signals = [name for name in dir(MyWindow) if isinstance(getattr(cls,
> name), signal)]
>
>     for signal in signals:
>         getattr(MyWindow, signal).connect(reloadApp)
>
> @Slot()
> def reloadApp(*args, **kwargs):
>     app = QtWidgets.QApplication.instance()
>     app.processEvents()
>
> --
> 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/08e3e66a-2124-4d5e-b122-474cd7b4b45d%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA09UQxfptD_mmR1MUR7%3Dbg6%2BmMGJYkwvBodEbK9W8_V_g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to