task install4jCustomiseDS_StoreX64(type: PythonTask) {
inputs.file(install4jDMGDSStore)
outputs.file(install4jDMGFixedDSStoreX64)
- def command_args = [ jalview_customise_ds_store, '--input', install4jDMGDSStore, '--output', install4jDMGFixedDSStoreX64, '--volumename', install4jmacOSArchiveX64Name, '--backgroundfile', install4j_dmg_background_filename, '--dmg', install4jmacOSArchiveX64DMGFilename + ".dmg" ]
+ def command_args = [ jalview_customise_ds_store,
+ '--input', install4jDMGDSStore,
+ '--output', install4jDMGFixedDSStoreX64,
+ '--volumename', install4jmacOSArchiveX64Name,
+ '--backgroundfile', install4j_dmg_background_filename,
+ '--dmg', install4jmacOSArchiveX64DMGFilename + ".dmg",
+ '--appname', "${applicationName}.app",
+ ]
if (file(install4jDMGDSStoreJSON).exists()) {
command_args += [ '--config', install4jDMGDSStoreJSON ]
inputs.file(install4jDMGDSStoreJSON)
task install4jCustomiseDS_StoreAarch64(type: PythonTask) {
inputs.file(install4jDMGDSStore)
outputs.file(install4jDMGFixedDSStoreAarch64)
- def command_args = [ jalview_customise_ds_store, '--input', install4jDMGDSStore, '--output', install4jDMGFixedDSStoreAarch64, '--volumename', install4jmacOSArchiveAarch64Name, '--backgroundfile', install4j_dmg_background_filename, '--dmg', install4jmacOSArchiveAarch64DMGFilename + ".dmg" ]
+ def command_args = [ jalview_customise_ds_store,
+ '--input', install4jDMGDSStore,
+ '--output', install4jDMGFixedDSStoreAarch64,
+ '--volumename', install4jmacOSArchiveAarch64Name,
+ '--backgroundfile', install4j_dmg_background_filename,
+ '--dmg', install4jmacOSArchiveAarch64DMGFilename + ".dmg",
+ '--appname', "${applicationName}.app",
+ ]
if (file(install4jDMGDSStoreJSON).exists()) {
command_args += [ '--config', install4jDMGDSStoreJSON ]
inputs.file(install4jDMGDSStoreJSON)
parser.add_argument("-m", "--dmg", help="The filename of the DMG file", dest="dmg", default="Jalview_macos.dmg")
parser.add_argument("--dump", help="Display contents of the input DS_Store to stdout", action="store_true", dest="dump")
parser.add_argument("-q", "--quiet", help="Don't print messages to stdout", action="store_true", dest="quiet")
-parser.add_argument("-f", "--filenames", help="List of comma-separated filenames to show information for --dump", dest="filenames", default="")
+parser.add_argument("--appname", help="Filename of the application on the DMG (including '.app')", dest="appname")
+parser.add_argument("--appxpos", help="x position of the application icon", dest="appxpos", type=int)
+parser.add_argument("--appypos", help="y position of the application icon", dest="appypos", type=int)
args = parser.parse_args()
if (args.dump):
with ds_store.DSStore.open(args.input, 'r') as d:
- print(f"d=")
- print(pprint.pformat(d['.']['bwsp'], width=1))
-
for key in ["bwsp", "icvp","Iloc"]:
try:
- print(f"d['.']['{key}']=")
- pprint.pprint(str(d['.'][key]), width=1)
+ print(f"d['.']['{key}'] =\n" + pprint.pformat(d['.'][key], width=4))
except:
print(f"No info for d['.']['{key}']")
pprint.pprint(f"d['{data}']="+d[data], width=1)
except:
print(f"No info for d['{data}']")
-# for filename in args.filenames.split(","):
-# if (filename):
-# for f in d.find(filename):
-# myprint(f"d['{f}']=", d[f])
-# else:
-# myprint(f"# No filename '{filename}' found in DS_Store '{args.input}'")
exit(0)
if (args.output and not (args.input or args.config)):
bwsp = {}
for key in "ShowStatusBar SidebarWidthTenElevenOrLater ShowToolbar ShowTabView ContainerShowSidebar WindowBounds ShowSidebar ShowPathbar".split():
- if key in inputds['.']['bwsp']:
- bwsp[key] = inputds['.']['bwsp'][key]
- myprint(f"Setting bwsp['{key}'] to '"+str(inputds['.']['bwsp'][key])+"'")
+ if config and 'bwsp' in config and key in config['bwsp']:
+ bwsp[key] = config['bwsp'][key]
+ myprint(f"Setting bwsp['{key}'] to '"+str(bwsp[key])+"' from config")
else:
- myprint(f"Did not find '{key}' in input bwsp")
+ if key in inputds['.']['bwsp']:
+ bwsp[key] = inputds['.']['bwsp'][key]
+ myprint(f"Setting bwsp['{key}'] to '"+str(bwsp[key])+"' from input DS_Store")
+ else:
+ myprint(f"Did not find '{key}' in input bwsp")
outputds['.']['bwsp'] = bwsp
alias.target.posix_path = f'/{args.backgrounddir}/{args.backgroundfile}'
icvp['backgroundImageAlias'] = alias.to_bytes()
+myprint(f"Setting icvp['backgroundImageAlias']")
for key in "backgroundColorRed backgroundColorBlue backgroundColorGreen gridSpacing gridOffsetX gridOffsetY showItemInfo viewOptionsVersion arrangeBy textSize labelOnBottom backgroundType showIconPreview iconSize".split():
- if key in inputds['.']['icvp']:
- icvp[key] = inputds['.']['icvp'][key]
- myprint(f"Setting icvp['{key}'] to '"+str(inputds['.']['icvp'][key])+"'")
+ if config and 'icvp' in config and key in config['icvp']:
+ icvp[key] = config['icvp'][key]
+ myprint(f"Setting icvp['{key}'] to '"+str(icvp[key])+"' from config")
else:
- myprint(f"Did not find '{key}' in input icvp")
+ if key in inputds['.']['icvp']:
+ icvp[key] = inputds['.']['icvp'][key]
+ myprint(f"Setting icvp['{key}'] to '"+str(icvp[key])+"' from input DS_Store")
+ else:
+ myprint(f"Did not find '{key}' in input icvp")
outputds['.']['icvp'] = icvp
-
-# copy filenames properties? not working, using JSON config file
-#for filename in args.filenames.split(","):
-# outputds[filename]['Iloc'] = inputds[filename]['Iloc']
-
outputds['.']['vSrn'] = ('long', 1)
if config:
outputds[fileinfo['name']]['Iloc'] = (fileinfo['xpos'], fileinfo['ypos'])
myprint("Setting icon location for filename '" + fileinfo['name'] + "' to ( " + str(fileinfo['xpos']) + ", " + str(fileinfo['ypos']) + " )")
+if args.appname:
+
+ xpos = args.appxpos
+ if (not xpos) and 'app' in config and 'xpos' in config['app']:
+ xpos = config['app']['xpos']
+
+ ypos = args.appypos
+ if (not ypos) and 'app' in config and 'ypos' in config['app']:
+ ypos = config['app']['ypos']
+
+ if xpos != None and ypos != None:
+ outputds[args.appname]['Iloc'] = (xpos, ypos)
+ myprint("Setting icon location for filename '" + args.appname + "' to ( " + str(xpos) + ", " + str(ypos) + " )")
+
outputds.flush()
outputds.close()
inputds.close()