python / cpython

The Python programming language
https://www.python.org
Other
63.5k stars 30.41k forks source link

IDLE: Document, fix, and complete configdialog font tests #75176

Closed terryjreedy closed 7 years ago

terryjreedy commented 7 years ago
BPO 30993
Nosy @terryjreedy, @ned-deily, @mlouielu, @csabella
PRs
  • python/cpython#2805
  • python/cpython#2818
  • python/cpython#2826
  • python/cpython#2831
  • python/cpython#2834
  • 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: ```python assignee = 'https://github.com/terryjreedy' closed_at = created_at = labels = ['expert-IDLE', 'type-feature', '3.7'] title = 'IDLE: Document, fix, and complete configdialog font tests' updated_at = user = 'https://github.com/terryjreedy' ``` bugs.python.org fields: ```python activity = actor = 'terry.reedy' assignee = 'terry.reedy' closed = True closed_date = closer = 'terry.reedy' components = ['IDLE'] creation = creator = 'terry.reedy' dependencies = [] files = [] hgrepos = [] issue_num = 30993 keywords = [] message_count = 14.0 messages = ['298862', '298878', '298882', '298884', '298888', '298902', '298907', '298908', '298909', '298913', '298920', '298926', '298928', '298930'] nosy_count = 4.0 nosy_names = ['terry.reedy', 'ned.deily', 'louielu', 'cheryl.sabella'] pr_nums = ['2805', '2818', '2826', '2831', '2834'] priority = 'normal' resolution = 'fixed' stage = 'resolved' status = 'closed' superseder = None type = 'enhancement' url = 'https://bugs.python.org/issue30993' versions = ['Python 3.6', 'Python 3.7'] ```

    terryjreedy commented 7 years ago

    This follows bpo-30981 and the comments on PR 2805 after the close notice.

    terryjreedy commented 7 years ago

    Patch ready for test on linux and review.

    csabella commented 7 years ago

    Works on linux. I just had one question on github about a test for sizelist and moving the initialization of the Tk variables into setUp.

    I also deleted a second comment that was just a wrong comment, but it's led me to another question.

    For test_indent_scale, you have the widget test and the changes test in the same place. I know you mentioned that you had thought about this before, but now that you have the widget tests for the font name, font bold, (and soon) font size, would there be any reason to split the test_font_set tests into the same place where each of the widgets is tested? That way, all the pieces of the graph flow would be in one place for each widget/Tk Variable/trace function.

    terryjreedy commented 7 years ago

    I am thinking that the tab title should be 'Font/Indent' rather than 'Font/Tabs' to avoid the confusion between the simulated file-folder tab that we click on and the tab key that indents. Opinions?

    But maybe the indent widget will be moved, eliminating the issue, or maybe more will be added, as part of converting 'extensions' to features, requiring a different rename. 'Reformat paragraph, also affect text layout.

    terryjreedy commented 7 years ago

    Yes, test_font_set could be split up. But then the setup would have to be repeated for each, and it would be harder to verify that each .set() call was being tested the same way.

    The event graph for indent_scale is a simple linear chain, and the simple liner test mirrors that.

    The combined test of bold_toggle and set_samples is not what I wanted, but I prefer it to the alternative of depending on an undocumented internal detail of the tcl wrapper maker (_tkinter, I suspect).

    csabella commented 7 years ago

    +1 on the Font/Indent name. And I agree that the indent widget would make more sense on the General tab, or another name, like Editor/Shell Preferences.

    Another thought I had was Fonts should maybe be part of a Theme. At the theme level (not at the tag level), define font name/font size and then have font bold at the tag level. Spyder has that, so the function names (IDLE tag of definition) are bolded and the rest aren't. It's subtle, but I find it pleasing to work with because function/class/method names stand out. That would be after everything else though.

    Another thought I had with the cycle in fonts: A wdiget is clicked on, which calls the tkinter command callback. But, the Tk variable is also updated which calls the trace function. Those are the two paths. What if the trace function called set_samples? Then font_bold and font_size widgets wouldn't need the command argument. I think opt_menu_highlight_target does that now because the command is commented out.

    instead of: click bold-toggle \~> set font_bold -> var_changed_font | \---> call set_sample

    this: click bold_toggle -> set font_bold -> var_changed_font -> set_sample

    terryjreedy commented 7 years ago

    New changeset 07ba305a4c169e017e076e490a173a6f9b95b38e by Terry Jan Reedy in branch 'master': bpo-30993: IDLE - Improve configdialog font page and tests. (bpo-2818) https://github.com/python/cpython/commit/07ba305a4c169e017e076e490a173a6f9b95b38e

    terryjreedy commented 7 years ago

    A big issue with changing to tagging individual elements is back compatibility. Besides which, if the font is not bold, I cannot imaging bolding anything other than the definition names. This also seems to venture beyond 'keep IDLE simple for beginners'. How about a new option to just bold definition names?

    Factoring out the call to set_samples to one place is a great idea that simplifies code and tests. I did it and the htest dialog worked just fine. The tests also passed as were, but need reworking. I am doing that now. The result will be one FontTest class that tests that each widget sets its var, tests that var setting adds changes and calls set_samples, and tests set_samples.

    terryjreedy commented 7 years ago

    New changeset 5aa3bf041de5ee90ccbfcff103dcf3e54c5af237 by Terry Jan Reedy in branch '3.6': [3.6] bpo-30993: IDLE - Improve configdialog font page and tests. (GH-2818) (bpo-2826) https://github.com/python/cpython/commit/5aa3bf041de5ee90ccbfcff103dcf3e54c5af237

    terryjreedy commented 7 years ago

    2nd and presumably last PR for this issue: please verify on linux.

    csabella commented 7 years ago

    The tests pass on linux and the htest looks good. Thank you for making all these changes. It seems much clearer now, but I do want to spend more time reading the code to understand it. Looks like you grouped all the font-related functions, so they are ready to become a Class? The only part I couldn't figure out is how to update highlight_sample since it wouldn't be in the class.

    With the backwards compatibility, I thought maybe you have an idea about how to make the changes compatible because of the issue that moves the extensions. I can see where that would be a problem as far as making changes is concerned.

    Maybe I'll look at the creating tests for one of the other tabs next?

    terryjreedy commented 7 years ago

    New changeset 77e97ca9ff6f3dbbf98b89b4103c46b43eef5642 by Terry Jan Reedy in branch 'master': bpo-30993: IDLE - Improve configdialog font page and tests. (bpo-2831) https://github.com/python/cpython/commit/77e97ca9ff6f3dbbf98b89b4103c46b43eef5642

    terryjreedy commented 7 years ago

    Ned, in a comment on PR2826, Louie reported "The patch unittest work on Linux, but on MacOS, I get test.support.ResourceDeined: cannot run without OS X gui process, it is wierd, I'm inside the GUI mode.

    Also, I'm not sure if this only on MacOS (is font problem or what), when checking bold box, some font won't render to bold (I've check that this may not relative to patch, in older commit have this problem, too)."

    Have you run gui tests, and in particular, IDLE tests on OSX lately? Is the OSX code in test.support for GUI required still working?

    terryjreedy commented 7 years ago

    New changeset 1daeb259799d0664c9453a3bd8e80411e65b52c9 by Terry Jan Reedy in branch '3.6': [3.6] bpo-30993: IDLE - Improve configdialog font page and tests. (GH-2831) (bpo-2834) https://github.com/python/cpython/commit/1daeb259799d0664c9453a3bd8e80411e65b52c9