Thread: [Pyobjc-dev] enumerator support
Brought to you by:
ronaldoussoren
From: Bill B. <bb...@co...> - 2003-02-27 18:46:13
|
It is in the version in CVS. Specifically, this... for aRow in self.typesTable.selectedRowEnumerator(): .... ... works just fine nowadays. Basically, anything that implements -nextObject can be used on the RHS of the 'in' in an iterative context. b.bum |
From: <bo...@pa...> - 2003-02-27 19:26:27
|
ok, this works in a command-line program (% python test.py), but doesnt work inside PB. is there a way to see which version of python is being launched by PB? and how to change it? thanks, bob On Thursday, February 27, 2003, at 10:45 AM, Bill Bumgarner wrote: > It is in the version in CVS. Specifically, this... > > for aRow in self.typesTable.selectedRowEnumerator(): > .... > > ... works just fine nowadays. > > Basically, anything that implements -nextObject can be used on the RHS > of the 'in' in an iterative context. > > b.bum > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > |
From: Bill B. <bb...@co...> - 2003-02-27 19:39:27
|
On Thursday, Feb 27, 2003, at 13:55 US/Eastern, Bob Pasker wrote: > ok, this works in a command-line program (% python test.py), but doesnt > work inside PB. is there a way to see which version of python is being > launched by PB? and how to change it? thanks, bob Sure. Add something like... import sys print sys.version .... to __main__.py. It sounds like you probably have a non-Apple build of Python installed? If you do, that is fine -- if you plan on using it all the time, I would recommend 'rm -rf /usr/lib/python2.2/site-packages/...pyobjc stuff...' to avoid confusion. In any case, you can launch one of the Project Template created projects with an alternative python binary by changing the PythonBinPath default. I do this in PBX by editing the executable and adding... -PythonBinPath /usr/local/bin/python ... as a launch argument. b.bum |
From: <bo...@pa...> - 2003-02-27 20:31:50
|
thanks, this helped alot. the key was sys.path, which showed the difference: for PB: ['/System/Library/Frameworks/Foundation.framework/Versions/C/ Resources', '/Users/rbp/Documents/build projects/Mbox2AB.app/Contents/Resources', '/Users/rbp/Documents/build projects/Mbox2AB.app/Contents/Resources', '/usr/lib/python2.2', '/usr/lib/python2.2/plat-darwin', '/usr/lib/python2.2/lib-tk', '/usr/lib/python2.2/lib-dynload', '/usr/lib/python2.2/site-packages'] command line: ['', '/sw/lib/python2.2', '/sw/lib/python2.2/plat-darwin', '/sw/lib/python2.2/lib-tk', '/sw/lib/python2.2/lib-dynload', '/sw/lib/python2.2/site-packages', '/sw/lib/python2.2/site-packages/PyObjC'] --bob On Thursday, February 27, 2003, at 11:39 AM, Bill Bumgarner wrote: > On Thursday, Feb 27, 2003, at 13:55 US/Eastern, Bob Pasker wrote: >> ok, this works in a command-line program (% python test.py), but >> doesnt >> work inside PB. is there a way to see which version of python is being >> launched by PB? and how to change it? thanks, bob > > Sure. Add something like... > > import sys > print sys.version > > .... to __main__.py. > > It sounds like you probably have a non-Apple build of Python > installed? If you do, that is fine -- if you plan on using it all the > time, I would recommend 'rm -rf > /usr/lib/python2.2/site-packages/...pyobjc stuff...' to avoid > confusion. > > In any case, you can launch one of the Project Template created > projects with an alternative python binary by changing the > PythonBinPath default. > > I do this in PBX by editing the executable and adding... > > -PythonBinPath /usr/local/bin/python > > ... as a launch argument. > > b.bum > > |
From: <bo...@pa...> - 2003-02-27 19:26:27
|
both of these methods are generating a sigbus. the first one fails instantly, the second one prints out "tableview will display cell" 3 times (in a 4x3 TableModel) and fails. any ideas? --bob # # TableView delegate methods # def tableView_shouldSelectRow_(self, aTableView, rowIndex): print "tableview select row" return 1 def tableView_willDisplayCell_forTableColumn_row_(self, aTableView, aCell, aColumn, rowIndex): print "tableview will display cell" |
From: <bb...@ma...> - 2003-02-27 19:59:56
|
Did you declare your table data source or table delegate as a class that implements NSTableDataSource or NSTableViewDelegate? If not, the problem is that PyObjC has no way of knowing that your implementation of said method should take, say, an integer for the rowIndex argument vs. an object. It assumes object and interprets the, say, row 1 index as an object pointer -- *boom*. I.e.: class TableFoo(SuperFoo, NSTableDataSource): .... implement methods ... Ahhh... there is no NSTableViewDelegate. Now there is. Update from cvs and rebuild... then declare your class as: class TableFoo(SuperFoo, NSTableDataSource, NSTableViewDelegate): .... implement methods ... I updated the TableModel2 example to demonstrate the use of tableView_shouldSelectRow_(). b.bum On Thursday, Feb 27, 2003, at 14:17 US/Eastern, Bob Pasker wrote: > both of these methods are generating a sigbus. the first one fails > instantly, the second one prints out "tableview will display cell" > 3 times (in a 4x3 TableModel) and fails. any ideas? --bob > > # > # TableView delegate methods > # > def tableView_shouldSelectRow_(self, aTableView, rowIndex): > print "tableview select row" > return 1 > > def tableView_willDisplayCell_forTableColumn_row_(self, > aTableView, aCell, aColumn, rowIndex): > print "tableview will display cell" |