Fix GUI inputhook for qt 5.15.0#12355
Conversation
|
My guess is that:
Might be better to register |
|
ahh, that makes a lot of sense. I haven't tested it yet, but I wonder whether adding |
|
ok, looks like # these all fail
notifier.activated.connect(lambda socket, ntype: event_loop.exit())
notifier.activated.connect(lambda socket: event_loop.exit())
def _exit(*args):
event_loop.exit()
notifier.activated.connect(_exit)in qt 5.14.x, the slot was passed the socket identifier as a positional argument, so this was legal: notifier.activated.connect(lambda socket: print(socket))because I think the fact that so the only syntax that works in both 5.15 and earlier versions is how this PR currently has it: |
|
Yikes, glad my speculation at least pointed you in the right direction! If I'm understanding this right, the issue is that pyside is failing inside of its dispatch logic? This probably should be reported upstream as a regression. |
Thanks! I'll see what I can do |
|
Do you think we needs this kind of workaround in IPython still ? |
|
looks like it might be fixed in 5.15.1... so it may not be permanently required. that said, it's worth pointing out that while the previous code ( |
|
Awesome, thanks for working with upstream here @tlambert03 ! I think this should go in anyway, passing the notifier to |
…355-on-7.x Backport PR #12355 on branch 7.x (Fix GUI inputhook for qt 5.15.0)
this fixes #12350
minimal code that reproduces the error:
If you run that script on it's own, you get to see the error that PySide is throwing, which is:
(in a normal
ipython --gui qtsession, the error is not invisible... the interpreter just doesn't accept any input)changing the way
notifier.activatedis connected toevent_loop.exitfixes the issue. I can't say I completely understand whyevent_loop.exitis no longer a valid callback for the connection in5.15... (though I have seen this seemingly unnecessary lambda help in the past with Qt)I'm not sure how to add a test for this, as it seems inputhooks in general aren't being tested?