Skip to content

[2.7] bpo-31500: IDLE: Scale default fonts on HiDPI displays. (GH-3639)#6585

Merged
terryjreedy merged 11 commits into
python:2.7from
csabella:backport-a96c96f-2.7
Oct 20, 2018
Merged

[2.7] bpo-31500: IDLE: Scale default fonts on HiDPI displays. (GH-3639)#6585
terryjreedy merged 11 commits into
python:2.7from
csabella:backport-a96c96f-2.7

Conversation

@csabella

@csabella csabella commented Apr 24, 2018

Copy link
Copy Markdown
Contributor

(cherry picked from commit a96c96f

https://bugs.python.org/issue31500

@csabella

Copy link
Copy Markdown
Contributor Author

I didn't backport the changes to pyshell because that code doesn't exist in 2.7.

@serhiy-storchaka

Copy link
Copy Markdown
Member

Please include also changes from #3664.

@serhiy-storchaka

Copy link
Copy Markdown
Member

And seems fix_scaling() is never called.

@csabella

Copy link
Copy Markdown
Contributor Author

Please include also changes from #3664.

I couldn't include #3664 because that code isn't present in 2.7. In configdialog, the TabbedPageSet was changed to a Notebook, which originally had a width and height. #3664 removed the width and height, but the TabbedPageSet in 2.7 never had that.

@csabella

Copy link
Copy Markdown
Contributor Author

And seems fix_scaling() is never called.

Thanks. I couldn't backport the first call to fix_scaling() in pyshell, but I missed the second call, which should have been included. This should work now.

@serhiy-storchaka

Copy link
Copy Markdown
Member

It doesn't work because round() returns float in 2.7, but the font size option must be an integer.

  File "/home/serhiy/py/cpython2.7/Lib/idlelib/run.py", line 254, in fix_scaling
    font['size'] = round(-0.75*size)
  File "/home/serhiy/py/cpython2.7/Lib/lib-tk/tkFont.py", line 107, in __setitem__
    self.configure(**{key: value})
  File "/home/serhiy/py/cpython2.7/Lib/lib-tk/tkFont.py", line 139, in config
    *self._set(options))
_tkinter.TclError: expected integer but got "11.0"

@csabella

csabella commented Apr 25, 2018

Copy link
Copy Markdown
Contributor Author

It doesn't work because round() returns float in 2.7, but the font size option must be an integer.

Apologies for that. I'm not able to successfully build over the 2.7 branch, so I couldn't test this.

Update: I've finally figured out how to build 2.7! :-) I was able to call this on Ubuntu without any issues and it looked OK, but I never had the original HiDPI problem.

@terryjreedy

Copy link
Copy Markdown
Member

I caught the same two omissions as Serhiy did, and then saw your explanations. 2.7 does not have the 8.5 warning box in PyShell because the 8.5 requirement is new in 3.6.

@taleinat taleinat closed this Sep 10, 2018
@taleinat taleinat reopened this Sep 10, 2018
@taleinat

taleinat commented Sep 10, 2018

Copy link
Copy Markdown
Contributor

Ping, @terryjreedy. ISTM this should go in (assuming it works).

@vstinner

Copy link
Copy Markdown
Member

ping @terryjreedy again

@terryjreedy

Copy link
Copy Markdown
Member

The patch is likely needed on 2.7 for people with HiRes screens, but I am always nervous patching 2.7. A factor here is that 2.7 is built against 8.5 instead of 8.6, at least on Windows and Mac. Cheryl tested on Ubuntu. I will test on Windows. Tal, did you test on Mac? I presume Serhiy tested this on Linux with a HiRes screen and it worked fine.

@ned-deily

ned-deily commented Oct 20, 2018

Copy link
Copy Markdown
Member

A factor here is that 2.7 is built against 8.5 instead of 8.6, at least on Windows and Mac.

As of 2.7.15, the default python.org installer for macOS supplies its own 8.6.8, like the current 3.x installers do. The deprecated 32-bit/64-bit installers for 2.7.15 and 3.6.x still use 8.5.x at the moment. FWIW, I haven't noticed any resolution issues on current versions of macOS when smoke testing IDLE 3.x or 2.7.x.
https://www.python.org/download/mac/tcltk/

@terryjreedy

terryjreedy commented Oct 20, 2018

Copy link
Copy Markdown
Member

The patch should only make a difference (improvement) if one has a high DPI screen, which makes it hard to test. Anyway, IDLE looks fine on Windows. Anyway, I will merge this now and try to remember to ask if someone has tried IDLE on Mac before 2.7.16 is released.

@terryjreedy terryjreedy merged commit 18c44cc into python:2.7 Oct 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants