[Pyobjc-dev] Inheritance questions....
Brought to you by:
ronaldoussoren
From: Jiva D. <ji...@de...> - 2004-04-14 20:59:56
|
How do I call functions in a class which inherits from an objc class *before* i have finished initializing self? My goal here is to call some subfunctions in my constructor before calling the inherited constructor. But self is not yet initialized, so it doesn't work... So, say I have the following code in a python file: from Foundation import * from AppKit import * class BaseView(NSView): def __new__(cls, *args, **kwargs): return cls.alloc().init() def initWithFrame_(self, frame): super(BaseView, self).initWithFrame_(frame) return self def initWithPrintInfo_(self, info): self.info = info self.frame = self.getFrameFromPaperSize(info.papersize()) self.initWithFrame_(frame) return self def getFrameFromPaperSize(self, size): return ((0, 0), (10, 10)) class Inherit1(BaseView): def getFrameFromPaperSize(self, size): return ((0, 0), (20, 20)) class Inherit2(BaseView): def getFrameFromPaperSize(self, size): return ((0, 0), (30, 30)) See what I am trying to do? What should I do? -- Jiva DeVoe jiva at devoesquared.com http://www.devoesquared.com |