gh-77578: IDLE Help - let users control font size#6665
Conversation
|
I have made the requested changes; please review again. |
Sorry, something went wrong.
|
Thanks for making the requested changes! @terryjreedy: please review the changes made to this pull request. |
Sorry, something went wrong.
terryjreedy
left a comment
There was a problem hiding this comment.
You can leave the one suggested code change until I retest and recheck code. 3.7.0c1 is scheduled next Tues, but I don't want to rush this without test on Mac. I really must try out devguide instructions with a small MacBook portable I was given.
Sorry, something went wrong.
There was a problem hiding this comment.
We started with this code, extracted from turtledemo.main.
# Menu bindings (which we might use for context menu)
menu.add_command(label="Decrease (C-'-')", command=self.decrease_size,
font=menufont)
menu.add_command(label="Increase (C-'+')", command=self.increase_size,
font=menufont)
# Key/mouse bindings
text.bind_all('<%s-minus>' % shortcut, self.decrease_size)
text.bind_all('<%s-underscore>' % shortcut, self.decrease_size)
text.bind_all('<%s-equal>' % shortcut, self.increase_size)
text.bind_all('<%s-plus>' % shortcut, self.increase_size)
text.bind('<Control-MouseWheel>', self.update_mousewheel)
text.bind('<Control-Button-4>', self.increase_size)
text.bind('<Control-Button-5>', self.decrease_size)
# Event/action functions
darwin = sys.platform == 'darwin'
def set_txtsize(self, size):
txtfont[1] = size
self.text['font'] = tuple(txtfont)
self.output_lbl['text'] = 'Font size %d' % size
def decrease_size(self, dummy=None):
self.set_txtsize(max(txtfont[1] - 1, MINIMUM_FONT_SIZE))
return 'break'
def increase_size(self, dummy=None):
self.set_txtsize(min(txtfont[1] + 1, MAXIMUM_FONT_SIZE))
return 'break'
def update_mousewheel(self, event):
# For wheel up, event.delta = 120 on Windows, -1 on darwin.
# X-11 sends Control-Button-4 event instead.
if (event.delta < 0) == (not darwin):
return self.decrease_size()
else:
return self.increase_size()
As far as I know, menu, keyboard, and mouse methods work on all three major systems. There are no pseudoevents. To the extent possible, the meaning of actions is determined by their bindings.
Note: the code above is extracted from 4 different locations. This is the first time I have looked at it altogether.
At my request, Cheryl combined and consolidated the functions into one zoom handler. At Tal's request, she partly undid what I had requested. Zoom() has been separated into multiple functions again. However, I prefer the original code to the result. If we don't agree on reverting to the original design, lets discuss.
Sorry, something went wrong.
|
When I looked back through my original commits and Terry's comments, I thought the main issue was that I was using lambda and sending another parameter to the |
Sorry, something went wrong.
|
My apologies, @terryjreedy and @csabella. I wasn't aware of Terry's request to consolidate the zoom handling into a single handler. Cheryl, please do as Terry has requested, as he has the final say on these matters. |
Sorry, something went wrong.
|
Tal, I assumed that you had not gone through all the hidden 'outdated' comments. In the future, perhaps I should give better summary reviews as they should be easier to find. In any case, I welcome your review of all IDLE issues. Your dislike of zoom got me to take another look. I partly like it, but partly not. It is okay with me if we occasionally try a refactoring and decide against it. I responded about pseudoevents and handler names on the May 17 comment on line 180. |
Sorry, something went wrong.
It conflicted with my requested changes.
|
@terryjreedy, on the contrary, I should just take more care to read all of the previous discussion. You've got more than enough on your plate, you shouldn't bother to write summaries when the reviews are there to be read. |
Sorry, something went wrong.
terryjreedy
left a comment
There was a problem hiding this comment.
Current requested changes: Reverse previous request to combine turtledemo functions into zoom(). However, add psuedoevents '<<increase_font_size>>' and '<<decrease_font_size>>', use the same names for the handler functions. Don't use *[] in event add. Use original mouse logic.
Use pseudoevents for testing. Don't worry about key-mouse events now.
Sorry, something went wrong.
* Remove use of callback to adjust fonts in tags. * Adjust tag font sizes the same as the main font. * TODO: Tags don't retain ratio, so after they all go to min size, they don't recover original ratios.
* Originally resized Font objects, but now can resize fonts defined as tuples.
|
I summarized 'remaining issues' on Sept 8, 2018, and added more on Sept 23 and Dec 14. I need to check all against current code updated since then. |
Sorry, something went wrong.
|
As far as I know, I had made all the requested changes and I had tried to keep up with rebasing. |
Sorry, something went wrong.
|
This missed the boat for inclusion in Python 3.9 which accepts security fixes only as of today. |
Sorry, something went wrong.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
edited by terryjreedy
LoadingUh oh!
There was an error while loading. Please reload this page.
Copy link Copy MarkdownSorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.