[pygtk] feature request: binding for gtk_propagate_event?

2002-11-10 Thread Brian Warner
Howdy all..

I've been trying to rewrite my python/gnome1 -based applets in python/gnome2
(somewhat forced into it because of the recent debian/unstable gnome2
switch). One of the more significant changes in gtk2/gnome2 that shows up in
panel applets is that right-clicks on top of GtkButtons no longer result in
the applet's menu appearing. I don't know if this is because GtkButtons
consume the button2 and button3 events instead of passing them up to their
containers (they do, but from what I can tell they did in gtk1.2 as well) or
because the new bonobo-based libpanel-applet system does something different
than the old applet-widget scheme (it does, but I don't know if it is not
implementing an old workaround or if something else changed).

The net result is that, in the applets I write that contain buttons, it is
difficult to get to the applet's context menu (to configure or remove the
applet). If the applet is all button, it is impossible.

Several of standard Gnome applets (in gnome-applets-2.0.3), drivemount and
mini-commander in particular, have a hack to work around this. The hack adds
a signal handler to the GtkButton which catches button2/button3 and uses
gtk_propagate_event() to send the event off to the applet as a whole, which
responds by putting up the context menu. button1 events are ignored/refused;
the signal handler returns FALSE to let the event go to the GtkButton as
usual.

In lieu of seeing GtkButtons changed to let button2/button3 events get
passed along to their containers, I wanted to implement this same hack in my
python applets. But gtk_propagate_event() is missing from the python
binding, as it is listed in an %ignore clause in the gtk.override file.

Any idea why there is no binding for this function? Or how hard it would be
to add one? If there's a better workaround for this problem I'd love to hear
it, but I suspect a real fix would involve changes to gtk that aren't going
to happen any time soon.

thanks,
 -Brian
___
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] TreeStore getting iterator from column and value

2002-11-10 Thread Tanya Brethour

> > So lets say I have two columns. One is of type text and the other is of
> > type boolean. I want to be able to get the iterator for the row that
> > matches a given text string in the first column. 
> > 
> > Any ideas?
> 
> yes, get the root iter of the tree, and then use the other tree walker
> functons, there is a get_iter_root() call, and some to etirmin if the
> iter hasa children or not, and another to move to the next iter.  etc
> etc.  Walk your way down the tree looking for the value.

Yeah.. thats what I ended up doing (walking the tree). But it seems like
such a common function that there would be a function in the API for it.

Thanks!

-Tanya

>   
> 
> -- 
> 
> *  Rob Brown-Bayliss
> *  =  
> *  zoism.org
> 

___
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] TreeStore getting iterator from column and value

2002-11-10 Thread Rob Brown-Bayliss
> So lets say I have two columns. One is of type text and the other is of
> type boolean. I want to be able to get the iterator for the row that
> matches a given text string in the first column. 
> 
> Any ideas?

yes, get the root iter of the tree, and then use the other tree walker
functons, there is a get_iter_root() call, and some to etirmin if the
iter hasa children or not, and another to move to the next iter.  etc
etc.  Walk your way down the tree looking for the value.


-- 

*  Rob Brown-Bayliss
*  =
*  zoism.org
___
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] add_events() to GtkLabel?

2002-11-10 Thread Tommy Lindgren
Christian Reis <[EMAIL PROTECTED]> writes:

> On Sun, Nov 10, 2002 at 12:13:35PM +0100, Tommy Lindgren wrote:
> > I'm trying to catch a button_press_event from a 
> > GtkLabel with this code:
> [...] 
> > One could easily interpret this as that the widget must be added to
> > a window before the call, but it doesn't seem to help. 
> 
> http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq03.003.htp

Ah, thanks!

-- 
Tommy Lindgren  |  o y @ i u . u
41A942131CAA5C  | t m l l n x n
^C^C
___
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] add_events() to GtkLabel?

2002-11-10 Thread Christian Reis
On Sun, Nov 10, 2002 at 12:13:35PM +0100, Tommy Lindgren wrote:
> I'm trying to catch a button_press_event from a 
> GtkLabel with this code:
[...] 
> One could easily interpret this as that the widget must be added to
> a window before the call, but it doesn't seem to help. 

http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq03.003.htp

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
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] add_events() to GtkLabel?

2002-11-10 Thread Tommy Lindgren
Hi!

I'm trying to catch a button_press_event from a 
GtkLabel with this code:


from gtk import *

def button_press(wid, ev):
print wid, ev.button

win = GtkWindow()
win.connect("destroy", mainquit)

label = GtkLabel('Blaaah')
# win.add(label) 
label.add_events(GDK.BUTTON_PRESS_MASK)
label.connect('button_press_event', button_press)
label.show()

# win.add_events(GDK.BUTTON_PRESS_MASK)
# win.connect('button_press_event', button_press)
win.add(label) 
win.show()

mainloop()


The program runs, but the event is never caught, which 
doesn't surprise me, since the label.add_events() call spits out

Gtk-CRITICAL **: file gtkwidget.c: line 3861 (gtk_widget_add_events): assertion 
`!GTK_WIDGET_NO_WINDOW (widget)' failed.

One could easily interpret this as that the widget must be added to
a window before the call, but it doesn't seem to help. 

Any ideas?

-- 
Tommy Lindgren  |  o y @ i u . u
41A942131CAA5C  | t m l l n x n
^C^C
___
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] Make row of Clist invisible?

2002-11-10 Thread Christian Reis
On Sun, Nov 10, 2002 at 12:13:47AM -0600, Tanya Brethour wrote:
> 
> Is it possible to make a single row of a CList invisible? And then be able
> to make it visible again?  I see a is_visible function.. so I would assume
> there is a way to make it invisible. But correct me if I am wrong :)

I think row_is_visible() verifies if the row is in the displayed area of
its ScrolledWindow (looks at gtk source) yep, that's what it is. If you
have the gtk+ source for 1.2.10, look at line 3152.

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