David Rose před 13 roky
rodič
revize
74a20d0305
2 změnil soubory, kde provedl 40 přidání a 19 odebrání
  1. 28 18
      direct/src/p3d/DeploymentTools.py
  2. 12 1
      direct/src/p3d/pdeploy.py

+ 28 - 18
direct/src/p3d/DeploymentTools.py

@@ -450,6 +450,8 @@ class Installer:
         self.fullname = fullname
         self.fullname = fullname
         self.version = str(version)
         self.version = str(version)
         self.includeRequires = False
         self.includeRequires = False
+        self.offerRun = True
+        self.offerDesktopShortcut = True
         self.licensename = ""
         self.licensename = ""
         self.licensefile = Filename()
         self.licensefile = Filename()
         self.authorid = "org.panda3d"
         self.authorid = "org.panda3d"
@@ -1091,26 +1093,34 @@ class Installer:
 
 
         # Tell Vista that we require admin rights
         # Tell Vista that we require admin rights
         print >>nsi, 'RequestExecutionLevel admin'
         print >>nsi, 'RequestExecutionLevel admin'
-        print >>nsi
-        print >>nsi, 'Function launch'
-        print >>nsi, '  ExecShell "open" "$INSTDIR\\%s.exe"' % self.shortname
-        print >>nsi, 'FunctionEnd'
-        print >>nsi
-        print >>nsi, 'Function desktopshortcut'
-        if icofile is None:
-            print >>nsi, '  CreateShortcut "$DESKTOP\\%s.lnk" "$INSTDIR\\%s.exe"' % (self.fullname, self.shortname)
-        else:
-            print >>nsi, '  CreateShortcut "$DESKTOP\\%s.lnk" "$INSTDIR\\%s.exe" "" "$INSTDIR\\%s.ico"' % (self.fullname, self.shortname, self.shortname)
-        print >>nsi, 'FunctionEnd'
-        print >>nsi
+        print >>nsi 
+        if self.offerRun:
+            print >>nsi, 'Function launch'
+            print >>nsi, '  ExecShell "open" "$INSTDIR\\%s.exe"' % self.shortname
+            print >>nsi, 'FunctionEnd'
+            print >>nsi
+
+        if self.offerDesktopShortcut:
+            print >>nsi, 'Function desktopshortcut'
+            if icofile is None:
+                print >>nsi, '  CreateShortcut "$DESKTOP\\%s.lnk" "$INSTDIR\\%s.exe"' % (self.fullname, self.shortname)
+            else:
+                print >>nsi, '  CreateShortcut "$DESKTOP\\%s.lnk" "$INSTDIR\\%s.exe" "" "$INSTDIR\\%s.ico"' % (self.fullname, self.shortname, self.shortname)
+            print >>nsi, 'FunctionEnd'
+            print >>nsi
+            
         print >>nsi, '!include "MUI2.nsh"'
         print >>nsi, '!include "MUI2.nsh"'
         print >>nsi, '!define MUI_ABORTWARNING'
         print >>nsi, '!define MUI_ABORTWARNING'
-        print >>nsi, '!define MUI_FINISHPAGE_RUN'
-        print >>nsi, '!define MUI_FINISHPAGE_RUN_FUNCTION launch'
-        print >>nsi, '!define MUI_FINISHPAGE_RUN_TEXT "Run %s"' % self.fullname
-        print >>nsi, '!define MUI_FINISHPAGE_SHOWREADME ""'
-        print >>nsi, '!define MUI_FINISHPAGE_SHOWREADME_TEXT "Create Desktop Shortcut"'
-        print >>nsi, '!define MUI_FINISHPAGE_SHOWREADME_FUNCTION desktopshortcut'
+        if self.offerRun:
+            print >>nsi, '!define MUI_FINISHPAGE_RUN'
+            print >>nsi, '!define MUI_FINISHPAGE_RUN_NOTCHECKED'
+            print >>nsi, '!define MUI_FINISHPAGE_RUN_FUNCTION launch'
+            print >>nsi, '!define MUI_FINISHPAGE_RUN_TEXT "Run %s"' % self.fullname
+        if self.offerDesktopShortcut:
+            print >>nsi, '!define MUI_FINISHPAGE_SHOWREADME ""'
+            print >>nsi, '!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED'
+            print >>nsi, '!define MUI_FINISHPAGE_SHOWREADME_TEXT "Create Desktop Shortcut"'
+            print >>nsi, '!define MUI_FINISHPAGE_SHOWREADME_FUNCTION desktopshortcut'
         print >>nsi
         print >>nsi
         print >>nsi, 'Var StartMenuFolder'
         print >>nsi, 'Var StartMenuFolder'
         print >>nsi, '!insertmacro MUI_PAGE_WELCOME'
         print >>nsi, '!insertmacro MUI_PAGE_WELCOME'

+ 12 - 1
direct/src/p3d/pdeploy.py

@@ -102,6 +102,11 @@ Options:
      is licensed under.
      is licensed under.
      Only relevant when generating a graphical installer.
      Only relevant when generating a graphical installer.
 
 
+  -O 
+     Specify this option when generating a graphical installer to omit
+     the default checkboxes for "run this program" and "install a
+     desktop shortcut" on completion.
+
   -a com.your_company
   -a com.your_company
      Short identifier of the author of the application. The default
      Short identifier of the author of the application. The default
      is "org.panda3d", but you will most likely want to change
      is "org.panda3d", but you will most likely want to change
@@ -164,9 +169,10 @@ authorname = ""
 authoremail = ""
 authoremail = ""
 iconFiles = []
 iconFiles = []
 includeRequires = False
 includeRequires = False
+omitDefaultCheckboxes = False
 
 
 try:
 try:
-    opts, args = getopt.getopt(sys.argv[1:], 'n:N:v:o:t:P:csl:L:a:A:e:i:h')
+    opts, args = getopt.getopt(sys.argv[1:], 'n:N:v:o:t:P:csOl:L:a:A:e:i:h')
 except getopt.error, msg:
 except getopt.error, msg:
     usage(1, msg or 'Invalid option')
     usage(1, msg or 'Invalid option')
 
 
@@ -188,6 +194,8 @@ for opt, arg in opts:
         currentPlatform = True
         currentPlatform = True
     elif opt == '-s':
     elif opt == '-s':
         includeRequires = True
         includeRequires = True
+    elif opt == '-O':
+        omitDefaultCheckboxes = True
     elif opt == '-l':
     elif opt == '-l':
         licensename = arg.strip()
         licensename = arg.strip()
     elif opt == '-L':
     elif opt == '-L':
@@ -267,6 +275,9 @@ elif deploy_mode == 'installer':
         tokens["verify_contents"] = "never"
         tokens["verify_contents"] = "never"
     i = Installer(appFilename, shortname, fullname, version, tokens = tokens)
     i = Installer(appFilename, shortname, fullname, version, tokens = tokens)
     i.includeRequires = includeRequires
     i.includeRequires = includeRequires
+    if omitDefaultCheckboxes:
+        i.offerRun = False
+        i.offerDesktopShortcut = False
     i.licensename = licensename
     i.licensename = licensename
     i.licensefile = licensefile
     i.licensefile = licensefile
     if authorid:
     if authorid: