JAL-4421 Allow JSON config file to be options (no icon positioning for default or...
authorBen Soares <b.soares@dundee.ac.uk>
Tue, 4 Jun 2024 17:35:53 +0000 (18:35 +0100)
committerBen Soares <b.soares@dundee.ac.uk>
Tue, 4 Jun 2024 17:35:53 +0000 (18:35 +0100)
build.gradle
utils/channels/develop-SUFFIX/channel_gradle.properties
utils/channels/develop/channel_gradle.properties
utils/channels/develop/images/jalview_develop_dmg_DS_Store.json [new file with mode: 0644]
utils/channels/test-release/images/jalview_test-release_dmg_DS_Store.json
utils/macos_dmg/jalview_customise_dsstore.py

index ee883af..a8d55dd 100644 (file)
@@ -2726,6 +2726,21 @@ task copyInstall4jTemplate {
       }
     }
 
+    // delete .VolumeIcon.icns in macos DMG if there isn't one
+    if (!file(install4jDMGVolumeIcon).exists()) {
+      println("No '.VolumeIcon.icns' file found. Removing from install4j file.")
+      install4jConfigXml.'**'.macosArchive.topLevelFiles.each { topLevelFiles ->
+        topLevelFiles.file.each() { file ->
+          if (file.attribute("name") && file.attribute("name").equals(".VolumeIcon.icns")) {
+            println("Removing "+file.toString())
+            topLevelFiles.remove(file)
+          }
+        }
+      }
+    } else {
+      println("Using '.VolumeIcon.icns' file '${install4jDMGVolumeIcon}'")
+    }
+
     // disable install screen for OSX dmg (for 2.11.2.0)
     install4jConfigXml.'**'.macosArchive.each { macosArchive -> 
       macosArchive.attributes().remove('executeSetupApp')
@@ -2847,11 +2862,11 @@ python {
 
 task install4jCustomiseDS_StoreX64(type: PythonTask) {
   inputs.file(install4jDMGDSStore)
-  inputs.file(install4jDMGDSStoreJSON)
   outputs.file(install4jDMGFixedDSStoreX64)
   def command_args = [ jalview_customise_ds_store, '--input', install4jDMGDSStore, '--output', install4jDMGFixedDSStoreX64, '--volumename', install4jmacOSArchiveX64Name, '--backgroundfile', install4j_dmg_background_filename, '--dmg', install4jmacOSArchiveX64DMGFilename + ".dmg" ]
   if (file(install4jDMGDSStoreJSON).exists()) {
     command_args += [ '--config', install4jDMGDSStoreJSON ]
+    inputs.file(install4jDMGDSStoreJSON)
   }
   command = command_args
   doFirst {
@@ -2861,11 +2876,11 @@ task install4jCustomiseDS_StoreX64(type: PythonTask) {
 
 task install4jCustomiseDS_StoreAarch64(type: PythonTask) {
   inputs.file(install4jDMGDSStore)
-  inputs.file(install4jDMGDSStoreJSON)
   outputs.file(install4jDMGFixedDSStoreAarch64)
   def command_args = [ jalview_customise_ds_store, '--input', install4jDMGDSStore, '--output', install4jDMGFixedDSStoreAarch64, '--volumename', install4jmacOSArchiveAarch64Name, '--backgroundfile', install4j_dmg_background_filename, '--dmg', install4jmacOSArchiveAarch64DMGFilename + ".dmg" ]
   if (file(install4jDMGDSStoreJSON).exists()) {
     command_args += [ '--config', install4jDMGDSStoreJSON ]
+    inputs.file(install4jDMGDSStoreJSON)
   }
   command = command_args
   doFirst {
index 31abcbd..84e84bf 100644 (file)
@@ -30,6 +30,7 @@ install4j_png_icon_file = jalview_develop_logo.png
 install4j_background = jalview_develop_logo_background_fade-640x480.png
 install4j_dmg_background = jalview_develop_dmg_background-72dpi.png
 install4j_dmg_ds_store = jalview_develop_dmg_DS_Store
+install4j_dmg_ds_store_json = jalview_develop_dmg_DS_Store.json
 install4j_dmg_volume_icon = jalview_develop-VolumeIcon.icns
 
 getdown_background_image_text_font = utils/fonts/Roboto.ttf
index b1d06d1..80e64d1 100644 (file)
@@ -30,6 +30,7 @@ install4j_png_icon_file = jalview_develop_logo.png
 install4j_background = jalview_develop_logo_background_fade-640x480.png
 install4j_dmg_background = jalview_develop_dmg_background-72dpi.png
 install4j_dmg_ds_store = jalview_develop_dmg_DS_Store
+install4j_dmg_ds_store_json = jalview_develop_dmg_DS_Store.json
 install4j_dmg_volume_icon = jalview_develop-VolumeIcon.icns
 
 getdown_background_image_text_font = utils/fonts/Roboto.ttf
diff --git a/utils/channels/develop/images/jalview_develop_dmg_DS_Store.json b/utils/channels/develop/images/jalview_develop_dmg_DS_Store.json
new file mode 100644 (file)
index 0000000..5aa0357
--- /dev/null
@@ -0,0 +1,14 @@
+{
+  "files": [
+    {
+      "name": "Jalview Develop.app",
+      "xpos": 132,
+      "ypos": 124
+    },
+    {
+      "name": " ",
+      "xpos": 332,
+      "ypos": 124
+    }
+  ]
+}
index b584fda..2944791 100644 (file)
       "ypos": 124
     }
   ],
-  "_comment": "bwsp and icvp are not being used yet",
-  "bwsp": {
-    "ShowStatusBar": false,
-    "SidebarWidthTenElevenOrLater": 160,
-    "ShowToolbar": false,
-    "ShowTabView": false,
-    "ContainerShowSidebar": false,
-    "WindowBounds": "{{355, 432}, {504, 324}}",
-    "ShowSidebar": false,
-    "ShowPathbar": false
-  },
-  "icvp": {
-    "backgroundColorBlue": 1.0,
-    "backgroundColorGreen": 1.0,
-    "backgroundColorRed": 1.0,
-    "labelOnBottom": true,
-    "gridSpacing": 100,
-    "textSize": 12.0,
-    "backgroundType": 2,
-    "gridOffsetX": 0.0,
-    "gridOffsetY": 0.0,
-    "showItemInfo": false,
-    "viewOptionsVersion": 1,
-    "arrangeBy": "none"
-  }
 }
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()