Re: [Pyobjc-dev] Wrapping SkimNotes framework
Brought to you by:
ronaldoussoren
From: Ronald O. <ron...@ma...> - 2009-11-16 21:27:58
|
On 15 Nov, 2009, at 13:01, Jonas Zimmermann wrote: > Hi, > > I'm quite new to Python and pyobjc; I've searched the pyobjc documentation and this list archive but couldn't find an answer to my problem: > > I'd like to wrap the SkimNotes framework. It extends several standard Cocoa classes such as PDFDocument and NSFileManager using informal protocols. > The methods defined in the framework are actually implemented as well. In the examples I've found for using objc.informal_protocol it seems that these are expected to be implemented in the Python code? > So if I want to use the framework with code like this: > > objc.loadBundle("SkimNotes", globals(), bundle_path=objc.pathForFramework(pathToSkimNotes)) > SKNPDFDocument = objc.informal_protocol('SKNPDFDocument',[objc.selector(None, > selector="SkimNotesAtURL",signature="[@]@:@",isRequired=0), objc.selector(None, > selector="notes",signature="[@]",isRequired=0)]) > > how do I actually get an instance of PDFDocument that listens to the method SkimNotesAtURL defined and implemented in the framework? > > Sorry for being confus(ed/ing)... If I understand what you write correctly and the SkimNotes framework implements the informal protocol when loaded you don't have to do anything beyond the 'loadBundle' call, you don't even have to create the informal_protoco object. PyObjC automaticly scans classes for methods when it accesses a class. There is one reason why you might have to do more: if the class has pointer arguments (such as an 'NSError**' or 'int*' argument) you have to tell PyObjC what it should do with the pointer. Ronald > > Jonas > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |