Support for Qt5#241
Conversation
|
This is awesome and very time-appropriate, as we were just discussing what might be needed for supporting Qt5 in TraitsUI. Thanks for kicking this off! In terms of how to proceed, it'd be great if we can minimize the amount of duplicated code just from the point of view of reducing maintenance costs going forward (eg. avoid having to fix the same bug in multiple places, if possible). Our tentative plan had been to see if we could manage to have one common qt4/qt5 codebase which avoided using new features of Qt5 for the near future - I'm not sure if that's possible or practical, but it Matplotlib can manage it, or something close to it, then there is hope! In fact, once PySide has solid support for Qt5, I'd be reasonably comfortable about deprecating Qt4. It's worth noting that this is similar to the plan for WxPython 3.0 support, which we recently merged experimental support for in PyFace and TraitsUI. In terms of testing, tests are indeed a bit skimpier than we might like for TraitsUI and Pyface, but I'm happy to merge a PR that has "experimental" Qt5 support as long as all tests run and any examples which run under Qt4 also run under Qt5. In addition, for Pyface, although there is a lot that is not tested, we've put in a fair bit of effort in the last couple of months to make sure that the core components now at least have basic smoke tests. The other obstacle to testing is that we recently switched to containerized Travis CI builds and Qt5 APT is not yet whitelisted (see travis-ci/apt-package-safelist#442), so Qt5 tests would need to build Qt5 and cache it in the container for the time being, which adds some complexity to the test infrastructure. So does the following seem reasonable to you (since you've been looking at the issue more closely than I have yet):
Once again, thanks for doing this! |
|
Dear Corran, good to hear you like that approach. Concerning your roadmap, I think that is feasible.
Frankly, I have difficulties understanding the toolkit selection process with all the automatic choices. So I can offer to go ahead, finish the porting to a single code base for both qt4 and qt5, using the qt5 syntax, with a layer in pyface.qt so it continues to work with qt4. Don't know how long this will take, but I will cry for help if I get stuck, especially with testing and fixing remaining issues. Gregor |
|
Hi, please go ahead, and please ask for any help you need. To answer your question about toolkit selection:
For testing, the easiest is to set the |
|
Dear Corran, I went ahead and got rather far. I think most of the porting to Qt5 is done and got to the final point: cry for help. Code is living on the the qt5_V2 branch of geggo/traitsui and geggo/pyface. You can switch between using qt4 and qt5 by setting QT_API to pyqt or pyqt5. Most tests passes, some traitsui demos fail, mostly due to the issues:
Most annoying is an issue, with my anaconda python using (this is used when I type in python) Qt5 fails with But with (this is used when I type in ipython on the console) no failure. Possibly some issue with the qt5/pyqt5 conda package I have installed. Gregor |
|
Hi @geggo Thanks for this once again. Unfortunately, I don't know about that issue - I may try to install Qt5 on my mac, but more likely I'll just work in my linux VM, since it's easier to work with for this sort of stuff, but if I have any insight, I'll let you know. Also, I see the pyface Qt5_v2 branch, but not the traitsui one. Did you push it to github, or am I missing something? |
forgot to push also to the geggo/traitsui repository, Qt5_v2 branch, now it’s there. Sorry for the confusion. I think the failures with PyQt5 I have seen are not directly related to pyface/traitsui, but to the way how the Qt5 library is installed within the anaconda environment and where it searches for plugins. I assume if you rely on a system wide Qt5 install they would go away. Gregor |
|
Excited to see TraitsUI moving fwd, cool... @geggo , have you tried setting $QT_PLUGIN_PATH=""? Or you could use the QtGui.QApplication.setLibraryPaths([]) before creating app. A more detailed conversation on the conda list that touches upon this topic is found here |
|
As a notice (@jf---), the failure I have seen when using Qt5 (on OS X with Anaconda Python, Qt5 installed via can be resolved by deleting with contents |
|
@geggo , I'm on conda as well, great to hear this is a way to sidestep the issue... |
|
It seems that the 408 line at traitsui/qt5/ui_base.py: |
|
@PAleksandrov, the development now happens at the traitsui/qt5_V2 branch of geggo/traitsui, there this issues (should) have been fixed. Sorry for the confusion. |
|
Closing as we have support for Qt5 vias Pyface at a more basic level. |
|
@corranwebster I'm looking into Qt5 support (or really take a stab at implementing it) for Mayavi and I'm a bit confused. I noticed that there is still this line: Even adding Or is "qt4" meant to be a misnomer, and Pyface is supposed to use PySide or PyQt5 to get Qt5 support, if available, even when "qt4" is supplied ...? (I have the latest This is mostly necessary because of recurring bugs we've had with using matplotlib and mayavi (which uses traitsui) concurrently (see many bug reports about "API QDate" and you'll see what I mean). I think qt5 would solve it, so it would be great to get it working. |
|
@larsoner -- I think I have already added support for Qt5 in Mayavi master, see enthought/mayavi#528 . |
|
Okay I'll try it and report there, thanks @prabhuramachandran (I guess the end result is that |
|
@larsoner -- IIRC, I think you need to set |
|
@larsoner Yes, for the time being It would be nice to allow |
|
Great, thanks for the info. Looks like it works when using PyQt5 + latest PyFace / Traits / TraitsUI. Now I'm having problems with segfaults but I think that's VTK's problem. |
Dear developers,
I had the feeling that the sands of Qt4 are running out, so I started adding support for PyQt5 to traitsui and pyface. This is not a serious pull request, yet unfinished, but I would like to get some feedback how to proceed. Some basic stuff such as text or range editors already work.
I started by copying the implementation from the qt4 backend, and then adding the necessary changes. Most of the changes are due to the splitting of the QtGui submodule of qt4 into QtGui and QtWidgets in qt5. These are mostly trivial and are performed by script. Then, where still in use, the old SIGNAL/SLOT connections need to be updated to the new style signals/slots.
Similar to what matplotlib did to support both qt4 and qt5, it is possible to use the same code, ported to qt5, for both qt4 and qt5, with a thin layer to make qt4 look like qt5. I think this would be the way to go also for traitsui/pyface. However, this implies that third party modules that rely on pyface.qt to import qt4 need to be modified to support the new module layout.
Any feedback, especially on the following issues is welcome:
Gregor