diff --git a/vasl_templates/webapp/static/help/index.html b/vasl_templates/webapp/static/help/index.html index a646b3e..e6bdf2a 100644 --- a/vasl_templates/webapp/static/help/index.html +++ b/vasl_templates/webapp/static/help/index.html @@ -42,14 +42,14 @@

VASL Templates is a web application that runs in a browser, but since it hasn't been set up as a web site on the public internet, you will need to run the web server yourself.

As a convenience, a program is provided that bundles the web server together with an embedded browser, so that it runs as if it were a normal desktop application. - +

Installing on Windows

If you're using Windows, you should get the pre-built version from Github, unpack it somewhere, then run vasl-templates.exe. Note that it can be a bit slow to start, so please give it a few seconds.

If the program won't start because a DLL is missing from your computer, install the VC2015 runtime (get the 32-bit version, vc_redist.x86.exe, even if you are running 64-bit Windows).

If you don't see anything in the main window, check the notes below about configuring OpenGL. - +

Running from source

If you're on a Mac or Linux, you can run the program directly from the source code. Get a copy from Github in the usual way, by git clone'ing it, or downloading a ZIP and unpacking it somewhere. @@ -77,7 +77,7 @@ python vasl_templates/webapp/run_server.py and then connect to it in a browser at http://localhost:5010. - +

Running a Docker container

If you have Docker installed, the webapp can be run in a container e.g. @@ -94,7 +94,7 @@ and then connect to it in a browser at http://localhost:5010.

chcon -Rt svirt_sandbox_file_t /home/pacman-ghost/vasl/
- +

Installing a webdriver

Some features require a webdriver to be installed. You can use either: @@ -105,7 +105,7 @@ and then connect to it in a browser at http://localhost:5010.

Unpack the download ZIP file somewhere (it will contain a single executable file), and configure the location in the Server Settings dialog (or set WEBDRIVER_PATH in site.cfg, if you are running from source). - +

I'm having problems running the desktop application

The desktop application uses OpenGL for the embedded browser, so if you are getting error messages about OpenGL, or the main window is not displaying properly, you can try configuring OpenGL to work in a different way. @@ -131,7 +131,7 @@ The program will then not attempt to create the embedded browser, and will just

- +

Configuring the program @@ -146,7 +146,7 @@ Configuring the program VASL extensions: C:\bin\vasl\extensions\ VASL boards: C:\bin\vasl\boards\ Java: C:\Program Files\VASSAL-3.4.6\jre\bin\java.exe -
If you're on Windows, you can leave this field blank,
and the version of Java that comes with VASSAL will be used.
+
Leave this field blank to use the Java that comes with VASSAL (Windows only), or on your PATH.
Web driver: C:\bin\geckodriver.exe For the webdriver, download and unpack one of the following: @@ -157,7 +157,7 @@ For the webdriver, download and unpack one of the following:
Make sure to download the version that corresponds to the version of Chrome you are running.
- +

Setting up a scenario

@@ -177,9 +177,9 @@ In VASL Templates, open the save file for this scenario (The Street We now want to create labels in the VASL scenario for all this information. Choose Update VASL scenario from the menu, and select the VASL scenario file you created earlier (e.g. streets-of-stalingrad.vsav). The program will now launch VASSAL to do the work, so be patient since it may take a minute or two, and you may see VASSAL momentarily appear on-screen.

Once it's done, save the updated .vsav file somewhere. Go back to VASSAL, open the updated .vsav file, and you will see all the labels with the scenario information:

-In particular, note the data tables for the vehicles, which contain useful information that will need during your game. +In particular, note the data tables for the vehicles, which contain useful information that you can refer to during your game. - +

Including pictures in the labels

@@ -205,7 +205,7 @@ We can pretty-up the labels by including pictures in them. Open the User Set

You can find more examples here, with files that you can load into the program, together with the generated VASL scenarios.
- +

Adding the scenario details

@@ -218,6 +218,7 @@ We start by entering the basic scenario details, such as its name, location and

Once the scenario details are in, click on one of the Snippet buttons, and the program will generate an HTML snippet and put it into your clipboard, which you can then copy into a VASL label.

To create a label in VASL, open the Draggable Overlays window, and drag a label onto the main window. +

Make sure to use the "Label (no background)" label, as indicated in the screenshot, since the others may not work properly!

Labels come in two parts, which are accessible via the right-click menu, or press Ctrl-L and Ctrl-2 to access each one. I always just use the first line, so I delete everything in line 2.

The thick black box indicates that the label is selected. If you click elsewhere on the main window, it goes away, and the label will remain in place even if you click on it, or try to drag it. To select it again, Shift-click somewhere in the box, and you will be able to move it around, or edit it. This can sometimes be difficult to find, since it's not visible on-screen, but it will be in the middle (vertically and horizontally) of the label.
@@ -234,7 +235,7 @@ Once you have a label in VASL, copy the HTML snippet generated above into it.
- +

Adding victory conditions and SSR's

@@ -253,7 +254,7 @@ To add SSR's, click on the green plus button in the SSR section and add the SSR

Once they're all in, click on the Snippet button to get a nicely formatted bullet list. - +

Adding each player's OB

@@ -278,13 +279,13 @@ Finally, if special support weapons such as PF and BAZ are in play, snippets are

If you have already set up the VASL scenario, you can choose Analyze VASL scenario from the menu, and the program will scan the .vsav file for 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. - +

Extra templates

Extra templates are also available to generate other kinds of snippets e.g. to keep track of how many PF shots you have left, or to generate a shaded box that can be inserted behind the Turn Track to indicate an LV Hindrance. - +

Including your own images

@@ -306,7 +307,7 @@ or a width and/or height parameter to explicitly set the image

You should avoid having spaces in image URL's, since VASSAL seems to have problems with them.
- +

Suggested workflow

    @@ -323,7 +324,7 @@ When the scenario has been completed and checked, you can contribute it back to
    For copyright reasons, some details will be removed
    from the upload e.g. the Victory Conditions and SSR's.

    - +

    Analyzing log files

    @@ -339,7 +340,7 @@ The report also calculates "hotness", which is a measure of how hot you
    - +

    Configuring the program

    @@ -379,7 +380,7 @@ The report also calculates "hotness", which is a measure of how hot you

    It is possible to include Chapter H notes in your VASL scenarios, but since this is copyrighted material, the data files are not included in releases, and you will need to set them up yourself. - +

    Setting up the Chapter H data files

    Unpack this ZIP file somewhere, and configure the location in the Server Settings dialog (or the CHAPTER_H_NOTES_DIR setting in site.cfg, if you are running from source). @@ -399,7 +400,7 @@ The report also calculates "hotness", which is a measure of how hot you

    Note that the HTML engine used by VASSAL is ancient and doesn't support floating images, which is needed to format this content in the same way as the ASLRB. To work around this, an option is provided (in the User Settings) to show these vehicle/ordnance notes as images. If this is enabled, the vehicle/ordnance notes will be rendered by the VASL Templates program (using a modern browser), and sent to VASSAL as an image, which is slower but gives the expected layout. If you don't use images in your HTML, you can leave this option disabled, and the raw HTML will be inserted into the VASL scenario, where it will be displayed much more quickly by VASSAL.

- +

Adding Chapter H notes to your VASL scenario

Restart the VASL Templates program, and add a PSW 234/1 to the German OB. You will see some changes in the UI (see screenshot). @@ -416,7 +417,7 @@ The report also calculates "hotness", which is a measure of how hot you

Depending on how you scanned the Chapter H pages, the image may not be the right size, so you can set a scaling factor for these images in the Server Settings dialog. As a guide, I scanned my ASLRB at 300dpi, and a scaling factor of 40% produced images that fit in with the rest of the scenario. However, if you have a lot of these images, there will be a noticeable delay when loading the scenario in VASSAL (because the program has to resize all the images), so you will be better off shrinking the images yourself, then setting the scaling factor to 100, so that no resizing needs to be done.
VASSAL caches images (which can't be turned off), so if you're making changes that don't seem to be having any effect, try restarting VASSAL.
- +

Creating a scenario reference sheet

If you Shift-click on the Snippet buttons, an image of the snippet will be copied to the clipboard, instead of the raw HTML snippet. You can then copy these into Microsoft Word (or any other editor that can accept images), and print it out, to get a reference sheet with all the Chapter H notes for a scenario. Very handy, even if you're not using VASL! @@ -434,7 +435,7 @@ The report also calculates "hotness", which is a measure of how hot you

The template files can be found in $/data/default-template-pack/ (where $ is where you've installed the program). - +

Placeholders and template conditionals

@@ -498,7 +499,7 @@ But if the user hasn't specified anything for this field, what's between the - +

Looping over lists

There will often be multiple SSR's, and near the bottom of the file, we can see how these are handled: @@ -519,7 +520,7 @@ If the user had entered the SSR's as shown in the screenshot, then we would get Note that if they enter HTML into the SSR text, it will be inserted verbatim into the HTML snippet, thus allowing them to format the content. - +

Template packs

If you want to customize how the HTML snippets are generated, you could just edit the files directly, but the down-side of doing this is that if you install a new version of the program, you will lose your changes. @@ -542,7 +543,7 @@ When you're writing a new template file, it would be painful to have to ZIP up a

- +

Setting up

After cloning the repo, install the developer requirements: @@ -559,7 +560,13 @@ pytest --webdriver chrome --headless

Note that since pylint is run as part of these tests, this should be done from the root directory of the repo. - + +

Running the test suite

+ +

The test suite communicates with the web server being tested using gRPC, which runs over a socket. To configure this port, rename the provided debug.cfg.example file to debug.cfg, and configure it there (or use -1 to have one automatically assigned.). +

You should also provide at least one installation of VASSAL, and at least one VASL .vmod file. If there are multiple installations of VASSAL and/or VASL, the tests will be run against each combination thereof. + +

Compiling the VASSAL shim

The program uses VASSAL to update VASL scenarios (.vsav files), and since this is written in Java, a helper program has been written in Java to do this. @@ -570,7 +577,7 @@ make all VASSAL_DIR=... where VASSAL_DIR points to VASSAL's lib/ directory (the program needs Vengine.jar).

Since this program doesn't change very often, the resulting artifact (vassal-shim.jar) is checked into source control, so that it can be used without needing to install a JDK and compiling it first. - +

Code lint'ing

Python code is checked using pylint (installed during the pip install above), which should be run from the root directory of the repo. @@ -581,7 +588,7 @@ export JSHINT_RHINO=~/bin/jshint-2.6.3/dist/jshint-rhino.js Note that both of these are run as part of a normal pytest run. - +

Creating a pre-compiled package

It is possible to compile the desktop application down to a single binary. This is typically done for the benefit of Windows users, but also works for other platforms. From the root directory of the repo: diff --git a/vasl_templates/webapp/vassal.py b/vasl_templates/webapp/vassal.py index ec0810f..6cdaa2c 100644 --- a/vasl_templates/webapp/vassal.py +++ b/vasl_templates/webapp/vassal.py @@ -105,7 +105,6 @@ def update_vsav(): #pylint: disable=too-many-statements,too-many-locals # return the results logger.info( "Updated the VSAV file OK: elapsed=%.3fs", time.time()-start_time ) - # NOTE: We adjust the recommended save filename to encourage users to not overwrite the original file :-/ vsav_filename = os.path.split( vsav_filename )[1] errors = [] for fail in report["failed"]: