Export to GitHub

spyderlib - issue #880

Windows detached from the main interface window do not paint correctly after restarting Spyder


Posted on Dec 12, 2011 by Happy Kangaroo

Spyder Version: 2.1.2 Python Version: 2.7.2 Qt Version: 4.7.4, PyQt4 (API v1) 4.8.6 on Windows

What steps will reproduce the problem? 1. Pull any window off of the main window and place it onto a second monitor. 2. Restart Spyder. 3. The separate window does not paint correctly.

What is the expected output? What do you see instead? The window should be painted like normal. I can place the window back into the main spyder window, restart spyder, and then it begins being painted correctly again. As of right now I am unable to use any windows that aren't attached to the main window.

Please provide any additional information below. See Issue #754 for a screenshot of the issue.

Comment #1

Posted on Dec 12, 2011 by Swift Elephant

(No comment was entered for this change.)

Comment #2

Posted on Dec 12, 2011 by Swift Elephant

Issue 754 has been merged into this issue.

Comment #3

Posted on Dec 13, 2011 by Happy Camel

I can reproduce this issue and this is indeed very annoying.

I'll have to dig further: I have no idea where this comes from.

Comment #4

Posted on Dec 13, 2011 by Swift Elephant

I suspect that it is PySide/Qt bug, but to report it we need a minimal reproducible example.

Comment #5

Posted on Dec 13, 2011 by Happy Camel

I'm reproducing this bug with both PyQt and PySide.

Setting back the flags argument here solves the issue: http://code.google.com/p/spyderlib/source/browse/spyderlib/plugins/init.py#117

I'm checking why I wrote this is bugging with Qt 4.4. And I think I meant PyQt 4.4... but, anyway, we might have to drop PyQt/Qt 4.4 support which is maybe already dropped by the fact that no user is using these old versions and so noone is testing Spyder with those versions.

Comment #6

Posted on Dec 13, 2011 by Happy Camel

I'll fix this only for PyQt 4.5+ and PySide.

Testing this change on all platforms is essential!

Carlos can you test this is working on MacOS, and Anatoly on Linux?

Comment #7

Posted on Dec 13, 2011 by Swift Elephant

Getting dual monitor setup is troublesome on my system, but I'll try to get a hold of some notebook capable to do that. No promises though.

Comment #8

Posted on Dec 13, 2011 by Happy Camel

This not necessary: to reproduce the issue, you just need to detach a dockwidget from main window (lets say the Console for example) by double clicking on its title bar, and restart Spyder, that's all.

Comment #9

Posted on Dec 13, 2011 by Swift Elephant

Oh yea, now I see. I mean - don't see. =) So, no problem with testing this on Linux.

Comment #10

Posted on Dec 13, 2011 by Happy Camel

This issue was updated by revision a417568e483c.

I'm checking if PyQt v4.4 is being used: in that case, the fix won't work, so we do nothing. Otherwise (PyQt v4.5+ and PySide), we set the appropriate window flags for dockwidgets (Qt.Window) to avoid this bug.

Comment #11

Posted on Dec 13, 2011 by Swift Elephant

The dock widget is now rendered correctly, but now there a console window pops up before main window is loaded.

Attachments

Comment #12

Posted on Dec 13, 2011 by Quick Horse

I tested it in OS X and it's working well. Great job!

However, during startup I'm seeing the console plugin being painted in the center of the screen with a small size before the main window is created. At the end all plugins return to its past positions though.

Comment #13

Posted on Dec 13, 2011 by Swift Elephant

There is also a lot of output in console. See recorded video in attach.

Attachments

Comment #14

Posted on Dec 13, 2011 by Happy Camel

The console quick/undesired apparition has been fixed (on my local repo).

However, I've tested on Linux (Ubuntu 10.04 LTS with PyQt 4.7.2) and the fix does not work at all. This window flags option is apparently not supported.

Comment #15

Posted on Dec 13, 2011 by Happy Camel

If I could have the confirmation that it works only for PyQt 4.8+, that would helps.

Comment #16

Posted on Dec 13, 2011 by Happy Camel

In the meantime I think I'll revert this changeset, too risky.

Comment #17

Posted on Dec 13, 2011 by Happy Camel

This issue was updated by revision 7f445bb8263a.

