Re: Event loop in a secondary thread? Nibless Cocoa?
Re: Event loop in a secondary thread? Nibless Cocoa?
- Subject: Re: Event loop in a secondary thread? Nibless Cocoa?
- From: Bruce Sherwood <email@hidden>
- Date: Sat, 03 May 2008 23:13:39 -0400
Thanks! I'm really glad to hear that this is a known problem, and that
there are solutions, even if it is "pretty tricky stuff". Can you or
someone else point me to a sample piece of code that could get me started?
Indeed, the nib file (if there is one) would be right next to the Visual
module (in site-packages/visual). But initial reading of documentation,
or at least of examples, made it look like you say something like
"LoadNib", with no option to say where to get it, because the assumption
is that the nib file is in a standard place in the app's bundle. Is
there some kind of nib-loading procedure that takes a file location as
an argument? I don't have anything against nib files in principle; I
just don't know how to find them when my software isn't an app.
Bruce Sherwood
Jens Alfke wrote:
On 3 May '08, at 4:35 PM, Bruce Sherwood wrote:
Visual, which is written in multithreaded C++, can be imported
dynamically at any time in a Python program. Visual then has to start
up an event loop to make a window and process events.
Oh boy, this is a flashback. You've got the exact same issues we had
when we brought up Java on OS X back in 2000. The process starts out
GUI-less (just an invocation of /usr/bin/python, in your case) and has
to acquire a windowserver connection, event loop, menus, all that stuff.
This is pretty tricky stuff, or it was back then, and we had the
advantage of being able to use or create private APIs. But more of that
stuff might be public now. (Wasn't there some discussion on this list
recently of upgrading a command-line process to a GUI?)
IIRC, you don't have to start the event loop on the process's main
thread, but whatever thread you create the WindowServer connection on
becomes the de facto GUI thread, on which the main event loop will run.
I don't see any problem with loading nibs. You just have to find them —
presumably you'd put them next to wherever you put your code.
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden