Skip to content

Use HiDPI icons for PyQt5 #5057

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

Closed
wants to merge 1 commit into from

Conversation

astrofrog
Copy link
Contributor

This partially addresses #4978, by adding and using HiDPI PNG icons for the PyQt5 framework.

Before:

mb_before

After:

mb_after

Note that I had to adjust the toolbar height and spacing because otherwise it ended up more condensed than before for some reason.

Note: I'm not aware of a reliable way to determine the DPI of a display so at the moment this always uses the HiDPI icons when using PyQt5. It would be great if someone could check that this still looks fine (and no worse than before)

@astrofrog
Copy link
Contributor Author

I've found a way to figure out whether we need to use the HiDPI icons (i.e. what the screen resolution is). I'll work on it later this week.

@tacaswell
Copy link
Member

It looks like qt understands svg, could we use those instead of hi-res pngs?

http://doc.qt.io/qt-5/qimagereader.html#supportedImageFormats

@astrofrog
Copy link
Contributor Author

@tacaswell - ah, certainly! I had not realized that. I will work on that in a few days.

@astrofrog
Copy link
Contributor Author

@tacaswell - although it looks like this was actually changed from SVG to PNG in the past for Qt4:

c61df40

#143

http://sourceforge.net/p/matplotlib/mailman/matplotlib-users/thread/4D4EA423.5090802@vanderHoeven.biz/

Sounds like this caused some issues on Windows? This was 4 years ago though, so maybe things have changed?

@tacaswell
Copy link
Member

attn @jbmohler @mfitzp Do either of you have experience with py2exe + qt ?

@astrofrog
Copy link
Contributor Author

@tacaswell - how do you think we should proceed on this? Is there anyone else who might be able to advise on what to do here re: PNG vs SVG?

@tacaswell
Copy link
Member

I am not sure, py2exe seems to be a persistent thorn in our side in general and I have no windows experience.

I know @jrevans has recently done a lot of work porting a Qt app over to Qt5, he might have some insight here (not sure what platform they run on).

@mfitzp
Copy link
Member

mfitzp commented Oct 12, 2015

@tacaswell I've not used py2exe before. But from the mailing list link it looks like the change to PNG was more due to a packaging issue (i.e. py2exe wasn't bundling the required xml handler). I have a Windows machine available I can test this on. On Qt5 Svg I think rendering is handled by a separate Qt.Svg module so I suspect there will be the same problem, but with a different fix. There are also the image format plugins that may need to be triggered.

Making this work may just be a case of including the Svg/other import in our qt_compat.py. The linked post says that this didn't work, but that may be a case of where to do the import + what exactly to import.

@fariza
Copy link
Member

fariza commented Nov 19, 2015

We are adding more files to lib/matplotlib/mpl-data/images/ without any organization or control.

I really don't like the hand adding of icons of different sizes and hand naming is even worst.

Why don't we use a script to convert the source svg to different sizes automatically at build, generating different 40x40_, 60x60_... 1280x1280_ or small_, medium_... xxlarge_?

With an automatic icon creation, we are sure the size that we are requesting in the format that we are requesting will be there.

@mdboom
Copy link
Member

mdboom commented Dec 6, 2015

With an automatic icon creation, we are sure the size that we are requesting in the format that we are requesting will be there.

Just FYI: I'm working on this.

@mdboom mdboom mentioned this pull request Dec 6, 2015
@astrofrog
Copy link
Contributor Author

astrofrog commented Jun 10, 2016

I think this is now fixed in master? (with the new icons)

@jenshnielsen
Copy link
Member

Confirming that Qt5Agg and the OSX backend have HiDPI icons on HiDPI screens Thanks @astrofrog

@QuLogic QuLogic modified the milestones: 2.0 (style change major release), 2.1 (next point release) Nov 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants