Re: [Pyobjc-dev] shouldSelectRow not working as expected
Brought to you by:
ronaldoussoren
From: Just v. R. <ju...@le...> - 2003-02-28 11:17:45
|
Ronald Oussoren wrote: > Right. Does the patch I just checked in solve the problem? Partly, it seems. However, you _must_ return an int/bool for methods that are declared to return a BOOL; when I return None instead I get an exception. I assume that's because ObjC can't see the difference between a BOOL and a char at the time the conversion happens. In my PythonBrowser playground I have an inconsitency, though. Two methods are supposed to return BOOLs, yet one is part of the NSOutlineViewDataSource protocol, the other is an NSOutlineView delegate method (is there even a NSOutlineViewDelegate protocol?). class PythonBrowserModel(AutoBaseClass, NSOutlineViewDataSource): [..snippo..] def outlineView_isItemExpandable_(self, view, item): # part of the NSOutlineViewDataSource protocol, # must return int/bool if item is None: item = self.root return item.isExpandable() def outlineView_shouldEditTableColumn_item_(self, view, col, item): # this is a delegate method of NSOutlineView, I _must_ return # None as "NO", any other object as "YES", hence the "or None" # hack. return item.isEditable() or None I suppose this is not solvable without adding an NSOutlineViewDelegate informal protocol? Here's a thought: what if the bridge would convert the False bool instance to nil? Hm, this would only work with Python 2.3 unless we add proper bool support to 2.2 ourselves (btw. plistlib.py contains code that does just that, but only for that module). Just |