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: make editor title bar user configurable #65787

Open
terryjreedy opened this issue May 27, 2014 · 4 comments
Open

Idle: make editor title bar user configurable #65787

terryjreedy opened this issue May 27, 2014 · 4 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@terryjreedy
Copy link
Member

BPO 21588
Nosy @terryjreedy, @roseman
Files
  • title.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 = None
    created_at = <Date 2014-05-27.05:09:14.904>
    labels = ['3.8', 'expert-IDLE', 'type-bug', '3.7']
    title = 'Idle: make editor title bar user configurable'
    updated_at = <Date 2019-03-20.16:50:21.065>
    user = 'https://github.com/terryjreedy'

    bugs.python.org fields:

    activity = <Date 2019-03-20.16:50:21.065>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = False
    closed_date = None
    closer = None
    components = ['IDLE']
    creation = <Date 2014-05-27.05:09:14.904>
    creator = 'terry.reedy'
    dependencies = []
    files = ['35482']
    hgrepos = []
    issue_num = 21588
    keywords = ['patch']
    message_count = 4.0
    messages = ['219198', '219199', '219760', '223087']
    nosy_count = 4.0
    nosy_names = ['terry.reedy', 'markroseman', 'jesstess', 'Saimadhav.Heblikar']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'needs patch'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue21588'
    versions = ['Python 3.7', 'Python 3.8']

    @terryjreedy
    Copy link
    Member Author

    python/cpython#61592 changes the title bars for (so far), shell and editor windows. While the editor window change helps me (for reasons given on the issue) and got no objection, before being pushed, from people nosy on the issue, others have found it objectionable in practice. Since no one solution satisfies all use cases, I propose to make the editor_title format user configurable. Since extra keywords are ignored, as in
      >>> "{short}".format(short='abc', long='xyz')
      'abc'
    users can omit and arrange fields as they please in editor_title, which would then be called with all 3 variable field values. 
      editor_title.format(short=short, long=long, version=version)
    I believe editor_title = '{short} - {long}' produces the previous title. That can be the default.

    A complication is that EditorWindow is also the base window class for Shell and Output windows. The title is calculated and set in a generic
    def saved_change_hook(self): # line 921 in 3.3
    However, I believe that having non-empty short and long names is unique to editor windows (must recheck). If so. the format call could go in the second line of
    if short and long:
    title = short + " - " + long
    If untitled files were given a 'long' title of '(no file)', then they would be handled by the same clause. Explaining why a window is 'untitled' (no file to title it from) might be a benefit anyway.

    Some other possible solutions: Add parameter editor=False to saved_change_hook. Make EditorWindow a subclass of a generic Base Editor and move things specific to EditorWindow to the subclass.

    @terryjreedy terryjreedy self-assigned this May 27, 2014
    @terryjreedy terryjreedy added the type-bug An unexpected behavior, bug, or error label May 27, 2014
    @terryjreedy
    Copy link
    Member Author

    Another possibility is to separate the calculation of the title from setting it. This would make it much easier to unittest the calculation of the title.

    @SaimadhavHeblikar
    Copy link
    Mannequin

    SaimadhavHeblikar mannequin commented Jun 4, 2014

    Attaching a patch to make title bar user configurable.

    In this patch
    The title bar is configurable for PyShellEditorWindow(EditorWindow), PyShell and OutputWindow.
    The user may add the following parameters -

        py_major_version (3)
        py_minor_version (4)
        py_patchlevel (1+)
        tk_version (8.5)
        tcl_version (8.5)
        filename (sample.py)
        dir_path (/media/dev/)
        full_path (/media/dev/sample.py)
        modified_asterik (if/not saved '*')
    

    These parameters are configurable by going to "options"->"configure idle"->"general tab"->"configure"
    The above parameters have to inserted between {} as {tk_version}

    The fetching of title is done by a utility function called get_title.
    Redundant methods short_title and long_title have been removed.

    Default config titles for PyShellEditorWindow, PyShell and OutputWindow have been inserted into config-main.def. This is based on my preferences. It may be very different from what the community/idle userbase requires. These settings have to be changed to suit the tastes of community/idle userbase.

    A new module called configTitle. This contains a getTitleDialog class. It is modeled along the lines of cfgSectionNameDialog and cfgSectionHelpSourceEdit dialog.

    In configDialog.py,in "general tab", a new section for configuring title bar has been added. Clicking "configure" brings up a "getTitleDialog" dialog, where the user can modify the title. A simple validity check is also performed. As best possible, the GUI additions are in close sync with the existing code around it(except in ConfigureTitleBar).

    And to whats missing,

    1. Bettor error messages could be shown to user
    2. Better help text to user in the config dialog,
    3. Better UI/UX for configDialog
    4. Tests!
    5. ConfigureTitleBar() could be rewritten, say once we have a good picture of whats needed/not needed/to be removed etc.

    @terryjreedy
    Copy link
    Member Author

    I decided that it would be better to try to quickly solve Raymond's issue with editor windows in a simpler fashion and not rush this. Once we add a new configuration option, the cross-version nature of user config files means we are more or less stuck with the decision.

    I agree that the current title code is hackish and should be refactored somehow. I am just not sure how yet. I want to take the in-process CheckerWindows and future ExternalWindows into account too.

    @terryjreedy terryjreedy added topic-IDLE 3.7 (EOL) end of life 3.8 only security fixes labels Mar 20, 2019
    @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-bug An unexpected behavior, bug, or error
    Projects
    Status: No status
    Development

    No branches or pull requests

    1 participant