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

display python version on idle title bar #61592

Closed
bagratte mannequin opened this issue Mar 10, 2013 · 37 comments
Closed

display python version on idle title bar #61592

bagratte mannequin opened this issue Mar 10, 2013 · 37 comments
Assignees
Labels
easy topic-IDLE type-feature A feature request or enhancement

Comments

@bagratte
Copy link
Mannequin

bagratte mannequin commented Mar 10, 2013

BPO 17390
Nosy @rhettinger, @terryjreedy, @ezio-melotti, @serwy, @merwok, @rovitotv
Files
  • issue17390.patch
  • issue17390_editor_title.patch: Adds description and Python version to IDLE's editor window title in EditorWindow.py
  • issue17390_editor_title_rev2.patch: Revised patch to add Python version to editor window title
  • issue17390_outputwindow.patch
  • taskbar.png: screenshot of taskbar on windows 7
  • 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 2014-08-15.01:56:43.267>
    created_at = <Date 2013-03-10.12:56:34.729>
    labels = ['easy', 'expert-IDLE', 'type-feature']
    title = 'display python version on idle title bar'
    updated_at = <Date 2014-08-15.01:56:43.267>
    user = 'https://bugs.python.org/bagratte'

    bugs.python.org fields:

    activity = <Date 2014-08-15.01:56:43.267>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2014-08-15.01:56:43.267>
    closer = 'terry.reedy'
    components = ['IDLE']
    creation = <Date 2013-03-10.12:56:34.729>
    creator = 'bagratte'
    dependencies = []
    files = ['29426', '29657', '29804', '34239', '34705']
    hgrepos = []
    issue_num = 17390
    keywords = ['patch', 'easy']
    message_count = 37.0
    messages = ['183874', '183929', '183932', '183957', '183963', '184128', '184161', '184338', '184613', '184620', '184621', '185594', '185595', '185598', '185599', '185863', '186230', '186751', '208787', '208834', '208880', '208881', '212336', '212337', '215287', '215388', '215393', '215399', '215406', '215422', '215427', '215489', '219195', '219200', '219738', '223064', '225328']
    nosy_count = 11.0
    nosy_names = ['rhettinger', 'terry.reedy', 'ezio.melotti', 'roger.serwy', 'eric.araujo', 'Todd.Rovito', 'westley.martinez', 'python-dev', 'bagratte', 'edmond.burnett', 'Saimadhav.Heblikar']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue17390'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

    @bagratte
    Copy link
    Mannequin Author

    bagratte mannequin commented Mar 10, 2013

    useful for those who routinely use different versions of python on idle. as it ships, idle displays "python shell" on its title bar. it would be useful to have there the version displayed as well.

    see http://bagratte.blogspot.it/2013/03/display-python-version-on-idle-title-bar_10.html

    @bagratte bagratte mannequin added topic-IDLE type-feature A feature request or enhancement labels Mar 10, 2013
    @merwok
    Copy link
    Member

    merwok commented Mar 11, 2013

    Sounds like a good idea to me. Would you like to propose a patch? The devguide contains information to do that.

    Hint: sys.version is not meant to be parsed, there is sys.version_info for that (no regex needed! :)

    @merwok merwok added the easy label Mar 11, 2013
    @terryjreedy
    Copy link
    Member

    I agree. Sometimes when I have multiple IDLE windows open I have to scroll back to the top to make sure which one I am in. I suggest:
    Python x.y Shell for shell window
    I am not sure, for edit window: currently xxx.py -- <path>/xxx.py
    I am not sure the redundancy is needed, but I do tended to look at the isolated file name. Maybe "xxx.py -- in <path>/" without filename at end.
    Add 'Python x.y', 'Py x.y' 'x.y', beginning or end of line?

    @bagratte
    Copy link
    Mannequin Author

    bagratte mannequin commented Mar 11, 2013

    ...
    class PyShell(OutputWindow):

        import platform
        version = platform.python_version() + " " + platform.architecture()[0]
        shell_title = "Python %s Shell" % version
    ...
    (PyShell.py)

    i'll take a look at the devguide and see if i can figure a patch out.

    @bagratte
    Copy link
    Mannequin Author

    bagratte mannequin commented Mar 11, 2013

    or better still:

    ...
    from platform import python_version, architecture
    shell_title = "Python %s %s Shell" % (python_version(), architecture()[0])
    ...

    @edmondburnett
    Copy link
    Mannequin

    edmondburnett mannequin commented Mar 14, 2013

    Suggesting a patch which addresses this enhancement. I did not include architecture() in the title bar but can add it as well if others think it is appropriate.

    Import of platform.python_version is done at the top of PyShell.py rather than inside the class as per PEP-8.

    @bagratte
    Copy link
    Mannequin Author

    bagratte mannequin commented Mar 14, 2013

    good. thank you.

    i'm not sure about the architecture. i understand it's not crucial for most of the users. i would like to have it though.

    @edmondburnett
    Copy link
    Mannequin

    edmondburnett mannequin commented Mar 16, 2013

    Updated patch to conform to PEP-3101

    @ezio-melotti
    Copy link
    Member

    The 0 in "{0}" can be omitted, otherwise patch looks good to me. I agree that the architecture is not necessary.

    @terryjreedy
    Copy link
    Member

    I have been planning to test and commit some version of this patch after PEP-434 is resolved, as I would like to backport it at least to 2.7 and 3.3. The only thing that could break is some esoteric application that looks at window title bars from outside and looks for an exact match rather than startswith('IDLE') or the equivalent.

    @ezio-melotti
    Copy link
    Member

    I think it's safe to apply this patch to 2.7/3.2/3.3/3.4.

    @terryjreedy
    Copy link
    Member

    Edmond: please fill in, sign, and send by your preferred method a PSF Contributor Agreement
    http://www.python.org/psf/contrib/contrib-form/
    (back up a level for more explanation)

    For a patch more complicated than this, the CA would now be required before applying a patch of yours.

    @terryjreedy terryjreedy self-assigned this Mar 30, 2013
    @edmondburnett
    Copy link
    Mannequin

    edmondburnett mannequin commented Mar 30, 2013

    Terry,

    I submitted my contributor form on March 15th, and received the confirmation, but it has not yet been applied to my account.

    I saw some discussion on one of the mailing lists of there being a potential backlog due to the PyCon sprints, so I just assumed that I was still waiting in the queue. If there is someone in particular I should contact at this point, I'm happy to do this.

    Thanks,
    Edmond

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 30, 2013

    New changeset 74d9a9507019 by Terry Jan Reedy in branch '3.3':
    Issue bpo-17390: Display Python version on Idle title bar. Patch by Edmond Burnett.
    http://hg.python.org/cpython/rev/74d9a9507019

    New changeset e0f66c924544 by Terry Jan Reedy in branch 'default':
    Merge from 3.3: Issue bpo-17390
    http://hg.python.org/cpython/rev/e0f66c924544

    New changeset 225022955c65 by Terry Jan Reedy in branch '2.7':
    Issue bpo-17390: Display Python version on Idle title bar. Patch by Edmond Burnett.
    http://hg.python.org/cpython/rev/225022955c65

    @terryjreedy
    Copy link
    Member

    Can you find the place where the editor title is set? I am currently thinking of something like

    Python x.y.z: xxx.py (directory path) # or
    Python x.y.z Editor: xxx.y (path)

    I am guessing that the reason to put the file name at the beginning is in case the path is so long that the end gets cut off.

    (Let's give the secretary a couple more weeks to catch up.)

    @edmondburnett
    Copy link
    Mannequin

    edmondburnett mannequin commented Apr 2, 2013

    Here is a patch to add a more descriptive title to the IDLE editor.

    Python <version> Editor: <filename> - <path>

    @serwy
    Copy link
    Mannequin

    serwy mannequin commented Apr 7, 2013

    bpo-10747 is tangentially related. It is about adding the python version to the short cuts on Windows.

    @kjohnson
    Copy link
    Mannequin

    kjohnson mannequin commented Apr 13, 2013

    issue17390_editor_title.patch is not correct, it changes the title on any window that inherits from EditorWindow, including the shell window. Here is a new patch that changes short_title() instead of saved_change_hook(), so it can be overridden by derived classes. This is the same method used to change the title of the shell window.

    Derived classes of EditorWindow are PyShellEditorWindow and OutputWindow. OutputWindow overrides short_title() and IIUC PyShellEditorWindow should use the same title as a normal editor window.

    @bagratte bagratte mannequin closed this as completed Jan 9, 2014
    @ezio-melotti
    Copy link
    Member

    Why this issue has been closed even though people were still discussing it and submitting patches?

    Terry, can you check if the new patches should be applied?

    @ezio-melotti ezio-melotti reopened this Jan 22, 2014
    @terryjreedy
    Copy link
    Member

    I presume the OP only cared about the Shell Window, and that was fixed.
    I agree that submitted patches should not be ignored. I have decided I really want editor windows labelled as sometimes run the *same* file with more than one version, and it can be difficult to remember which x.py window will run with which version. My only question is whether 'Python x.y Editor' will be too much to add in addition to the short and long file name, but after being undecided for months, I think the best thing is to add it and see.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jan 23, 2014

    New changeset bcfbab86f49a by Terry Jan Reedy in branch '2.7':
    Issue bpo-17390: Add Python version to Idle editor window title bar.
    http://hg.python.org/cpython/rev/bcfbab86f49a

    New changeset b26db63bb931 by Terry Jan Reedy in branch '3.3':
    Issue bpo-17390: Add Python version to Idle editor window title bar.
    http://hg.python.org/cpython/rev/b26db63bb931

    @terryjreedy
    Copy link
    Member

    Edmond and Kent, thanks for the patch. Ezio, thanks for re-opening.

    After testing the patch with and without 'Editor', I preferred without. It is slightly redundant and noisy, especially when editing EditorWindow.py ;-). Also, Windows 7 stacks icons for windows belonging to a program under the program icon on the task bar. When the mouse is over the program icon, it pop up a window of *limited* width listing the window titles. The popup is narrow enough that paths to Idle test files in my repository clone get truncated when 'Editor' is added.

    I suspect that adding '''else: filename = "Untitled"''' to short_title() makes the corresponding '''else: title = "Untitled"''' in saved_change_hook() useless. I will check later for possible removal.

    Since I sometimes have multiple Find in File Output windows, I would like to expand their titles also. Since the Python version is irrelevant. I am thinking of
    Python: Matches for "<re>"
    But I think their may be other uses of Output windows (easily found by searching for "Output" ;-). In any case, extensions and new features should be free to use use OutputWindow. So we cannot generically modify OutputWindow.short_title . If the self parameter of short_title does not somehow indicate that the output is for Find in Files, we can subclass and over-ride.

    class FiFWindow(OutputWindow):
      def short_title(self):
        return <fif title>

    @westleymartinez
    Copy link
    Mannequin

    westleymartinez mannequin commented Feb 27, 2014

    How about adding an optional argument to OutputWindow that specifies the title for the window? Or would this be more suitable for EditorWindow (which OutputWindow inherits from)? Either way, doing this would allow any OutputWindow to specify its own title. The current title "Output", is pretty useless.

    I've written a patch that adds the functionality. In addition, I changed the title of the Find in Files output window to what you imagined.

    @terryjreedy
    Copy link
    Member

    That looks like a sensible approach.

    @terryjreedy
    Copy link
    Member

    As far as I can tell, there are 4 window classes to be concerned with. (Dialogs would be a separate issue.)

    EditorWindow
    |- PyShellEditorWindow - EW+breakpoints, replaces WE in PyShellFileList
    |- OutputWindow - used by Find in Files
    |- PyShell - the visible shell window

    PyShellEditorWindow does not override the title methods and is of no concern to us.

    If we want the title for all these windows to start with 'Python', we should 'factor' that out and start with it at the beginning of EditorWindow.saved_change_hook (and change other things in EW). Thinking ahead, another possible use for OutputWindow is for containing the result of running an external program on a file. I think that a leading 'Python' would be fine something like
    Python: PyFlakes output for OutputWindow.py

    Adding the flexibility of a title parameter to OutputWindow instead of EditorWindow seems about right. If we do that, the override of .short_title for PyShell in the first patch should be removed and the title passed in to the one and only call that creates a PyShell (PyShell.py, 315).

    I would like to add some minimal automated tests (maybe in a new test_misc.py file) using either mock classes or unittest.mock (which I have not used yet).

    @bagratte
    Copy link
    Mannequin Author

    bagratte mannequin commented Apr 2, 2014

    guys,
    the filename should be the first thing on the titlebar of idle editor window. that way, on taskbar, one can see the file that's open in editor. i suggest the format of editor's title be changed to:
    xxx.py - python x.y.z - path
    or whatever you will as separator between elements.

    @terryjreedy
    Copy link
    Member

    Bagrat, are you on XP by any chance? In Win7, all windows for a program are attached to one program icon on the taskbar, which has the program name. When I hover over the program icon, mini views of each window are displayed, with each window view showing about 30 chars of the window title. For instance "Python 3.4.0: CallTipsWindow", which is fine for me. Moving the mouse over the mini window displays the complete title.

    @bagratte
    Copy link
    Mannequin Author

    bagratte mannequin commented Apr 2, 2014

    terry, i'm on 7 but i have my taskbar configured not to combine buttons. see the screenshot attached.

    (does anyone know why on earth i am not receiving email notifications when someone posts to an issue i have started or i have commented to?)

    @ezio-melotti
    Copy link
    Member

    Other editors (e.g. Kate) use the format "filename - editor name". This is common for other applications as well (e.g. Firefox uses "page title - Mozilla Firefox"), so the request seems reasonable to me.

    If you want to go the extra mile you could have an option to decide if the filename should be first or not or even a format string that would allow users to fully configure the titlebar (e.g. "{file} - IDLE {version}"), but that might be out of the scope of this issue. FWIW I don't think Kate has an option for that, but it has one to show the full path in titlebar.

    (@bagrat: assuming your email address is correct, if you are not getting notifications they might have ended up in the spam folder.)

    @terryjreedy
    Copy link
    Member

    The general issue of Idle title bars is definitely not finished, though I may close this issue and open others.

    1. 'Python' versus "Idle' versus neither in titles (assuming not both).

    1a. Shell: Since the link in msg183874 is dead, I don't know what Bagrat suggested. I said 'Python' in msg183932, hinted 'Idle' in msg184620, and pushed the patch that had 'Python'. I could argue either way, but 'Python x.y.z Shell' (versus 'Idle x.y.z Shell') works as the name of the Idle product and also identifies what will run the code entered. I am now thinking 'neither' and propose making the title 'Shell x.y.z' -- see the more on this below.

    1b. Editor: The patch I applied followed the same pattern, and again, I could argue for either 'Idle x.y.z' (what is doing the editing) or 'Python x.y.z' (what will run the code with F5)'. In this and the shell case, the version is the most important new information. If we consider the titles of other windows (see still more below), I think the class title should be 'Editor x.y.z'.

    1c. OutputWindow: This is a bit tougher. 'Output' only works, sort of, as long as the class is only used for FIF, (Find in Files, grep). The initial title is actually '*Output*', indicating unsaved content, with no file name specified. Once saved, the title changes to "Output - <file name>". This is a precedent for 'Editor - <file name>'

    Since this issue started about adding versions, and version is not relevant to this and the following windows, a patch for OutputWindows should be a new issue. However, the design options need to be considered together.

    1d. Read-only windows: We have "Debug Control", "Path Browser", and "Class Browser - Output Window". (For the last, "- Output Window" should go since it adds nothing and misleads in that the window is not an OutputWindow. It could be replaced with the class name.)

    1. Order of generic and specific (or class and instance) components.

    Most windows have a generic title for windows of a class. Part of my thinking above in suggesting 'Shell x.y.z' and 'Editor x.y.z' for the respective classes is that none of the class titles should contain either 'Python' or 'Idle' [separate? issue 0 -- it would be a correction of the patches on this issue].

    Once an OutputWindow is saved, its title has a generic and specific component, in that order. The specific component identifies the specific contents of the instance. While I expect to replace 'Output' with names that reflect the subclasses of usage, the pattern will remain the same [separate issue 1].

    Before we added a generic component for editor windows, they were unique in not having one. They currently follow the output pattern.

    I am also thinking a giving the title for ClassBrowswer (which is really ModuleBrowser) a specific component -- the module name [separate issue 2].

    My point is that we have gone from one generic-specific (class-instance) name pair to two, and soon to more. If someone wants one pair flipped, then it seems logical to me that the same person would want all such pairs flipped, for the same reason. Bagrat, is this true for you? I know you only mentioned editor pairs, but you may not have known about output pairs, and certainly not future pairs that do not exist yet. I am willing to consider a user-settable option [separate issue 3], but I would think it should cover all such pairs, and not just editor window pairs.

    Currently, editor window titles are also unique in repeating part of the specific title. Output windows, when saved, do not repeat the short file name. Do any other editor programs do this?

    I expect we may decide to eliminate the redundancy as it exist now. Notepad++ puts "<complete path> - Notepad++" on the title bar and the filename on the notebook tab. When the tabbed selected changes, the title bar changes. Firefox does the title to match the tab also.

    There is already an issue to use tabbed notebooks with Idle and when we do that, I would expect to remove the duplication in the title and imitate Notepad++.

    @bagratte
    Copy link
    Mannequin Author

    bagratte mannequin commented Apr 3, 2014

    terry, i indeed didn't know about output windows. (or at least i didn't know i knew. by the way, what are they?) the logic behind my request is that the file being edited in the editor is the most important thing of the editor. a quick glance at the taskbar, for those like me that have it set not to combine taskbar buttons, or for those on xp and the like, should reveal what is what.

    (terry, i received your email but still none from issue tracker, neither in spam. the last notification i received was that of msg186751, back in 2013. do you think i should file an issue on meta tracker?)

    @westleymartinez
    Copy link
    Mannequin

    westleymartinez mannequin commented Apr 4, 2014

    I second that the title should start with the filename, by default. This seems to be the precedent, and it makes it easy when working with multiple files.

    Example:
    xxx.py - IDLE x.y.z: C:\mydir\xxx.py

    Terry, I think we can generalize this as '<important/useful title> - <general>: <specific>' and apply it to all windows. The first element essentially guarantees that the title name will be a good one for the taskbar. We can apply this to say the FIF output window:
    Matches for "hello" - IDLE x.y.z: C:\output.txt

    but maybe everything after the hyphen isn't necessary. I wonder if long titles could be annoying or distracting. Regardless, anything more specific than 'Output Window' will be better.

    @rhettinger
    Copy link
    Contributor

    I taught a python class this week with Python 2.7.7 and the learners found this change to be an impediment to usability.

    The filename and fullpath are the most important pieces of information in the title bar. They are now obscured by the version information which is somewhat unimportant (it has already been shown in the shell window and it is uncommon to run multiple versions of python using IDLE at the same time).

    Looking to Microsoft Excel and Word as comparative examples, they only show the document name.

    I conclude that this change should be reverted. For the time being, I can't continue to use IDLE in 2.7.7 to teach with. Not seeing the filename is especially important when many small windows are open (as they usually are during tdd and pdb sessions).

    @terryjreedy
    Copy link
    Member

    Since no title format can satisfy everyone, I propose to make it user configurable. The default can be the old style. I opened bpo-21588 for that and marked it high priority.

    @rhettinger
    Copy link
    Contributor

    I don't know if this is related but the Window tab has been affect as well. It shows all open windows like this

    *Python 2.7.7 Shell*
    Python 2.7.7: demo.py /Users/raymond/class/demo.py
    Python 2.7.7: download.py /Users/raymond/class/download.py

    This is a bit over the top :-)

    I would really like the old behavior restored.

    @terryjreedy
    Copy link
    Member

    I agree that the repeated 'Python x.y.z: " in the listing is too much. bpo-21588 has a patch but I am not ready to push it or do the review and revision needed . So I propose to reduce the current prefix to the minimum needed to know what version F5 will run the file with, x.y with minimal dressing, and put it in the middle or at the end. Your example Windows listing would then look like

    *Python 2.7.7 Shell*
    demo.py (2.7) /Users/raymond/class/demo.py
    download.py (2.7) /Users/raymond/class/download.py
    or
    *Python 2.7.7 Shell*
    demo.py - /Users/raymond/class/demo.py (2.7)
    download.py - /Users/raymond/class/download.py (2.7)
    or
    *Python 2.7.7 Shell*
    demo.py - /Users/raymond/class/demo.py | 2.7
    download.py - /Users/raymond/class/download.py | 2.7

    Which do you like best? I am trying out the second one in my 3.4 installation, and will switch to the third later.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Aug 15, 2014

    New changeset 6d41f139709b by Terry Jan Reedy in branch '2.7':
    Issue bpo-17390: Adjust Editor window title. Remove 'Python', move version to end.
    http://hg.python.org/cpython/rev/6d41f139709b

    New changeset ba141f9e58b6 by Terry Jan Reedy in branch '3.4':
    Issue bpo-17390: Adjust Editor window title. Remove 'Python', move version to end.
    http://hg.python.org/cpython/rev/ba141f9e58b6

    @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
    easy topic-IDLE type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants