Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure PyQt5 is supported #663

Merged
merged 18 commits into from
Nov 19, 2015
Merged

Make sure PyQt5 is supported #663

merged 18 commits into from
Nov 19, 2015

Conversation

astrofrog
Copy link
Member

@astrofrog
Copy link
Member Author

@astrofrog
Copy link
Member Author

Note that to get PyQt5 to work at all, I needed to do https://github.com/conda/conda-recipes/issues/385

@astrofrog
Copy link
Member Author

Stuck on this very frustrating error:

glue/qt/widgets/mpl_widget.py:38: in wrapper
    result = func(*args, **kwargs)
glue/core/application_base.py:72: in new_data_viewer
    c = viewer_class(self._session)
glue/qt/widgets/histogram_widget.py:46: in __init__
    super(HistogramWidget, self).__init__(session, parent)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <glue.qt.widgets.histogram_widget.HistogramWidget object at 0x12f035180>
session = <glue.core.session.Session object at 0x12e99a4d0>, parent = None

    def __init__(self, session, parent=None):
        """
            :type session: :class:`~glue.core.Session`
            """
>       QMainWindow.__init__(self, parent)
E       TypeError: __init__() takes exactly 2 arguments (1 given)

Even though I am passing two arguments. However it's possible parent no longer takes None as an argument but that still wouldn't explain error message

@astrofrog
Copy link
Member Author

So inverting the order of inheritance for DataViewer to:

class DataViewer(ViewerBase, QMainWindow):

fixed that issue, somehow. Not 100% I understand at this point.

@astrofrog
Copy link
Member Author

Only two failing tests...

@astrofrog
Copy link
Member Author

Need to set the following to get HiDPI icons:

app.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps);

@astrofrog
Copy link
Member Author

Main to-dos:

  • Move changes from glue.external.qt to qt_helpers
  • Check how icons look on non-HiDPI display
  • Get all tests passing
  • Check that we don't break anything on PyQt4

@astrofrog
Copy link
Member Author

The following will be required for Matplotlib icons to look good in PyQt5: matplotlib/matplotlib#5057

@@ -243,7 +244,11 @@ def __init__(self, data_collection, parent=None):
# without this reference, PySide clobbers instance
# data of model items
self.register_to_hub(self.data_collection.hub)
self.setSupportedDragActions(Qt.CopyAction)
if not is_pyqt5():
self.setSupportedDragActions(Qt.CopyAction)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does Qt5 not support this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does but I had to add a method now, see a few lines down.

@astrofrog
Copy link
Member Author

There were issues with the existing PyQt5 packages for conda, so I made a Docker image in which to build my own: https://hub.docker.com/r/astrofrog/ubuntu-12.04-conda-pyqt5-builder/ - the conda package can be installed with conda install -c astrofrog pyqt5. Fingers crossed that it works.

@astrofrog
Copy link
Member Author

lotr-victory

@astrofrog
Copy link
Member Author

Well, this took a while :-/

🎉

astrofrog added a commit that referenced this pull request Nov 19, 2015
Make sure PyQt5 is supported
@astrofrog astrofrog merged commit 9d5bf46 into glue-viz:master Nov 19, 2015
@ChrisBeaumont
Copy link
Member

Nicely done!

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants