Re: [pygtk] please help with setting accelerator for the menu item

2003-10-06 Thread John Finlay


Christian Reis wrote:

On Mon, Oct 06, 2003 at 03:03:42PM -0500, Alex Roitman wrote:
 

On Mon, Oct 06, 2003 at 03:28:51PM -0300, Christian Reis wrote:
   

Have you looked at the GTK+ documentation for AccelGroups? It should be
simple to translate examples to PyGTK from that.
 

I have some reference in front of me right now:
 http://developer.gnome.org/doc/API/gtk/gtk-keyboard-accelerators.html
but I would not call it documentation in its usual sense. 
All descriptions and explanations seem yet to be filled. If you could 
refer me to a better doc I would be most grateful.
   

That's the old 1.0 documentation. Try

   http://developer.gnome.org/doc/API/2.0/gtk/gtk-Keyboard-Accelerators.html

(and keep the 2.0 API docs handy)
 

Or try the PyGTK2 reference docs:

http://www.moeraki.com/pygtkreference/pygtk2reference/class-gtkaccelgroup.html

John

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] please help with setting accelerator for the menu item

2003-10-06 Thread Christian Reis
On Mon, Oct 06, 2003 at 03:03:42PM -0500, Alex Roitman wrote:
> On Mon, Oct 06, 2003 at 03:28:51PM -0300, Christian Reis wrote:
> > Hmmm. You should save a reference to your AccelGroup, but I'm curious as
> > to what happens when you set pass in group to add_accelerator().
> 
> I apologize, but I'm clueless as to how to save a reference to my 
> AccelGroup. What is my AccelGroup?

Well, I meant saving a reference as a python variable:

group = gtk.AccelGroup()

But I'm still curious about the warning issued.

> > Have you looked at the GTK+ documentation for AccelGroups? It should be
> > simple to translate examples to PyGTK from that.
> 
> I have some reference in front of me right now:
>   http://developer.gnome.org/doc/API/gtk/gtk-keyboard-accelerators.html
> but I would not call it documentation in its usual sense. 
> All descriptions and explanations seem yet to be filled. If you could 
> refer me to a better doc I would be most grateful.

That's the old 1.0 documentation. Try

http://developer.gnome.org/doc/API/2.0/gtk/gtk-Keyboard-Accelerators.html

(and keep the 2.0 API docs handy)

> > I talked to James over IRC about this once; there's an issue that (in a
> > similar situation as signals connected via libglade) there isn't an easy
> > way to reach accelerator groups that are created during the libglade
> > parse for most/some of the GTK+ widgets.
> 
> What puzzles me is that the glade file gets away with the following XML 
> which is enough for a fully functional accelerators:
> 
>   
> True
> The Label
> 
> 
> 
> This does not seem to ever worry about accel group at all!

But I assure you that libglade, internally, *does* consider them :-)

> > *However*, when I asked him, I was referring to keyboard accelerators in
> > widgets *other* than GtkMenu, and since GtkMenu *does* provide an API to
> > get to its accel_group, I'm as to why get_accel_group() is returning
> > None. It may very well be a bug.
> 
> Should I make a testcase and file it with Gnome bugzilla then?

I'm not sure; let's see if anybody else has a comment, and if not, I'd
say yes.

Take care,
--
Christian Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] please help with setting accelerator for the menu item

2003-10-06 Thread Alex Roitman
Chris, 

Thanks for your response!

On Mon, Oct 06, 2003 at 03:28:51PM -0300, Christian Reis wrote:
> Hmmm. You should save a reference to your AccelGroup, but I'm curious as
> to what happens when you set pass in group to add_accelerator().

I apologize, but I'm clueless as to how to save a reference to my 
AccelGroup. What is my AccelGroup?
 
> Have you looked at the GTK+ documentation for AccelGroups? It should be
> simple to translate examples to PyGTK from that.

I have some reference in front of me right now:
  http://developer.gnome.org/doc/API/gtk/gtk-keyboard-accelerators.html
but I would not call it documentation in its usual sense. 
All descriptions and explanations seem yet to be filled. If you could 
refer me to a better doc I would be most grateful.

> > I also tried obtaining the get_accel_group() of the present menu, which  
> > returns None. I probably should add here that the whole menu hierarchy  
> > was created in glade and parsed using libglade. I want to just create  
> > this little submenu from the python code.
> 
> I talked to James over IRC about this once; there's an issue that (in a
> similar situation as signals connected via libglade) there isn't an easy
> way to reach accelerator groups that are created during the libglade
> parse for most/some of the GTK+ widgets.

What puzzles me is that the glade file gets away with the following XML 
which is enough for a fully functional accelerators:

  
True
The Label



This does not seem to ever worry about accel group at all!
 
> *However*, when I asked him, I was referring to keyboard accelerators in
> widgets *other* than GtkMenu, and since GtkMenu *does* provide an API to
> get to its accel_group, I'm as to why get_accel_group() is returning
> None. It may very well be a bug.

Should I make a testcase and file it with Gnome bugzilla then?

Thanks,
Alex

-- 
Alexander Roitman   http://ebner.neuroscience.umn.edu/people/alex.html
Dept. of Neuroscience, Lions Research Building
2001 6th Street SE, Minneapolis, MN  55455
Tel (612) 625-7566   FAX (612) 626-9201


signature.asc
Description: Digital signature
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] please help with setting accelerator for the menu item

2003-10-06 Thread Christian Reis
On Mon, Oct 06, 2003 at 01:16:00PM -0500, Alex Roitman wrote:
> I apologize for asking a silly question here, but I just can't figure  
> it out by myself. I am creating a submenu of a main menu of a gnome  
> program. I would like to add accelerators to the menu items of my menu.

I've had this problem before myself. 

>gomenu = gtk.Menu()
>back = gtk.ImageMenuItem(gtk.STOCK_GO_BACK)
>back.connect("activate",self.back_clicked)
>back.show()
>gomenu.append(self.back)
> 
> The above snippet works. But when I attempt to add an accelerator using
>back.add_accelerator()
> is when I get in trouble. The add_accelerator() method of gtk.Widget  
> wants accel_group as its second argument. What am I supposed to give  
> it?
> 
> I tried None (does not work) and an empty gtk.AccelGroup() (works but  
> produces complains about not being able to connect to the accel group).  

Hmmm. You should save a reference to your AccelGroup, but I'm curious as
to what happens when you set pass in group to add_accelerator().

Have you looked at the GTK+ documentation for AccelGroups? It should be
simple to translate examples to PyGTK from that.

> I also tried obtaining the get_accel_group() of the present menu, which  
> returns None. I probably should add here that the whole menu hierarchy  
> was created in glade and parsed using libglade. I want to just create  
> this little submenu from the python code.

I talked to James over IRC about this once; there's an issue that (in a
similar situation as signals connected via libglade) there isn't an easy
way to reach accelerator groups that are created during the libglade
parse for most/some of the GTK+ widgets.

*However*, when I asked him, I was referring to keyboard accelerators in
widgets *other* than GtkMenu, and since GtkMenu *does* provide an API to
get to its accel_group, I'm as to why get_accel_group() is returning
None. It may very well be a bug.

Take care,
--
Christian Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] please help with setting accelerator for the menu item

2003-10-06 Thread Alex Roitman
Hi,

I apologize for asking a silly question here, but I just can't figure  
it out by myself. I am creating a submenu of a main menu of a gnome  
program. I would like to add accelerators to the menu items of my menu.

   gomenu = gtk.Menu()
   back = gtk.ImageMenuItem(gtk.STOCK_GO_BACK)
   back.connect("activate",self.back_clicked)
   back.show()
   gomenu.append(self.back)
The above snippet works. But when I attempt to add an accelerator using
   back.add_accelerator()
is when I get in trouble. The add_accelerator() method of gtk.Widget  
wants accel_group as its second argument. What am I supposed to give  
it?

I tried None (does not work) and an empty gtk.AccelGroup() (works but  
produces complains about not being able to connect to the accel group).  
I also tried obtaining the get_accel_group() of the present menu, which  
returns None. I probably should add here that the whole menu hierarchy  
was created in glade and parsed using libglade. I want to just create  
this little submenu from the python code.

Any help is greatly appreciated.

Alex

--
Alexander Roitman   http://ebner.neuroscience.umn.edu/people/alex.html
Dept. of Neuroscience, Lions Research Building
2001 6th Street SE, Minneapolis, MN  55455
Tel (612) 625-7566   FAX (612) 626-9201


pgp0.pgp
Description: PGP signature
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/