[pygtk] How to add 'clicked' event to treeview cell?

2009-10-17 Thread Taras
Hello, all!


There is a table with some rows. For example, it has 3 columns. 
The first one is icon column 'Add/Remove to favorites' with star icon.
I read about pixbuf renderer but I can't find how can I connect
'clicked' event to this column :( I also research how it made in Exaile
(music player written in Python/GTK). 

There is workaround with:
...
  self.list.connect('button-release-event', self.update_rating)
...
and
...
 (x, y) = e.get_coords()
   #check if the click is within rating column and on a list entry
 if self.list.get_path_at_pos(int(x), int(y)) \
 and left_edge < x < left_edge + rating_col_width:
...
But it looks like unbeautiful workaround. Is there more beautiful
solution to connect 'clicked' event to icon cell?

Thanks for answers!

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] pyGtk segfault comparing gtk.Image with 0

2009-10-17 Thread Ralph Sleigh
Hey

The following code is getting me a segfault (found by mistake on my
part, meant to compare with another attribute):

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import pygtk
pygtk.require('2.0')
import gtk

class myImage(gtk.Image):
def __init__(self):
  return

image = myImage()

if(image.parent == 0):
print image


Current Ubuntu 9.04, python2.6.2-0ubuntu1, python-gtk2 2.14.1ubuntu1

It's silly code I know, but a more friendly error would be nice.

-Ralph



signature.asc
Description: OpenPGP digital signature
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] pyGtk segfault comparing gtk.Image with 0

2009-10-17 Thread René 'Necoro' Neumann
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Well -- you are not initializing gtk.Image. So it's your very own
mistake. I don't see a pygtk issue here.
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkrZ7PIACgkQ4UOg/zhYFuB9TgCcCGNFRlS4MHf/G97U8FphEczC
vh4AmwZmNhY2Ph1n7uRLf1FbDR2kADLu
=IIT/
-END PGP SIGNATURE-
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] pyGtk segfault comparing gtk.Image with 0

2009-10-17 Thread Tomeu Vizoso
On Sat, Oct 17, 2009 at 17:12, René 'Necoro' Neumann  wrote:
>
> Well -- you are not initializing gtk.Image. So it's your very own
> mistake. I don't see a pygtk issue here.

This is Python, any crash is a bug.

Regards,

Tomeu
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] pyGtk segfault comparing gtk.Image with 0

2009-10-17 Thread Pietro Battiston
Il giorno sab, 17/10/2009 alle 17.30 +0100, Tomeu Vizoso ha scritto:
> On Sat, Oct 17, 2009 at 17:12, René 'Necoro' Neumann  wrote:
> >
> > Well -- you are not initializing gtk.Image. So it's your very own
> > mistake. I don't see a pygtk issue here.
> 
> This is Python, any crash is a bug.

Wait, wait.

Read http://bugzilla.gnome.org/show_bug.cgi?id=561130 , then come back
here and let's talk :-)

Pietro

(P.S: as you can desume from the page, I _would like_ to agree with you)


signature.asc
Description: Questa è una parte del messaggio firmata digitalmente
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] pyGtk segfault comparing gtk.Image with 0

2009-10-17 Thread Paul Pogonyshev
Pietro Battiston wrote:
> Il giorno sab, 17/10/2009 alle 17.30 +0100, Tomeu Vizoso ha scritto:
> > On Sat, Oct 17, 2009 at 17:12, René 'Necoro' Neumann  
> > wrote:
> > >
> > > Well -- you are not initializing gtk.Image. So it's your very own
> > > mistake. I don't see a pygtk issue here.
> > 
> > This is Python, any crash is a bug.
> 
> Wait, wait.
> 
> Read http://bugzilla.gnome.org/show_bug.cgi?id=561130 , then come back
> here and let's talk :-)
> 
> Pietro
> 
> (P.S: as you can desume from the page, I _would like_ to agree with you)

You can still rightfully agree with him that it _is_ a bug.  Whether
it gets fixed is another point.

Paul
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] pyGtk segfault comparing gtk.Image with 0

2009-10-17 Thread Pietro Battiston
Il giorno sab, 17/10/2009 alle 20.49 +0300, Paul Pogonyshev ha scritto:
> Pietro Battiston wrote:
> > Il giorno sab, 17/10/2009 alle 17.30 +0100, Tomeu Vizoso ha scritto:
> > > On Sat, Oct 17, 2009 at 17:12, René 'Necoro' Neumann  
> > > wrote:
> > > >
> > > > Well -- you are not initializing gtk.Image. So it's your very own
> > > > mistake. I don't see a pygtk issue here.
> > > 
> > > This is Python, any crash is a bug.
> > 
> > Wait, wait.
> > 
> > Read http://bugzilla.gnome.org/show_bug.cgi?id=561130 , then come back
> > here and let's talk :-)
> > 
> > Pietro
> > 
> > (P.S: as you can desume from the page, I _would like_ to agree with you)
> 
> You can still rightfully agree with him that it _is_ a bug.  Whether
> it gets fixed is another point.

What I mean is: where is it written that every crash is a bug, if Pygtk
developers themselves are not so clear on that (and I'm possibly too
ignorant)?

Pietro

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] pyGtk segfault comparing gtk.Image with 0

2009-10-17 Thread Paul Pogonyshev
Pietro Battiston wrote:
> What I mean is: where is it written that every crash is a bug, if Pygtk
> developers themselves are not so clear on that (and I'm possibly too
> ignorant)?

I am a PyGTK developer (not active currently), Matthias Classen is
not.  He is a developer of GTK+ itself.  I think it is pretty much
common sense that Python or any other script language must not crash.

For the record, the bug with gtk.Image (actually, with almost any
PyGObject wrapper class) is known and there is an entry for it in the
Bugzilla.  It is a bug in PyGTK/PyGObject, not GTK+.

Paul
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] pyGtk segfault comparing gtk.Image with 0

2009-10-17 Thread John Finlay
Pietro Battiston wrote:
> Il giorno sab, 17/10/2009 alle 20.49 +0300, Paul Pogonyshev ha scritto:
>   
>> Pietro Battiston wrote:
>> 
>>> Il giorno sab, 17/10/2009 alle 17.30 +0100, Tomeu Vizoso ha scritto:
>>>   
 On Sat, Oct 17, 2009 at 17:12, René 'Necoro' Neumann  
 wrote:
 
> Well -- you are not initializing gtk.Image. So it's your very own
> mistake. I don't see a pygtk issue here.
>   
 This is Python, any crash is a bug.
 
>>> Wait, wait.
>>>
>>> Read http://bugzilla.gnome.org/show_bug.cgi?id=561130 , then come back
>>> here and let's talk :-)
>>>
>>> Pietro
>>>
>>> (P.S: as you can desume from the page, I _would like_ to agree with you)
>>>   
>> You can still rightfully agree with him that it _is_ a bug.  Whether
>> it gets fixed is another point.
>> 
>
> What I mean is: where is it written that every crash is a bug, if Pygtk
> developers themselves are not so clear on that (and I'm possibly too
> ignorant)?
>
>   
this question has come around a couple of times before and I recall that 
each time it's deemed too impractical to catch every possible error to 
prevent a segfault.

John
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] How to add 'clicked' event to treeview cell?

2009-10-17 Thread John Finlay
Taras wrote:
> Hello, all!
>
>
> There is a table with some rows. For example, it has 3 columns. 
> The first one is icon column 'Add/Remove to favorites' with star icon.
> I read about pixbuf renderer but I can't find how can I connect
> 'clicked' event to this column :( I also research how it made in Exaile
> (music player written in Python/GTK). 
>
> There is workaround with:
> ...
>   self.list.connect('button-release-event', self.update_rating)
> ...
> and
> ...
>  (x, y) = e.get_coords()
>#check if the click is within rating column and on a list entry
>  if self.list.get_path_at_pos(int(x), int(y)) \
>  and left_edge < x < left_edge + rating_col_width:
> ...
> But it looks like unbeautiful workaround. Is there more beautiful
> solution to connect 'clicked' event to icon cell?
>
>   
I don't think there is a built-in way to connect to a clicked event on a 
TreeView cell.

John
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/