[Python-bugs-list] [Bug #110617] IDLE and -t (PR#213)

noreply@sourceforge.net noreply@sourceforge.net
Fri, 15 Sep 2000 08:34:26 -0700


Bug #110617, was updated on 2000-Jul-31 14:06
Here is a current snapshot of the bug.

Project: Python
Category: IDLE
Status: Closed
Resolution: Fixed
Bug Group: None
Priority: 3
Summary: IDLE and -t (PR#213)

Details: Jitterbug-Id: 213
Submitted-By: aa8vb@yahoo.com
Date: Fri, 25 Feb 2000 07:36:01 -0500 (EST)
Version: 1.5.2 (w/ IDLE 0.5)
OS: IRIX


Since no other X app I know of works this way, I think this is a bug.

If you set the title of the IDLE window:

     idle.py -t IDLE

the title is set correctly, but the icon name is not.
It is set to "*IDLE" rather than "IDLE".




====================================================================
Audit trail:
Tue Mar 07 14:41:55 2000	guido	changed notes
Tue Mar 07 14:41:55 2000	guido	moved from incoming to open

Follow-Ups:

Date: 2000-Jul-31 14:06
By: none

Comment:
From: Guido van Rossum <guido@python.org>
Subject: Re: [Python-bugs-list] IDLE and -t (PR#213)
Date: Fri, 25 Feb 2000 08:26:32 -0500

> Since no other X app I know of works this way, I think this is a bug.
> 
> If you set the title of the IDLE window:
> 
>      idle.py -t IDLE
> 
> the title is set correctly, but the icon name is not.
> It is set to "*IDLE" rather than "IDLE".

Not a bug -- IDLE adds * before (and after!) the window title and
icon name to indicate that the window is modified and unsaved.

Does this bother you in some way?

--Guido van Rossum (home page: http://www.python.org/~guido/)


-------------------------------------------------------

Date: 2000-Jul-31 14:06
By: none

Comment:
From: Randall Hopper <aa8vb@yahoo.com>
Subject: Re: [Python-bugs-list] IDLE and -t (PR#213)
Date: Mon, 28 Feb 2000 07:25:31 -0500

Guido van Rossum:
 |> Since no other X app I know of works this way, I think this is a bug.
 |> 
 |> If you set the title of the IDLE window:
 |> 
 |>      idle.py -t IDLE
 |> 
 |> the title is set correctly, but the icon name is not.
 |> It is set to "*IDLE" rather than "IDLE".
 |
 |Not a bug -- IDLE adds * before (and after!) the window title and
 |icon name to indicate that the window is modified and unsaved.

The icon name doesn't follow this convention:

        if not self.get_saved():            
            title = "*%s*" % title
            icon = "*%s" % icon

The reason I took note of this inconsistency is that I was assigning a
window manager icon to IDLE based on the startup icon string.

 |Does this bother you in some way?

Well, no other X app I know of communicates unsaved status by putting '*'s
in the title and icon, but I don't have a big problem with it.  

I do think the icon should have a '*' both before "and after", as you
described though.  I'm guessing this was just a typo.

Thanks,

Randall

-- 
Randall Hopper
aa8vb@yahoo.com


-------------------------------------------------------

Date: 2000-Jul-31 14:06
By: none

Comment:
From: Guido van Rossum <guido@python.org>
Subject: Re: [Python-bugs-list] IDLE and -t (PR#213)
Date: Mon, 28 Feb 2000 08:16:48 -0500

>  |Not a bug -- IDLE adds * before (and after!) the window title and
>  |icon name to indicate that the window is modified and unsaved.
> 
> The icon name doesn't follow this convention:
> 
>         if not self.get_saved():            
>             title = "*%s*" % title
>             icon = "*%s" % icon
> 
> The reason I took note of this inconsistency is that I was assigning a
> window manager icon to IDLE based on the startup icon string.
> 
>  |Does this bother you in some way?
> 
> Well, no other X app I know of communicates unsaved status by putting '*'s
> in the title and icon, but I don't have a big problem with it.  

Hm, I have to admit that I have given up years ago on configuring X
apps through their app name.  Is that still a common practice?  I could
certainly change things around so that the title and icon are always "idle:
*file*" or "idle: file" depending on saved status.

> I do think the icon should have a '*' both before "and after", as you
> described though.  I'm guessing this was just a typo.

I think it was intentional, trying to save some space in the icon
label.  Not worth it, probably.

--Guido van Rossum (home page: http://www.python.org/~guido/)



-------------------------------------------------------

Date: 2000-Jul-31 14:06
By: none

Comment:
From: Randall Hopper <aa8vb@yahoo.com>
Subject: Re: [Python-bugs-list] IDLE and -t (PR#213)
Date: Tue, 29 Feb 2000 14:26:37 -0500


--oyUTqETQ0mS9luUI
Content-Type: text/plain; charset=us-ascii

Guido van Rossum:
 |Hm, I have to admit that I have given up years ago on configuring X
 |apps through their app name.  Is that still a common practice?  I could

Definitely.  Most all (all?) use WM_CLASS, and many use WM_NAME and
WM_ICONNAME as fallbacks.  This is useful if WM_CLASS isn't set to a useful
value (as in this case).

IDLE doesn't set a class name property on it's window, so the window name
and icon name are all the window manager has to go on when matching it up
with configuration settings.

However, I believe IDLE could set a class name easily by passing it to
Tkinter -- e.g.  root = Tk( className="IDLE" ).  See attached.

More info: the properties used by many window managers as a key into a
configuration database are: CLASS, NAME, and ICON_NAME.  For example,
running 'xprop' on my xterm window here:

   > xprop
   ...
   WM_CLASS(STRING) = "xterm-color", "XTerm"
   ...
   WM_ICON_NAME(STRING) = "Local"
   WM_NAME(STRING) = "Local"

So I can set window manager resources for this window using "XTerm",
"xterm-color", or "Local" -- with overrides in that order I believe.
So I can have a default icon for xterms, and then an override icon for
xterm windows with a certain title.

IDLE doesn't set CLASS so it's basically useless for this configuration
purpose.  On stock IDLE:

   WM_CLASS(STRING) = "270515832", "Toplevel"

 |certainly change things around so that the title and icon are always "idle:
 |*file*" or "idle: file" depending on saved status.

If IDLE could set WM_CLASS to a static (or cmd-line-specified) value on
it's shell windows, that'd be enough for me.  For now I'm using -t IDLE,
but that doesn't cover opening new windows inside of IDLE (opening files,
File->New Window, etc.)

A unique prefix on the WM_NAME (title string) would work too.

 |> I do think the icon should have a '*' both before "and after", as you
 |> described though.  I'm guessing this was just a typo.
 |
 |I think it was intentional, trying to save some space in the icon
 |label.  Not worth it, probably.

Thanks,

Randall


-- 
Randall Hopper
aa8vb@yahoo.com

--oyUTqETQ0mS9luUI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="tk.py"

from Tkinter import *
root = Tk( className="Test" )
btn = Button( root )
btn.pack()
root.mainloop()

--oyUTqETQ0mS9luUI--


-------------------------------------------------------

Date: 2000-Jul-31 14:06
By: none

Comment:
From: Guido van Rossum <guido@python.org>
Subject: Re: [Python-bugs-list] IDLE and -t (PR#213)
Date: Wed, 01 Mar 2000 09:21:41 -0500

Randall,

Thanks for your enlightenment.  I looked at your example, and it
works; but I need more, because IDLE creates windows using Toplevel(),
not using Tk().  (Using Tk() would create a new Tcl interpreter for
each window, which wastes time and memory resources, and re-reads the
~/.<whatever>.py file each time.)

I've experimented with xprop a bit, and I'm not getting results I
like.  If I write root = Tk(className="foo"), WM_CLASS is "foo",
"Foo".  Them if I write top = Toplevel(root), WM_CLASS for that window
is "1234567", "Toplevel".  If I try top = Toplevel(root, name="bar"),
I get "bar", "Toplevel".  Shouldn't I be able to set the second
component of WM_CLASS somehow?

Got any ideas?

If you can send me a patch, that would be greatly appreciated!

--Guido van Rossum (home page: http://www.python.org/~guido/)


-------------------------------------------------------

Date: 2000-Jul-31 14:06
By: none

Comment:
From: Randall Hopper <aa8vb@yahoo.com>
Subject: Re: [Python-bugs-list] IDLE and -t (PR#213)
Date: Mon, 6 Mar 2000 08:50:29 -0500


--MGYHOYXEY6WxJCY8
Content-Type: text/plain; charset=us-ascii

Guido van Rossum:
 |Thanks for your enlightenment.  I looked at your example, and it
 |works; but I need more, because IDLE creates windows using Toplevel(),
 |not using Tk().  (Using Tk() would create a new Tcl interpreter for
 |each window, which wastes time and memory resources, and re-reads the
 |~/.<whatever>.py file each time.)
 |
 |I've experimented with xprop a bit, and I'm not getting results I
 |like.  If I write root = Tk(className="foo"), WM_CLASS is "foo",
 |"Foo".  Them if I write top = Toplevel(root), WM_CLASS for that window
 |is "1234567", "Toplevel".  If I try top = Toplevel(root, name="bar"),
 |I get "bar", "Toplevel".  Shouldn't I be able to set the second
 |component of WM_CLASS somehow?
 |
 |Got any ideas?

Sorry about that last message.  This issue is very closely related to the
resource loading issue on idle-dev, but not the same.  Once the small
change below is in-place (to solve this problem), the platform-independent
Tkinter methods for resource loading can be used to solve the idle-dev
problem, if desired.

Research indicates that the Tk-ism for setting Toplevel classes is:

      "toplevel .mytop -class classname"

So the Tkinter syntax is:

      top1   = Toplevel( root, class_=classname )

The attached test app demonstrates this.  I verified that I am able to set
X resources for these windows using the class name "Idle".

-- 
Randall Hopper
aa8vb@yahoo.com

--MGYHOYXEY6WxJCY8
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="tk_class.py"

from Tkinter import *

CLASSNAME = "Idle"

root = Tk( className=CLASSNAME )
root.wm_withdraw()

# A toplevel with a WM_CLASS
top1   = Toplevel( root, class_=CLASSNAME )
label1 = Label( top1, text="Toplevel 1" )
label1.pack()

# Another one
top2   = Toplevel( root, class_=CLASSNAME )
label2 = Label( top2, text="Toplevel 2" )
label2.pack()

root.mainloop()

--MGYHOYXEY6WxJCY8--


-------------------------------------------------------

Date: 2000-Jul-31 14:06
By: none

Comment:
From: Guido van Rossum <guido@python.org>
Subject: Re: [Python-bugs-list] IDLE and -t (PR#213)
Date: Mon, 06 Mar 2000 09:11:30 -0500

> Sorry about that last message.  This issue is very closely related to the
> resource loading issue on idle-dev, but not the same.  Once the small
> change below is in-place (to solve this problem), the platform-independent
> Tkinter methods for resource loading can be used to solve the idle-dev
> problem, if desired.

See my response in idle-dev :-)

Of course the Tk options can still be used for changing things that
the config file or prefs dialog doesn't support.

> Research indicates that the Tk-ism for setting Toplevel classes is:
> 
>       "toplevel .mytop -class classname"
> 
> So the Tkinter syntax is:
> 
>       top1   = Toplevel( root, class_=classname )
> 
> The attached test app demonstrates this.  I verified that I am able to set
> X resources for these windows using the class name "Idle".

OK, I'll try to support this!

--Guido van Rossum (home page: http://www.python.org/~guido/)


-------------------------------------------------------

Date: 2000-Sep-07 15:06
By: jhylton

Comment:
Please do triage on this bug.
-------------------------------------------------------

Date: 2000-Sep-14 22:29
By: tim_one

Comment:
Assigned to Guido for obvious reasons.
-------------------------------------------------------

Date: 2000-Sep-15 08:34
By: gvanrossum

Comment:
The original complaint (about the icon being set to *IDLE) was taken care of by explanation. The remaining issue of the proper className is taken care of by using Tk(className="Idle") in PyShell.py -- Fred just checked this in.
-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=110617&group_id=5470