Revision a417568e483c is apparently working on PyQt 4.8+ on Windows platforms. On non-Windows platforms, it produces a lot of warning messages in the terminal.

So this revision enables the fix only on Windows platforms with PyQt 4.8+ until we understand why it does not work well on other configurations.

Comment #18

Posted on Dec 13, 2011 by Swift Elephant

I hope everybody agree to leave this open.

Comment #19

Posted on Dec 20, 2011 by Swift Elephant

r592c586d076f reverted change. Looks like we still need the smallest reproducible example.

Comment #20

Posted on Dec 20, 2011 by Happy Kangaroo

I'm staying with 2.1.5 since it fixes the painting issue for me. 2.1.6 broke it again.

Comment #21

Posted on Dec 20, 2011 by Happy Camel

Apparently, the fix is not working with PyQt v4.8.5 which is based on Qt 4.7.3. The thing is I did believe it was working with this configuration, otherwise I wouldn't have done this bugfix: I was tricked by the fact that PySide v1.0.9 (based on Qt 4.7.4) was also installed on my machine and Windows was using this version of the Qt DLLs instead of those shipped with PyQt v4.8.5... so I was very surprised yesterday when I found out that it was not working at home with the exact same configuration, but it suddenly was after installing PySide v1.0.9...

So, Steve, I see you are using PyQt v4.8.6 which is also based on Qt 4.7.4. So I guess that the bugfix only works with PyQt 4.8.6+ and PySide 1.0.9+ (maybe 1.0.8+ but I don't know for sure). Anyway I don't regret reverting this changeset as this whole issue is probably a Qt bug.

We have to come up with a small test script, I agree. I'll try to write something if I can spare a minute or two.

As for the workaround, I think that, given the unexpected behaviors on Windows and the suspicious output in terminal on Unix-like platforms, the wisest solution is probably to abandon the "Qt.Windows flag" approach and to try another way. This might be to systematically attach all windows to Spyder's main window when quitting (saving their original state: attached or not) and then, when restarting, restore all the windows within the main window first and only then restore their floating state. This might be worth trying.

Comment #22

Posted on Dec 29, 2011 by Happy Camel

I'm also thinking of adding an option in the Preferences dialog box to select the dockwidgets flag: Qt.Widget (default) or Qt.Window (will fix this issue on some configurations, as mentioned in my previous comment). Any change of this option will require Spyder to be restarted to take effect.

Steve, with this option available in v2.1.7, you will be able to upgrade your Spyder installation.

Comment #23

Posted on Dec 29, 2011 by Swift Elephant

My opinion that it is too hackish and overloads Spyder interface with too much obscure details.

Comment #24

Posted on Dec 29, 2011 by Happy Camel

You're probably right. As for the workaround I've suggested in comment 21, I'm not sure it would be a good solution: it would induce a lot of flickering.

Comment #25

Posted on Dec 29, 2011 by Swift Elephant

If we have a test script, we will be able to:

  1. Fill a bug at Qt
  2. Compose a blacklist of Qt/PyQt versions
  3. Implement workarounds for Qt/PyQt and periodically test them against newer versions

Right now I am not even sure what Qt.Windows flag does, how it should work and what is broken with it. Test script will not only help me understand what's going on, but also to explain upstream.

Comment #26

Posted on Jan 3, 2012 by Happy Camel

This issue was updated by revision f1fd0bdbdd3b.

This workaround should be sufficient to avoid the following Qt bugs: * Floating QDockwidget objects are not painted when their state is restored using the following command in spyderlib/spyder.py: self.restoreState( QByteArray().fromHex(str(hexstate)) ) * QDockWidget objects do not work with flags other than Qt.Widget on certain platforms or versions of Qt (so the Qt.Window flag workaround do not work)

Of course we still have to write minimalist test scripts reproducing these bugs and report them to Qt developers.

Comment #27

Posted on Jan 4, 2012 by Happy Camel

This issue was updated by revision 322cdf3e78dd.

/ This workaround works better and is clever/simpler.

Comment #28

Posted on Feb 17, 2015 by Quick Horse

This issue was migrated to https://github.com/spyder-ide/spyder/issues/

The issue number is exactly the same

Status: Fixed

Labels:
Type-Defect Priority-Medium Cat-SpyderGUI Restrict-AddIssueComment-Commit