pyobjc-dev Mailing List for PyObjC (Page 275)
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: Bob I. <bo...@re...> - 2003-01-07 23:49:08
|
On Tuesday, Jan 7, 2003, at 18:33 America/New_York, Jack Jansen wrote: > > On dinsdag, jan 7, 2003, at 23:39 Europe/Amsterdam, Bob Ippolito wrote: >>> Again: why not go via the Carbon.CF objects here too? We *have* all >>> this functionality in Python, so it seems a bit silly not to use > >>> it.... >>> >> >> I'm using Apple's stock python 2.2 > > Carbon.CF is in there, albeit through an oversight of either myself or > Apple. The only problem is that it is called "_CF" only (that's the > internal name, the external name should be "Carbon.CF"). > > But note that my note was more aimed towards development of PyObjC > itself: I think we should tie in more to what is already available > than try to do everything from scratch. Wow, that's excellent.. I had absolutely no idea that was in Apple's distrib. Is there currently any way to do (pyobjc) NS* <-> (Carbon.CF) CF* for the toll-free bridged types? I don't see anything obvious from a quick look. -bob |
From: Jack J. <Jac...@or...> - 2003-01-07 23:33:12
|
On dinsdag, jan 7, 2003, at 23:39 Europe/Amsterdam, Bob Ippolito wrote: >> Again: why not go via the Carbon.CF objects here too? We *have* all >> this functionality in Python, so it seems a bit silly not to use > >> it.... >> > > I'm using Apple's stock python 2.2 Carbon.CF is in there, albeit through an oversight of either myself or Apple. The only problem is that it is called "_CF" only (that's the internal name, the external name should be "Carbon.CF"). But note that my note was more aimed towards development of PyObjC itself: I think we should tie in more to what is already available than try to do everything from scratch. -- - Jack Jansen <Jac...@or...> http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - |
From: Bob I. <bo...@re...> - 2003-01-07 22:39:33
|
On Tuesday, Jan 7, 2003, at 17:33 America/New_York, Jack Jansen wrote: > > On dinsdag, jan 7, 2003, at 16:30 Europe/Amsterdam, Bob Ippolito wrote: >> Maybe there should be some convenience methods in the ObjC core, or >> additions to the NSData/NSMutableData proxy objects so you can just >> get an NSData/NSMutableData directly to and from str, array, and >> numeric arrays? > > Again: why not go via the Carbon.CF objects here too? We *have* all > this functionality in Python, so it seems a bit silly not to use > it.... > I'm using Apple's stock python 2.2 -bob |
From: Jack J. <Jac...@or...> - 2003-01-07 22:33:35
|
On dinsdag, jan 7, 2003, at 16:30 Europe/Amsterdam, Bob Ippolito wrote: > Maybe there should be some convenience methods in the ObjC core, or > additions to the NSData/NSMutableData proxy objects so you can just > get an NSData/NSMutableData directly to and from str, array, and > numeric arrays? Again: why not go via the Carbon.CF objects here too? We *have* all this functionality in Python, so it seems a bit silly not to use it.... -- - Jack Jansen <Jac...@or...> http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - |
From: Jack J. <Jac...@or...> - 2003-01-07 22:33:35
|
On dinsdag, jan 7, 2003, at 11:34 Europe/Amsterdam, Dinu Gherman wrote: > Ok, instead of fiddling further with services I wrote a simple demo > that fetches and displays QuickTime movies from the web, with some > predefined URLs pointing to pixar.com > Now if I only could get access to the real QuickTime movie content > using PyObjC...! We have all the tools in Python to do this, we only need to glue them together! NSMovie has a QTMovie method which returns the quicktime movie object. If we have a way to pass this to Carbon.Qt.Movie() we would be all set. And note that the same goes for lots of other objects for other frameworks that Cocoa can wrap. This is an area in which Python can really outshine Java, because we not only have the Cocoa interface but also the Carbon and other toolboxes. My preferred way to glue this together would be to add a method pyObjC_NSMovieAsMovie to PyObjC, which would return the void* as a Carbon.Qt.Movie object (and also the reverse: initWithMovie: should accept a Carbon. Qt.Movie object too. Note that this will not tie PyObjC to the Carbon.Qt module directly: the MovieObj_New() and MovieObj_Convert() routines (which convert C pointers from/to Python objects) are in the Python core, and when first invoked they will attempt to load the required module. After that the calls are fairly cheap: one extra subroutine call. Or we could say that NSMovie and initWithMovie: are pretty useless as they are anyway, and just let those always use Carbon.Qt.Movie objects. -- - Jack Jansen <Jac...@or...> http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - |
From: Lele G. <le...@se...> - 2003-01-07 19:11:01
|
>>>>> On Tue, 7 Jan 2003 08:37:12 -0500, bb...@ma... said: b> I'll be a happier camper once CVS dies the horrible death that b> it deserves. Maybe in 5 years... Yup!-) Let's hope the Subversion' guys will find a good solution for this... I do not think there is an obvious one. bye, lele. -- nickname: Lele Gaifax | Quando vivro' di quello che ho pensato ieri real: Emanuele Gaifas | comincero' ad aver paura di chi mi copia. email: le...@se... | -- Fortunato Depero, 1929. |
From: Just v. R. <ju...@le...> - 2003-01-07 18:57:26
|
bb...@ma... wrote: > Directories are never removable in CVS-- SF or otherwise. If you end > up with an empty directory in CVS, then use: > > cvs -q -z5 update -dP > > To update your workarea. The -dP is the important part; -d deletes > anything that has been removed from the repository and -P prunes empty > directories. In using CVS for way too many years now, I haven't run > across a situation where you wouldn't want to use '-dP' to do the > update. I have a .cvsrc file in my home dir which reads: % cat .cvsrc cvs -z9 -q update -dP Very handy: just type "cvs up" and things work as they should. Just |
From: <bb...@ma...> - 2003-01-07 18:40:02
|
On Tuesday, Jan 7, 2003, at 06:06 US/Eastern, Dinu Gherman wrote: > Given SourceForge's policy of unremovable CVS directories, I wonder > what the PyObjC policy is with respect to sample code etc. in its > CVS repository? With Cocoa/OS X many file resources are stored in- > side dictionaries and I remember I added myself a .cre8 directory > on SF in a different project before... :-/ SourceForge [thankfully] doesn't support wrappers. So, you either need to add the directory and its contents individually with 'cvs add' or you need to tarball/zip the resource into an archive. Directories are never removable in CVS-- SF or otherwise. If you end up with an empty directory in CVS, then use: cvs -q -z5 update -dP To update your workarea. The -dP is the important part; -d deletes anything that has been removed from the repository and -P prunes empty directories. In using CVS for way too many years now, I haven't run across a situation where you wouldn't want to use '-dP' to do the update. I'll be a happier camper once CVS dies the horrible death that it deserves. Maybe in 5 years... b.bum |
From: Mirko V. <mi...@ob...> - 2003-01-07 17:14:29
|
Ronald Oussoren <ous...@ci...> ha scritto: > I've applied the entire patch, which some changed (minor changes in > Modules/objc, larger ones in Modules/Cocoa). Ok, I've tested a bit and it seems to work. Pathes for subclassing and Cocoa/scripts will follow. -- Ciao Mirko |
From: Bob I. <bo...@re...> - 2003-01-07 15:30:18
|
I updated to latest CVS.. it seems that you may now initialize NSData/NSMutableData with a python string or an array, but it breaks for big ones. >>> from Foundation import * >>> import array >>> bytes = array.array('b', 'abcdef') >>> NSData.alloc().initWithBytes_length_(bytes, len(bytes)) <a07e> >>> NSMutableData.alloc().initWithBytes_length_(bytes, len(bytes)) <a07eda48 00000001 00000000 00000054 007db1e0 00000000 00000000 00000001 76304034 3a385e76 31324931 36000001 76304034 3a384931 32000000 00010002 76> >>> bytes = array.array('b', 'abcdef' * 1000) >>> NSData.alloc().initWithBytes_length_(bytes, len(bytes)) Segmentation fault >>> from Foundation import * >>> NSData.alloc().initWithBytes_length_('a'*1000, 1000) Segmentation fault >>> from Foundation import * >>> for n in range(2**10): ... print n ... NSData.alloc().initWithBytes_length_('a' * n, n) ^^ failed at 31 (30 being the last one that initialized successfully) Is there some reason the unittest seems to skirt around this issue (other than not wanting to crash ;)? It does work (probably unreliably) with small strings/arrays. Maybe there should be some convenience methods in the ObjC core, or additions to the NSData/NSMutableData proxy objects so you can just get an NSData/NSMutableData directly to and from str, array, and numeric arrays? I think that would cover most bases, and I don't think people would mind having to use convenience methods so long as they're documented. It seems kind of silly to require you to specify the length.. it's not very 'pythonic' since it's to easy to slice sequence types to whatever size they need to be and not safe to specify lengths any longer than that. oh.. and I think these segfaults are doing something really nasty to my system (though I don't see exactly why it should), as my front terminal window (that I was using for Python) was going between normal display and completely white and unresponsive at a cycle time of about 5 seconds.. I did manage to close it eventually, and the other terminals seem fine. I dunno if this is related, but I have never seen it happen before. -bob |
From: Dinu G. <gh...@da...> - 2003-01-07 13:01:04
|
bb...@ma...: >> Cocoa-Python Document-based Application > > Already in the works. Great! Please let me know if I can help to accelerate the process!? I'm planning to evaluate porting some stuff over to using PyObjC and having multi-document wiring would certainly be helpful... Regards, Dinu -- Dinu C. Gherman ...................................................................... "Patriotism is the willingness to kill and be killed for trivial reasons." (Bertrand Russell) |
From: Just v. R. <ju...@le...> - 2003-01-07 12:42:38
|
Dinu Gherman wrote: > http://python.net/~gherman/tmp/QuickTimeViewer.tgz Cool! FWIW, you can also build an bundle with a script like this (typically called buildapp.py): from bundlebuilder import buildapp buildapp( name = "QuickTimeViewer", mainprogram = "__main__.py", resources = ["English.lproj", "MyAppDelegate.py"], nibname = "MainMenu", ) Invoke it from the command line as "python buildapp.py build". This is independent from PB and doesn't need bin-python-main.m. Just |
From: Dinu G. <gh...@da...> - 2003-01-07 11:06:01
|
Given SourceForge's policy of unremovable CVS directories, I wonder what the PyObjC policy is with respect to sample code etc. in its CVS repository? With Cocoa/OS X many file resources are stored in- side dictionaries and I remember I added myself a .cre8 directory on SF in a different project before... :-/ Dinu -- Dinu C. Gherman ...................................................................... "The proper basis for a marriage is a mutual misunderstanding." (Oscar Wilde) |
From: Dinu G. <gh...@da...> - 2003-01-07 10:33:19
|
Ok, instead of fiddling further with services I wrote a simple demo that fetches and displays QuickTime movies from the web, with some predefined URLs pointing to pixar.com: http://python.net/~gherman/tmp/QuickTimeViewer.tgz Apart from the obvious functionality, there is an interaction with an NSPopupButton and there are some tooltips for the bottom widgets. The movie view even resizes nicely during playing the movie (but strangely not before initialising it with a movie...)! For some rea- son the Show button needs to be pressed twice at the beginning... I wrote the same demo much earlier using Jython, but never quite managed to use IB in the same context. Using PyObjC makes live so much easier! :-) Now if I only could get access to the real QuickTime movie content using PyObjC...! That would allow for keeping aspect ratio and do- ing all sorts of other nifty things... Enjoy, Dinu -- Dinu C. Gherman ...................................................................... "I want to put a ding in the universe." (Steve Jobs) |
From: <bb...@ma...> - 2003-01-07 03:58:22
|
On Monday, Jan 6, 2003, at 20:03 US/Eastern, Bob Ippolito wrote: > Which is ok, and works fine. But how the heck do you do the opposite > (short of writing to a tempfile)? I can get an ObjCPointer to > mutableData or the like, but there aren't any useful methods in it > because I can't use python to read data from a pointer (unless there's > some sketchy stuff in objc that I haven't found yet). If you grab the source from the cvs repository, you can now do stuff like the following (this is the unit test, btw). This will, of course, be in the next version of PyObjC (sometime in February or March, maybe). Be forewarned, there is a bit of a dichotomy between the behavior of array, buffer, str, and other buffer like things in PyObjC. There is a PEP (296, I believe) that will nicely fix this, but it may never actually be implemented. b.bum import unittest import objc import array from Foundation import NSData, NSMutableData rawBytes = "a\x13b\x00cd\xFFef\xEFgh" otherBytes = array.array('c') otherBytes.fromstring('12345678901234567890' * 5) class TestNSData(unittest.TestCase): def assertDataContents(self, d1, d2, rawData): self.assertEquals(len(d1), d1.length(), "d1: len() and -length didn't match.") self.assertEquals(len(d1), len(rawData), "d1: len(<data>) and len(<input>) didn't match.") self.assertEquals(len(d2), d2.length(), "d2: len() and -length didn't match.") self.assertEquals(len(d2), len(rawData), "d2: len(<data>) and len(<input>) didn't match.") def testDataWithBytes_length_(self): """Test +dataWithBytes:length:""" data = NSData.dataWithBytes_length_(rawBytes, len(rawBytes)) mutableData = NSMutableData.dataWithBytes_length_(rawBytes, len(rawBytes)) self.assertDataContents(data, mutableData, rawBytes) def testInitWithBytes_length_(self): """Test -initWithBytes:length:""" data = NSData.alloc().initWithBytes_length_(rawBytes, len(rawBytes)) mutableData = NSMutableData.alloc().initWithBytes_length_(rawBytes, len(rawBytes)) self.assertDataContents(data, mutableData, rawBytes) def testBytes(self): """Test -bytes""" data = NSData.alloc().initWithBytes_length_(rawBytes, len(rawBytes)) bytes = data.bytes() self.assertEquals(len(bytes), len(rawBytes), "bytes() and rawBytes not equal length.") for i in range(0,len(bytes)): self.assertEquals(rawBytes[i], bytes[i], "byte %s of bytes and rawBytes are not equal." % i) try: bytes[3] = 0xAE except TypeError, r: if str(r).find('buffer is read-only') is not 0: raise def testMutableBytes(self): """Test -mutableBytes""" mutableData = NSMutableData.dataWithBytes_length_(rawBytes, len(rawBytes)) mutableBytes = mutableData.mutableBytes() for i in range(0, len(mutableBytes)): mutableBytes[i] = otherBytes[i] mutableBytes[1:8] = otherBytes[1:8] try: mutableBytes[2:10] = otherBytes[1:5] except TypeError, r: if str(r).find('right operand length must match slice length') is not 0: raise def testVariousDataLengths(self): """Test data of different lengths. Data of different lengths may be stored in different subclasses within the class cluster. """ testFactor = [1, 10, 1000, 10000, 1000000] for aFactor in testFactor: bigRawBytes = "1234567890" * aFactor mutableData = NSMutableData.dataWithBytes_length_(bigRawBytes, len(bigRawBytes)) data = NSData.dataWithBytes_length_(bigRawBytes, len(bigRawBytes)) self.assertDataContents(data, mutableData, bigRawBytes) mutableBytes = mutableData.mutableBytes() bytes = data.bytes() self.assertEquals(len(bytes), data.length()) self.assertEquals(len(mutableBytes), mutableData.length()) self.assertEquals(bytes, mutableBytes) mutableBytes[0:len(mutableBytes)] = bytes[0:len(bytes)] def suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TestNSData)) return suite if __name__ == '__main__': unittest.main( ) |
From: Bob I. <bo...@re...> - 2003-01-07 01:12:02
|
On Monday, Jan 6, 2003, at 20:08 America/New_York, David Eppstein wrote: > On 1/6/03 8:03 PM -0500 Bob Ippolito <bo...@re...> wrote: > > I've been using the NSString <-> str bridge with unicode strings that > include chars >128 and having no difficulty in either direction. I > think converting to unicode is better than your array workaround > because you have to be more explicit about what encoding you intend. > I'm working with raw data, not unicode strings.. I don't want any encoding mishaps. -bob |
From: Bob I. <bo...@re...> - 2003-01-07 01:03:18
|
I was just toying around with pyobjc today and I ran across a few stumbling blocks.. the NSString <-> str bridge doesn't work for raw data (stuff with characters > 128). Which is ok, because you can get around it with something like this (took me a few minutes of wandering the list archives): from Foundation import * import array s = '\xFF' b = array.array('B') b.fromstring(s) data = NSData.alloc().initWithBytes_length_(b, len(b)) print data Which is ok, and works fine. But how the heck do you do the opposite (short of writing to a tempfile)? I can get an ObjCPointer to mutableData or the like, but there aren't any useful methods in it because I can't use python to read data from a pointer (unless there's some sketchy stuff in objc that I haven't found yet). -bob |
From: Ronald O. <ous...@ci...> - 2003-01-06 22:03:46
|
I've applied the entire patch, which some changed (minor changes in Modules/objc, larger ones in Modules/Cocoa). Ronald |
From: David E. <epp...@ic...> - 2003-01-06 21:34:52
|
On 1/6/03 6:40 PM +0100 Just van Rossum <ju...@le...> wrote: > David Eppstein wrote: > >> I'm pretty sure it is all I need. But I got confused by the way the >> xml module replaces itself with _xmlplus if available and decided I >> didn't know how to include only pyexpat.so without including all the >> rest of _xmlplus or breaking something else. > > Actually, the standard xml package (the one that _xmlplus replaces) > works just fine with expat, as long as pyexpat.so is available (on the > top level). You could try by manually fiddling with your .app bundle. Thanks, that does appear to work. I hadn't realized the default pyexpat was ok at top level instead of in xml/parsers where _xmlplus puts it. -- David Eppstein UC Irvine Dept. of Information & Computer Science epp...@ic... http://www.ics.uci.edu/~eppstein/ |
From: Ronald O. <ous...@ci...> - 2003-01-06 21:12:19
|
On Monday, Jan 6, 2003, at 20:08 Europe/Amsterdam, Dinu Gherman wrote: > > Here is what I have so far or mentioned before: > > http://python.net/~gherman/tmp/PythonServices.tgz > http://python.net/~gherman/tmp/URLServices.tgz > http://python.net/~gherman/tmp/reloadservices > > Bill, if you can give the first a quick look, great, otherwise I'll > delve a bit deeper in frustration... At least part of your problem is the method signature for simpleEncrypt_userData_error_. In Objective-C the last argument is a pointer to an id. Because not all arguments are an object and your not overriding a method from a superclass you'll have to provide a correct signature. In the service I posted earlier I used: import objc def NSServiceFunc(meth): return objc.selector(meth, signature="v@:@@o^@") and in class ServiceTest: def doFoo_userData_error_(self, pboard, data): # Note: No argument error # ... return (None, None) doFoo_userData_error_ = NSServiceFunc(doFoo_userData_error_) The program still tries to start in the foreground. My example used '<key>NSBGOnly</key><string>1</string>' in the Info.plist. That didn't work here, but at the service is working (using the first alternative in __main__.py, and without importing MyAppDelegate). Bill^H^H^H^HRonald ;-) |
From: Dinu G. <gh...@da...> - 2003-01-06 19:07:34
|
bb...@ma...: > A Cocoa application generally has the concept of a 'Main NIB file'. > That is, a NIB file that is automatically loaded at application launch > that contains things like the main menu and the primary controller > object. In the case of Cocoa/Python, the default 'controller' object > is an instance of MyAppDelegate. The instance appears in > MainMenu.nib. Ok, I removed just the window from the NIB, but now see spurious complaints like "Could not connect the action buttonPressed: to target of class NSApplication" though I can't find any action method named buttonPressed. > Ahhh... I see... you want to create a services engine that runs > completely in the background. I'll leave the above in anyway (it is > still useful). Yes, ideally without any icons popping up anywhere. > Yes -- this is a bug in the bridge, sort of. There is a category on > NSAutoreleasePool that allows you to push and pop pools, as needed. > > [...] So, just call... > > NSAutoreleasePool.pyobjcPushPool() > > ... instead of NSAutoreleasePool.alloc().init(). Done, but with little if any effect, see below. > PyObjC maps Objective-C exceptions to Python and vice-versa. That is, > you can do: > > try: > NSRunLoop.currentRunLoop().configureAsServer() > NSRunLoop.currentRunLoop().run() > except: > ... handle exception as you would any other Python exception ... Tried to replace this with code more like Ronald's, also with little effect. Here are all three versions I tried: if 0: # inspired by Ronald's code in service.py serviceProvider = PyServices.PyServices.alloc().init() NSRegisterServicesProvider(serviceProvider, "PyServices") NSRunLoop.currentRunLoop().configureAsServer() NSRunLoop.currentRunLoop().run() sys.exit() if 0: # pass control to the AppKit (from template __main__.py) import sys sys.exit(AppKit.NSApplicationMain(sys.argv)) if 1: # stuff ported from URLServices' main.m ## pool = NSAutoreleasePool.alloc().init() pool = NSAutoreleasePool.pyobjcPushPool() serviceProvider = PyServices.PyServices.alloc().init() NSRegisterServicesProvider(serviceProvider, "PyServices") # NS_DURING try: NSRunLoop.currentRunLoop().configureAsServer() NSRunLoop.currentRunLoop().run() # NS_HANDLER except: pass # NSLog("%@", localException) # NS_ENDHANDLER serviceProvider.release() pool.release() > Agreed. I haven't seen URLServices -- is there any reason not to have > some kind of a UI? I.e. does it need preferences, documentation or > any kind of a UI? If so, I would punt on creating an 'invisible' > service -- they are handy for a lot of things, but it also means that > the user cannot easily kill/quit the service. If the service is every > invoked from a disk image or other removable media, the media cannot > be ejected until the service is killed. For now no GUI will be just what I want, later we'll see. Also, I don't care about killing/quitting the service. I do about re- starting newly "improved" services (during development) for which you can either relogin or use a tool named "reloadservices" that I got from somewhere... Here is what I have so far or mentioned before: http://python.net/~gherman/tmp/PythonServices.tgz http://python.net/~gherman/tmp/URLServices.tgz http://python.net/~gherman/tmp/reloadservices Bill, if you can give the first a quick look, great, otherwise I'll delve a bit deeper in frustration... Dinu -- Dinu C. Gherman ...................................................................... "Any sufficiently advanced technology is indistinguishable from magic." (Arthur C. Clarke) |
From: Just v. R. <ju...@le...> - 2003-01-06 17:40:26
|
David Eppstein wrote: > I'm pretty sure it is all I need. But I got confused by the way the > xml module replaces itself with _xmlplus if available and decided I > didn't know how to include only pyexpat.so without including all the > rest of _xmlplus or breaking something else. Actually, the standard xml package (the one that _xmlplus replaces) works just fine with expat, as long as pyexpat.so is available (on the top level). You could try by manually fiddling with your .app bundle. Just |
From: <bb...@ma...> - 2003-01-06 17:24:09
|
On Monday, Jan 6, 2003, at 10:53 US/Eastern, Jack Jansen wrote: > For instance, in the plist file you have the NSServices dict, which > maps menu entries to calls to be made in the service. I assume that > the mapping from <string>doPythonExec</string> to > doPythonExec:userData:error: is defined somewhere, right? But it looks > as though I miss an argument? Or does the NSServiceFunc magic have > something to do with this? And what is the NSPortName=PythonService > used for? The port name is the name assigned to the mach port upon which the inbound services request arrives. It is an implementation detail. The method mapping is a standard part of the services mechanism. The method name you pass has the additional arguments tacked on the end. Basically, the services mechanism is unchanged from the NeXT days. Given Rendezvous, I would expect to see some fairly major changes in the way services are implemented on the system. Also, the services menu is *really* annoying -- have to traverse through at least two levels, often three, to get to the item you want. When implementing services aware applications, I recommend duplicating the services menu as a dock menu, as well. The dock menu cannot directly act on the active selection in the active app-- simply requires that the user hit cmd-c before hitting the menu and cmd-v afterwords (depending on what is appropriate). The dock menu also allows the user to interact with the app in a more robust/complete fashion than does services. Documentation on various services -- first is specific to NSServices, the rest are loosely related: file://localhost/Developer/Documentation/Cocoa/TasksAndConcepts/ ProgrammingTopics/SysServices/index.html file://localhost/Developer/Documentation/Cocoa/TasksAndConcepts/ ProgrammingTopics/Workspace/index.html file://localhost/Developer/Documentation/Cocoa/TasksAndConcepts/ ProgrammingTopics/NetServices/index.html b.bum |
From: David E. <epp...@ic...> - 2003-01-06 17:01:25
|
On 1/6/03 2:25 PM +0100 Just van Rossum <ju...@le...> wrote: > David Eppstein wrote: > >> * The application itself is big (7.7Mb). More than half of the bulk >> is due to including _xmlplus due to Apple's failure to include >> pyexpat in the default command-line Python. Pyexpat itself is not so >> big (460k) so maybe it would be possible to reduce the build size. > > I forgot to mention: if expat is all you need from _xmlplus, it should > suffice to just include pyexpat.so instead of all of _xmlplus. I'm pretty sure it is all I need. But I got confused by the way the xml module replaces itself with _xmlplus if available and decided I didn't know how to include only pyexpat.so without including all the rest of _xmlplus or breaking something else. -- David Eppstein UC Irvine Dept. of Information & Computer Science epp...@ic... http://www.ics.uci.edu/~eppstein/ |
From: Ronald O. <ous...@ci...> - 2003-01-06 16:16:45
|
On Monday, Jan 6, 2003, at 16:53 Europe/Amsterdam, Jack Jansen wrote: > > On Monday, Jan 6, 2003, at 16:16 Europe/Amsterdam, Ronald Oussoren > wrote: > >> Dinu, >> >> The attached files implement a simple service. It implements two menu >> items, but only 'Evaluate expression' is functional at the moment. > > Ronald, this looks really cool, but could you explain how things are > tied together (or point me to the right documentation?). I've used the SimpleService example (part of the Developer Tools) as a template. IIRC the documentation that Dinu referred to contains more detailed information. Ronald |