Bill Janssen <jans...@parc.com> wrote:

> Ronald Oussoren <ronaldousso...@mac.com> wrote:
> 
> > The example that's in the repository is fully up-to-date, although it
> > doesn't use Interface Builder.
> 
> Good to know.  I'd downloaded a version of the example from somewhere,
> which seems a bit antique compared to what's in
> http://svn.red-bean.com/pyobjc/trunk/ (I presume that's the
> repository?).  But the repo code still has things like marking actions
> with "@objc.IBAction", which I haven't found necessary in my code.  Is
> that still necessary?
> 
> > The easiest way to develop preference panes for now is to have a dummy
> > xcode project to get the nibfile integration in interface builder
> > (that is, when you add python files to an xcode project IB automaticly
> > knows about those files). Then use py2app to actually build the
> > preference pane.
> 
> OK, that seems straightforward.  Do I have to run "File>>Reload All
> Class Files" to get IB to know about the specifics of the class?
> 
> And, how do I build an appropriate setup.py file to run py2app on?
> Where is that documented?
> 
> > Py2app in subversion already can compile .xib files when building a
> > bundle, unless you use the '-A' flag. In that case you're better of to
> > instruct Interface builder to save your IB documents as '.nib' files.
> 
> My problem is connecting things up in IB in the first place, which is
> why I was talking about a step-by-step example.  Suppose I use XCode to
> build a stub PrefPane project called "test".  I remove the testPref.h
> and testPref.m files it provides, and add my own testPref.py file, using
> the "Python class which inherits from NSObject template".  I make sure
> that testPref.py is in the "Classes" part of the Xcode project.  I edit
> testPref.py to have the class "testPref" inherit from NSPreferencePane
> instead of NSObject.  I then double-click on testPref.xib to bring up
> IB.
> 
> That's where I get lost.  What specific actions do I need to do to
> connect the preference pane to that new class file?
> 
> Here's what I think is right:
> 
> 1.  In IB, use "File >> Reload All Class Files".
> 2.  Select "File's Owner", and set its Class type to "testPref".
> 3.  Build the UI of the PP and connect it up to outlets and actions
>     on the "File's Owner" class.
> 4.  Save everything in IB.
> 5.  Run py2app to build the pane.
> 
> > BTW, AFAIK there are no Xcode templates for building plugin bundles in
> > Python and I have no intention to create those because I don't like
> > Xcode for Python development.
> 
> Yeah, I use Emacs myself, but it's handy to generate that stub project
> you recommend.
> 
> Bill
> 
> > Ronald
> > 
> > On 17 Apr, 2009, at 19:56, Bill Janssen wrote:
> > 
> > > Hi, all.  I'm trying to build a PreferencePane with Python and
> > > Interface
> > > Builder, and the examples I can find on the Web seem somewhat
> > > out-of-date.  In particular, the EnvironmentPane example seems to
> > > use a
> > > "magic NIB", which I can't figure out how to construct from scratch,
> > > and
> > > which I can't seem to convert to XIB format.  If someone could outline
> > > the steps of what needs to happen to build a new PreferencePane XIB
> > > file
> > > from scratch, using IB, I'd be grateful.
> > >
> > > Or if you've got a pointer to an up-to-date Xcode 3 example, that
> > > would
> > > be useful, too.
> > >
> > > Thanks!
> > >
> > > Bill

Yeah, I still can't get this to work.  When I try to load the prefPane,
I get the following error message on the console:

*** -[NSCFArray insertObject:atIndex:]: attempt to insert nil

I think I'm missing something in the NIB.

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

Reply via email to