fix problems with wx

This commit is contained in:
David Rose 2009-09-24 14:46:07 +00:00
parent 87ba6c1597
commit 32ceb7e638
4 changed files with 26 additions and 11 deletions

View File

@ -37,11 +37,9 @@ Options:
all be combined in the first file. If the private key is
encrypted, the password will be required to decrypt it.
-A
Sets the auto-start flag in the application, so that the user
will not need to click the green play button before it starts,
when embedded in a web page. This can also be set on the HTML
page.
-c config=value
Sets the indicated config flag in the application. This option
may be repeated as necessary.
-r package
Names an additional package that this application requires at
@ -78,14 +76,14 @@ class ArgumentError(StandardError):
pass
def makePackedApp(args):
opts, args = getopt.getopt(args, 'd:m:S:Ar:s:Dh')
opts, args = getopt.getopt(args, 'd:m:S:c:r:s:Dh')
packager = Packager.Packager()
root = Filename('.')
main = None
signParams = []
autoStart = False
configFlags = []
requires = []
allowPythonDev = False
@ -96,8 +94,8 @@ def makePackedApp(args):
main = value
elif option == '-S':
signParams.append(value)
elif option == '-A':
autoStart = True
elif option == '-c':
configFlags.append(value.split('=', 1))
elif option == '-r':
requires.append(value)
elif option == '-s':
@ -155,8 +153,8 @@ def makePackedApp(args):
name, version, host = tokens
packager.do_require(name, version = version, host = host)
if autoStart:
packager.do_config(auto_start = True)
if configFlags:
packager.do_config(**dict(configFlags))
packager.do_dir(root)
packager.do_mainModule(mainModule)

View File

@ -163,6 +163,7 @@
// If you have to link with a static Python library, define it here.
#define EXTRA_LIBS $[EXTRA_P3DPYTHON_LIBS]
#define OSX_SYS_FRAMEWORKS Carbon
#define WIN_SYS_LIBS user32.lib
#end bin_target

View File

@ -18,6 +18,11 @@
#include <sstream>
#include <string.h> // strrchr
using namespace std;
#ifdef __APPLE__
#include <Carbon/Carbon.h>
extern "C" { void CPSEnableForegroundOperation(ProcessSerialNumber* psn); }
#endif
////////////////////////////////////////////////////////////////////
// Function: main
@ -80,6 +85,16 @@ main(int argc, char *argv[]) {
}
}
#ifdef __APPLE__
// In case the application is going to run a wx app, allow it to
// have access to the desktop.
ProcessSerialNumber psn;
GetCurrentProcess(&psn);
CPSEnableForegroundOperation(&psn);
SetFrontProcess(&psn);
#endif
if (!run_p3dpython(program_name, archive_file, input_handle, output_handle,
NULL, interactive_console)) {
cerr << "Failure on startup.\n";

View File

@ -975,6 +975,7 @@ class Freezer:
# It's actually a package. In this case, we really write
# the file moduleName/__init__.py.
filename += '/__init__'
moduleDirs[moduleName] = True
# Ensure we don't have an implicit filename from above.
multifile.removeSubfile(filename + '.py')