Re: [pygtk] new snapshot of pygtk and gnome-python

1999-02-28 Thread James Henstridge

What is the type of self where the exception occurs?  (ie. put in a print
`self` before calling self.get_data(i).get_text())

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Sun, 28 Feb 1999, Sam Tannous wrote:

> 
> When I do that, I get an AttributeError:
> 
> Traceback (innermost last):
>   File "./gtk.py", line 80, in __call__
> ret = apply(self.func, a)
>   File "./gconfig.py", line 1028, in ctree_select_row
> self.save_entries()
>   File "./gconfig.py", line 796, in save_entries
> a = self.get_data(i).get_text()
> AttributeError: get_data
> 
> 
> Any ideas?  
> 
> Sam
> 
> On Wed, Feb 24, 1999 at 07:58:53AM +0800, James Henstridge wrote:
> -> Probably just have to revert to the old way.
> -> 
> -> Convert getattr(self, i) to "self.get_data(i)" and setattr(self, i, a) to
> -> "self.set_data(i, a)"
> -> 
> -> James Henstridge.
> -> 
> -> --
> -> On Tue, 23 Feb 1999, Sam Tannous wrote:
> -> 
> -> > 
> -> > Sorry for my stupidity, but since you've commented out the 
> -> > setattr and getattr in this new snapshot, my code now crashed.
> -> > 
> -> > To make life easy, I have a loop set up where I do the following:
> -> > 
> -> > for i in self.router_config_entries:
> -> >   a = getattr(self,i).get_text()
> -> >   setattr(self.router_dict[self.current_router],i,a)
> -> > 
> -> > for i in self.router_config_checkbuttons:
> -> >   a = getattr(self,i).active
> -> >   #   print 'saving i = ',i, 'a = ',a
> -> >   setattr(self.router_dict[self.current_router],i,a)
> -> >  
> -> > So what am I supposed to do now?
> -> > 
> -> > Sam
> -> > 
> -> > On Tue, Feb 23, 1999 at 11:29:47PM +0800, James Henstridge wrote:
> -> > -> I have put up a new snapshot of pygtk and gnome-python.  The big change is
> -> > -> that I have commented out the __[gs]etattr__ functions as they were had
> -> > -> the potential to cause more trouble than convenience.
> -> > -> 
> 
> To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
> 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] new snapshot of pygtk and gnome-python

1999-02-28 Thread Sam Tannous


When I do that, I get an AttributeError:

Traceback (innermost last):
  File "./gtk.py", line 80, in __call__
ret = apply(self.func, a)
  File "./gconfig.py", line 1028, in ctree_select_row
self.save_entries()
  File "./gconfig.py", line 796, in save_entries
a = self.get_data(i).get_text()
AttributeError: get_data


Any ideas?  

Sam

On Wed, Feb 24, 1999 at 07:58:53AM +0800, James Henstridge wrote:
-> Probably just have to revert to the old way.
-> 
-> Convert getattr(self, i) to "self.get_data(i)" and setattr(self, i, a) to
-> "self.set_data(i, a)"
-> 
-> James Henstridge.
-> 
-> --
-> On Tue, 23 Feb 1999, Sam Tannous wrote:
-> 
-> > 
-> > Sorry for my stupidity, but since you've commented out the 
-> > setattr and getattr in this new snapshot, my code now crashed.
-> > 
-> > To make life easy, I have a loop set up where I do the following:
-> > 
-> > for i in self.router_config_entries:
-> >   a = getattr(self,i).get_text()
-> >   setattr(self.router_dict[self.current_router],i,a)
-> > 
-> > for i in self.router_config_checkbuttons:
-> >   a = getattr(self,i).active
-> >   #   print 'saving i = ',i, 'a = ',a
-> >   setattr(self.router_dict[self.current_router],i,a)
-> >  
-> > So what am I supposed to do now?
-> > 
-> > Sam
-> > 
-> > On Tue, Feb 23, 1999 at 11:29:47PM +0800, James Henstridge wrote:
-> > -> I have put up a new snapshot of pygtk and gnome-python.  The big change is
-> > -> that I have commented out the __[gs]etattr__ functions as they were had
-> > -> the potential to cause more trouble than convenience.
-> > -> 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] new snapshot of pygtk and gnome-python

1999-02-23 Thread James Henstridge

Probably just have to revert to the old way.

Convert getattr(self, i) to "self.get_data(i)" and setattr(self, i, a) to
"self.set_data(i, a)"

James Henstridge.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Tue, 23 Feb 1999, Sam Tannous wrote:

> 
> Sorry for my stupidity, but since you've commented out the 
> setattr and getattr in this new snapshot, my code now crashed.
> 
> To make life easy, I have a loop set up where I do the following:
> 
> for i in self.router_config_entries:
>   a = getattr(self,i).get_text()
>   setattr(self.router_dict[self.current_router],i,a)
> 
> for i in self.router_config_checkbuttons:
>   a = getattr(self,i).active
>   #   print 'saving i = ',i, 'a = ',a
>   setattr(self.router_dict[self.current_router],i,a)
>  
> So what am I supposed to do now?
> 
> Sam
> 
> On Tue, Feb 23, 1999 at 11:29:47PM +0800, James Henstridge wrote:
> -> I have put up a new snapshot of pygtk and gnome-python.  The big change is
> -> that I have commented out the __[gs]etattr__ functions as they were had
> -> the potential to cause more trouble than convenience.
> -> 
> 
> To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
> 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] new snapshot of pygtk and gnome-python

1999-02-23 Thread Hrvoje Niksic

Richard Fish <[EMAIL PROTECTED]> writes:

> Sam Tannous wrote:
> > So what am I supposed to do now?
> 
> Use class attributes referenced from self, or lambda's to pass the
> class instance to your callbacks:
[...]

There is a third solution, kindly provided by Gtk:

def clicked_cb (junk, button):
  print button.my_attr

button = GtkButton(...)
button.my_attr = "something"
... blah blah ...
button.connect ("clicked", clicked_cb, button)

I've used this kind of code with success.  If all you wish to do is
embed something in an existing class, then my proposal is less
heavy-weight than inheriting from GtkButton and nicer than the lambda
hack.

If our 1:1 mapping ideas see the light of day, you should be able to
simply use the "junk" argument directly.
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] new snapshot of pygtk and gnome-python

1999-02-23 Thread Richard Fish

Sam Tannous wrote:
> So what am I supposed to do now?

Use class attributes referenced from self, or lambda's to pass the class
instance to your callbacks:

from gtk import *
from GDK import *

def ClickedCB(button):
  print button.my_attr

class MyButton(GtkButton):
  my_attr = "Hello there!"
  def __init__(self,*args,**kw):
apply(GtkButton.__init__,(self,)+args,kw)
self.connect("clicked",self.MyClickedCB)
self.connect("clicked",lambda ignore,x=self: ClickedCB(x))

  def MyClickedCB(self,ignore):
print self.my_attr

b=MyButton()
b.emit("clicked")


-- 
Richard Fish  Enhanced Software Technologies, Inc.
Software Developer4014 E Broadway Rd Suite 405
[EMAIL PROTECTED]Phoenix, AZ  85040 
(602) 470-1115http://www.estinc.com
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] new snapshot of pygtk and gnome-python

1999-02-23 Thread Sam Tannous


Sorry for my stupidity, but since you've commented out the 
setattr and getattr in this new snapshot, my code now crashed.

To make life easy, I have a loop set up where I do the following:

for i in self.router_config_entries:
  a = getattr(self,i).get_text()
  setattr(self.router_dict[self.current_router],i,a)

for i in self.router_config_checkbuttons:
  a = getattr(self,i).active
  #   print 'saving i = ',i, 'a = ',a
  setattr(self.router_dict[self.current_router],i,a)
 
So what am I supposed to do now?

Sam

On Tue, Feb 23, 1999 at 11:29:47PM +0800, James Henstridge wrote:
-> I have put up a new snapshot of pygtk and gnome-python.  The big change is
-> that I have commented out the __[gs]etattr__ functions as they were had
-> the potential to cause more trouble than convenience.
-> 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] new snapshot of pygtk and gnome-python

1999-02-23 Thread Richard Fish

James Henstridge wrote:

> This will probably be the next release of pygtk.


???

(You didn't mean 'last', did you?)

-- 
Richard Fish  Enhanced Software Technologies, Inc.
Software Developer4014 E Broadway Rd Suite 405
[EMAIL PROTECTED]Phoenix, AZ  85040 
(602) 470-1115http://www.estinc.com
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



[pygtk] new snapshot of pygtk and gnome-python

1999-02-23 Thread James Henstridge

I have put up a new snapshot of pygtk and gnome-python.  The big change is
that I have commented out the __[gs]etattr__ functions as they were had
the potential to cause more trouble than convenience.

This release also fixes up a number of bugs in the style code that I
introduced in a previous snapshot, and adds a cursor changing example to
testgtk.py.  I have also updated the XML parser in the pyglade package.
If the xmllib module is available (and it is for python >= 1.5), it will
use that as its parser instead of my crappy one.  This should make the
pyglade code a bit more robust.

I have also included a file MAPPING, which gives a bit of information
about the internals of pygtk for those who are interested, and the mapping
of the C functions to python, which is useful for those wanting to use
documentation or examples written for C.

This will probably be the next release of pygtk.

James Henstridge.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]