pyobjc-dev Mailing List for PyObjC (Page 195)
Brought to you by:
ronaldoussoren
You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(1) |
Feb
(2) |
Mar
(3) |
Apr
(30) |
May
(18) |
Jun
|
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2002 |
Jan
(7) |
Feb
(2) |
Mar
(1) |
Apr
|
May
|
Jun
(3) |
Jul
(13) |
Aug
|
Sep
(23) |
Oct
(180) |
Nov
(291) |
Dec
(95) |
2003 |
Jan
(338) |
Feb
(352) |
Mar
(97) |
Apr
(46) |
May
(226) |
Jun
(184) |
Jul
(145) |
Aug
(141) |
Sep
(69) |
Oct
(161) |
Nov
(96) |
Dec
(90) |
2004 |
Jan
(66) |
Feb
(87) |
Mar
(98) |
Apr
(132) |
May
(115) |
Jun
(68) |
Jul
(150) |
Aug
(92) |
Sep
(59) |
Oct
(52) |
Nov
(17) |
Dec
(75) |
2005 |
Jan
(84) |
Feb
(191) |
Mar
(133) |
Apr
(114) |
May
(158) |
Jun
(185) |
Jul
(62) |
Aug
(28) |
Sep
(36) |
Oct
(88) |
Nov
(65) |
Dec
(43) |
2006 |
Jan
(85) |
Feb
(62) |
Mar
(92) |
Apr
(75) |
May
(68) |
Jun
(101) |
Jul
(73) |
Aug
(37) |
Sep
(91) |
Oct
(65) |
Nov
(30) |
Dec
(39) |
2007 |
Jan
(24) |
Feb
(28) |
Mar
(10) |
Apr
(2) |
May
(18) |
Jun
(16) |
Jul
(21) |
Aug
(6) |
Sep
(30) |
Oct
(31) |
Nov
(153) |
Dec
(31) |
2008 |
Jan
(63) |
Feb
(70) |
Mar
(47) |
Apr
(24) |
May
(59) |
Jun
(22) |
Jul
(12) |
Aug
(7) |
Sep
(14) |
Oct
(26) |
Nov
(5) |
Dec
(5) |
2009 |
Jan
(10) |
Feb
(41) |
Mar
(70) |
Apr
(88) |
May
(49) |
Jun
(62) |
Jul
(34) |
Aug
(15) |
Sep
(55) |
Oct
(40) |
Nov
(67) |
Dec
(21) |
2010 |
Jan
(60) |
Feb
(17) |
Mar
(26) |
Apr
(26) |
May
(29) |
Jun
(4) |
Jul
(21) |
Aug
(21) |
Sep
(10) |
Oct
(12) |
Nov
(3) |
Dec
(19) |
2011 |
Jan
(3) |
Feb
(13) |
Mar
(8) |
Apr
(8) |
May
(17) |
Jun
(20) |
Jul
(21) |
Aug
(7) |
Sep
|
Oct
|
Nov
(9) |
Dec
(11) |
2012 |
Jan
(3) |
Feb
|
Mar
|
Apr
(5) |
May
(4) |
Jun
(14) |
Jul
(5) |
Aug
(2) |
Sep
(15) |
Oct
(2) |
Nov
(23) |
Dec
(1) |
2013 |
Jan
(8) |
Feb
(1) |
Mar
|
Apr
|
May
(5) |
Jun
(1) |
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(12) |
Nov
(10) |
Dec
(3) |
2014 |
Jan
(7) |
Feb
(14) |
Mar
(2) |
Apr
|
May
(2) |
Jun
(11) |
Jul
(10) |
Aug
(4) |
Sep
|
Oct
(8) |
Nov
(1) |
Dec
(2) |
2015 |
Jan
(9) |
Feb
(7) |
Mar
(1) |
Apr
|
May
(7) |
Jun
|
Jul
(5) |
Aug
(6) |
Sep
|
Oct
(1) |
Nov
(4) |
Dec
|
2016 |
Jan
(1) |
Feb
(1) |
Mar
(4) |
Apr
(2) |
May
(1) |
Jun
|
Jul
(6) |
Aug
(8) |
Sep
(21) |
Oct
(17) |
Nov
|
Dec
(36) |
2017 |
Jan
(6) |
Feb
(2) |
Mar
(4) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
(1) |
Dec
(6) |
2018 |
Jan
(2) |
Feb
(3) |
Mar
(3) |
Apr
(14) |
May
(2) |
Jun
(2) |
Jul
(4) |
Aug
(3) |
Sep
(6) |
Oct
(16) |
Nov
(1) |
Dec
(6) |
2019 |
Jan
(3) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
(6) |
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(2) |
Jun
(1) |
Jul
(7) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
(2) |
Dec
(1) |
2021 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(5) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2023 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2025 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Burris T. E. <bu...@gi...> - 2004-03-25 16:31:55
|
I should mention that the reason each worker has it's own thread is because in the real app I'm working on, each worker calls a blocking function that doesn't return for hours. The blocking function takes callables that are used as callbacks for display. Since you can't touch appkit objects from any thread but the main thread, the callbacks use some mechanism (I've tried performOnMainThread, NSTimer, and DO) to pass the display data to the main thread so the appkit objects can be updated. This is the third time I've tried to rewrite this existing ObjC/python app (that has over a million downloads, BTW) in pyobjc and it never works. I do not believe that pyobjc can be used for multithreaded apps at all. I think my only choice is to run the workers in a subprocess and use DO to communicate with the display process, but I'm skeptical even that will work. burris |
From: Burris T. E. <bu...@gi...> - 2004-03-25 06:19:25
|
Okay, here is a bare bones implementation of what I was describing. http://www.gigagig.org/BT/mcfoo.tgz Start this up. It helps to click on the cells, try to drag them. Sometimes it will hang. Sometimes it will crash like this: *** malloc[1540]: Deallocation of a pointer not malloced: 0x726df0; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug *** malloc_zone_malloc[1540]: argument too large: 4294967292 mcfoo has exited due to signal 10 (SIGBUS). thanks, burris |
From: <a0...@bb...> - 2004-03-23 14:57:33
|
=1B$B!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A=1B(B =1B$B%5%$%H4IM}<TMM$X=1B(B =1B$B$*K;$7$$=3Dj!"BgJQ<:Ni$$$?$7$^$9!#=1B(B =1B$B$"!!$-!!$H?=3D$7$^$9!#=1B(B =1B$B%i%s%-%s%0$N?75,3+@_$KEv$?$j!"=1B(B =1B$B5.%5%$%HMM$N$h$&$JM%NI%5%$%HMM$K;22C$$$?$@$-$?$/=1B(B =1B$B%a!<%k$rCW$7$^$7$?!#=1B(B =1B$B!V%9!<%Q!<%i%s%-%s%0!W=1B(B http://www.hotclick.tv/24781 =1B$B$*<j;}$A$N%5%$%H$,$"$j$^$7$?$i!"=1B(B =1B$B$44uK>$N%8%c%s%k$K$I$s$I$sEPO?$7$F$/$@$5$$$M!#=1B(B =1B$B$b$7=3DEJ#Aw?.Ey8f:B$$$^$7$?$i$*OM$S?=3D$7>e$2$^$9!#=1B(B =1B$B$^$?!"$3$N%i%s%-%s%0$X$NM6$$$r<u$1<h$j$?$/$J$$$H$*9M$($N4IM}<TMM$O!"= =1B(B =1B$B$=3D$N;]$rJV?.$7$F$/$@$5$$!#=1B(B =1B$B:G8e$^$GFI$s$G$$$?$@$$$FM-Fq$&$4$6$$$^$7$?!#=1B(B =1B$B!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A!A=1B(B |
From: Ronald O. <ous...@ci...> - 2004-03-19 09:27:44
|
On 19-mrt-04, at 7:30, b.bum wrote: > On Mar 18, 2004, at 9:45 PM, Burris T. Ewell wrote: >> I think I'm running latest CVS and built in 2.3 on 10.3.2 > > (0) It sounds like you are tripping over some threading weirdness.... > > ... but before you go down that route .... > > (1) make sure you are leveraging Cocoa Bindings as much as possible. > It will eliminate code -- one less line of code is one less potential > bug. > > http://developer.apple.com/documentation/Cocoa/Conceptual/ > CocoaBindings/index.html > > (2) have a look at the Twisted+WebServices+ControllerLayer example > found in the examples. It does multithreaded filling of a table view > and I haven't encountered a crash.... (3) try to reproduce your crash in a minimal program I'd like to know what causes this crash, even when it turns out to be a bug in your script. If it is a bug in PyObjC it should be fixed, and that is not likely to happen unless you either send a patch or a program that reproduces your problem. Ronald -- X|support bv http://www.xsupport.nl/ T: +31 610271479 F: +31 204416173 |
From: Bob I. <bo...@re...> - 2004-03-19 09:16:17
|
On Mar 19, 2004, at 1:30 AM, b.bum wrote: > On Mar 18, 2004, at 9:45 PM, Burris T. Ewell wrote: >> I think I'm running latest CVS and built in 2.3 on 10.3.2 > > (0) It sounds like you are tripping over some threading weirdness.... > > ... but before you go down that route .... > > (1) make sure you are leveraging Cocoa Bindings as much as possible. > It will eliminate code -- one less line of code is one less potential > bug. > > http://developer.apple.com/documentation/Cocoa/Conceptual/ > CocoaBindings/index.html > > (2) have a look at the Twisted+WebServices+ControllerLayer example > found in the examples. It does multithreaded filling of a table view > and I haven't encountered a crash.... It's only technically multithreaded because CoreFoundation uses an additional thread behind the scenes to do a select loop. Python only knows about the event loop thread, so I would consider it single threaded. -bob |
From: b.bum <bb...@ma...> - 2004-03-19 06:30:29
|
On Mar 18, 2004, at 9:45 PM, Burris T. Ewell wrote: > I think I'm running latest CVS and built in 2.3 on 10.3.2 (0) It sounds like you are tripping over some threading weirdness.... ... but before you go down that route .... (1) make sure you are leveraging Cocoa Bindings as much as possible. It will eliminate code -- one less line of code is one less potential bug. http://developer.apple.com/documentation/Cocoa/Conceptual/ CocoaBindings/index.html (2) have a look at the Twisted+WebServices+ControllerLayer example found in the examples. It does multithreaded filling of a table view and I haven't encountered a crash.... b.bum |
From: Burris T. E. <bu...@gi...> - 2004-03-19 05:46:23
|
Forgive me, my Cocoa is pretty rusty... I have a single column NSTableView using an NSCell subclass. The cell gets a reference to a view (a box of regular controls) in setObjectValue_ Each row has a worker thread, started with start_new_thread, that posts a method and arguments onto a queue. I have an NSTimer going off in the main thread that pulls the methods off the queue, which update the views that are displayed in the cell. When there is more than one row in the TV I get a strange crash shortly after selecting rows in quick succession or in dragging on a row (the TV is set to single selection and no rearranging of rows). Usually in the cell's drawInteriorWithFrame_inView_ the attribute containing the content view will disappear mid-method. Or an extra argument will show up in the NSTimer fired event loop. Now I'm getting "Fatal Python error: GC object already tracked" I think I'm running latest CVS and built in 2.3 on 10.3.2 Any help would be appreciated! interesting bits from cell: def setObjectValue_(self, controller): self.controller = controller def drawInteriorWithFrame_inView_(self, frame, view): if self.controller.cview.superview() != view: view.addSubview_(self.controller.cview) if self.controller.resized: self.controller.resized = 0 self.controller.cview.setFrame_(frame) self.controller.cview.lockFocus() self.controller.cview.drawRect_(frame) self.controller.cview.unlockFocus() interesting bits from the controller: def handleEvents_(self, timer): while self.events: self.event_lock.acquire() f, args, kwargs = self.events.pop() self.event_lock.release() try: f(*args,**kwargs) except: print_exc() if not self.flag.isSet(): NSTimer.scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_ (0.2, self, self.handleEvents_, self, 0) burris |
From: Ronald O. <ous...@ci...> - 2004-03-17 20:32:04
|
On 17-mrt-04, at 18:58, Birch Browning wrote: > Please forgive me if I've gone about this the wrong way. I'm still > quite > a newbie to pyobjc. I think I know just enough to be dangerous. You're lucky ;-), I thought you ran into a PyObjC bug and I wanted to fix that. The attached archive contains two python files: main.py is the translation of the Objective-C source-code into python, buildapp.py can be used to build the application. Copy both files into the Objective-C example tree and then run 'python buildapp.py build'. This should create 'build/NSMovie_Example.app', which seems fully functional. |
From: Birch B. <b.b...@cs...> - 2004-03-17 18:15:00
|
Please forgive me if I've gone about this the wrong way. I'm still quite a newbie to pyobjc. I think I know just enough to be dangerous. I'm developing a research application for evaluating pre-service teachers (I have to get tenure!). The application is all set with the exception of extracting time data from the quicktime file. I've seen it done in cocoa/objc (see nsmovie_example at www.macdevcenter.com/pub/a/mac/2003/08/15/quicktime_cocoa.html) but I can't quite figure out how to translate this to pyobjc. If I do: m = self.movie.QTMovie() s = str(m) self.results.insertText_(s) I can see that m is a QT.Movie object. Doing this, however, also promptly crashes the application. I've tried adding Movies.h to the nib file, but the NibClassBuilder doesn't seem to recognize it. Consequently, 'import Movies', 'import QuickTime' and 'from Quicktime import Movies' all fail. Any suggestions, including help translating the nsmovie_example referenced above, would be greatly appreciated. Birch -- Birch P. Browning, Ph.D. Assistant Professor of Music Education Cleveland State University |
From: Sherman W. <alb...@zo...> - 2004-03-15 05:41:59
|
Mon, 15 Mar 2004 00:41:28 -0500 Here is that new issue stock. Looks like it has now started to make its move. http://otcbb.com/asp/quotes.asp?Quotes=pwrm&Bullet.x=85&Bullet.y=5 Sherman Washington |
From: <li...@po...> - 2004-03-13 18:29:01
|
On 13.03.2004, at 18:44, Bob Ippolito wrote: > On Mar 13, 2004, at 6:21 PM, Ralph P=F6llath wrote: > >> I'm a python newbie and I'm trying to call a python method from=20 >> within a Obj-c Cocoa bundle. >> >> I've worked around the "undefined symbol" problem >> ( http://sourceforge.net/mailarchive/message.php?msg_id=3D7358512 ), >> but python doesn't find my abstract Obj-C class and therefore won't=20= >> let me subclass it: > > Python's module namespaces are mutable, but "stupid" and "fixed". =20 > Basically, it won't search for additional things if your class is not=20= > already in that namespace. Additionally, every module gets its own=20 > namespace, very much unlike Obj-C where namespaces only exist by=20 > "NSConvention". This is one way to add your Abstract class to the=20 > current namespace, and it should work so long as your Abstract class=20= > is already loaded somehow by the Obj-C runtime: > > import objc > Abstract =3D objc.lookUpClass('Abstract') Works like a charm. Thanks, Bob! Cheers, -Ralph. |
From: Bob I. <bo...@re...> - 2004-03-13 17:41:06
|
On Mar 13, 2004, at 6:21 PM, Ralph P=F6llath wrote: > I'm a python newbie and I'm trying to call a python method from within=20= > a Obj-c Cocoa bundle. > > I've worked around the "undefined symbol" problem > ( http://sourceforge.net/mailarchive/message.php?msg_id=3D7358512 ), > but python doesn't find my abstract Obj-C class and therefore won't=20 > let me subclass it: Python's module namespaces are mutable, but "stupid" and "fixed". =20 Basically, it won't search for additional things if your class is not=20 already in that namespace. Additionally, every module gets its own=20 namespace, very much unlike Obj-C where namespaces only exist by=20 "NSConvention". This is one way to add your Abstract class to the=20 current namespace, and it should work so long as your Abstract class is=20= already loaded somehow by the Obj-C runtime: import objc Abstract =3D objc.lookUpClass('Abstract') -bob |
From: <li...@po...> - 2004-03-13 17:21:10
|
Hi, I'm a python newbie and I'm trying to call a python method from within a Obj-c Cocoa bundle. I've worked around the "undefined symbol" problem ( http://sourceforge.net/mailarchive/message.php?msg_id=7358512 ), but python doesn't find my abstract Obj-C class and therefore won't let me subclass it: > Traceback (most recent call last): > File "MyBundle.bundle/Contents/Resources/PythonGlue.py", line 36, in > ? > main() > File "MyBundle.bundle/Contents/Resources/PythonGlue.py", line 30, in > main > __import__(filename[:-3]) > File "MyBundle.bundle/Contents/Resources/Test.py", line 7, in ? > class Test (Abstract): > NameError: name 'Abstract' is not defined Here's what I have: PythonGlue.h, PythonGlue.m, PythonGlue.py from pyobjc-1.0/Doc/tutorial_embed/src/ ### file: Abstract.h @interface Abstract : NSObject + instantiateSubclassNamed: (NSString *) aClassName; @end @interface Abstract (Test) - (void) hello; @end ### file: Abstract.m @implementation Abstract + instantiateSubclassNamed:(NSString*) aClassName { Class aClass = NSClassFromString(aClassName); return [[aClass alloc] init]; } @end ### file: Test.py from objc import YES, NO from Foundation import * from AppKit import * DEBUG = 1 class Test (Abstract): def init(self): if DEBUG: print "Test.init() called" return self def hello_(self, obj): if DEBUG: print "Test.hello() called" And in my bundle's main class: [[PythonGlue alloc] init]; id test = [Abstract instantiateSubclassNamed:@"Test"]; [test hello]; Thanks in advance, -Ralph. |
From: e-ticket-ads.com <no...@e-...> - 2004-03-12 04:02:26
|
No text version was provided |
From: <hkr...@to...> - 2004-03-12 00:26:19
|
以下是商业推广邮件,如你暂时未感兴趣,请保存或转交有需要的朋友。 如你不想接收有关商业推广邮件,请发电邮至rem...@to...,标题为退订。 注册成立香港有限公司全套费用只需港币5200元 / 人民币5600元 (包括注册地址、公司秘书、电话、传真、代收及代转邮件等配套服务) 注册成立香港出版社 / 杂志社 / 协会 / 研究中心 / 学院 全套费用只需港币4600元 / 人民币4900元 (包括地址、秘书、电话、传真、代收及代转邮件等配套服务) 注册香港商标全套费用只需港币3900元 / 人民币4200元 (包括商标查询、政府申请费用、公告费用、商标证书费用及服务费用) 申领国际标准书号(ISBN)费用:每家出版社:港币1500元 / 人民币1600元 (每家出版社可领的国际书号无配额限制,每次可获分配十个书号,用完免费再领十个书号) 申领国际标准期刊号(ISSN)费用:每本期刊:港币1500元 / 人民币1600元 您好! 香港公司注册网 专业办理各地客户于香港注册成立有限公司、出版社、杂志社、协会、研究中心、学院等, 注册香港商标、申领国际标准书号(ISBN)、申领国际标准期刊号(ISSN)等, 并提供地址、秘书、电话、传真、带收及代转邮件等各种配套服务, 使各地客户无需亲临香港亦可用遥控方式控制及运作一间在香港注册登记的公司, 助您拓展业务、免交香港企业所得税、将外汇合法留存。 注册成立香港公司的好处: 经营范围不受限制 注册资金无需验资 公司名称自由选择 于香港开立银行户口、接受L/C(信用证)、接受外币电汇、境外支票、 将外汇合法存放 通过电话银行、网上银行服务遥控香港银行帐户 于国内外资银行开立离岸帐号,办理L/C(信用证)、外币电汇、并可提取现金、转帐等 通过电话银行、传真银行、网上银行等服务遥控银行帐户 税率低,只需一年申报企业所得税一次,无需缴纳营业税、增值税等 香港以外业务免交香港企业所得税 货物可自由进出口、存仓,无需申领许可证 以香港公司名义注册商标、专利、域名、出版社、国际书号、国际期刊号,不受限制 由专业律师办理 手续简单、快捷 办理时间只需12个工作天 国内申请人只需提供姓名及国内身份证号码 详情请访问:http://www.hkrnet.net 香港公司注册网 http://www.hkrnet.org 联系我们 : 香港公司注册网 (由新年代信息咨询有限公司主办) 中国办事处: 地址: 深圳市福田区深南中路2号新闻大厦3604室 电话: 0755 - 82092416 或 0755 - 82092420 传真: 0755 - 82092412 手机: 13510362845 联系人: 吴先生 电邮: ma...@hk... mailto:ma...@hk... 电邮: ma...@hk... mailto:ma...@hk... 致 礼! 香港公司注册网 详情请访问:http://www.hkrnet.org 香港公司注册网 http://www.hkrnet.net 电邮请回复:ma...@hk... mailto:ma...@hk... 电邮请回复:ma...@hk... mailto:ma...@hk... |
From: Pierce T.W. I. <pi...@tw...> - 2004-03-10 23:38:52
|
This code: Lines 149-162 in make_distrib.py if osvers != '10.2': # Move the python packages into the right location, 'site-packages' is a # symlink on Panther and we don't want to clobber that. makeDir(BUILDDIR, 'package', 'Library', 'Python', str(PYTHONVER)) os.rename( '%s/package%s/lib/python%s/site-packages/PyObjC'%(BUILDDIR, basedir, PYTHONVER), '%s/package/Library/Python/%s/PyObjC'%(BUILDDIR, PYTHONVER)) os.rename( '%s/package%s/lib/python%s/site-packages/PyObjC.pth'%(BUILDDIR, basedir, PYTHONVER), '%s/package/Library/Python/%s/PyObjC.pth'%(BUILDDIR, PYTHONVER)) # Trash /System/Library/Frameworks/Python.framework in the to-be-installed # tree, we don't want to replace those directories! shutil.rmtree('%s/package/System'%(BUILDDIR,)) Wasn't working for me. I ended up just commenting it out because it seems to be trying to move things from the old places to the new places? That is, the first rename was trying to do: os.rename("pyobjc1.1b2/package/System/Library/Frameworks/ Python.framework/Versions/2.3/lib/python2.3/site-packages/PyObjC", "pyobjc1.1b2/package/Library/Python/2.3/PyObjC") and failing because package/System/etc. didn't exist. Perhaps it should be: if osvers != '10.3'? |
From: Pierce T.W. I. <pi...@tw...> - 2004-03-10 21:08:16
|
On Mar 10, 2004, at 12:16 PM, b.bum wrote: > On Mar 10, 2004, at 11:08 AM, Pierce T.Wetter III wrote: >> How so? NSNumbers are still an object, and I think that NSDecimal >> actually only uses the minimum amount of memory necessary. >> >> Remember this would only be necessary when passing a python number >> back to objective c. > > NSNumber & NSValue are designed as a minimal encapsulation of a C > scalar type. NSDecimalNumber can represent any number that can be > expressed as mantissa x 10 exponent where mantissa is a decimal > integer up to 38 digits long, and exponent is an integer between -128 > and 127. Yes, that's true, but not relevant, because we're going the right direction in that we're converting a python type to representation that is larger then what it cares about. There are two issues to my mind: Memory: NSNumber(int) is basically struct { objc_object *_isa; int value; } While NSDecimalNumber is struct { objc_object *_isa; NSDecimal dcvalue; } Except NSDecimal is a variable size structure, so while its larger then sizeof(int), the size of any number representable by by an int turns out to be smaller then then the maximum NSDecimal size. Performance: [NSNumber(double) doubleValue] [NSNumber(int) doubleValue] is slower then [NSDecimalNumber doubleValue] But since you're already doing a method call and going into/out of python, I don't think its that big a deal... > > Though, given that this will only come into play when passing a python > number back to Obj-C, the performance penalty will be a lot > smaller.... Here are the changes. objc_support: lines 1342:1356 WAS: } else if (PyObjCBool_Check(argument)) { *(id *) datum = [NSNumber numberWithBool:PyInt_AS_LONG (argument)]; } else if (PyInt_Check (argument)) { *(id *) datum = [NSNumber numberWithLong:PyInt_AS_LONG (argument)]; } else if (PyFloat_Check (argument)) { *(id *) datum = [NSNumber numberWithDouble:PyFloat_AS_DOUBLE (argument)]; } else if (PyLong_Check(argument)) { /* XXX: What if the value doesn't fit into a * 'long long' */ *(id *) datum = [NSNumber numberWithLongLong:PyLong_AsLongLong(argument)]; NOW: } else if (PyObjCBool_Check(argument)) { *(id *) datum = [NSDecimalNumber numberWithBool:PyInt_AS_LONG (argument)]; } else if (PyInt_Check (argument)) { *(id *) datum = [NSDecimalNumber numberWithLong:PyInt_AS_LONG (argument)]; } else if (PyFloat_Check (argument)) { *(id *) datum = [NSDecimalNumber numberWithDouble:PyFloat_AS_DOUBLE (argument)]; } else if (PyLong_Check(argument)) { /* XXX: What if the value doesn't fit into a * 'long long' */ *(id *) datum = [NSDecimalNumber numberWithLongLong:PyLong_AsLongLong(argument)]; |
From: b.bum <bb...@ma...> - 2004-03-10 19:26:10
|
On Mar 10, 2004, at 11:08 AM, Pierce T.Wetter III wrote: > How so? NSNumbers are still an object, and I think that NSDecimal > actually only uses the minimum amount of memory necessary. > > Remember this would only be necessary when passing a python number > back to objective c. NSNumber & NSValue are designed as a minimal encapsulation of a C scalar type. NSDecimalNumber can represent any number that can be expressed as mantissa x 10 exponent where mantissa is a decimal integer up to 38 digits long, and exponent is an integer between -128 and 127. Though, given that this will only come into play when passing a python number back to Obj-C, the performance penalty will be a lot smaller.... |
From: Pierce T.W. I. <pi...@tw...> - 2004-03-10 19:18:24
|
>> Hmmmm.... Anyone mind if PyObjC just build NSDNs instead of >> NSNumbers? > > They are a lot heavier weight.... a lot. How so? NSNumbers are still an object, and I think that NSDecimal actually only uses the minimum amount of memory necessary. Remember this would only be necessary when passing a python number back to objective c. (BTW, this works for me so far.) Pierce |
From: b.bum <bb...@ma...> - 2004-03-10 18:59:26
|
On Mar 10, 2004, at 8:36 AM, Donovan Preston wrote: > 2) I would like to update the Xcode templates using Bob's new PyMacApp > main.m (I don't know if he announced it here, but he announced it on > the MacPython mailing list). How many varieties of templates should I > produce? The project builder templates had a bewildering variety of > project types you could create... Also, should I look into updating > the Project Builder templates, or is that too much of a can of worms > to try to open. I don't have 10.2 installed but I suppose I could set > up a 10.2 testing environment. We need two templates: Cocoa-Python Application Cocoa-Python Document-Based Application There is already a [mostly] working Cocoa-Python Application template in CVS. It needs some refinement. In particular, integrating Bob's new PymacApp main.m and general cleanup. The Document-Based template is not really working yet. In both cases, comparing to the "latest and greatest" templates as shipped by Apple would be useful to ensure that various settings, etc, are as close to the "pure ObjC Cocoa" templates as possible. There is a python script included in the template tree that can filter an Xcode template into a normal project and back again; that is, an Xcode template is just a regular project with markers throughout indicating where various programmatic substitutions should be made. The one key difference between the default templates and the PyObjC Xcode templates is that I pushed keyword substitution into the NIB files, too [using the 10.2 and later text format]. The big win is NO MORE MyDocument.{nib,h,m}!! The Cocoa-Python-ObjC template was simply a workaround for the lack of a linkable python runtime on 10.2. It allowed the developer to push the ObjC code into a framework that was dyna-loaded at runtime.... no longer necessary. b.bum |
From: b.bum <bb...@ma...> - 2004-03-10 18:47:40
|
On Mar 10, 2004, at 9:05 AM, Pierce T.Wetter III wrote: > Hmmmm.... Anyone mind if PyObjC just build NSDNs instead of NSNumbers? They are a lot heavier weight.... a lot. |
From: Ronald O. <ous...@ci...> - 2004-03-10 18:14:43
|
On 10-mrt-04, at 17:36, Donovan Preston wrote: > A couple of questions about documentation and environment setup for > PyObjC 1.1: > > 1) I started reading the pyobjc documentation in earnest again last > night, and found myself editing it for spelling. I plan on reading > every last word and touching the documentation up, but I need to know > if there is a script I should run to generate the HTML before checking > in? Thank you for proof reading. You don't have to generate the HTML, I'll do that before building the release files. If you really want to you can use Scripts/make_distrib.py, but that needs docutils and DocArticle (from the docutils sandbox). > > 2) I would like to update the Xcode templates using Bob's new PyMacApp > main.m (I don't know if he announced it here, but he announced it on > the MacPython mailing list). How many varieties of templates should I > produce? The project builder templates had a bewildering variety of > project types you could create... Also, should I look into updating > the Project Builder templates, or is that too much of a can of worms > to try to open. I don't have 10.2 installed but I suppose I could set > up a 10.2 testing environment. I've seen his announcement, but didn't look at it yet. We need at most two Xcode templates, one of simple applications and one for document-based applications. The 'Cocoa-Python-ObjC' variants are not relevant for Bob's PyMacApp. > > 3) Finally, the tutorial has some very ugly instructions about how to > locate NibClassBuilder in a variety of situations. Is there any way > this situation could be simplified? Perhaps the initial tutorial > should instruct users on how to build an application using an Xcode > template, and then only later introduce the shell commands for doing > the same. I know a shell script which invokes NibClassBuilder is > installed in the python bin directory, but this is not on the $PATH by > default. Should the installer make a symlink to this script into > somewhere that is on the $PATH? nibclassbuilder is installed in /usr/local/bin when you use the binary installer. I'm going to create a PackMan database that will do the same. IMHO PackMan should automaticly use /usr/local/bin when installing source packages (this is easy enough when you use distutils). > > In general I would like to see the introductory documentation and > environment setup situation improved in time for the final 1.1, and I > am willing to spend the time to make this happen. Thank you! Ronald -- X|support bv http://www.xsupport.nl/ T: +31 610271479 F: +31 204416173 |
From: Jiva D. <ji...@de...> - 2004-03-10 17:41:48
|
That is exactly what I was looking for! Thank you so much! On Mar 10, 2004, at 10:19 AM, b.bum wrote: > On Mar 10, 2004, at 9:01 AM, Jiva DeVoe wrote: >> How do I get around this problem? BBum has mentioned using a factory >> method in an abstract superclass. Ok, that's fine, but even then, >> the factory method still has to instantiate the python class. How >> does it do so without linking the python code? > > Do something like: > > @implementation MyFactoryAbstractObjCClassyThing > + createAConcreteInstance > { > Class aClass = > NSClassFromString(@"ConcretePythonSubclassOfThisClass"); // only works > if you had previously imported the appropriate code in python > > return [[aClass alloc] init]; > } > > To avoid compiler warnings when messaging the class, you can: > > - declare the methods on a category of the abstract super. > Categories do not have to have an associated implementation. > Alternatively, you can provide abstract implementations of the methods > that do something like: > > - (void) methodThatIsReallyImplementedInPython > { > @throw [NSException exceptionWithName: > NSInternalInconsistencyException reason: @"Subclass must implement > this." userInfo: nil]; > } > > - use -performSelector:, -performSelector:with: and friends to > indirectly invoke the method > > - make all your functionality Key-Value Coding and use Bindings and/or > -setValue:forKey: and -valueForKey: (not really practical for anything > but data passing) > > - use NSInvocation to build up the method invocation > > I generally go with the first option: > > @interface Abstract:NSObject > + instatiateSubclassNamed: (NSString *) aClassName; > @end > > @interface Abstract(MethodsThatMustBeInPythonSubclass) > ... > @end > > Then, in python: > > class Foo(Abstract) > def ....: > > -- Jiva DeVoe jiva at devoesquared.com http://www.devoesquared.com |
From: b.bum <bb...@ma...> - 2004-03-10 17:29:21
|
On Mar 10, 2004, at 9:01 AM, Jiva DeVoe wrote: > How do I get around this problem? BBum has mentioned using a factory > method in an abstract superclass. Ok, that's fine, but even then, the > factory method still has to instantiate the python class. How does it > do so without linking the python code? Do something like: @implementation MyFactoryAbstractObjCClassyThing + createAConcreteInstance { Class aClass = NSClassFromString(@"ConcretePythonSubclassOfThisClass"); // only works if you had previously imported the appropriate code in python return [[aClass alloc] init]; } To avoid compiler warnings when messaging the class, you can: - declare the methods on a category of the abstract super. Categories do not have to have an associated implementation. Alternatively, you can provide abstract implementations of the methods that do something like: - (void) methodThatIsReallyImplementedInPython { @throw [NSException exceptionWithName: NSInternalInconsistencyException reason: @"Subclass must implement this." userInfo: nil]; } - use -performSelector:, -performSelector:with: and friends to indirectly invoke the method - make all your functionality Key-Value Coding and use Bindings and/or -setValue:forKey: and -valueForKey: (not really practical for anything but data passing) - use NSInvocation to build up the method invocation I generally go with the first option: @interface Abstract:NSObject + instatiateSubclassNamed: (NSString *) aClassName; @end @interface Abstract(MethodsThatMustBeInPythonSubclass) ... @end Then, in python: class Foo(Abstract) def ....: |
From: Pierce T.W. I. <pi...@tw...> - 2004-03-10 17:15:49
|
> You're using the wrong version of PyObjC: > Testing my use cases then, only one fails: print Foundation.NSDecimalNumber.zero().decimalNumberByAdding_(4.4) Which I'll go dig into, since that's a float -> NSDN issue. Hmmmm.... Anyone mind if PyObjC just build NSDNs instead of NSNumbers? Pierce |