pyobjc-dev Mailing List for PyObjC (Page 20)
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: Diez B. R. <de...@we...> - 2011-07-22 07:40:36
|
On Jul 22, 2011, at 9:13 AM, Greg Ewing wrote: > I found out what was causing this. Turns out it was blocked > importing encodings.ascii, trying to acquire the import lock. > > The reason it couldn't acquire the import lock is that the > main module of my application was a stub that imported the > real main module, which in turn started the event loop > directly from the module code. > > So the whole app was running inside an import statement, > holding on to the import lock. Once I fixed that, everything > was fine. Nice catch... Diez |
From: Greg E. <gre...@ca...> - 2011-07-22 07:13:14
|
I found out what was causing this. Turns out it was blocked importing encodings.ascii, trying to acquire the import lock. The reason it couldn't acquire the import lock is that the main module of my application was a stub that imported the real main module, which in turn started the event loop directly from the module code. So the whole app was running inside an import statement, holding on to the import lock. Once I fixed that, everything was fine. -- Greg |
From: Ronald O. <ron...@ma...> - 2011-07-17 14:59:54
|
On 16 Jul, 2011, at 4:46, Greg Ewing wrote: > This is getting extremely weird. It turns out that the > thread is hanging on the following line in httplib.py: > > host_enc = self.host.encode("ascii") > > where the string being encoded in my test case is > '127.0.0.1'. > > I can't for the life of me imagine what the ascii codec > could be doing to cause a thread to block. > > Can anyone with more knowledge of the codec system > shed any light? Not really. Have you tried getting a C stacktrace using gdb? The only obvious reason for blocking is the GIL: if for some reason the main thread doesn't release the GIL at some point you'll get a hang in the secondary threads. That's pretty unlikely though given that the secondary thread does some work before it hangs. Debugging would be easier if you had a smallish sample program (a dependency on PyGUI would be fine) Ronald |
From: Greg E. <gre...@ca...> - 2011-07-16 07:25:28
|
PyGUI 2.5.3 is available: http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ Clipboard access now implemented on MacOSX, plus a few bug fixes. What is PyGUI? -------------- PyGUI is a cross-platform GUI toolkit designed to be lightweight and have a highly Pythonic API. -- Gregory Ewing gre...@ca... http://www.cosc.canterbury.ac.nz/greg.ewing/ |
From: Greg E. <gre...@ca...> - 2011-07-16 02:46:37
|
This is getting extremely weird. It turns out that the thread is hanging on the following line in httplib.py: host_enc = self.host.encode("ascii") where the string being encoded in my test case is '127.0.0.1'. I can't for the life of me imagine what the ascii codec could be doing to cause a thread to block. Can anyone with more knowledge of the codec system shed any light? Some more data points: * It doesn't happen when Cocoa is used in a simple way (just create an NSApplication and call its run() method). * It also doesn't happen if I just create a PyGUI Application object and call its run() method. So it's something about my big complicated PyGUI app... :-( > Speaking of Cocoa. I don't know if you're doing anything that really requires > threaded programming or python networking. If not, consider using the > asynchronous Cocoa networking APIs. This needs to be cross-platform, so I can't rely on anything Cocoa-specific. -- Greg |
From: Jonathan S. <sa...@gm...> - 2011-07-15 13:13:54
|
You might also consider adding a run loop to each thread you fork. I'm not sure how things are handled by pyobjc (eg if it manages run loops in threads for you, I would tend to doubt it), but many networking API in Cocoa require a run loop or Bad Things Happen (TM), where "Bad Things" are usually silent failures or stuck threads. http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Multithreading/RunLoopManagement/RunLoopManagement.html Speaking of Cocoa. I don't know if you're doing anything that really requires threaded programming or python networking. If not, consider using the asynchronous Cocoa networking APIs. They'll keep you out of threaded programming land. Look at NSHttp* and NSURL* classes. YMMV, etc. Cheers, Jonathan Saggau <http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Multithreading/RunLoopManagement/RunLoopManagement.html> On Fri, Jul 15, 2011 at 4:42 AM, Ronald Oussoren <ron...@ma...>wrote: > > On 15 Jul, 2011, at 3:43, Greg Ewing wrote: > > > I'm trying to use httplib to send an http request in > > a background thread. It works fine on its own, but when > > I do it inside a Cocoa application, the thread hangs > > as soon as it tries to send the request. > > > > It doesn't seem to be a GIL problem, because I can do > > other things in the thread leading up to that point. > > It's just sending the request that seems to block. > > > > Is there anything I should be aware of when using > > the threading module in conjunction with pyobjc? > > This should work. One thing you could try is redefining urllib. > proxy_bypass_macosx_sysconf and urllib.getproxies_macosx_sysconf > > def getproxies_macosx_sysconf(): > return {} > > def proxy_bypass_macosx_sysconf(host): > return True > > urllib. getproxies_macosx_sysconf = getproxies_macosx_sysconf > urllib.proxy_bypass_macosx_sysconf = proxy_bypass_macosx_sysconf > > This ensures that urllib doesn't use the OSX specific code for getting the > HTTP proxy configuration. That code should work just fine in a Cocoa > program, but it does call into Apple's frameworks and hence might cause > problems in some way. > > Ronald > > -- > > Greg > > > > > ------------------------------------------------------------------------------ > > AppSumo Presents a FREE Video for the SourceForge Community by Eric > > Ries, the creator of the Lean Startup Methodology on "Lean Startup > > Secrets Revealed." This video shows you how to validate your ideas, > > optimize your ideas and identify your business strategy. > > http://p.sf.net/sfu/appsumosfdev2dev > > _______________________________________________ > > Pyobjc-dev mailing list > > Pyo...@li... > > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > > > > ------------------------------------------------------------------------------ > AppSumo Presents a FREE Video for the SourceForge Community by Eric > Ries, the creator of the Lean Startup Methodology on "Lean Startup > Secrets Revealed." This video shows you how to validate your ideas, > optimize your ideas and identify your business strategy. > http://p.sf.net/sfu/appsumosfdev2dev > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > > -- Jonathan Saggau jonathansaggau.com This amusement engaged me so much that [friends] were obliged to force me from it; and thus it is with every inclination I give into, it continues to augment, till at length it becomes so powerful, that I lose sight of everything except the favorite amusement. - Rousseau |
From: Ronald O. <ron...@ma...> - 2011-07-15 08:43:03
|
On 15 Jul, 2011, at 3:43, Greg Ewing wrote: > I'm trying to use httplib to send an http request in > a background thread. It works fine on its own, but when > I do it inside a Cocoa application, the thread hangs > as soon as it tries to send the request. > > It doesn't seem to be a GIL problem, because I can do > other things in the thread leading up to that point. > It's just sending the request that seems to block. > > Is there anything I should be aware of when using > the threading module in conjunction with pyobjc? This should work. One thing you could try is redefining urllib. proxy_bypass_macosx_sysconf and urllib.getproxies_macosx_sysconf def getproxies_macosx_sysconf(): return {} def proxy_bypass_macosx_sysconf(host): return True urllib. getproxies_macosx_sysconf = getproxies_macosx_sysconf urllib.proxy_bypass_macosx_sysconf = proxy_bypass_macosx_sysconf This ensures that urllib doesn't use the OSX specific code for getting the HTTP proxy configuration. That code should work just fine in a Cocoa program, but it does call into Apple's frameworks and hence might cause problems in some way. Ronald > -- > Greg > > ------------------------------------------------------------------------------ > AppSumo Presents a FREE Video for the SourceForge Community by Eric > Ries, the creator of the Lean Startup Methodology on "Lean Startup > Secrets Revealed." This video shows you how to validate your ideas, > optimize your ideas and identify your business strategy. > http://p.sf.net/sfu/appsumosfdev2dev > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |
From: Ronald O. <ron...@ma...> - 2011-07-15 08:36:40
|
On 8 Jul, 2011, at 2:50, Greg Ewing wrote: > Ronald Oussoren wrote: > >> To be honest I'm more likely to work on a fork of CPython where a PyObject* >> is toll-free bridged to an Objective-C class, that would solve some problems were >> currently having and might open up other interesting avenues. > > That sounds interesting, but I hope it won't come at the > expense of a version of PyObjC that works with standard > CPython. I don't have plans to work on such a fork, and even with such a fork the regular CPython version PyObjC will be supported. Ronald |
From: Diez B. R. <de...@we...> - 2011-07-15 06:53:22
|
On Jul 15, 2011, at 3:43 AM, Greg Ewing wrote: > I'm trying to use httplib to send an http request in > a background thread. It works fine on its own, but when > I do it inside a Cocoa application, the thread hangs > as soon as it tries to send the request. > > It doesn't seem to be a GIL problem, because I can do > other things in the thread leading up to that point. > It's just sending the request that seems to block. > > Is there anything I should be aware of when using > the threading module in conjunction with pyobjc? I've used threads + Cocoa without a hitch, so without more information I can only assume it's something you do. Diez |
From: Greg E. <gre...@ca...> - 2011-07-15 01:43:47
|
I'm trying to use httplib to send an http request in a background thread. It works fine on its own, but when I do it inside a Cocoa application, the thread hangs as soon as it tries to send the request. It doesn't seem to be a GIL problem, because I can do other things in the thread leading up to that point. It's just sending the request that seems to block. Is there anything I should be aware of when using the threading module in conjunction with pyobjc? -- Greg |
From: <end...@gm...> - 2011-07-11 03:58:36
|
Hi. I'd like to inform you that I was finally able to access the camera and take photo programatically. Let me know if you are interested in more details. I will post a working port of my iCam project written in PyObjC, relying on this module, at http://mobile-revival.110mb.com/ReVival/ (alias http://go.to/slog) in the following days. iCam is a cross platform video surveillance application using camera phones that I worked on for more than 1 year. The project transforms a mobile phone in a surveillance camera with motion detection. One can also create a network of such devices connected via Bluetooth or WiFi, where the master phone transmits via 3G/GSM. The photo/video information can be uploaded on YouTube, Picasa, etc. The phone application can be controlled remotely via Internet. This project is deployed and in use for almost 1 year. Best regards. On Thu, Jun 30, 2011 at 1:48 AM, <end...@gm...> wrote: > Hi. > I am trying to implement in PyObjC the program available at > > https://github.com/erica/iphone-3.0-cookbook-/tree/b8ca8905d17015839a0917e1dcd407d055890236/C07-Images/04-Snapping%20Images. > > Although I am a "beginner" in PyObjC, I spent a couple of days trying to > very seriously translate this script to PyObjC and tried my best to find out > all errors. > However, it doesn't work: the application doesn't execute normally after > entering viewDidLoad() - it doesn't change appearance of UI as specified > there. I guess it has to do with the fact I am not loading (or using the > specification) of the TestBedViewController.xib file, which describes > properties of TestBedViewController - I translated only the main.m and did > not use by any means the TestBedViewController.xib - I do not know how can I > load this file in PyObjC on iOS... > Please find the PyObjC code I wrote so far here: > http://mobile-revival.110mb.com/ReVival/HelloPython.py . > > I run my PyObjC scripts on iOS version 3.1.2. PyObjC is version 1946-4, > Python is version 2.5.1-5 (obtained with Cydia 1.1.1; and libffi is version > 130618-4). > > Best regards. > Alex > > |
From: <end...@gm...> - 2011-07-10 20:55:26
|
Hi. I'd like to inform you that I found what the problem was. Basically it had to do with the fact I didn't start properly the camera viewfinder. Let me know if you are interested in more details. I will post a working port of my iCam project written in PyObjC, relying on this module, at http://mobile-revival.110mb.com/ReVival/ (alias http://go.to/slog) in the following days. iCam is a cross platform video surveillance application using camera phones that I worked on for more than 1 year. The project transforms a mobile phone in a surveillance camera with motion detection. One can also create a network of such devices connected via Bluetooth or WiFi, where the master phone transmits via 3G/GSM. The photo/video information can be uploaded on YouTube, Picasa, etc. The phone application can be controlled remotely via Internet. This project is deployed and in use for almost 1 year. Best regards. On Sat, Jul 9, 2011 at 12:54 AM, <...> wrote: > Hi. > When I load UIKit with > myUIKit = objc.loadBundle("UIKit", globals(), > "/System/Library/Frameworks/UIKit.framework") > I import a lot of symbols, but a few protocols such as > UIImagePickerControllerDelegate and UINavigationControllerDelegate are not > loaded with this occasion (probably because they are not used in any any > other place). > > Could you please tell me if you have an idea on what goes wrong when > using UIImagePickerController with UIImagePickerControllerDelegate in the > code below. > The symptom is the following: none of the methods of MyDelegate don't > get called, although ipc.takePicture() should call them. > Documentation on how to use UIImagePickerController at: > - > http://developer.apple.com/library/ios/#documentation/AudioVideo/Conceptual/CameraAndPhotoLib_TopicsForIOS/Articles/TakingPicturesAndMovies.html#//apple_ref/doc/uid/TP40010406 > - > http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html#//apple_ref/occ/cl/UIImagePickerController > > """ > Following > http://pyobjc.sourceforge.net/documentation/pyobjc-core/wrapping.html: > "If the framework defines any (informal) protocols you should add > objc.informal_protocol objects for those protocols to your module. These can > be defined in a submodule, as long as you arrange for that module to be > loaded whenever someone imports your package." > """ > UIImagePickerControllerDelegate = > objc.informal_protocol("UIImagePickerControllerDelegate", [ > #- (void)imagePickerController:(UIImagePickerController *)picker > didFinishPickingMediaWithInfo:(NSDictionary *)info > objc.selector(None, > selector="imagePickerController:didFinishPickingMediaWithInfo:", > signature="v@:@@"), > #- (void)imagePickerControllerDidCancel:(UIImagePickerController > *)picker > objc.selector(None, selector="imagePickerControllerDidCancel:", > signature="v@:@"), > #- (void) imagePickerController:(UIImagePickerController *)picker > didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary > *)editingInfo > objc.selector(None, > selector="imagePickerController:didFinishPickingImage:editingInfo:", > signature="v@:@@@") > #objc.selector(None, selector="testMethod", signature="I@:", > isRequired=1), #isClassMethod=1 > ]) > UINavigationControllerDelegate = > objc.formal_protocol("UINavigationControllerDelegate", > (objc.protocolNamed("NSObject"), ), [ > #The protocol defines methods that the delegate CAN implement (NOT > mandatory) > #- (void)navigationController:(UINavigationController > *)navigationController didShowViewController:(UIViewController > *)viewController animated:(BOOL)animated > #- (void)navigationController:(UINavigationController > *)navigationController willShowViewController:(UIViewController > *)viewController animated:(BOOL)animated > ]) > > #class MyDelegate(UINavigationControllerDelegate): #function takes at most > 1 argument (3 given). ANYHOW BAD BECAUSE I MISTAKED AND USED > UINavigationControllerDelegate > class MyDelegate(NSObject, UIImagePickerControllerDelegate): > #- (void) imagePickerController:(UIImagePickerController *)picker > didFinishPickingMediaWithInfo:(NSDictionary *)info > @objc.signature("v@:@@") > def imagePickerController_didFinishPickingMediaWithInfo_(self, picker, > info): > try: > print "Entered > imagePickerController_didFinishPickingMediaWithInfo_(self, picker = %s, info > = %s)." % (str(picker), str(info)) > sys.stdout.flush() > > picker.release() > except: > traceback.print_exc() > sys.stderr.flush() > > #Provide 2.x compliance > #- (void) imagePickerController:(UIImagePickerController *)picker > didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary > *)editingInfo > @objc.signature("v@:@@@") > def imagePickerController_didFinishPickingImage_editingInfo_(self, > picker, image, editingInfo): > try: > print "Entered > imagePickerController_didFinishPickingImage_editingInfo_(self, picker = %s, > image = %s, editingInfo = %s)." % (str(picker), str(image), > str(editingInfo)) > sys.stdout.flush() > > #NSDictionary *dict = [NSDictionary dictionaryWithObject:image > forKey:@"UIImagePickerControllerOriginalImage"]; > > self.imagePickerController_didFinishPickingMediaWithInfo_(picker, dict) > except: > traceback.print_exc() > sys.stderr.flush() > > #- (void) imagePickerControllerDidCancel: > @objc.signature("v@:@") > def imagePickerControllerDidCancel_(self, picker): > try: > print "Entered imagePickerControllerDidCancel_(self, picker = > %s)." % (str(picker)) > sys.stdout.flush() > > self.dismissModalViewControllerAnimated_(objc.YES) > picker.release() > except: > traceback.print_exc() > sys.stderr.flush() > > ipcDelegate = MyDelegate.alloc().init() > > ... > ipc = UIImagePickerController.alloc().init() > ... > ipc.takePicture() > > > Thank you. > > |
From: <end...@gm...> - 2011-07-08 21:54:27
|
Hi. When I load UIKit with myUIKit = objc.loadBundle("UIKit", globals(), "/System/Library/Frameworks/UIKit.framework") I import a lot of symbols, but a few protocols such as UIImagePickerControllerDelegate and UINavigationControllerDelegate are not loaded with this occasion (probably because they are not used in any any other place). Could you please tell me if you have an idea on what goes wrong when using UIImagePickerController with UIImagePickerControllerDelegate in the code below. The symptom is the following: none of the methods of MyDelegate don't get called, although ipc.takePicture() should call them. Documentation on how to use UIImagePickerController at: - http://developer.apple.com/library/ios/#documentation/AudioVideo/Conceptual/CameraAndPhotoLib_TopicsForIOS/Articles/TakingPicturesAndMovies.html#//apple_ref/doc/uid/TP40010406 - http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html#//apple_ref/occ/cl/UIImagePickerController """ Following http://pyobjc.sourceforge.net/documentation/pyobjc-core/wrapping.html: "If the framework defines any (informal) protocols you should add objc.informal_protocol objects for those protocols to your module. These can be defined in a submodule, as long as you arrange for that module to be loaded whenever someone imports your package." """ UIImagePickerControllerDelegate = objc.informal_protocol("UIImagePickerControllerDelegate", [ #- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info objc.selector(None, selector="imagePickerController:didFinishPickingMediaWithInfo:", signature="v@:@@"), #- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker objc.selector(None, selector="imagePickerControllerDidCancel:", signature="v@:@"), #- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo objc.selector(None, selector="imagePickerController:didFinishPickingImage:editingInfo:", signature="v@:@@@") #objc.selector(None, selector="testMethod", signature="I@:", isRequired=1), #isClassMethod=1 ]) UINavigationControllerDelegate = objc.formal_protocol("UINavigationControllerDelegate", (objc.protocolNamed("NSObject"), ), [ #The protocol defines methods that the delegate CAN implement (NOT mandatory) #- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated #- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated ]) #class MyDelegate(UINavigationControllerDelegate): #function takes at most 1 argument (3 given). ANYHOW BAD BECAUSE I MISTAKED AND USED UINavigationControllerDelegate class MyDelegate(NSObject, UIImagePickerControllerDelegate): #- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info @objc.signature("v@:@@") def imagePickerController_didFinishPickingMediaWithInfo_(self, picker, info): try: print "Entered imagePickerController_didFinishPickingMediaWithInfo_(self, picker = %s, info = %s)." % (str(picker), str(info)) sys.stdout.flush() picker.release() except: traceback.print_exc() sys.stderr.flush() #Provide 2.x compliance #- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo @objc.signature("v@:@@@") def imagePickerController_didFinishPickingImage_editingInfo_(self, picker, image, editingInfo): try: print "Entered imagePickerController_didFinishPickingImage_editingInfo_(self, picker = %s, image = %s, editingInfo = %s)." % (str(picker), str(image), str(editingInfo)) sys.stdout.flush() #NSDictionary *dict = [NSDictionary dictionaryWithObject:image forKey:@"UIImagePickerControllerOriginalImage"]; self.imagePickerController_didFinishPickingMediaWithInfo_(picker, dict) except: traceback.print_exc() sys.stderr.flush() #- (void) imagePickerControllerDidCancel: @objc.signature("v@:@") def imagePickerControllerDidCancel_(self, picker): try: print "Entered imagePickerControllerDidCancel_(self, picker = %s)." % (str(picker)) sys.stdout.flush() self.dismissModalViewControllerAnimated_(objc.YES) picker.release() except: traceback.print_exc() sys.stderr.flush() ipcDelegate = MyDelegate.alloc().init() ... ipc = UIImagePickerController.alloc().init() ... ipc.takePicture() Thank you. |
From: Greg E. <gre...@ca...> - 2011-07-08 00:51:17
|
Ronald Oussoren wrote: > To be honest I'm more likely to work on a fork of CPython where a PyObject* > is toll-free bridged to an Objective-C class, that would solve some problems were > currently having and might open up other interesting avenues. That sounds interesting, but I hope it won't come at the expense of a version of PyObjC that works with standard CPython. -- Greg |
From: Ronald O. <ron...@ma...> - 2011-07-07 08:14:12
|
On 5 Jul, 2011, at 17:50, Leonardo Santagada wrote: > On Tue, Jul 5, 2011 at 12:21 PM, Lawrence Akka > <la...@us...> wrote: >> 4) Clang: interesting. I have been playing with clang compilation of >> PyObjC generally, today. Had a couple of problems with libxml though. > > Any chance that while rewriting you do a pure python version of > pyobjc? pyglet is using a pure python bridge to objective-c because > getting pyobjc compiled is a pain. And specially now that pypy can run > ctypes faster than python c extensions I would say it is time to think > about it. It is unlikely that I'll rewrite PyObjC using ctypes anytime soon. Porting to PyPy would need some rearchitecturing anyway as the current implementation is pretty tightly bound to the CPython implementation anyway. To be honest I'm more likely to work on a fork of CPython where a PyObject* is toll-free bridged to an Objective-C class, that would solve some problems were currently having and might open up other interesting avenues. BTW. What problems are you haveing with compiling PyObjC? Would those be solved by having a single archive with an install script that compiles the various bit of PyObjC in the right order? Ronald |
From: Ronald O. <ron...@ma...> - 2011-07-07 08:04:54
|
On 5 Jul, 2011, at 17:21, Lawrence Akka wrote: > > > On Tue, 05 Jul 2011 17:02 +0200, "Ronald Oussoren" > <ron...@ma...> wrote: >> >> On 19 Jun, 2011, at 12:39, Lawrence Akka wrote: >> >>> I notice that at the end of last year Ronald said he intended to >>> move the PyObjC repository from SVN to mercurial, to join py2app and >>> friends which have already been transferred. >>> >>> In an attempt to be helpful and for my own purposes I have >>> successfully (I hope) created a copy of the PyObjC SVN repository >>> using mercurial at bitbucket: https://bitbucket.org/lakka/pyobjc >>> >>> All history/branches/tags have been preserved (though some of them >>> might usefully be closed off), but please open an issue if you find >>> any problems. I would be delighted if Ronald wanted to move/clone >>> this into his account! >>> >>> I hope soon to be able to contribute to the project some work I have >>> done reorganising the Sphinx documentation and updating the >>> examples. >> >> Cool, the documentation definitely needs work. I also want to redo >> the website, I have to update the scripts to generate the site >> anyway because of the move to sphinx and the site design needs some >> love as well. >> >> >> I already have a mercurial repository on my machine, but haven't >> uploaded that to bitbucket yet. >> >> BTW. I've started the port to Lion, but that's going slower than I'd >> want. I've decided to rewrite my metadata generator using the python >> bindings to clang, the current heap of regular expressions barely >> works and causes to much problems. From what I've seen so far it >> should be fairly easy to using clang.cindex as the parser. >> >> Ronald >> > > 1) Bitbucket: By all means clone mine and become the 'master' > repository if that is easier. I have done some optimisation to > shrink the size of the repo, but there remains some work to do to > close off unneeded branches etc. Alternatively, once you upload your > version, I'll delete my own conversion. I've already closed unnecessary branches in my copy, I just need to upload it. > > 2) Docs: Work has begun! I have reorganized/deduplicated and edited some > of what exists at the moment, and started to write additions. At the > moment, I am keeping this in a private patch queue, but once the > definitive repo has been set up, I will move over to public clone. > > 3) Sphinx: I have also updated the docs to use the newest Sphinx, and > had in mind seeing what I could do to generate the entire website > using Sphinx if you would like me to. I would only be able to turn > to that after the bulk of the docs have been written, though. > > 4) Clang: interesting. I have been playing with clang compilation of > PyObjC generally, today. Had a couple of problems with libxml though. I've also been playing with clang, and have fixed a number of bugs in my tree thanks to its static analyzer. Adding support for Py_INCREF/Py_DECREF to that analyzer would be a neat project for anyone that wants to do some easy-ish compiler hacking ;-) I haven't run into issues with libxml because I've recently removed libxml from my tree: I'm now "compiling" the XML file into a python file and use that to lazily initialize the wrapper modules. The intention is to improve PyObjC's startup speed and memory usage by reducing the amount of work that's done up front, and the implementation seems to to that if you use 'import Cocoa' instead of 'from Cocoa import *'. Ronald > > Lawrence > > ------------------------------------------------------------------------------ > All of the data generated in your IT infrastructure is seriously valuable. > Why? It contains a definitive record of application performance, security > threats, fraudulent activity, and more. Splunk takes this data and makes > sense of it. IT sense. And common sense. > http://p.sf.net/sfu/splunk-d2d-c2 > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |
From: Leonardo S. <san...@gm...> - 2011-07-05 15:50:59
|
On Tue, Jul 5, 2011 at 12:21 PM, Lawrence Akka <la...@us...> wrote: > 4) Clang: interesting. I have been playing with clang compilation of > PyObjC generally, today. Had a couple of problems with libxml though. Any chance that while rewriting you do a pure python version of pyobjc? pyglet is using a pure python bridge to objective-c because getting pyobjc compiled is a pain. And specially now that pypy can run ctypes faster than python c extensions I would say it is time to think about it. -- Leonardo Santagada |
From: Lawrence A. <la...@us...> - 2011-07-05 15:21:32
|
On Tue, 05 Jul 2011 17:02 +0200, "Ronald Oussoren" <ron...@ma...> wrote: > > On 19 Jun, 2011, at 12:39, Lawrence Akka wrote: > > > I notice that at the end of last year Ronald said he intended to > > move the PyObjC repository from SVN to mercurial, to join py2app and > > friends which have already been transferred. > > > > In an attempt to be helpful and for my own purposes I have > > successfully (I hope) created a copy of the PyObjC SVN repository > > using mercurial at bitbucket: https://bitbucket.org/lakka/pyobjc > > > > All history/branches/tags have been preserved (though some of them > > might usefully be closed off), but please open an issue if you find > > any problems. I would be delighted if Ronald wanted to move/clone > > this into his account! > > > > I hope soon to be able to contribute to the project some work I have > > done reorganising the Sphinx documentation and updating the > > examples. > > Cool, the documentation definitely needs work. I also want to redo > the website, I have to update the scripts to generate the site > anyway because of the move to sphinx and the site design needs some > love as well. > > > I already have a mercurial repository on my machine, but haven't > uploaded that to bitbucket yet. > > BTW. I've started the port to Lion, but that's going slower than I'd > want. I've decided to rewrite my metadata generator using the python > bindings to clang, the current heap of regular expressions barely > works and causes to much problems. From what I've seen so far it > should be fairly easy to using clang.cindex as the parser. > > Ronald > 1) Bitbucket: By all means clone mine and become the 'master' repository if that is easier. I have done some optimisation to shrink the size of the repo, but there remains some work to do to close off unneeded branches etc. Alternatively, once you upload your version, I'll delete my own conversion. 2) Docs: Work has begun! I have reorganized/deduplicated and edited some of what exists at the moment, and started to write additions. At the moment, I am keeping this in a private patch queue, but once the definitive repo has been set up, I will move over to public clone. 3) Sphinx: I have also updated the docs to use the newest Sphinx, and had in mind seeing what I could do to generate the entire website using Sphinx if you would like me to. I would only be able to turn to that after the bulk of the docs have been written, though. 4) Clang: interesting. I have been playing with clang compilation of PyObjC generally, today. Had a couple of problems with libxml though. Lawrence |
From: Ronald O. <ron...@ma...> - 2011-07-05 15:02:50
|
On 19 Jun, 2011, at 12:39, Lawrence Akka wrote: > I notice that at the end of last year Ronald said he intended to move the PyObjC repository from SVN to mercurial, to join py2app and friends which have already been transferred. > > In an attempt to be helpful and for my own purposes I have successfully (I hope) created a copy of the PyObjC SVN repository using mercurial at bitbucket: https://bitbucket.org/lakka/pyobjc > > All history/branches/tags have been preserved (though some of them might usefully be closed off), but please open an issue if you find any problems. I would be delighted if Ronald wanted to move/clone this into his account! > > I hope soon to be able to contribute to the project some work I have done reorganising the Sphinx documentation and updating the examples. Cool, the documentation definitely needs work. I also want to redo the website, I have to update the scripts to generate the site anyway because of the move to sphinx and the site design needs some love as well. I already have a mercurial repository on my machine, but haven't uploaded that to bitbucket yet. BTW. I've started the port to Lion, but that's going slower than I'd want. I've decided to rewrite my metadata generator using the python bindings to clang, the current heap of regular expressions barely works and causes to much problems. From what I've seen so far it should be fairly easy to using clang.cindex as the parser. Ronald |
From: Ronald O. <ron...@ma...> - 2011-07-05 14:43:43
|
On 18 Jun, 2011, at 7:05, Greg Ewing wrote: > Invisible Bob wrote: >> I am on the PyObjC list and got this email, will it work on an >> i-(phone/touch)? > > I have absolutely no idea. Someone will have to try it to find out. It is unlikely that pyobjc will work on iOS because the included copy of libffi doesn't work with the ARM platform used in iOS devices. I also have no intention of supporting iOS at the moment. Ronald |
From: <end...@gm...> - 2011-06-29 22:48:27
|
Hi. I am trying to implement in PyObjC the program available at https://github.com/erica/iphone-3.0-cookbook-/tree/b8ca8905d17015839a0917e1dcd407d055890236/C07-Images/04-Snapping%20Images. Although I am a "beginner" in PyObjC, I spent a couple of days trying to very seriously translate this script to PyObjC and tried my best to find out all errors. However, it doesn't work: the application doesn't execute normally after entering viewDidLoad() - it doesn't change appearance of UI as specified there. I guess it has to do with the fact I am not loading (or using the specification) of the TestBedViewController.xib file, which describes properties of TestBedViewController - I translated only the main.m and did not use by any means the TestBedViewController.xib - I do not know how can I load this file in PyObjC on iOS... Please find the PyObjC code I wrote so far here: http://mobile-revival.110mb.com/ReVival/HelloPython.py . I run my PyObjC scripts on iOS version 3.1.2. PyObjC is version 1946-4, Python is version 2.5.1-5 (obtained with Cydia 1.1.1; and libffi is version 130618-4). Best regards. Alex |
From: Lawrence A. <la...@us...> - 2011-06-29 22:27:22
|
On 29 Jun 2011, at 23:04, Diez B. Roggisch wrote: > > On Jun 29, 2011, at 11:23 PM, Thomas Cool wrote: > >> Hello, >> I'm starting with PyObjC and am having some trouble creating windows >> I am not a beginner at either python or cocoa by the way. >> >> Here is what i am trying (both with macports python 2.6 and builtin python 2.6) on 10.6.8 >> >> from AppKit import * >> a=NSWindow.alloc().init() >> >> simply this returns an error: >> >> Wed Jun 29 16:23:09 TCi7.local python[10060] <Error>: kCGErrorInvalidConnection: CGSGetCurrentCursorLocation: Invalid connection >> Wed Jun 29 16:23:09 TCi7.local python[10060] <Error>: kCGErrorInvalidConnection: CGSNewWindowWithOpaqueShape: Invalid connection >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> objc.error: NSInternalInconsistencyException - Error (1002) creating CGSWindow > > > Let me guess, you just wrote that into a script, and executed it? > > It won't work in Objective-C either, if all you do is just to create a simple executable. > > Instead, you need to create an application bundle, using py2app. Otherwise, the window-server refuses to accept connections. I never really bothered to get to know the gory details, but see e.g. this discussion: > > http://stackoverflow.com/questions/3704629/why-cant-i-use-cocoa-classes-from-my-python-script > > And especially the related tech-note. > > Diez You need to create an application object first. Try something like this. #!/usr/bin/env python # encoding: utf-8 import sys import os # We need to import the relvant object definitions from PyObjC from AppKit import * from PyObjCTools import AppHelper # Cocoa prefers composition to inheritance. The members of an object's # delegate will be called upon the happening of certain events. Once we define # methods with particular names, they will be called automatically class Delegate (NSObject): def applicationDidFinishLaunching_(self, aNotification): '''Called automatically when the application has launched''' print "Hello, World!" def windowWillClose_(self, aNotification): '''Called automatically when the window is closed''' print "Window has been closed" # Terminate the application NSApp().terminate_(self) def main(): # Create a new application instance ... a=NSApplication.sharedApplication() # ... and create its delgate. Note the use of the # Objective C constructors below, because Delegate # is a subcalss of an Objective C class, NSObject delegate = Delegate.alloc().init() # Tell the application which delegate object to use. a.setDelegate_(delegate) # Now we can can start to create the window ... frame = ((200.0, 300.0), (250.0, 100.0)) # (Don't worry about these parameters for the moment. They just specify # the type of window, its size and position etc) w = NSWindow.alloc().initWithContentRect_styleMask_backing_defer_(frame, 15, 2, 0) # ... tell it which delegate object to use (here it happens # to be the same delegate as the application is using)... w.setDelegate_(delegate) # ... and set some properties. Unicode strings are preferred. w.setTitle_(u'Hello, World!') # All set. Now we can show the window ... w.orderFrontRegardless() # ... and start the application AppHelper.runEventLoop() if __name__ == '__main__': main() |
From: Diez B. R. <de...@we...> - 2011-06-29 22:05:07
|
On Jun 29, 2011, at 11:23 PM, Thomas Cool wrote: > Hello, > I'm starting with PyObjC and am having some trouble creating windows > I am not a beginner at either python or cocoa by the way. > > Here is what i am trying (both with macports python 2.6 and builtin python 2.6) on 10.6.8 > > from AppKit import * > a=NSWindow.alloc().init() > > simply this returns an error: > > Wed Jun 29 16:23:09 TCi7.local python[10060] <Error>: kCGErrorInvalidConnection: CGSGetCurrentCursorLocation: Invalid connection > Wed Jun 29 16:23:09 TCi7.local python[10060] <Error>: kCGErrorInvalidConnection: CGSNewWindowWithOpaqueShape: Invalid connection > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > objc.error: NSInternalInconsistencyException - Error (1002) creating CGSWindow Let me guess, you just wrote that into a script, and executed it? It won't work in Objective-C either, if all you do is just to create a simple executable. Instead, you need to create an application bundle, using py2app. Otherwise, the window-server refuses to accept connections. I never really bothered to get to know the gory details, but see e.g. this discussion: http://stackoverflow.com/questions/3704629/why-cant-i-use-cocoa-classes-from-my-python-script And especially the related tech-note. Diez |
From: Thomas C. <tho...@me...> - 2011-06-29 21:24:05
|
Hello, I'm starting with PyObjC and am having some trouble creating windows I am not a beginner at either python or cocoa by the way. Here is what i am trying (both with macports python 2.6 and builtin python 2.6) on 10.6.8 from AppKit import * a=NSWindow.alloc().init() simply this returns an error: Wed Jun 29 16:23:09 TCi7.local python[10060] <Error>: kCGErrorInvalidConnection: CGSGetCurrentCursorLocation: Invalid connection Wed Jun 29 16:23:09 TCi7.local python[10060] <Error>: kCGErrorInvalidConnection: CGSNewWindowWithOpaqueShape: Invalid connection Traceback (most recent call last): File "<stdin>", line 1, in <module> objc.error: NSInternalInconsistencyException - Error (1002) creating CGSWindow Would anyone have any recommendations? T. |
From: Steve W. <sw...@ti...> - 2011-06-27 01:59:44
|
>From: Ronald Oussoren <ronaldoussoren@ma...> - 2010-12-09 09:58 http://sourceforge.net/mailarchive/message.php?msg_id=26725293 >On 8 Dec, 2010, at 18:44, Mark Sienkiewicz wrote: > > > I downloaded pyobjc 2.3 fro http://pypi.python.org/pypi/pyobjc > > error: Could not find required distribution pyobjc-core > >That's odd, pyobjc-core is on pypi and should work just fine. > >Could you try "easy_install pyobjc-core==2.3" followed running >"python setup.py install" for pyobjc itself again? Me too. This fix works fine for me -- especially with your warnings of how many errors to ignore. However I'm on Python 2.6.6, Mac OS 10.6.7, XCode 3.2.5, FWIW. Google "Could not find required distribution pyobjc-core" found a mirror of this mailing list. By the way, the mailing list web interface does everything possible to a) encourage one to sign up multiple times and b) NOT post or reply to the mailing list! So, sorry if this message becomes disconnected from the thread. MacPorts' install of py26-pyobjc @2.3 fails too, only with a seeming success; I've filed a bug with them. Should I file one with you? It does look like an install bug to me. Anything I can do to help diagnose the problem, etc., etc. --Steve |