pyobjc-dev Mailing List for PyObjC (Page 205)
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: riCCol p. <ri...@ho...> - 2003-12-02 12:20:40
|
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head> <body bgcolor="#000000" text="#000000" leftmargin="0" topmargin="0"> <table width="50%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><a href="mailto:ric...@gl..."><img src="http://www.riccolpropaganda.kit.net/folder6.jpg" alt="clique aqui para mandar um e-mail e solicitar informações" width="387" height="480" border="0"></a></td> </tr> <tr> <td height="69"> <div align="center"><font size="1" color="#FFFFFF" face="Arial, Helvetica, sans-serif"><b>Esta mensagem é única. Você não receberá novamente. De acordo com a Lei de Ética destinada ao controle de envio de e-mails, a riCCol propaganda reserva-se no "dever" de não lhe enviar mais de uma mensagem deste tipo.</b></font></div> </td> </tr> </table> </body> </html> |
From: Carlos P. <ca...@ci...> - 2003-12-02 09:12:03
|
I'm trying to create a python-cocoa program with a VTK view. The VTK view is taken verbatim from the two articles on MacDevCenter (link follows) which is written in objective-c. http://www.macdevcenter.com/pub/a/mac/2003/02/11/dev_osx.html http://www.macdevcenter.com/pub/a/mac/2003/03/25/dev_osx.html I am using an up-to-date CVS version of PyObjC. I have created a project using the Cocoa-Python-ObjC template. I have placed the two objective-c classes involved in the VTK view into the support framework. I also have put renamed copies of the VTK cocoa objective-c classes in this framework. This allows me to wrap the VTK view class using objc.loadBundle. I have subclassed VTKView in python to emulate the program written in the second macdevcenter article and instantiated it through the MainMenu.nib. When I run the program, it crashes. It's log output is: ===== 2003-12-02 03:30:46.165 Simple1[1541] PyObjCPointer created: at 0x6d16080 of type {vtkRenderer={?={?={?=^^?i}C{vtkTimeStamp=^^? L}^{vtkSubjectHelper}}^{vtkAssemblyPath}^{vtkPropCollection}iIff^{vtkPro pCollection}^{vtkActor2DCollection}^{vtkWindow}[3f][4f][2f][2f][2f][2i][ 2i][3f][3f][4f]}^{vtkCamera}^{vtkLight}^{vtkLightCollection}^{vtkCullerC ollection}^{vtkActorCollection}^{vtkVolumeCollection}[3f]^{vtkRenderWind ow}ffiii*{vtkTimeStamp=^^? L}fii^^{vtkProp}i^^{vtkAssemblyPath}iii[6f]f}8@0:4 Simple1 has exited due to signal 10 (SIGBUS). ===== The Debugger complains that here is a lack of stack frames: ===== warning: Trying to remove a section from the ordered section list that did not exist at 0x0. Program received signal: "SIGTRAP". warning: ppc_frame_chain_valid: stack pointer from 0xbffff84c to 0x1000 grows upward; assuming invalid mi_cmd_stack_list_frames: Not enough frames in stack. mi_cmd_stack_list_frames: Not enough frames in stack. ===== Does anyone know what is going on? I know that quite a few people would be happy if they could integrate VTK views into cocoa programs using python and interface builder. |
From: Ronald O. <ous...@ci...> - 2003-12-02 07:12:36
|
On 2 dec 2003, at 5:36, Bob Ippolito wrote: > > On Dec 1, 2003, at 8:08 PM, b.bum wrote: > >> >> On Dec 1, 2003, at 4:48 PM, Carlos Phillips wrote: >>>> Try adding... >>>> >>>> def automaticallyNotifiesObserversForKey_(self, aKey): >>>> return NO >>>> >>>> ... to your class and see if that fixes the problem. Also, make >>>> sure you are running pyobjc based on the latest source from CVS -- >>>> there have been many updates that are 10.3 specific. >>>> >>>> Finally, we should continue this on pyobjc-dev. I'm really busy @ >>>> Apple and will likely not have time to answer you in the coming >>>> days -- but the folks on pyobjc-dev will answer and they are really >>>> friendly/knowledgeable. >>> >>> Overloading the method did in fact fix the problem. I thought this >>> might be useful to someone else. >> >> This appears to be because of the method swizzling that occurs >> because of key-value observing [KVO]. It causes an infinite loop in >> the bridge. >> >> You can still use KVO, though. You just need to call... >> >> - (void)willChangeValueForKey:(NSString *)key; >> - (void)didChangeValueForKey:(NSString *)key; >> >> ... or ... >> >> - (void)willChange:(NSKeyValueChange)change >> valuesAtIndexes:(NSIndexSet *)indexes forKey:(NSString *)key; >> - (void)didChange:(NSKeyValueChange)change >> valuesAtIndexes:(NSIndexSet *)indexes forKey:(NSString *)key; >> >> ... before/after the value is changed. > > Alternatively you can implement the accessors (and make sure that your > instance variables aren't keyName or _keyName).. here's a snippet of > something I have: I didn't see the middle of this discussion, and specifically the code that causes the infinite recursion problem. Could someone please post that code, other better yet open a bugreport for this issue (including the failing code). Ronald |
From: Bob I. <bo...@re...> - 2003-12-02 05:41:10
|
On Dec 1, 2003, at 8:08 PM, b.bum wrote: > > On Dec 1, 2003, at 4:48 PM, Carlos Phillips wrote: >>> Try adding... >>> >>> def automaticallyNotifiesObserversForKey_(self, aKey): >>> return NO >>> >>> ... to your class and see if that fixes the problem. Also, make >>> sure you are running pyobjc based on the latest source from CVS -- >>> there have been many updates that are 10.3 specific. >>> >>> Finally, we should continue this on pyobjc-dev. I'm really busy @ >>> Apple and will likely not have time to answer you in the coming days >>> -- but the folks on pyobjc-dev will answer and they are really >>> friendly/knowledgeable. >> >> Overloading the method did in fact fix the problem. I thought this >> might be useful to someone else. > > This appears to be because of the method swizzling that occurs because > of key-value observing [KVO]. It causes an infinite loop in the > bridge. > > You can still use KVO, though. You just need to call... > > - (void)willChangeValueForKey:(NSString *)key; > - (void)didChangeValueForKey:(NSString *)key; > > ... or ... > > - (void)willChange:(NSKeyValueChange)change > valuesAtIndexes:(NSIndexSet *)indexes forKey:(NSString *)key; > - (void)didChange:(NSKeyValueChange)change valuesAtIndexes:(NSIndexSet > *)indexes forKey:(NSString *)key; > > ... before/after the value is changed. Alternatively you can implement the accessors (and make sure that your instance variables aren't keyName or _keyName).. here's a snippet of something I have: def KVC(fn): n = fn.__name__.split('_') if len(n) == 1: if n[0].startswith('countOf'): return selector(fn, signature=NSArray.count.signature) elif len(n) == 2: if n[0].startswith('objectIn') and n[0].endswith('AtIndex') and not n[1]: return selector(fn, signature=NSArray.objectAtIndex_.signature) elif n[0].startswith('removeObjectFrom') and n[0].endswith('AtIndex') and not n[1]: return selector(fn, signature=NSMutableArray.removeObjectAtIndex_.signature) elif len(n) == 3: if n[0] == 'insertObject' and n[1].startswith('in') and n[1].endswith('AtIndex') and not n[2]: return selector(fn, signature=NSMutableArray.insertObject_atIndex_.signature) elif n[0].startswith('replaceObjectIn') and n[0].endswith('AtIndex') and n[1] == 'withObject' and not n[2]: return selector(fn, signature=NSMutableArray.replaceObjectAtIndex_withObject_) class PyNNTPConnectionWindowController(NibClassBuilder.AutoBaseClass): # this is heavily sliced and diced def init(self): self._groups = [] # key value coding compliance for group array def groupArray(self): return self._groups def countOfGroupArray(self): return len(self._groups) countOfGroupArray = KVC(countOfGroupArray) def objectInGroupArrayAtIndex_(self, index): return self._groups[index] objectInGroupArrayAtIndex_ = KVC(objectInGroupArrayAtIndex_) def insertObject_inGroupArrayAtIndex_(self, obj, index): self._groups.insert(index, obj) insertObject_inGroupArrayAtIndex_ = KVC(insertObject_inGroupArrayAtIndex_) def removeObjectFromGroupArrayAtIndex_(self, index): del self._groups[index] removeObjectFromGroupArrayAtIndex_ = KVC(removeObjectFromGroupArrayAtIndex_) and then elsewhere in the code I use self.groupsController.addObjects_(...) instead of manually doing the notifications.. although in one place I do: self.willChangeValueForKey_(u"groupArray") del self._groups[:] self.didChangeValueForKey_(u"groupArray") I'm pretty busy working on non-PyObjC stuff so I can't answer too many questions about this, but it may help (for something). -bob |
From: b.bum <bb...@ma...> - 2003-12-02 03:26:42
|
On Dec 1, 2003, at 4:48 PM, Carlos Phillips wrote: >> Try adding... >> >> def automaticallyNotifiesObserversForKey_(self, aKey): >> return NO >> >> ... to your class and see if that fixes the problem. Also, make sure >> you are running pyobjc based on the latest source from CVS -- there >> have been many updates that are 10.3 specific. >> >> Finally, we should continue this on pyobjc-dev. I'm really busy @ >> Apple and will likely not have time to answer you in the coming days >> -- but the folks on pyobjc-dev will answer and they are really >> friendly/knowledgeable. > > Overloading the method did in fact fix the problem. I thought this > might be useful to someone else. This appears to be because of the method swizzling that occurs because of key-value observing [KVO]. It causes an infinite loop in the bridge. You can still use KVO, though. You just need to call... - (void)willChangeValueForKey:(NSString *)key; - (void)didChangeValueForKey:(NSString *)key; ... or ... - (void)willChange:(NSKeyValueChange)change valuesAtIndexes:(NSIndexSet *)indexes forKey:(NSString *)key; - (void)didChange:(NSKeyValueChange)change valuesAtIndexes:(NSIndexSet *)indexes forKey:(NSString *)key; ... before/after the value is changed. b.bum |
From: Jordan K. <jo...@kr...> - 2003-12-02 03:24:27
|
Going through the tutorial and other examples, I'm wondering why the (implied) common practice is to directly edit the NibClassBuilder-generated python files. Will regeneration upon changes in IB destroy changes to the file? I tried creating another file for CurrencyConverter which imported CurrencyConverter.py's classes (which were renamed to _Converter and _ConverterController), subclassed them, and attempted to call runEventLoop() from there, but the runtime is complaining that the classes already exist: File "Resources/t.py", line 6, in ? class Converter(_Converter): objc.error: Class already exists in Objective-C runtime Here's t.py: *snip* from PyObjCTools import NibClassBuilder, AppHelper from CurrencyConverter import Converter as _Converter from CurrencyConverter import ConverterController as _ConverterController class Converter(_Converter): pass class ConverterController(_ConverterController): pass AppHelper.runEventLoop() *snip* If this is in fact a problem, how does one get around this? Perhaps I'm just used to wxglade, where it exports classes to be used elsewhere, knowing that they will be generated often. If it's something else, please let me know :) On another documentation-related note: the nib in the tutorial (step3-MainMenu.nib.zip) actually has two Convert buttons, one on top of the other. J. |
From: Carlos P. <car...@ma...> - 2003-12-02 03:21:28
|
Hi, I sent the following email to Bill (b.bum): > There is something fundamental about the key-value binding that I don' > t understand. I have been using it extensively in objective-c, but I > can't seem to be able to use it to connect to a nib in PyObjC. Here is > a sample python class I use: > > # Converter.py: > import objc > > class Converter(objc.runtime.NSObject): > def getAmount(self): > return "1" > if __name__ == "__main__": > AppHelper.runEventLoop() > > > Now I create a MainMenu.nib which has a window with a single > NSTextField. In the nib, I instantiate an empty definition of > Converter in the nib. Converter is defined as a subclass of NSObject. > I then create an instance of NSController, add an "amount" key and > bind the value of the text field to it. Finally, I connect the > Converter instance to the "content" outlet of the NSController. This > is the exact setup I used in an obj-c version of this test. > > I run the following buildapp.py script to make this into a program > > from bundlebuilder import buildapp > buildapp( > mainprogram = "Converter.py", > resources = ["English.lproj" ], > nibname = "MainMenu", > ) > > The result is a sementation fault. What am I doing wrong? He responded as follows: > This'd be an objc/c problem -- if the app is crashing and giving you > the "submit crash report" panel, then click "submit" and copy/paste > the backtrace found in the resulting window. If not, have a look in > ~/Library/Logs/ and see if there is a log there. > > Otherwise, you'd need to run under gdb. > > Try adding... > > def automaticallyNotifiesObserversForKey_(self, aKey): > return NO > > ... to your class and see if that fixes the problem. Also, make sure > you are running pyobjc based on the latest source from CVS -- there > have been many updates that are 10.3 specific. > > Finally, we should continue this on pyobjc-dev. I'm really busy @ > Apple and will likely not have time to answer you in the coming days > -- but the folks on pyobjc-dev will answer and they are really > friendly/knowledgeable. Overloading the method did in fact fix the problem. I thought this might be useful to someone else. Carlos |
From: Monique Berdge<py...@AO...> - 2003-12-01 13:26:58
|
<html> <body> <a href="http://srd.yahoo.com/drst/biggs/*http://www.blend323d.com/in/"> <img border="0" src="http://srd.yahoo.com/drst/boundedacuityillicitlycorrespondences/*http://backrefdvc.com/picnic.jpg"> </a> <font color="#ffffff">melee <font color="#ffffff">plower <font color="#ffffff">excitable <font color="#ffffff">batavia <font color="#ffffff">messiah <font color="#ffffff">portrayal <font color="#ffffff">existentialists <font color="#ffffff">horrid <font color="#ffffff">hordes <font color="#ffffff">countable <font color="#ffffff">4th <font color="#ffffff">birmingham <font color="#ffffff">horrid <font color="#ffffff">breakfasters <font color="#ffffff">estimating <font color="#ffffff">craters <font color="#ffffff">tenors euphemist evict bolsters scrolled polaron megaton seance evolutions adjudications actors<p> <font color="#ffffff">seaming <font color="#ffffff">taxes <font color="#ffffff">crooked <font color="#ffffff">bowel <font color="#ffffff">andover <font color="#ffffff">crossly <font color="#ffffff">counseling <font color="#ffffff">polarograph <font color="#ffffff">accomplishments <font color="#ffffff">pliant <font color="#ffffff">bema <font color="#ffffff">evicts <font color="#ffffff">creepers <font color="#ffffff">hornets <font color="#ffffff">acculturate <font color="#ffffff">sanicle <font color="#ffffff">albright seared evened courtyards humility explicit poised tantalizing bracelet taxis scabbards<p> <font color="#ffffff">imbalance <font color="#ffffff">exporters <font color="#ffffff">exegesis <font color="#ffffff">satiate <font color="#ffffff">teacart <font color="#ffffff">albrecht <font color="#ffffff">humanly <font color="#ffffff">acquires <font color="#ffffff">costumed <font color="#ffffff">tang <font color="#ffffff">schnapps <font color="#ffffff">apocrypha <font color="#ffffff">adjoin <font color="#ffffff">bottomless <font color="#ffffff">hydroelectric <font color="#ffffff">adamson <font color="#ffffff">pooled scattergun imagined crazing scratching imagen bonuses satchels adherence sanguinary icosahedron<p> <font color="#ffffff">scythes <font color="#ffffff">hydrometer <font color="#ffffff">bordered <font color="#ffffff">means <font color="#ffffff">potentiometers <font color="#ffffff">criteria <font color="#ffffff">menagerie <font color="#ffffff">theology <font color="#ffffff">benzedrine <font color="#ffffff">immaterial <font color="#ffffff">benedict <font color="#ffffff">bovines <font color="#ffffff">talkative <font color="#ffffff">tallow <font color="#ffffff">tan <font color="#ffffff">illness <font color="#ffffff">excresence evolutions addict advisory pollock cropped hummock crafty sculptor exotica accumulators<p> <font color="#ffffff">alger <font color="#ffffff">podia <font color="#ffffff">alexander <font color="#ffffff">brainwashing <font color="#ffffff">exponentiations <font color="#ffffff">croon <font color="#ffffff">posable <font color="#ffffff">adjuring <font color="#ffffff">prairie <font color="#ffffff">even <font color="#ffffff">portending <font color="#ffffff">pleural <font color="#ffffff">brandishing <font color="#ffffff">housekeeping <font color="#ffffff">sanely <font color="#ffffff">acrobats <font color="#ffffff">bounding plover boasting tempo corresponding bottlers alphonse crackpot evidence tetrahedra possums<p> <font color="#ffffff">estimation <font color="#ffffff">evened <font color="#ffffff">immediacies <font color="#ffffff">men <font color="#ffffff">migration <font color="#ffffff">messing <font color="#ffffff">mezzanine <font color="#ffffff">tara <font color="#ffffff">adiabatically <font color="#ffffff">secondarily <font color="#ffffff">costuming <font color="#ffffff">materially <font color="#ffffff">explosives <font color="#ffffff">breakaway <font color="#ffffff">polio <font color="#ffffff">brainchild <font color="#ffffff">mentioned brassy scrutinize playgrounds exercised temperamental alcoa hourly hushing barney poisoner<p> <font color="#ffffff">bog <font color="#ffffff">hyphenate <font color="#ffffff">schizophrenic <font color="#ffffff">evened <font color="#ffffff">meat <font color="#ffffff">admonitions <font color="#ffffff">bookkeep <font color="#ffffff">tastefulness <font color="#ffffff">talon <font color="#ffffff">illustrations <font color="#ffffff">postprocess <font color="#ffffff">technology <font color="#ffffff">corroboree <font color="#ffffff">ignorant <font color="#ffffff">activating <font color="#ffffff">mercenaries <font color="#ffffff">aquarius blushed acclimatize expressway estoppal actuated hospitals that human illogical taft<p> </body> </html> |
From: b.bum <bb...@ma...> - 2003-11-30 17:13:04
|
On Nov 30, 2003, at 8:38 AM, Carlos Phillips wrote: > I read in a presentation pdf by Bill Bumgarner that the new Cocoa > Contronller layer is implemented in PyObjC. Does this mean that I > could easily implement a program like the example program given by > apple > (http://developer.apple.com/documentation/Cocoa/Conceptual/ > ControllerLayer/Tasks/ccwithbindings.html)? If so what kind of setup > is required in the application to enable this feature? Has someone > already implemented this example? The Controller Layer is implemented in Objective-C and is a part of the Cocoa and Foundation frameworks. PyObjC is compatible with the Controller Layer and, as such, the Controller Layer can be leveraged fully from within PyObjC based Cocoa applications. There are a handful of caveats, the details of which are shifting as PyObjC evolves. The Currency Converter can certainly be implemented in Python using PyObjC and the Controller Layer. For convenience's sake, the URL repeated so clicking on it actually works from Mail: http://developer.apple.com/documentation/Cocoa/Conceptual/ ControllerLayer/Tasks/ccwithbindings.html b.bum |
From: Carlos P. <car...@ma...> - 2003-11-30 16:39:39
|
Hi, I read in a presentation pdf by Bill Bumgarner that the new Cocoa Contronller layer is implemented in PyObjC. Does this mean that I could easily implement a program like the example program given by apple (http://developer.apple.com/documentation/Cocoa/Conceptual/ ControllerLayer/Tasks/ccwithbindings.html)? If so what kind of setup is required in the application to enable this feature? Has someone already implemented this example? Carlos |
=1B$BL$>5Bz9-9p"(=1B(B = =1B$B4X?4$NL5$$J}$K$O$*<j?t$G$9$,:o=3D|$r$*4j$$?=3D$7>e$2$^$9!#=1B(B =1B$B!vAw?.<T!'BgLnOB;R=1B(B =1B$B!v;v6H<T!'=1B(BAAA-network Co.,Ltd. =1B$B!!El5~ETL\9u6hL\9u=1B(B3-4-16=1B$B!?#T#E#L!'=1B(B0120=1B$B!]=1B(B77=1B= $B!]=1B(B5869 =1B$B"(EvJ}$+$i$N%a!<%k$,$4LBOG$JJ}$K$O!"$*<j?t$G$9$,!X<u?.5qH]!Y$HI=3D<(= =1B(B =1B$B!!$7$F=1B(B ma...@3-... = =1B$B$^$G%a!<%k$rJV?.$7$F2<$5$$!#=1B(B =1B$B"(5qH]%a!<%k<u?.8e!"=1B(B3=1B$BF|0JFb$K%a!<%k%"%I%l%9$r=3D|5nCW$7$^$= 9!#=1B(B =1B$B"(J#?t%"%I%l%9$r<u?.5qH]4uK>$NJ}$O!"$*<j?t$G$9$,BP>]%"%I%l%9$rA4$F=1B= (B =1B$B!!%a%C%;!<%8Fb$KI=3D<($7$F$$$?$@$1$l$P=3D|5n$$$?$7$^$9!#=1B(B =1B$B;d$I$b$O!"B>MQ!&N.=3DP$O0l@Z$$$?$7$^$;$s!#=1B(B =1B$B!z:_Bp!J=1B(BSOHO=1B$B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%"%I%l%9=3D|5n$O=3D=3DJ,Cm0U$7$F;2$j$^$9!#=1B= (B =1B$B"(BeM}E9$,?t<R$"$j!"=3DEJ#$$$?$7$^$7$?$i$4MF<O2<$5$$!#>pJs8r49$,IT2D= =1B(B =1B$B!!G=3D$J0Y!"$4LBOG$r$*$+$1$7$F?=3D$7Lu$4$6$$$^$;$s$,!"<u?.5qH]4uK>$N= J}=1B(B =1B$B!!$O$*<j?t$G$9$,!"3FAw?.@h$K<u?.5qH]$H$7$F<+F0JV?.$$$?$@$/$+!"Ce?.=1B= (B =1B$B!!5qH]$N@_Dj$r$*4j$$?=3D$7>e$2$^$9!#=1B(B |
From: Michael H. <mw...@py...> - 2003-11-24 11:47:07
|
Just van Rossum <ju...@le...> writes: > Bob Ippolito wrote: > >> I think that most of the time, people would be happier if this didn't >> raise an exception (use the unicode replace instead). If the python >> user doesn't know the encoding of the text, and it's not default >> encoding, the developer probably doesn't have anything better than >> replace to use on the string. The exception is a nuisance and can be >> hard to track down. >> >> Perhaps this could be a module level variable in objc, so that a >> person could toggle it to be strict if they wanted it that way, but >> have the default as replace? > > Strongly disagree. This leads to silent errors, possibly even data loss. > You _have_ to know the encoding, and you _have_ to deal with it. If > there's no way you can know the encoding, you have to explicitly tell > which encoding or behavior to use. Amen. Cheers, mwh -- When physicists speak of a TOE, they don't really mean a theory of *everything*. Taken literally, "Everything" covers a lot of ground, including biology, art, decoherence and the best way to barbecue ribs. -- John Baez, sci.physics.research |
From: Just v. R. <ju...@le...> - 2003-11-22 10:49:31
|
Bob Ippolito wrote: > I think that most of the time, people would be happier if this didn't > raise an exception (use the unicode replace instead). If the python > user doesn't know the encoding of the text, and it's not default > encoding, the developer probably doesn't have anything better than > replace to use on the string. The exception is a nuisance and can be > hard to track down. > > Perhaps this could be a module level variable in objc, so that a > person could toggle it to be strict if they wanted it that way, but > have the default as replace? Strongly disagree. This leads to silent errors, possibly even data loss. You _have_ to know the encoding, and you _have_ to deal with it. If there's no way you can know the encoding, you have to explicitly tell which encoding or behavior to use. Btw. it's not so much PyObjC's behavior, but Python's default str -> unicode coercion behavior. Perhaps it's "fixable" in the bridge, but I think it's a bad idea to deviate from Python's behavior (in addition to that I find it a bad idea to begin with). Just |
From: Bob I. <bo...@re...> - 2003-11-22 06:08:34
|
On Nov 22, 2003, at 12:08 AM, Ronald Oussoren wrote: > > On 22 nov 2003, at 4:51, Bob Ippolito wrote: > >> I think that most of the time, people would be happier if this didn't >> raise an exception (use the unicode replace instead). If the python >> user doesn't know the encoding of the text, and it's not default >> encoding, the developer probably doesn't have anything better than >> replace to use on the string. The exception is a nuisance and can be >> hard to track down. >> >> Perhaps this could be a module level variable in objc, so that a >> person could toggle it to be strict if they wanted it that way, but >> have the default as replace? >> >> -bob > > We already have such a variable, it is called defaultencoding and can > be set using sys.setdefaultencoding(). only at the "sitecustomize" phase.. you can't change this later. I don't really care to change the encoding, just what happens if it can't encode. > This is not exactly what you ask, but IMHO better than what you > propose ("Errors should never pass silently."). > > BTW. You should convert all input to unicode instead of waiting for > problems with the implicit conversion to unicode that is performed by > PyObjC. You're more likely to know the right encoding while reading > the data. But what's better, seeing unicode replace characters in your app or trying to track down a strange exception? If the behavior stays the same, maybe it should give you a hint as to what character sequence gave you the error. -bob |
From: Ronald O. <ous...@ci...> - 2003-11-22 05:08:05
|
On 22 nov 2003, at 4:51, Bob Ippolito wrote: > I think that most of the time, people would be happier if this didn't > raise an exception (use the unicode replace instead). If the python > user doesn't know the encoding of the text, and it's not default > encoding, the developer probably doesn't have anything better than > replace to use on the string. The exception is a nuisance and can be > hard to track down. > > Perhaps this could be a module level variable in objc, so that a > person could toggle it to be strict if they wanted it that way, but > have the default as replace? > > -bob We already have such a variable, it is called defaultencoding and can be set using sys.setdefaultencoding(). This is not exactly what you ask, but IMHO better than what you propose ("Errors should never pass silently."). BTW. You should convert all input to unicode instead of waiting for problems with the implicit conversion to unicode that is performed by PyObjC. You're more likely to know the right encoding while reading the data. Ronald |
From: Bob I. <bo...@re...> - 2003-11-22 03:51:15
|
I think that most of the time, people would be happier if this didn't raise an exception (use the unicode replace instead). If the python user doesn't know the encoding of the text, and it's not default encoding, the developer probably doesn't have anything better than replace to use on the string. The exception is a nuisance and can be hard to track down. Perhaps this could be a module level variable in objc, so that a person could toggle it to be strict if they wanted it that way, but have the default as replace? -bob |
From: Just v. R. <ju...@le...> - 2003-11-21 22:59:00
|
I found a neat circular slider: http://www.sticksoftware.com/software/CircularSlider.html I had a use for it, so I embarked on a new adventure for me: how to use 3rd party Objective-C code from Python. With Bob's help it wasn't so hard... Here are my findings in the form of a (quickly hacked together) how-to: http://just.letterror.com/ltrwiki/CircularSlider Just |
From: Jack J. <Jac...@cw...> - 2003-11-19 22:28:13
|
On 19-nov-03, at 17:37, Bob Ippolito wrote: > I think it would be cool to put rendezvous in there, and perhaps a > browser that let you look at everyone's net-clipboard on the LAN in > real-time-ish. Then of course there's digital signatures for internet > exchange.. you could really spend a lot of time on a project like > this, though it would probably be best integrated into something like > SubEthaEdit (or a PyObjC replacement for SubEthaEdit)? Well, I would start with interoperability with Windows/Unix. I would use this most often myself to communicate between systems of the three kinds. And the original author states that he specifically designed things to allow cross-platform operation (even though only Windows works right now). -- Jack Jansen, <Jac...@cw...>, http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman |
From: Ronald O. <ous...@ci...> - 2003-11-19 21:51:45
|
On 19 nov 2003, at 22:42, Bob Ippolito wrote: > On Nov 19, 2003, at 4:11 PM, David Eppstein wrote: > >> Hi, is anyone else using pychecker and pyobjc together successfully? >> I just did several things at once: upgrade to 10.3 (and the >> command-line >> python that comes with it); upgrade to yesterday's cvs version of >> PyObjC, and start trying the new pychecker that was just announced >> yesterday. When I try pychecker on a very short PyObjC source file, I >> get a bus error: >> >> Hyperbolic% pychecker unicmp.py >> Processing unicmp... >> /usr/local/bin/pychecker: line 3: 4306 Bus error > > pychecker probably tries to delete some ObjC-code-containing extension > modules from sys.modules, which causes Bad Things To Happen if their > ref count goes to 0 and python tries to unload the bundle. pydoc can > quite easily cause this problem. Try doing the following at the top > of your module: That's not necessary, it was a genuine PyObjC bug :-( Unloading of ObjC-code-containing extension modules will also cause a crash, but that's a different issue. Do you know where and how python unloads dynamicly loaded modules, the dynload_*.c files don't seem to define functions for unloading a module? I'd like to have a sugestion about how to fix the problem before filing a bug on this at python's bugtracker (a simple testcase would also be nice, but that is easy enough). Ronald |
From: Ronald O. <ous...@ci...> - 2003-11-19 21:45:25
|
On 19 nov 2003, at 22:11, David Eppstein wrote: > Hi, is anyone else using pychecker and pyobjc together successfully? probably not, there's a bug in PyObjC that makes that impossible:-(. A script containing nothing but 'import Foundation' is enough to crash the interpreter when using pychecker. I've checked in a partial fix for this problem, your script can now be checked but my almost empty script gives odd warnings: 2003-11-19 22:36:52.721 python[24062] *** *** Selector 'instancesRespondToSelector:' sent to dealloced instance 0xa0a04e10 of class UNKNOWN. Break at '-[_NSZombie methodSignatureForSelector:]' to debug. 2003-11-19 22:36:52.724 python[24062] *** *** Selector 'func:code' sent to dealloced instance 0xa0a04e10 of class UNKNOWN. Break at '-[_NSZombie methodSignatureForSelector:]' to debug. 2003-11-19 22:36:52.730 python[24062] *** *** Selector 'instancesRespondToSelector:' sent to dealloced instance 0xa0a04e10 of class UNKNOWN. Break at '-[_NSZombie methodSignatureForSelector:]' to debug. 2003-11-19 22:36:52.733 python[24062] *** *** Selector 'instanceMethodSignatureForSelector:' sent to dealloced instance 0xa0a04e10 of class UNKNOWN. Break at '-[_NSZombie methodSignatureForSelector:]' to debug. This is probably a bug in PyObjC. BTW. the crash was caused by getattr(..., 'func_code'). This probably means that pychecker won't be able to check if you use the right number of arguments for calls to ObjC methods. Ronald |
From: Bob I. <bo...@re...> - 2003-11-19 21:42:09
|
On Nov 19, 2003, at 4:11 PM, David Eppstein wrote: > Hi, is anyone else using pychecker and pyobjc together successfully? > I just did several things at once: upgrade to 10.3 (and the > command-line > python that comes with it); upgrade to yesterday's cvs version of > PyObjC, and start trying the new pychecker that was just announced > yesterday. When I try pychecker on a very short PyObjC source file, I > get a bus error: > > Hyperbolic% pychecker unicmp.py > Processing unicmp... > /usr/local/bin/pychecker: line 3: 4306 Bus error pychecker probably tries to delete some ObjC-code-containing extension modules from sys.modules, which causes Bad Things To Happen if their ref count goes to 0 and python tries to unload the bundle. pydoc can quite easily cause this problem. Try doing the following at the top of your module: # horrible_hack = ( import sys sys.modules['*' + __name__] = sys.modules[__name__] del sys # ) This will cause your module never to be released/unloaded because there will be the sys.modules['*'+__name__] reference. It shouldn't break anything, because '*' is not a valid character in a python module name. -bob |
From: David E. <epp...@ic...> - 2003-11-19 21:11:19
|
Hi, is anyone else using pychecker and pyobjc together successfully? I just did several things at once: upgrade to 10.3 (and the command-line python that comes with it); upgrade to yesterday's cvs version of PyObjC, and start trying the new pychecker that was just announced yesterday. When I try pychecker on a very short PyObjC source file, I get a bus error: Hyperbolic% pychecker unicmp.py Processing unicmp... /usr/local/bin/pychecker: line 3: 4306 Bus error /usr/bin/python /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/si te-packages/pychecker/checker.py "$@" Hyperbolic% cat unicmp.py """unicmp.py More intelligent collation ordering for unicode strings. Requires Mac OS X and PyObjC. Designed to be a plug-in replacement for the usual cmp function. D. Eppstein, October 2003. """ from Foundation import NSString def unicmp(u1,u2): if not isinstance(u1,(str,unicode)) or not isinstance(u2,(str,unicode)): return cmp(u1,u2) return NSString.localizedCaseInsensitiveCompare_(u1,u2) or cmp(u1.lower(),u2.lower()) I am unsure whether this indicates something wrong with my code (I doubt it since it's so short), a problem with PyObjC, a problem with pychecker, or what. PyObjC appears to be functioning normally when I actually run it, and pychecker appears to be functioning normally when I try it on non-PyObjC-based code. Neal Norwitz, pychecker's maintainer, writes: > There's no way Python should crash when running pychecker. pychecker > has no C modules. > > Pychecker may have a bug too, but that can't be determined until the > interpreter doesn't crash. > > It's possible that there is a double free in the extension module(s). > This was a problem in wxWindows a long time ago. Since pychecker > does the imports differently, the bug isn't usually found. -- David Eppstein http://www.ics.uci.edu/~eppstein/ Univ. of California, Irvine, School of Information & Computer Science |
From: Bob I. <bo...@re...> - 2003-11-19 16:37:17
|
On Nov 19, 2003, at 10:53 AM, b.bum wrote: > On Nov 19, 2003, at 5:20 AM, Jack Jansen wrote: >> Apparently it is currently windows-only, but I would love to have >> functionality like this cross-platform. >> And I think on MacOSX we could put it in the Services menu with >> PyObjC. > > See: > > http://apple.slashdot.org/apple/03/04/09/134204.shtml?tid=182 > > There are ways to monitor the pasteboard and automatically detect > changes. So, for inbound changes it is just a matter of calling > declareTypes:owner: on the NSGeneralPasteboard, then pushing the new > data onto the pasteboard. For outbound changes-- for a copy action > on some other app on the OS X system-- you will need to catch the > change in a fashion similar to one of the apps mentioned in the above > thread and push the change out across the wire. > > This has the advantage of being transparent/automatic -- would not > require user intervention via the Services menu. nsRemotePasteboard > has the disadvantage of polling. It looks like from the API of > NSPasteboard that it may be possible to receive notifications > automatically whenever the pasteboard changes. > > I am not familiar with the Carbon clipboard/pasteboard APIs. There > may be something there that can do the automatic notif? I think that it's better to use something explicit for security/privacy/efficiency reasons. If you're using a services-capable app you really just need to smash the hotkey, you don't have to know it's a service per se. I suppose it could have an option to link your local clipboard to the remote clipboard. I think it would be cool to put rendezvous in there, and perhaps a browser that let you look at everyone's net-clipboard on the LAN in real-time-ish. Then of course there's digital signatures for internet exchange.. you could really spend a lot of time on a project like this, though it would probably be best integrated into something like SubEthaEdit (or a PyObjC replacement for SubEthaEdit)? -bob |
From: b.bum <bb...@ma...> - 2003-11-19 15:54:11
|
On Nov 19, 2003, at 5:20 AM, Jack Jansen wrote: > Apparently it is currently windows-only, but I would love to have > functionality like this cross-platform. > And I think on MacOSX we could put it in the Services menu with PyObjC. See: http://apple.slashdot.org/apple/03/04/09/134204.shtml?tid=182 There are ways to monitor the pasteboard and automatically detect changes. So, for inbound changes it is just a matter of calling declareTypes:owner: on the NSGeneralPasteboard, then pushing the new data onto the pasteboard. For outbound changes-- for a copy action on some other app on the OS X system-- you will need to catch the change in a fashion similar to one of the apps mentioned in the above thread and push the change out across the wire. This has the advantage of being transparent/automatic -- would not require user intervention via the Services menu. nsRemotePasteboard has the disadvantage of polling. It looks like from the API of NSPasteboard that it may be possible to receive notifications automatically whenever the pasteboard changes. I am not familiar with the Carbon clipboard/pasteboard APIs. There may be something there that can do the automatic notif? b.bum |
From: Jack J. <Jac...@cw...> - 2003-11-19 13:20:27
|
In case anyone is looking for a project to kill some time with: I just came across <http://clipster.sourceforge.net/> which is a multi-machine clipboard written in Python. Apparently it is currently windows-only, but I would love to have functionality like this cross-platform. And I think on MacOSX we could put it in the Services menu with PyObjC. -- Jack Jansen <Jac...@cw...> http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman |