JAL-4421 Allow JSON config file to be options (no icon positioning for default or...
[jalview.git] / utils / macos_dmg / jalview_customise_dsstore.py
index f5f559f..27d68f9 100755 (executable)
@@ -94,8 +94,11 @@ outputds = ds_store.DSStore.open(args.output, 'w+')
 bwsp = {}
 
 for key in "ShowStatusBar SidebarWidthTenElevenOrLater ShowToolbar ShowTabView ContainerShowSidebar WindowBounds ShowSidebar ShowPathbar".split():
-  bwsp[key] = inputds['.']['bwsp'][key]
-  myprint(f"Setting bwsp['{key}'] to '"+str(inputds['.']['bwsp'][key])+"'")
+  if key in inputds['.']['bwsp']:
+    bwsp[key] = inputds['.']['bwsp'][key]
+    myprint(f"Setting bwsp['{key}'] to '"+str(inputds['.']['bwsp'][key])+"'")
+  else:
+    myprint(f"Did not find '{key}' in input bwsp")
 
 outputds['.']['bwsp'] = bwsp
 
@@ -122,8 +125,11 @@ alias.target.posix_path = f'/{args.backgrounddir}/{args.backgroundfile}'
 icvp['backgroundImageAlias'] = alias.to_bytes()
 
 for key in "backgroundColorRed backgroundColorBlue backgroundColorGreen gridSpacing gridOffsetX gridOffsetY showItemInfo viewOptionsVersion arrangeBy textSize labelOnBottom backgroundType showIconPreview iconSize".split():
-  icvp[key] = inputds['.']['icvp'][key]
-  myprint(f"Setting icvp['{key}'] to '"+str(inputds['.']['icvp'][key])+"'")
+  if key in inputds['.']['icvp']:
+    icvp[key] = inputds['.']['icvp'][key]
+    myprint(f"Setting icvp['{key}'] to '"+str(inputds['.']['icvp'][key])+"'")
+  else:
+    myprint(f"Did not find '{key}' in input icvp")
 
 outputds['.']['icvp'] = icvp
 
@@ -136,6 +142,7 @@ outputds['.']['vSrn'] = ('long', 1)
 if config:
   for fileinfo in config['files']:
     outputds[fileinfo['name']]['Iloc'] = (fileinfo['xpos'], fileinfo['ypos'])
+    myprint("Setting icon location for filename '" + fileinfo['name'] + "' to ( " + str(fileinfo['xpos']) + ", " + str(fileinfo['ypos']) + " )")
 
 outputds.flush()
 outputds.close()