That's a good tip, I haven't gotten the hang of Cocoa's verbosity yet.
The choice of read: was to balance write:. The whole thing started
because I found it odd that writing an image to a file was such a
convoluted process. In a lot of ways, Cocoa makes things really easy,
but when it isn't
On Jan 27, 2005, at 15:24, Dethe Elza wrote:
FYI, once I updated PyObjC from svn, my example code worked, thanks
again Ronald.
...
class NSImage(Category(NSImage)):
def rect(self):
return (0,0),self.size()
@classmethod # for Python2.3 replace with read_ =
classmethod(read_)
de
FYI, once I updated PyObjC from svn, my example code worked, thanks
again Ronald.
from objc import Category
from AppKit import *
from os.path import splitext
_fileRepresentationMapping = {
'.png': NSPNGFileType,
'.gif': NSGIFFileType,
'.jpg': NSJPEGFileType,
'.jpe
You totally rock, heading to svn now.
Thanks!
--Dethe
On 27-Jan-05, at 3:32 AM, Ronald Oussoren wrote:
On 27-jan-05, at 12:06, Ronald Oussoren wrote:
On 27-jan-05, at 6:34, Dethe Elza wrote:
On 26-Jan-05, at 8:58 PM, Dethe Elza wrote:
class NSImage(Category(NSImage)):
def read_(cls, filepath):
On 27-jan-05, at 12:06, Ronald Oussoren wrote:
On 27-jan-05, at 6:34, Dethe Elza wrote:
On 26-Jan-05, at 8:58 PM, Dethe Elza wrote:
class NSImage(Category(NSImage)):
def read_(cls, filepath):
return NSImage.alloc().initWithhContentsOfFile_(filepath)
read_ = classmethod(read_)
er, th
On 27-jan-05, at 6:34, Dethe Elza wrote:
On 26-Jan-05, at 8:58 PM, Dethe Elza wrote:
class NSImage(Category(NSImage)):
def read_(cls, filepath):
return NSImage.alloc().initWithhContentsOfFile_(filepath)
read_ = classmethod(read_)
er, that should be initWithContentsOfFile_, but still
On 26-Jan-05, at 8:58 PM, Dethe Elza wrote:
class NSImage(Category(NSImage)):
def read_(cls, filepath):
return NSImage.alloc().initWithhContentsOfFile_(filepath)
read_ = classmethod(read_)
er, that should be initWithContentsOfFile_, but still gets the same
error even without the ty
Hi folks,
Is it possible to add class methods to a class using Categories?
when I try what appears to me to be the naive way to do it:
from objc import Category
from AppKit import NSImage
class NSImage(Category(NSImage)):
def read_(cls, filepath):
return NSImage.alloc().initWithhContent