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

View File

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

View File

@ -18,6 +18,11 @@
#include <sstream> #include <sstream>
#include <string.h> // strrchr #include <string.h> // strrchr
using namespace std; using namespace std;
#ifdef __APPLE__
#include <Carbon/Carbon.h>
extern "C" { void CPSEnableForegroundOperation(ProcessSerialNumber* psn); }
#endif
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: main // 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, if (!run_p3dpython(program_name, archive_file, input_handle, output_handle,
NULL, interactive_console)) { NULL, interactive_console)) {
cerr << "Failure on startup.\n"; cerr << "Failure on startup.\n";

View File

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