Re: [Pythonmac-SIG] Right init method

2005-07-04 Thread Jacob Kaplan-Moss
Aldo --

PyObjC classes (that is, Python classes that extend ObjC ones, like  
you're trying there) don't use the standard __init__ mechanism (at  
least, not in a useful way).  They do use the standard alloc/init  
mechanism from ObjC, so you're on the right track in your last try:

 def init(self):
 super.init(self)
 NSLog(init)
 self.speechSynth = NSSpeechSynthetizer.alloc 
 ().initWithVoice_(nil)

The only think you're missing is a return self -- ObjC init methods  
always return self, so you have to do the same from PyObjC.

Hope that helps,

Jacob
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Right init method

2005-07-04 Thread Bob Ippolito

On Jul 4, 2005, at 6:23 AM, Jacob Kaplan-Moss wrote:

 Aldo --

 PyObjC classes (that is, Python classes that extend ObjC ones, like
 you're trying there) don't use the standard __init__ mechanism (at
 least, not in a useful way).  They do use the standard alloc/init
 mechanism from ObjC, so you're on the right track in your last try:


 def init(self):
 super.init(self)
 NSLog(init)
 self.speechSynth = NSSpeechSynthetizer.alloc
 ().initWithVoice_(nil)


 The only think you're missing is a return self -- ObjC init methods
 always return self, so you have to do the same from PyObjC.

def init(self):
 self = super(PySayTextAppDelegate, self).init()
 
 return self

Also, READ THE DOCS and examples please, this is most definitely  
covered a thousand times :)

-bob

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Right init method

2005-07-04 Thread Jacob Kaplan-Moss
On Jul 4, 2005, at 12:39 PM, Bob Ippolito wrote:
 Also, READ THE DOCS and examples please, this is most definitely  
 covered a thousand times :)

Lighten up, Bob; this isn't explicitly mentioned anywhere -- it only  
shows up once in a comment on the intro page (http:// 
pyobjc.sourceforge.net/doc/intro.php#objective-c-for-pyobjc-users),  
and it's easy to miss (I know I did when I was getting started).   
Perhaps this one should be added to the FAQ?

Jacob
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Right init method

2005-07-04 Thread Bob Ippolito

On Jul 4, 2005, at 9:31 AM, Jacob Kaplan-Moss wrote:

 On Jul 4, 2005, at 12:39 PM, Bob Ippolito wrote:

 Also, READ THE DOCS and examples please, this is most definitely  
 covered a thousand times :)


 Lighten up, Bob; this isn't explicitly mentioned anywhere -- it  
 only shows up once in a comment on the intro page (http:// 
 pyobjc.sourceforge.net/doc/intro.php#objective-c-for-pyobjc-users),  
 and it's easy to miss (I know I did when I was getting started).   
 Perhaps this one should be added to the FAQ?

It is used in nearly every single example, though.  I guess it should  
be reworded to be more obvious in the docs.

-bob

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig