add image; iterate through all mozilla tools
This commit is contained in:
parent
afe34ff575
commit
46ec3f1d00
|
|
@ -32,10 +32,13 @@ parser.add_option('-l', '--license', dest = 'license',
|
|||
parser.add_option('-w', '--website', dest = 'website',
|
||||
help = 'The product website',
|
||||
default = 'http://www.panda3d.org')
|
||||
parser.add_option('', '--start', dest = 'start',
|
||||
help = 'Specify this option to add a start menu',
|
||||
action = 'store_false', default = False)
|
||||
parser.add_option('', '--nsis', dest = 'nsis',
|
||||
help = 'The directory containing NSIS',
|
||||
default = None)
|
||||
parser.add_option('', '--welcome_bitmap', dest = 'welcome_bitmap',
|
||||
parser.add_option('', '--welcome_image', dest = 'welcome_image',
|
||||
help = 'The image to display on the installer',
|
||||
default = None)
|
||||
parser.add_option('', '--install_icon', dest = 'install_icon',
|
||||
|
|
@ -75,14 +78,14 @@ if not options.nsis or not options.license:
|
|||
if not options.license:
|
||||
options.license = os.path.join(PANDA, 'LICENSE')
|
||||
|
||||
## if not options.welcome_bitmap:
|
||||
## filename = Filename('plugin_images/download.jpg')
|
||||
## found = filename.resolveFilename(getModelPath().getValue())
|
||||
## if not found:
|
||||
## found = filename.resolveFilename("models")
|
||||
## if not found:
|
||||
## sys.exit("Couldn't find download.jpg for welcome_bitmap.")
|
||||
## options.welcome_bitmap = filename.toOsSpecific()
|
||||
if not options.welcome_image:
|
||||
filename = Filename('plugin_images/download.jpg')
|
||||
found = filename.resolveFilename(getModelPath().getValue())
|
||||
if not found:
|
||||
found = filename.resolveFilename("models")
|
||||
if not found:
|
||||
sys.exit("Couldn't find download.jpg for welcome_image.")
|
||||
options.welcome_image = filename
|
||||
|
||||
def parseDependenciesWindows(tempFile):
|
||||
""" Reads the indicated temporary file, the output from
|
||||
|
|
@ -172,6 +175,33 @@ def makeInstaller():
|
|||
pluginDependencies[file].append(dfile)
|
||||
dependentFiles[dfile] = pathname.toOsSpecific()
|
||||
|
||||
welcomeBitmap = None
|
||||
if options.welcome_image:
|
||||
# Convert the image from its current format to a bmp file, for NSIS.
|
||||
p = PNMImage()
|
||||
if not p.read(options.welcome_image):
|
||||
sys.exit("Couldn't read %s" % (options.welcome_image))
|
||||
|
||||
# We also must scale it to fit within 170x312, the space
|
||||
# allotted within the installer window.
|
||||
size = (170, 312)
|
||||
xscale = float(size[0]) / p.getXSize()
|
||||
yscale = float(size[1]) / p.getYSize()
|
||||
scale = min(xscale, yscale, 1)
|
||||
resized = PNMImage((int)(scale * p.getXSize() + 0.5),
|
||||
(int)(scale * p.getYSize() + 0.5))
|
||||
resized.quickFilterFrom(p)
|
||||
|
||||
# Now center it within the full window.
|
||||
result = PNMImage(size[0], size[1])
|
||||
result.fill(1, 1, 1)
|
||||
xc = (size[0] - resized.getXSize()) / 2
|
||||
yc = (size[1] - resized.getYSize()) / 2
|
||||
result.copySubImage(resized, xc, yc)
|
||||
|
||||
welcomeBitmap = Filename.temporary('', 'p3d_', '.bmp')
|
||||
result.write(welcomeBitmap)
|
||||
|
||||
# Now build the NSIS command.
|
||||
CMD = "\"" + options.nsis + "\\makensis.exe\" /V3 "
|
||||
CMD += '/DPRODUCT_NAME="' + options.long_name + '" '
|
||||
|
|
@ -194,10 +224,13 @@ def makeInstaller():
|
|||
dependencies = pluginDependencies[npapi]
|
||||
for i in range(len(dependencies)):
|
||||
CMD += '/DNPAPI_DEP%s="%s" ' % (i, dependencies[i])
|
||||
|
||||
if options.start:
|
||||
CMD += '/DADD_START_MENU '
|
||||
|
||||
if options.welcome_bitmap:
|
||||
CMD += '/DMUI_WELCOMEFINISHPAGE_BITMAP="' + options.welcome_bitmap + '" '
|
||||
CMD += '/DMUI_UNWELCOMEFINISHPAGE_BITMAP="' + options.welcome_bitmap + '" '
|
||||
if welcomeBitmap:
|
||||
CMD += '/DMUI_WELCOMEFINISHPAGE_BITMAP="' + welcomeBitmap.toOsSpecific() + '" '
|
||||
CMD += '/DMUI_UNWELCOMEFINISHPAGE_BITMAP="' + welcomeBitmap.toOsSpecific() + '" '
|
||||
if options.install_icon:
|
||||
CMD += '/DINSTALL_ICON="' + options.install_icon + '" '
|
||||
|
||||
|
|
@ -208,4 +241,7 @@ def makeInstaller():
|
|||
print "packing..."
|
||||
subprocess.call(CMD)
|
||||
|
||||
if welcomeBitmap:
|
||||
welcomeBitmap.unlink()
|
||||
|
||||
makeInstaller()
|
||||
|
|
|
|||
|
|
@ -74,6 +74,8 @@ Section "MainSection" SEC01
|
|||
File "${NPAPI_PATH}"
|
||||
File "${PANDA3D_PATH}"
|
||||
|
||||
; Auto-detected dependencies on the above executables. Python
|
||||
; computes these values for us.
|
||||
!ifdef DEP0P
|
||||
File "${DEP0P}"
|
||||
!endif
|
||||
|
|
@ -90,9 +92,11 @@ Section "MainSection" SEC01
|
|||
File "${DEP4P}"
|
||||
!endif
|
||||
|
||||
!ifdef ADD_START_MENU
|
||||
; Start->Programs links
|
||||
CreateDirectory "$SMPROGRAMS\${PROG_GROUPNAME}"
|
||||
; CreateShortCut "$SMPROGRAMS\${PROG_GROUPNAME}\${PRODUCT_NAME_SHORT}.lnk" "$INSTDIR\${LAUNCHER}"
|
||||
!endif
|
||||
|
||||
; Desktop Icon...commented out for now
|
||||
; CreateShortCut "$DESKTOP\${PRODUCT_NAME_SHORT}.lnk" "$INSTDIR\${OCX}"
|
||||
|
|
@ -105,8 +109,10 @@ SectionEnd
|
|||
|
||||
Section -AdditionalIcons
|
||||
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
|
||||
!ifdef ADD_START_MENU
|
||||
CreateShortCut "$SMPROGRAMS\${PROG_GROUPNAME}\${WEBSITE_LINK_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
|
||||
CreateShortCut "$SMPROGRAMS\${PROG_GROUPNAME}\${UNINSTALL_LINK_NAME}.lnk" "$INSTDIR\uninst.exe"
|
||||
!endif
|
||||
SectionEnd
|
||||
|
||||
Section -Post
|
||||
|
|
@ -135,26 +141,38 @@ Function .onInstSuccess
|
|||
# Register ActiveX
|
||||
ExecWait 'regsvr32 /s "$INSTDIR/${OCX}"'
|
||||
|
||||
# Install Firefox Plugin
|
||||
ReadRegStr $0 HKLM "${FIREFOX_DIR_REGKEY}" Path
|
||||
${If} $0 != ""
|
||||
CopyFiles $INSTDIR\${NPAPI} $0\plugins
|
||||
# Install Mozilla Plugin
|
||||
|
||||
StrCpy $1 "0"
|
||||
Mozilla-Install-Loop:
|
||||
EnumRegKey $0 HKLM "SOFTWARE\Mozilla" "$1"
|
||||
StrCmp $0 "" Mozilla-Install-End
|
||||
IntOp $1 $1 + 1
|
||||
ReadRegStr $2 HKLM "SOFTWARE\Mozilla\$0\Extensions" "Plugins"
|
||||
${If} $2 != ""
|
||||
CreateDirectory "$2"
|
||||
CopyFiles $INSTDIR\${NPAPI} "$2"
|
||||
!ifdef NPAPI_DEP0
|
||||
CopyFiles $INSTDIR\${NPAPI_DEP0} $0\plugins
|
||||
CopyFiles $INSTDIR\${NPAPI_DEP0} "$2"
|
||||
!endif
|
||||
!ifdef NPAPI_DEP1
|
||||
CopyFiles $INSTDIR\${NPAPI_DEP1} $0\plugins
|
||||
CopyFiles $INSTDIR\${NPAPI_DEP1} "$2"
|
||||
!endif
|
||||
!ifdef NPAPI_DEP2
|
||||
CopyFiles $INSTDIR\${NPAPI_DEP2} $0\plugins
|
||||
CopyFiles $INSTDIR\${NPAPI_DEP2} "$2"
|
||||
!endif
|
||||
!ifdef NPAPI_DEP3
|
||||
CopyFiles $INSTDIR\${NPAPI_DEP3} $0\plugins
|
||||
CopyFiles $INSTDIR\${NPAPI_DEP3} "$2"
|
||||
!endif
|
||||
!ifdef NPAPI_DEP4
|
||||
CopyFiles $INSTDIR\${NPAPI_DEP4} $0\plugins
|
||||
CopyFiles $INSTDIR\${NPAPI_DEP4} "$2"
|
||||
!endif
|
||||
${EndIf}
|
||||
|
||||
goto Mozilla-Install-Loop
|
||||
|
||||
Mozilla-Install-End:
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Section Uninstall
|
||||
|
|
@ -181,26 +199,39 @@ Section Uninstall
|
|||
Delete "$INSTDIR\${DEP4}"
|
||||
!endif
|
||||
|
||||
ReadRegStr $0 HKLM "${FIREFOX_DIR_REGKEY}" Path
|
||||
${If} $0 != ""
|
||||
Delete "$0\plugins\${NPAPI}"
|
||||
${EndIf}
|
||||
StrCpy $1 "0"
|
||||
Mozilla-Uninstall-Loop:
|
||||
EnumRegKey $0 HKLM "SOFTWARE\Mozilla" "$1"
|
||||
StrCmp $0 "" Mozilla-Uninstall-End
|
||||
IntOp $1 $1 + 1
|
||||
ReadRegStr $2 HKLM "SOFTWARE\Mozilla\$0\Extensions" "Plugins"
|
||||
${If} $2 != ""
|
||||
Delete "$2\${NPAPI}"
|
||||
# We can't delete the dependency files, because who knows--maybe
|
||||
# some other plugins are also using the same files.
|
||||
${EndIf}
|
||||
goto Mozilla-Uninstall-Loop
|
||||
Mozilla-Uninstall-End:
|
||||
|
||||
ReadRegDWORD $0 HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System EnableLUA
|
||||
${If} $0 != ""
|
||||
RmDir /r "$LOCALAPPDATALow\${APP_INTERNAL_NAME}"
|
||||
${Else}
|
||||
RmDir /r "$LOCALAPPDATA\${APP_INTERNAL_NAME}"
|
||||
${Endif}
|
||||
|
||||
# Remove the user's "Panda3D" directory, where all of the downloaded
|
||||
# contents are installed. Too bad we can't do this for every system
|
||||
# user, not just the current user.
|
||||
|
||||
RmDir /r "$LOCALAPPDATA\Low\${APP_INTERNAL_NAME}"
|
||||
RmDir /r "$LOCALAPPDATA\${APP_INTERNAL_NAME}"
|
||||
|
||||
Delete "$INSTDIR\uninst.exe"
|
||||
Delete "$INSTDIR\${PRODUCT_NAME}.url"
|
||||
|
||||
!ifdef ADD_START_MENU
|
||||
Delete "$SMPROGRAMS\${PROG_GROUPNAME}\${UNINSTALL_LINK_NAME}.lnk"
|
||||
Delete "$SMPROGRAMS\${PROG_GROUPNAME}\${WEBSITE_LINK_NAME}.lnk"
|
||||
; Delete "$DESKTOP\${PRODUCT_NAME_SHORT}${PRODUCT_RELEASE}.lnk"
|
||||
; Delete "$SMPROGRAMS\${PROG_GROUPNAME}\${PRODUCT_NAME_SHORT}.lnk"
|
||||
RMDir "$SMPROGRAMS\${PROG_GROUPNAME}"
|
||||
!endif
|
||||
|
||||
RMDir "$INSTDIR"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue