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
Initial plan.
1a. Change AboutDialog to mimic query.Query with respect to _utest and suppression of dialog display and waiting.
1b. Create AboutDialog instance.
2a. Change textview.TextViewer as with AboutDialog. Also change textview functions and AboutDialog methods to pass on _utest.
2b. Simulate keyclicks on buttons and test that root gains appropriate child. Then destroy it.
3. At some point, remove dead code and change now incorrect encoding comment.
Separate issue: add simulated button click tests to test_textview and other popup dialogs. Directly calling commands does not test that buttons invoke the right command.
A. Move code and tests into help.py and test_help.py.
B. Improve content: 1) bpo-25224; 2) remove or update credits;
3) reconsider each item.
C. Improve appearance: 1) ttk widgets; 2) Redo entire look.
I take 'fun' to mean you will try something. And yes, I have thought about the following for all IDLE modules.
Replace "from tkinter import *". It was mainly intended for interactive use. In production IDLE, use either
a. from tkinter import Tk, Frame, Label, Button, <constants>
b. import tkinter as tk
6a requires more typing in the import statement, but as a replacement, leaves the rest of the code alone. It documents what widgets will be used in the module. It allows individual classes to be mocked for a particular test or group of tests. I know I have done this for the tkinter TypeVar classes.
6b has a short import but requires more typing in the module body, especially when tkinter constants are present, as they are here.
When exploring or writing short, one-off programs, I usually use 'as tk'. But for IDLE, I may have converted at least one file to 'as tk', but I am now using 'import Tk, ...' and prefer it.
My current thoughts about Tkinter constants versus string literals, such as BOTH versus 'both': The two forms by themselves are about equally easy to type. The CAPS form is shorter but louder, whereas to me they are minor items that should not be loud. The constants seem designed to work with 'import *'; one can then potentially use name completion for the longer names. After 'as tk', I think "tk.Both" is worse than "'both'". For new code with explicit imports, adding constants to the imports is extra work. For existing code with many constants, such as help_about, adding constants to the imports is less work than converting. So I am inclined to leave them as are until such time as we might do a search-replace throughout idlelib.
When there are a few constants, I have put them after the classes. For this module, I would like to try a separate import rather than use '\' line continuation.
In one file with just two constants, I initially converted to the quoted literal, but another core dev objected on the basis that the constants are checked when the function is compiled instead of when called, and that this is somehow safer. For when issue comes up again, I am recording my current replies here.
The same logic would suggest that we should write, for instance, "open(filename, mode=W, encoding=ASCII, errors=STRICT)" (after appropriate imports) instead of the current "open(filename, mode='w', encoding='ascii', errors='strict')".
If running a file to do a test compile also does a test call of create-widget functions, then the objection does not apply. For every IDLE file that creates tk windows, there is an htest, initiated by running the file, that creates an instance of the window. The first purpose is to insure that widget creation calls are legitimate. The unit tests will eventually do the same, as in 1b above. (The second purpose, not duplicated by unittests, is to see if the result 'looks good'.)
mlouielu commented on May 21, 2017
mlouielumannequin
Mannequin
More actions
Due to the merged of bpo-30303, text_view now have _utest attribute for unittest, upload the unittest of help_about dialog in PR 1697
Louie, at first glance, this appears to implement the remaining changes in 1 and 2.
A possible problem is that I expect the needed 'self.' additions will conflict with the name changes on the same lines that Cheryl said she would do, about 10 hours ago. Cheryl, if you have not yet started your patch, hold off for now, until I can properly review Louie's patch.
Oh, I had started to make the changes, but that's OK. I'm still doing discovery too. 'Fun' did mean that I'll try something. This is exactly what I wanted to work on to dive into tkinter and idle, so I got excited.
Louie, just to coordinate, are you working on other items that Terry listed here?
Terry, should I do each item in its own PR for quick review or should I try to do many at once in a single PR? I was doing both the name changes and docstrings (and now maybe the import change) in one PR, but maybe that's too much?
mlouielu commented on May 21, 2017
mlouielumannequin
Mannequin
More actions
Cheryl: yes, I may work on 4a/4b and msg294004 on Monday, or do you start at these tasks?
I would like to review and apply all the non-test changes, 4,5,6 in one PR, and add 3 since I know what I meant. There can be multiple commits in one PR though.
Louie, from bpo-30422 and a tracker search, you can see that there is lots to do, for more that 1 or even 2 people. I think 4,5,6 are a good way for Cheryl to start with IDLE. Other files need similar changes that do not need your tkinter skills.
If you are looking for a useful challenge, there are 12 open IDLE debugger issues + some enhancements debugger ideas I have not bothered to post yet. If that does not interest you, I can try to suggest something else after I get up again.
I expect to be away from my computer on my Monday.
While reviewing, I decided to draw a widget tree. I believe it would have been easier if packs and grids were grouped.
I want to continue with 'IDLE: modernize help-about' and ditto for textview. The help_about issue can begin with ttk conversion: change imports and remove an invalid option or two. The textview issue can begin with the still missing docstrings. I want to refactor both the way I discussed in the roadmap issue: make separate Toplevel and Frame subclasses. The Toplevel subclass instance creates a Frame subclass instance which becomes an attribute of the toplevel. Help.py already has this structure.
A follow-up to my brief remarks about revamping About IDLE, in msg294298: idle-dev is subscription-required public forum for discussion of idle design issues. It has been dormant for a year and a half, but I would like to revive it to get broader user input. By coincidence, the first new post (held since April because the author is not subscribed) is a suggestion for AboutIDLE. In my second response, I listed 9 possible or definite changes. I would like that to be where we plan a future 'Modernize About IDLE' issue.
This became a meta-issue, which was awkward on bpo because of not being able to edit the todo list and add completion checkmarks and the issue in-place. I need to review this and other IDLE tracking/meta-issues and replace with up-to-date GH task lists. (Link is for me.)
Activity
terryjreedy commentedon May 6, 2017
Initial plan.
1a. Change AboutDialog to mimic query.Query with respect to _utest and suppression of dialog display and waiting.
1b. Create AboutDialog instance.
2a. Change textview.TextViewer as with AboutDialog. Also change textview functions and AboutDialog methods to pass on _utest.
2b. Simulate keyclicks on buttons and test that root gains appropriate child. Then destroy it.
3. At some point, remove dead code and change now incorrect encoding comment.
Separate issue: add simulated button click tests to test_textview and other popup dialogs. Directly calling commands does not test that buttons invoke the right command.
terryjreedy commentedon May 20, 2017
4a. Change uglyMidcap widget names and CamelCase function names to pep8_conformant names. Simplify: byline, email, docs, pyver, tkver, idlever, py_license, py_copyright, py_credits, readme, idle_news, idle_credits.
4b. Change CamelCase function names to pep8_conformant names.
ShowIDLEAbout => show_readme,
For show_xyz functions, "Command for xyz button"? even though not verb?
bpo-30303 implemented 2a, improve textview and tests.
Cheryl: this should be much easier than colorizer. Let me know if you want to take a stab at at least 4 and 5.
terryjreedy commentedon May 20, 2017
Follow-up issues.
A. Move code and tests into help.py and test_help.py.
B. Improve content: 1) bpo-25224; 2) remove or update credits;
3) reconsider each item.
C. Improve appearance: 1) ttk widgets; 2) Redo entire look.
csabella commentedon May 20, 2017
This looks like fun! :-) I'll let you know if I have any questions.
csabella commentedon May 21, 2017
Terry,
Is there interest in changing the 'from tkinter import *'?
terryjreedy commentedon May 21, 2017
I take 'fun' to mean you will try something. And yes, I have thought about the following for all IDLE modules.
a. from tkinter import Tk, Frame, Label, Button, <constants>
b. import tkinter as tk
6a requires more typing in the import statement, but as a replacement, leaves the rest of the code alone. It documents what widgets will be used in the module. It allows individual classes to be mocked for a particular test or group of tests. I know I have done this for the tkinter TypeVar classes.
6b has a short import but requires more typing in the module body, especially when tkinter constants are present, as they are here.
When exploring or writing short, one-off programs, I usually use 'as tk'. But for IDLE, I may have converted at least one file to 'as tk', but I am now using 'import Tk, ...' and prefer it.
My current thoughts about Tkinter constants versus string literals, such as BOTH versus 'both': The two forms by themselves are about equally easy to type. The CAPS form is shorter but louder, whereas to me they are minor items that should not be loud. The constants seem designed to work with 'import *'; one can then potentially use name completion for the longer names. After 'as tk', I think "tk.Both" is worse than "'both'". For new code with explicit imports, adding constants to the imports is extra work. For existing code with many constants, such as help_about, adding constants to the imports is less work than converting. So I am inclined to leave them as are until such time as we might do a search-replace throughout idlelib.
When there are a few constants, I have put them after the classes. For this module, I would like to try a separate import rather than use '\' line continuation.
In one file with just two constants, I initially converted to the quoted literal, but another core dev objected on the basis that the constants are checked when the function is compiled instead of when called, and that this is somehow safer. For when issue comes up again, I am recording my current replies here.
The same logic would suggest that we should write, for instance, "open(filename, mode=W, encoding=ASCII, errors=STRICT)" (after appropriate imports) instead of the current "open(filename, mode='w', encoding='ascii', errors='strict')".
If running a file to do a test compile also does a test call of create-widget functions, then the objection does not apply. For every IDLE file that creates tk windows, there is an htest, initiated by running the file, that creates an instance of the window. The first purpose is to insure that widget creation calls are legitimate. The unit tests will eventually do the same, as in 1b above. (The second purpose, not duplicated by unittests, is to see if the result 'looks good'.)
mlouielu commentedon May 21, 2017
Due to the merged of bpo-30303, text_view now have _utest attribute for unittest, upload the unittest of help_about dialog in PR 1697
terryjreedy commentedon May 21, 2017
Louie, at first glance, this appears to implement the remaining changes in 1 and 2.
A possible problem is that I expect the needed 'self.' additions will conflict with the name changes on the same lines that Cheryl said she would do, about 10 hours ago. Cheryl, if you have not yet started your patch, hold off for now, until I can properly review Louie's patch.
csabella commentedon May 21, 2017
Oh, I had started to make the changes, but that's OK. I'm still doing discovery too. 'Fun' did mean that I'll try something. This is exactly what I wanted to work on to dive into tkinter and idle, so I got excited.
Louie, just to coordinate, are you working on other items that Terry listed here?
Terry, should I do each item in its own PR for quick review or should I try to do many at once in a single PR? I was doing both the name changes and docstrings (and now maybe the import change) in one PR, but maybe that's too much?
mlouielu commentedon May 21, 2017
Cheryl: yes, I may work on 4a/4b and msg294004 on Monday, or do you start at these tasks?
terryjreedy commentedon May 21, 2017
I am about to go to bed, way late.
I would like to review and apply all the non-test changes, 4,5,6 in one PR, and add 3 since I know what I meant. There can be multiple commits in one PR though.
Louie, from bpo-30422 and a tracker search, you can see that there is lots to do, for more that 1 or even 2 people. I think 4,5,6 are a good way for Cheryl to start with IDLE. Other files need similar changes that do not need your tkinter skills.
If you are looking for a useful challenge, there are 12 open IDLE debugger issues + some enhancements debugger ideas I have not bothered to post yet. If that does not interest you, I can try to suggest something else after I get up again.
I expect to be away from my computer on my Monday.
7 remaining items
terryjreedy commentedon May 27, 2017
While reviewing, I decided to draw a widget tree. I believe it would have been easier if packs and grids were grouped.
I want to continue with 'IDLE: modernize help-about' and ditto for textview. The help_about issue can begin with ttk conversion: change imports and remove an invalid option or two. The textview issue can begin with the still missing docstrings. I want to refactor both the way I discussed in the roadmap issue: make separate Toplevel and Frame subclasses. The Toplevel subclass instance creates a Frame subclass instance which becomes an attribute of the toplevel. Help.py already has this structure.
csabella commentedon May 28, 2017
Thanks Terry. I've submitted a PR for the textview docstrings and PEP-8 names and I'll work on the ttk conversion and the refactoring.
terryjreedy commentedon May 28, 2017
pr 1839 is now attached to new issue bpo-30495. This issue is closed except for trivial bugs in the two merged PRs and backports.
terryjreedy commentedon Jun 6, 2017
A follow-up to my brief remarks about revamping About IDLE, in msg294298: idle-dev is subscription-required public forum for discussion of idle design issues. It has been dormant for a year and a half, but I would like to revive it to get broader user input. By coincidence, the first new post (held since April because the author is not subscribed) is a suggestion for AboutIDLE. In my second response, I listed 9 possible or definite changes. I would like that to be where we plan a future 'Modernize About IDLE' issue.
terryjreedy commentedon Jun 10, 2017
New changeset 12cbd87 by terryjreedy in branch '3.6':
[3.6] bpo-30290: IDLE - PEP-8 names and tests for help-about (bpo-2070)
12cbd87
terryjreedy commentedon Jan 17, 2019
Postscript: this test that the retrieved text has at least two lines caught a bug in the new Windows Store python distribution.
The license file was missing and the backup default had only one line.
bpo-35683, msg333891
erlend-aasland commentedon Jul 25, 2022
The following PRs were merged:
Are there more work to be done here? If not, this could be closed.
terryjreedy commentedon Jul 25, 2022
This became a meta-issue, which was awkward on bpo because of not being able to edit the todo list and add completion checkmarks and the issue in-place. I need to review this and other IDLE tracking/meta-issues and replace with up-to-date GH task lists. (Link is for me.)