Browse Source

fix problems with wx

David Rose 16 years ago
parent
commit
32ceb7e638

+ 9 - 11
direct/src/p3d/packp3d.py

@@ -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
-     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
   -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':
-            autoStart = True
+        elif option == '-c':
+            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:
-            packager.do_config(auto_start = True)
+        if configFlags:
+            packager.do_config(**dict(configFlags))
 
 
         packager.do_dir(root)
         packager.do_dir(root)
         packager.do_mainModule(mainModule)
         packager.do_mainModule(mainModule)

+ 1 - 0
direct/src/plugin/Sources.pp

@@ -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

+ 15 - 0
direct/src/plugin/p3dPythonMain.cxx

@@ -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";

+ 1 - 0
direct/src/showutil/FreezeTool.py

@@ -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')