On Mon, 2011-05-16 at 19:03 +0200, Martin Zibricky wrote:
> Devon Rueckner píše v Po 16. 05. 2011 v 14:47 +0000:
> >  * the latest trunk outputs the correct plist (though LSBackgroundOnly
> > still needs to be made False).
> 
> Could anyone please explain me why LSBackgroundOnly is set to True and
> why it needs to be False?

PyInstaller creates two processes: the first one (parent) decompressed
the single-file executable in a temporary directory, then it respawns
itself (child) to actually run the program; the parent waits until the
child exits, and then remove the temporary directory (to cleanup after
itself).

On MacOSX, if we set LSBackgroundOnly=True (default for GUI
applications), we obtain a double icon in the dock bar, because Mac OSX
thinks there are two different applications running at the same time.

If we set it to False (default for console/daemon applications), there
is absolutely no icon in the dockbar because the system believes it is a
daemon-kind application. Moreover, there are other collateral damages
(eg: wxPython applications don't event start, IIRC).

So the solution Lorenzo found out was to set LSBackgroundOnly=False in
the manifest, and later execute this code within the child process (in
the bootloader):

#if defined(__APPLE__) && defined(WINDOWED)
        ProcessSerialNumber psn = { 0, kCurrentProcess };
        OSStatus returnCode = TransformProcessType(&psn, 
kProcessTransformToForegroundApplication);
#endif

this way, the child process is changed into a foreground application,
and the dock icon appears again (just one of them, since the parent will
still be a background application).

Hope this clarifies the matter.
-- 
Giovanni Bajo   ::  [email protected]
Develer S.r.l.  ::  http://www.develer.com

My Blog: http://giovanni.bajo.it
Last post: Compile-time Function Execution in D

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyinstaller?hl=en.

Reply via email to