FROM : Uliano Guerrini
DATE : Wed Nov 07 09:46:29 2007
Il giorno 07/nov/07, alle ore 08:58, Bill Bumgarner ha scritto:
> On Nov 6, 2007, at 11:49 PM, Uliano Guerrini wrote:
>> with every Xcode project template involving Python it is enough to
>> add an
>>
>> import Quartz
>>
>> to any python file to hang the application with the icon jumping in
>> the dock.
>> From logs on the console it seems that the application isn't able
>> to connect to the window server
> .... error messages deleted ....
>
> Python's "import" works quite a bit differently than Objective-C's
> #import. Namely, it will execute any code found in the imported
> modules that appears within the module's scope.
>
> The Quartz module requires a viable window server connection to be
> set up. If you import Quartz in main.py or at the top level of your
> application delegate source file (or anywhere that is imported as a
> part of the app launching process prior to control being passed to
> the appkit), it'll blow up as you have seen.
>
> Instead, import Quartz in response to application initialization.
> I dropped "import Quartz" into the standard Cocoa Python
> Application's applicationDidFinishLaunching_() method and it no
> longer bombs (I didn't test much further than that):
>
> class FoobarAppDelegate(NSObject):
> def applicationDidFinishLaunching_(self, sender):
> import Quartz
> NSLog("Application did finish launching.")
>
> b.bum
the problem arises when you want to use Quartz "somewhere" to do
something useful and this "somewhere" is likely to be some subclass of
NSView (or some file imported in that subclass), well, if I'm not
wrong, that subclass in order to work should be imported in the
main.py file before
AppHelper.runEventLoop()
which is the call that fires up the window server
anyway, py2app without aliasing works, in pyobjc-dev they say that
they'll find to fix what to them seems a problem to be fixed
DATE : Wed Nov 07 09:46:29 2007
Il giorno 07/nov/07, alle ore 08:58, Bill Bumgarner ha scritto:
> On Nov 6, 2007, at 11:49 PM, Uliano Guerrini wrote:
>> with every Xcode project template involving Python it is enough to
>> add an
>>
>> import Quartz
>>
>> to any python file to hang the application with the icon jumping in
>> the dock.
>> From logs on the console it seems that the application isn't able
>> to connect to the window server
> .... error messages deleted ....
>
> Python's "import" works quite a bit differently than Objective-C's
> #import. Namely, it will execute any code found in the imported
> modules that appears within the module's scope.
>
> The Quartz module requires a viable window server connection to be
> set up. If you import Quartz in main.py or at the top level of your
> application delegate source file (or anywhere that is imported as a
> part of the app launching process prior to control being passed to
> the appkit), it'll blow up as you have seen.
>
> Instead, import Quartz in response to application initialization.
> I dropped "import Quartz" into the standard Cocoa Python
> Application's applicationDidFinishLaunching_() method and it no
> longer bombs (I didn't test much further than that):
>
> class FoobarAppDelegate(NSObject):
> def applicationDidFinishLaunching_(self, sender):
> import Quartz
> NSLog("Application did finish launching.")
>
> b.bum
the problem arises when you want to use Quartz "somewhere" to do
something useful and this "somewhere" is likely to be some subclass of
NSView (or some file imported in that subclass), well, if I'm not
wrong, that subclass in order to work should be imported in the
main.py file before
AppHelper.runEventLoop()
which is the call that fires up the window server
anyway, py2app without aliasing works, in pyobjc-dev they say that
they'll find to fix what to them seems a problem to be fixed
| Related mails | Author | Date |
|---|---|---|
| Uliano Guerrini | Nov 7, 08:49 | |
| Bill Bumgarner | Nov 7, 08:58 | |
| Uliano Guerrini | Nov 7, 09:46 | |
| Bill Bumgarner | Nov 7, 09:57 | |
| Uliano Guerrini | Nov 7, 10:41 | |
| Bill Bumgarner | Nov 7, 17:48 | |
| Uliano Guerrini | Nov 7, 18:04 | |
| Bill Bumgarner | Nov 7, 18:46 | |
| Luc Heinrich | Nov 8, 09:32 | |
| Uliano Guerrini | Nov 8, 13:00 | |
| Luc Heinrich | Nov 8, 14:10 | |
| Uliano Guerrini | Nov 8, 14:41 |






Cocoa mail archive

