[PyQt] properties and interfaces with dip 0.3

2011-07-13 Thread Lic . José M . Rodriguez Bacallao
hi folks, may be this is an fool question but, how to implement properties with interface attributes, for example, this doesn't work: class SomeObject(object): def __init__(self, id): self.id = id class ISomething(Interface): id = Str() class Somthing(Interface): _internal

Re: [PyQt] properties and interfaces with dip 0.3

2011-07-13 Thread Phil Thompson
On Wed, 13 Jul 2011 12:09:37 -0400, Lic. José M. Rodriguez Bacallao jmr...@gmail.com wrote: hi folks, may be this is an fool question but, how to implement properties with interface attributes, for example, this doesn't work: class SomeObject(object): def __init__(self, id):

Re: [PyQt] properties and interfaces with dip 0.3

2011-07-13 Thread Lic . José M . Rodriguez Bacallao
yes, I know I can't think in interfaces like base classes but, as I read in documentation that attributes are automatically added to te concrete implementation of the interface, well, look at this sample: class ITest(Interface): id = Str() @implements(ITest) class Test(Model):

Re: [PyQt] properties and interfaces with dip 0.3

2011-07-13 Thread Phil Thompson
On Wed, 13 Jul 2011 13:53:57 -0400, Lic. José M. Rodriguez Bacallao jmr...@gmail.com wrote: yes, I know I can't think in interfaces like base classes but, as I read in documentation that attributes are automatically added to te concrete implementation of the interface, well, look at this

Re: [PyQt] properties and interfaces with dip 0.3

2011-07-13 Thread Lic . José M . Rodriguez Bacallao
ok, I see now, a couple of questions: 1- and how to use observe function as a decorator 2- there is any way that the observer/setter method of a property be called when setting the initial value On Wed, Jul 13, 2011 at 2:24 PM, Phil Thompson p...@riverbankcomputing.com wrote: On Wed, 13 Jul 2011

Re: [PyQt] properties and interfaces with dip 0.3

2011-07-13 Thread Phil Thompson
On Wed, 13 Jul 2011 14:56:52 -0400, Lic. José M. Rodriguez Bacallao jmr...@gmail.com wrote: ok, I see now, a couple of questions: 1- and how to use observe function as a decorator @observe('id') def on_change(self, change): Note that you don't have to use 'ITest.id'. This is because

Re: [PyQt] properties and interfaces with dip 0.3

2011-07-13 Thread Lic . José M . Rodriguez Bacallao
in this example: class ITest(Interface): id = Str() @implements(ITest) class Test(Model): @ITest.id.getter def id(self): return 'getting id' @ITest.id.setter def id(self, v): print 'setting id' @observe('id') def on_change(self, change):

Re: [PyQt] properties and interfaces with dip 0.3

2011-07-13 Thread Phil Thompson
On Wed, 13 Jul 2011 15:17:48 -0400, Lic. José M. Rodriguez Bacallao jmr...@gmail.com wrote: in this example: class ITest(Interface): id = Str() @implements(ITest) class Test(Model): @ITest.id.getter def id(self): return 'getting id' @ITest.id.setter

Re: [PyQt] properties and interfaces with dip 0.3

2011-07-13 Thread Lic . José M . Rodriguez Bacallao
must the getter method is supposed to be called no, is a getter!!! On Wed, Jul 13, 2011 at 3:49 PM, Phil Thompson p...@riverbankcomputing.com wrote: On Wed, 13 Jul 2011 15:17:48 -0400, Lic. José M. Rodriguez Bacallao jmr...@gmail.com wrote: in this example: class ITest(Interface):     id =