Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idle: improve idle.html help viewer. #69385

Closed
terryjreedy opened this issue Sep 21, 2015 · 13 comments
Closed

Idle: improve idle.html help viewer. #69385

terryjreedy opened this issue Sep 21, 2015 · 13 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes topic-IDLE type-feature A feature request or enhancement

Comments

@terryjreedy
Copy link
Member

BPO 25198
Nosy @terryjreedy, @roseman, @csabella
PRs
  • gh-77578: IDLE Help - let users control font size #6665
  • Superseder
  • bpo-33396: IDLE: Improve and document help doc viewer
  • Files
  • help-indent-fix.patch
  • top-of-window.diff
  • 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 = <Date 2018-05-01.05:56:33.652>
    created_at = <Date 2015-09-21.00:07:47.091>
    labels = ['3.8', 'expert-IDLE', 'type-feature', '3.7']
    title = 'Idle: improve idle.html help viewer.'
    updated_at = <Date 2018-05-01.05:56:33.648>
    user = 'https://github.com/terryjreedy'

    bugs.python.org fields:

    activity = <Date 2018-05-01.05:56:33.648>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2018-05-01.05:56:33.652>
    closer = 'terry.reedy'
    components = ['IDLE']
    creation = <Date 2015-09-21.00:07:47.091>
    creator = 'terry.reedy'
    dependencies = []
    files = ['40565', '40595']
    hgrepos = []
    issue_num = 25198
    keywords = ['patch']
    message_count = 13.0
    messages = ['251181', '251409', '251534', '251547', '251556', '251571', '251573', '251574', '251690', '251692', '251715', '315976', '315986']
    nosy_count = 4.0
    nosy_names = ['terry.reedy', 'markroseman', 'python-dev', 'cheryl.sabella']
    pr_nums = ['6665']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = '33396'
    type = 'enhancement'
    url = 'https://bugs.python.org/issue25198'
    versions = ['Python 2.7', 'Python 3.6', 'Python 3.7', 'Python 3.8']

    @terryjreedy
    Copy link
    Member Author

    I just pushed the new viewer as part of bpo-16893. Possible improvements:

    • Font size should initially reflect user's size choice. Possibly change with control-mousewheel. (Possible same for edit windows.)

    • Make within-file links work.

    • Make Find ^F work, even without menu entry.

    • Possible immediate bug fixes.

    @terryjreedy terryjreedy self-assigned this Sep 21, 2015
    @terryjreedy terryjreedy added the type-feature A feature request or enhancement label Sep 21, 2015
    @terryjreedy
    Copy link
    Member Author

    List indent glitch: In the command line section, after the box, idle.rst has

    If there are arguments:

    #. If -, -c, or r is used, all arguments are placed in
    sys.argv[1:...] and sys.argv[0] is set to '', '-c',
    or '-r'. No editor window is opened, even if that is the default
    set in the Options dialog.

    Firefox shows this as (but does not allow copying of '1. ')

    If there are arguments:

    1. If -, -c, or r is used, all arguments are placed in sys.argv[1:...] and sys.argv[0] is set to '', '-c', or '-r'. No editor window is opened, even if that is the default set in the Options dialog.
    

    The help window shows this, for example, (but not copy indent) as

    If there are arguments:

    • If -, -c, or r is used, all arguments are placed in sys.argv[1:...] and sys.argv[0] is set to
      '', '-c', or '-r'. No editor window is opened, even if that is the default set in the Options dialog.

    The point is not '1. ' versus '* ', this being the only place where idle.rst uses '#' for a list (and I changed this). The problem is the dedent of the second line. This only occurs if the second line starts with a font change. If I narrow the window so it begins with 'to', the line is indented properly. Narrow further so it begins with 'sys', no ident. I am pretty sure I have not touched your indent code. Any ideas on how to fix? or a tk glitch?

    @roseman
    Copy link
    Mannequin

    roseman mannequin commented Sep 24, 2015

    Have attached help-indent-fix.patch. Basically the parser is very fragile when it comes to combining tags, so the handling of the 'span .pre' was stomping on the indent tag. Separated out handling of character level tags (e.g. italic) from block level tags (e.g. lists, headings).

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 24, 2015

    New changeset 8b3dc527a62c by Terry Jan Reedy in branch '2.7':
    Issue bpo-25198: In Idle doc viewer, fix indent of fixed-pitch <pre> text
    https://hg.python.org/cpython/rev/8b3dc527a62c

    New changeset 1d0f4b94066b by Terry Jan Reedy in branch '3.4':
    Issue bpo-25198: In Idle doc viewer, fix indent of fixed-pitch <pre> text
    https://hg.python.org/cpython/rev/1d0f4b94066b

    @terryjreedy
    Copy link
    Member Author

    Fixed. I added a light background as with Sphinx html. I am delighted with how well this is working so far. I like the little always-there [TOC] button better than the browser sidebar. Besides making it easy to verify the look of doc changes, I think it looks better. I like the appearance of the tk version, without the down arrow, a bit better than the ttk version with an arrow, but would switch, when possible, if there were functional reason (see below).

    To improve the button: I want to add an activebackground (or foreground) so when moused over, the button is more obviously a live button to be pushed. Any particular suggestion? Is there a standard? Or do I worry too much? Idle buttons don't change when moused over, but they have relief to convey 'push me'.

    So that people can navigate without mouse, I tested adding takefocus=True to toc creation, takefocus=False to text, and toc.focus_set(). <space> (and <click>), <enter>, and <esc> work as expected. However the tk Menubutton (but not ttk version) seems to have a bug (at least here, ). After <space>, it is left in a 'pressed' state, with a black outline, while the menu is displayed, and after. (With <click> the outline and menu appear on button-press and the outline disappears on button-release, while the menu remains.) A click on the button is required to reset it and remove the outline. Then either <space> or <click> work as before. I tried an expanded command function to reset toc,
    def cmd(mark=tag):
    toc['state'] = 'disabled'
    toc['state'] = 'normal'
    text.see(mark)
    but this does not work. If this bug windows-only or general? Do you know of any other workaround to make the tk version work right? Since click-to-reset is not obvious, and defeats keyboard-only use, I will not enable focus when click-reset is needed.

    @terryjreedy
    Copy link
    Member Author

    Another minor glitch: in a browser, each press of up or down arrow, when there is no cursor (after clicking outside of an entry box like this one), moves text up or down. (3 lines for me in FF, even though wheel click moved more) In an editor, each press moves the *cursor* up or down one line, and text only moves when the cursor is at the top or bottom of the window. The read-only text has an invisible cursor, which one must invisibly move to top or bottom before anything happens.

    Some of the code with bpo-17535 might help, but not looking now.

    Another enhancement: use user set Initial Window size.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 25, 2015

    New changeset c1eccae07977 by Terry Jan Reedy in branch '2.7':
    Issue bpo-25198: Idle doc viewer now uses user width and height setting.
    https://hg.python.org/cpython/rev/c1eccae07977

    New changeset 1c119da20663 by Terry Jan Reedy in branch '3.4':
    Issue bpo-25198: Idle doc viewer now uses user width and height setting.
    https://hg.python.org/cpython/rev/1c119da20663

    @terryjreedy
    Copy link
    Member Author

    Had to adjust number of line by 3/4 because average 4/3 as high as in editor due to taller header lines and extra interline spacing. Net result for me, using 12 pitch in editor also, is box size within 5%.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 27, 2015

    New changeset 40bab637295d by Terry Jan Reedy in branch '2.7':
    Issue bpo-25198: When using the Idle dov TOC menu, put the section title at the
    https://hg.python.org/cpython/rev/40bab637295d

    New changeset 5b635a3ca3d5 by Terry Jan Reedy in branch '3.4':
    Issue bpo-25198: When using the Idle dov TOC menu, put the section title at the
    https://hg.python.org/cpython/rev/5b635a3ca3d5

    @terryjreedy
    Copy link
    Member Author

    By reading http://www.tcl.tk/man/tcl8.6/TkCmd/text.htm I discovered that Text.yview(index) puts the line with index at the top of the windows, given enough line below to fill the window. This fixes another glitch.

    Still left: the original 3 items (msg251181), navigating the text with up and down arrow (msg251571), and operating TOC button with keyboard (msg251556).

    @roseman
    Copy link
    Mannequin

    roseman mannequin commented Sep 27, 2015

    Good catch about yview for text widgets!

    @csabella
    Copy link
    Contributor

    I've created PR6665 for the first bullet item.

    • Font size should initially reflect user's size choice. Possibly change with control-mousewheel.

    @terryjreedy
    Copy link
    Member Author

    The files uploaded 2015-09-24 and 27 were merged later the same day. The merge in between on 2015-09-25 was shorter and not uploaded separately. I opened bpo-33396 as an index issue for the other items and any new ones. I open bpo-33397 for font sizing and changed the title of PR6665.

    @terryjreedy terryjreedy added 3.7 (EOL) end of life 3.8 only security fixes labels May 1, 2018
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes topic-IDLE type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants