From 76b7d9836aeb910836327f28d96254e624ecc0b6 Mon Sep 17 00:00:00 2001 From: Taka Date: Tue, 23 Jul 2019 07:23:34 +0000 Subject: [PATCH] Allow vehicles/ordnance to be imported from a .vsav file. --- .../webapp/config/logging.yaml.example | 2 +- .../css/{vassal.css => vassal-shim.css} | 6 +- vasl_templates/webapp/static/help/index.html | 15 + vasl_templates/webapp/static/help/main.css | 2 +- vasl_templates/webapp/static/main.js | 5 +- vasl_templates/webapp/static/vassal.js | 300 +++++++++++++----- vasl_templates/webapp/static/vo.js | 22 +- vasl_templates/webapp/templates/index.html | 3 +- vasl_templates/webapp/templates/vassal.html | 4 +- .../tests/fixtures/analyze-vsav/basic.vsav | Bin 0 -> 6544 bytes .../fixtures/analyze-vsav/common-vo.vsav | Bin 0 -> 4219 bytes .../fixtures/analyze-vsav/extensions-bfp.vsav | Bin 0 -> 2510 bytes .../fixtures/analyze-vsav/landing-craft.vsav | Bin 0 -> 2852 bytes vasl_templates/webapp/tests/test_vassal.py | 133 +++++++- vasl_templates/webapp/vassal.py | 170 +++++++--- vassal-shim/release/vassal-shim.jar | Bin 26906 -> 28183 bytes vassal-shim/src/vassal_shim/AnalyzeNode.java | 20 ++ vassal-shim/src/vassal_shim/Main.java | 6 + vassal-shim/src/vassal_shim/Utils.java | 25 ++ vassal-shim/src/vassal_shim/VassalShim.java | 85 +++-- 20 files changed, 623 insertions(+), 175 deletions(-) rename vasl_templates/webapp/static/css/{vassal.css => vassal-shim.css} (73%) create mode 100644 vasl_templates/webapp/tests/fixtures/analyze-vsav/basic.vsav create mode 100644 vasl_templates/webapp/tests/fixtures/analyze-vsav/common-vo.vsav create mode 100644 vasl_templates/webapp/tests/fixtures/analyze-vsav/extensions-bfp.vsav create mode 100644 vasl_templates/webapp/tests/fixtures/analyze-vsav/landing-craft.vsav create mode 100644 vassal-shim/src/vassal_shim/AnalyzeNode.java diff --git a/vasl_templates/webapp/config/logging.yaml.example b/vasl_templates/webapp/config/logging.yaml.example index d498f2b..452f6bc 100644 --- a/vasl_templates/webapp/config/logging.yaml.example +++ b/vasl_templates/webapp/config/logging.yaml.example @@ -27,6 +27,6 @@ loggers: vasl_mod: level: "WARNING" handlers: [ "file" ] - update_vsav: + vassal_shim: level: "WARNING" handlers: [ "file" ] diff --git a/vasl_templates/webapp/static/css/vassal.css b/vasl_templates/webapp/static/css/vassal-shim.css similarity index 73% rename from vasl_templates/webapp/static/css/vassal.css rename to vasl_templates/webapp/static/css/vassal-shim.css index 96b7ebd..75ae0a7 100644 --- a/vasl_templates/webapp/static/css/vassal.css +++ b/vasl_templates/webapp/static/css/vassal-shim.css @@ -1,6 +1,6 @@ -.ui-dialog.update-vsav .ui-dialog-titlebar { display: none ; } -#update-vsav { display: flex ; align-items: center ; } -#update-vsav img { margin-right: 1em ; } +.ui-dialog.vassal-shim-progress .ui-dialog-titlebar { display: none ; } +#vassal-shim-progress { display: flex ; align-items: center ; } +#vassal-shim-progress img { margin-right: 1em ; } #vassal-shim-error textarea { width: 100% ; height: 15em ; min-height: 5em ; resize: none ; padding: 2px ; font-family: monospace ; font-size: 80% ; } .ui-dialog.vassal-shim-error .ui-dialog-titlebar { background: #f5af41 ; } diff --git a/vasl_templates/webapp/static/help/index.html b/vasl_templates/webapp/static/help/index.html index f6e456d..155f8c2 100644 --- a/vasl_templates/webapp/static/help/index.html +++ b/vasl_templates/webapp/static/help/index.html @@ -175,6 +175,11 @@ Adding each vehicle and ordnance for each player is just a matter of selecting t

Double-click on an entry to make changes to it e.g. because an SSR changes its capabilities, or you'd like to add a note.

It's also possible to include Chapter H notes in your scenarios, although you will need to set some things up first.
+ +

Analyzing a VASL scenario

+ +

If you have already set up the VASL scenario, you can also choose "Analyze VASL scenario" from the menu, and the program will identify vehicles and ordnance, and automatically create entries for each one. Only counters from the two configured nationalities will be imported, so make sure you set these first. +

@@ -211,6 +216,16 @@ or a width and/or height parameter to explicitly set the image
+

Suggested workflow

+ +

+

+

Configuring the program

Showing VASL counter images in the UI

diff --git a/vasl_templates/webapp/static/help/main.css b/vasl_templates/webapp/static/help/main.css index 8737545..3d448c3 100644 --- a/vasl_templates/webapp/static/help/main.css +++ b/vasl_templates/webapp/static/help/main.css @@ -6,7 +6,7 @@ h2 { margin-top: 1em ; clear: both ; color: #666 ; } h4 { margin-top: 0.5em ; clear: both ; color: #666 ; } p { margin-top: 0.5em ; } -li { margin-left: 1em ; } +li { margin: 0.2em 0 0 1em ; } .code { white-space: pre ; font-family: monospace ; margin: 0 1em 1em 2em ; } /* -------------------------------------------------------------------- */ diff --git a/vasl_templates/webapp/static/main.js b/vasl_templates/webapp/static/main.js index 3bbf673..aa81143 100644 --- a/vasl_templates/webapp/static/main.js +++ b/vasl_templates/webapp/static/main.js @@ -45,10 +45,11 @@ $(document).ready( function () { new_scenario: { label: "New scenario", action: function() { on_new_scenario() ; } }, load_scenario: { label: "Load scenario", action: on_load_scenario }, save_scenario: { label: "Save scenario", action: on_save_scenario }, - update_vsav: { label: "Update VASL scenario", action: on_update_vsav }, separator: { type: "separator" }, - template_pack: { label: "Load template pack", action: on_template_pack }, + analyze_vsav: { label: "Analyze VASL scenario", action: on_analyze_vsav }, + update_vsav: { label: "Update VASL scenario", action: on_update_vsav }, separator2: { type: "separator" }, + template_pack: { label: "Load template pack", action: on_template_pack }, user_settings: { label: "Settings", action: user_settings }, show_help: { label: "Help", action: show_help }, } ) ; diff --git a/vasl_templates/webapp/static/vassal.js b/vasl_templates/webapp/static/vassal.js index 64145c1..4d1b5ed 100644 --- a/vasl_templates/webapp/static/vassal.js +++ b/vasl_templates/webapp/static/vassal.js @@ -1,63 +1,17 @@ +gLoadVsavHandler = null ; // -------------------------------------------------------------------- -function on_update_vsav() -{ - // FOR TESTING PORPOISES! We can't control a file upload from Selenium (since - // the browser will use native controls), so we get the data from a