FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

FIX: Qt5 account for dpiratio as early as possible by tacaswell · Pull Request #9002 · matplotlib/matplotlib · GitHub

Repository navigation

FIX: Qt5 account for dpiratio as early as possible - #9002

Merged
efiring merged 2 commits into
matplotlib:masterfrom
tacaswell:fix_qt5_dpi_no_manager
Aug 14, 2017
Merged

efiring merged 2 commits into
matplotlib:masterfrom
tacaswell:fix_qt5_dpi_no_manager

Conversation

Copy link
Copy Markdown
Member

Previously, the canvas size would get set to too small because

  • in the FigureCanvasQt.init get_width_height is used to set
    the initial size of the canvas
  • get_width_height accounts for the dpiratio, but it has not been
    multiplied up yet so it reports half the size it should
  • this get propagated back down into the Figure object in the resize
    method
  • the dpi is then scaled up

This fix

  • moves adding the _original_dpi attribute to the Figure as
    soon as possible in the base init
  • calls _update_dpi before asking the figure how big it is

attn @djpine

Previously, the canvas size would get set to too small because
 - in the FigureCanvasQt.__init__ `get_width_height` is used to set
   the initial size of the canvas
 - `get_width_height` accounts for the dpiratio, but it has not been
   multiplied up yet so it reports half the size it should
 - this get propagated back down into the Figure object in the resize
   method
 - the dpi is then scaled up

This fix
 - moves adding the `_original_dpi` attribute to the Figure as
   soon as possible in the base __init__
 - calls `_update_dpi` before asking the figure how big it is

Closes matplotlib#8717
tacaswell added this to the 2.1 (next point release) milestone Aug 7, 2017
tacaswell requested review from anntzer and astrofrog August 7, 2017 04:33

Copy link
Copy Markdown
Contributor

I'll test this out this afternoon with my mixed resolution screen set-up

anntzer commented Aug 7, 2017

Copy link
Copy Markdown
Contributor

I won't be able to do proper reviews in the coming days due to spotty internet access, so please carry on without me. If someone is really courageous they can check how PRs such as this one interact with #8771 (cairo/qt5) and/or try to fix #8659 (causing some Qt-related tests to be skipped in some cases).

astrofrog left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This looks good and still works for me. Stylistically I find it unusual to have _update_figure_dpi before __init__ in FigureCanvasQT, but this is ultra-minor.

tacaswell added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Aug 7, 2017
The values in the test were the buggy values.  We expect a (5, 2) in
figure at 120 dpi to be (600, 240) screen pixels.

Copy link
Copy Markdown
Member Author

Turns out the number in the test were low due to the bug that this is fixing!

efiring merged commit 805d20c into matplotlib:master Aug 14, 2017
tacaswell deleted the fix_qt5_dpi_no_manager branch August 15, 2017 04:16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL