You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
IDLE: move Aqua context menu code to maxosx #71449
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/terryjreedy'closed_at=<Date2016-06-12.19:55:45.573>created_at=<Date2016-06-08.02:21:23.086>labels= ['expert-IDLE', 'type-feature']
title='IDLE: move Aqua context menu code to maxosx'updated_at=<Date2019-03-23.20:00:08.223>user='https://github.com/terryjreedy'
Put the AquaTk code added to pyshell.main in bpo-24801 where it should have gone originally. (My fault, ultimately.) See aqua_context.diff. This is a step in factoring main (currently about 170 lines) into a manageable number of function calls.
I will try to add a test that 1. creates an editor window with a 'fixed' root and mocked .right_click_event method, generates a right click, and checks the mock event handler; 2. creates a context menu, etc.
Serhiy, the docstring for .class_bind says "Bind to widgets with bindtag CLASSNAME". I have not and do not see 'bindtag' defined. Am I correct that it must refer to a tk widget class, rather than a python tkinter class, or subclass thereof?
"bindtag" is an arbitrary string. Usually this is a name of Tk widget class of or "all". bindtags() allows to retrieve or set a list of bindtags associated with a widget. By default they are: full path of a widget, name of Tk class of widgets, full path of a toplevel window, "all".
I am asking because I noticed that every editor windows gets the same set of bindings set and destroyed, (as in the other part of the bpo-24801 patch). Since events have a widget attribute, using bound methods with a self parameter is not necessary, so all the duplication seems redundant. But class_binding to Text is too broad. It there any way to register 'subclasses', similar to the way one can register style options as applying to a subset of, for instance, all Buttons?
[The light dawns, as the pieces connect together] The pseudoclass 'MyButton' would then consist of all widgets with 'MyButton' inserted into its bindtags list. Similarly for 'Editor'. I presume that a) tk has the equivalent of a master bind dict mapping bindtags to dicts mapping event sequences strings to event handlers, and b) .bind_class(cname, evseq, func) does the equivalent of "tagdict.get(cname, {})[evseq] = func".
I also notice that the introspective versions of .bind... call will let us discover the pre-defined bindings on difference systems and check our alterations. Anyway, thanks. I will experiment when ready to refactor bindings. In the meanwhile, I will apply the patch and close this.
I will add a test that calls setupApp, which would have failed with an error. I will also remove the call to _init_tk_type in setupApp, and let it be called when needed by the first isMacTk function called. Test code can partly simulate being on a particular type of Mac by setting _tk_type.
Activity
terryjreedy commentedon Jun 8, 2016
Put the AquaTk code added to pyshell.main in bpo-24801 where it should have gone originally. (My fault, ultimately.) See aqua_context.diff. This is a step in factoring main (currently about 170 lines) into a manageable number of function calls.
I will try to add a test that 1. creates an editor window with a 'fixed' root and mocked .right_click_event method, generates a right click, and checks the mock event handler; 2. creates a context menu, etc.
Serhiy, the docstring for .class_bind says "Bind to widgets with bindtag CLASSNAME". I have not and do not see 'bindtag' defined. Am I correct that it must refer to a tk widget class, rather than a python tkinter class, or subclass thereof?
serhiy-storchaka commentedon Jun 8, 2016
"bindtag" is an arbitrary string. Usually this is a name of Tk widget class of or "all". bindtags() allows to retrieve or set a list of bindtags associated with a widget. By default they are: full path of a widget, name of Tk class of widgets, full path of a toplevel window, "all".
terryjreedy commentedon Jun 8, 2016
I am asking because I noticed that every editor windows gets the same set of bindings set and destroyed, (as in the other part of the bpo-24801 patch). Since events have a widget attribute, using bound methods with a self parameter is not necessary, so all the duplication seems redundant. But class_binding to Text is too broad. It there any way to register 'subclasses', similar to the way one can register style options as applying to a subset of, for instance, all Buttons?
serhiy-storchaka commentedon Jun 8, 2016
I think you can just use bindtags().
terryjreedy commentedon Jun 8, 2016
[The light dawns, as the pieces connect together] The pseudoclass 'MyButton' would then consist of all widgets with 'MyButton' inserted into its bindtags list. Similarly for 'Editor'. I presume that a) tk has the equivalent of a master bind dict mapping bindtags to dicts mapping event sequences strings to event handlers, and b) .bind_class(cname, evseq, func) does the equivalent of "tagdict.get(cname, {})[evseq] = func".
I also notice that the introspective versions of .bind... call will let us discover the pre-defined bindings on difference systems and check our alterations. Anyway, thanks. I will experiment when ready to refactor bindings. In the meanwhile, I will apply the patch and close this.
python-dev commentedon Jun 8, 2016
New changeset 09ec7f7322b5 by Terry Jan Reedy in branch 'default':
Issue bpo-27262: move Aqua unbinding code, which enable context menus, to maxosx.
https://hg.python.org/cpython/rev/09ec7f7322b5
terryjreedy commentedon Jun 9, 2016
I am leaving this open to look into later adding an automated test for this to the new test_editmenu file that will be added for bpo-5124.
python-dev commentedon Jun 11, 2016
New changeset 374dd14cf0e5 by Ned Deily in branch 'default':
Issue bpo-27262: fix missing parameter typo
https://hg.python.org/cpython/rev/374dd14cf0e5
terryjreedy commentedon Jun 11, 2016
I will add a test that calls setupApp, which would have failed with an error. I will also remove the call to _init_tk_type in setupApp, and let it be called when needed by the first isMacTk function called. Test code can partly simulate being on a particular type of Mac by setting _tk_type.
terryjreedy commentedon Jun 12, 2016
Changeset d8a2b6efdd4a, bpo-27239, adds a test of setupApp in test_macosx that fails on any system, in particular mine, when Ned's fix is undone.