From 22274a61833814fe885d1196029d7b7727cbe402 Mon Sep 17 00:00:00 2001 From: Taka Date: Fri, 18 Mar 2022 17:46:08 +1100 Subject: [PATCH] Improved the help. --- vasl_templates/webapp/static/help/index.html | 111 ++++++++++--------- vasl_templates/webapp/static/help/main.css | 18 ++- 2 files changed, 69 insertions(+), 60 deletions(-) diff --git a/vasl_templates/webapp/static/help/index.html b/vasl_templates/webapp/static/help/index.html index 8351967..4956a67 100644 --- a/vasl_templates/webapp/static/help/index.html +++ b/vasl_templates/webapp/static/help/index.html @@ -39,20 +39,39 @@
-

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

+ +

Running 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 a Docker container

+ +

Note that config files installed into the container are taken from their normal location ($/vasl_templates/webapp/config/), but are overridden with Docker-specific versions in $/docker/config/.
+If you have Docker installed, the webapp can be run in a container e.g. +
+./run-container.sh \ + --port 5010 \ + --vassal ~/vassal-3.5.5/ \ + --vasl ~/vasl/vasl-6.6.2.vmod \ + --vasl-extensions ~/vasl/extensions/ \ + --boards ~/vasl/boards/ \ + --chapter-h ~/vasl/chapter-h/ \ + --user-files ~/vasl/user-files/ +
+ +

Then open a browser and connect to the webapp at http://localhost:5010. + +

If you have SElinux enabled, it may prevent the container from accessing files on the host. Access can be allowed like this: +
chcon -Rt svirt_sandbox_file_t /home/pacman-ghost/vasl/
+
+

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. +

You can also 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.

The web server was written and tested using Python 3.8.7, but it doesn't do anything particularly funky, so any recent version of Python should work. @@ -61,58 +80,42 @@ pip install .[gui]

-

Running the desktop application

- -

If you're on Windows, the Qt runtime will have been installed as part of PyQt5 (when you did the pip install above), but if you're in a virtual environment and you're getting "DLL load failed" errors, this is due to a problem with the way Python sets up the virtualenv. In the virtualenv's scripts/ sub-directory, there should be two Python DLL's, so if you're missing python3.dll, copy it over from the Python installation the virtualenv was created from, and you should be good to go. - -

If you're on Linux, you may need to install Qt 5.15.4. On Fedora 33, running the "gui" install above should install everything you need. +

Running the web server

-

Then, just run the vasl-templates command. - -

Running just the web server

- -

The simpler option is to just run the web server: +

The simplest option is to run the web server:

python vasl_templates/webapp/run_server.py
and then connect to it in a browser at http://localhost:5010. - -

Running a Docker container

+

Running the desktop application

-

If you have Docker installed, the webapp can be run in a container e.g. -

-./run-container.sh \ - --port 5010 \ - --vassal ~/vassal-3.5.5/ \ - --vasl ~/vasl/vasl-6.6.2.vmod \ - --vasl-extensions ~/vasl/extensions/ \ - --boards ~/vasl/boards/ \ - --chapter-h ~/vasl/chapter-h/ \ - --user-files ~/vasl/user-files/ -
+

If you want to run the desktop application, you will need to have the Qt runtime installed. -

Then open a browser and connect to the webapp at http://localhost:5010. +

If you're on Linux, you may need to install Qt 5.15.4. On Fedora 35, running the "gui" install above should install everything you need. -

If you have SElinux enabled, it may prevent the container from accessing files on the host. Access can be allowed like this: -
chcon -Rt svirt_sandbox_file_t /home/pacman-ghost/vasl/
-
+

If you're on Windows, the Qt runtime will have been installed as part of PyQt5 (when you did the pip install above), but if you're in a virtual environment and you're getting "DLL load failed" errors, this is due to a problem with the way Python sets up the virtualenv. In the virtualenv's scripts/ sub-directory, there should be two Python DLL's, so if you're missing python3.dll, copy it over from the Python installation the virtualenv was created from, and you should be good to go. -

Note that config files installed into the container are taken from their normal location ($/vasl_templates/webapp/config/), but are overridden with Docker-specific versions in $/docker/config/.
+

Then, run the vasl-templates command.

Installing a webdriver

-

Some features require a webdriver to be installed. You can use either: +

+
The webdriver is tightly coupled with the browser, so make sure that the webdriver you use supports the version of the browser you have.
+
Since browsers usually automatically update themselves as new versions are released, this means that the webdriver you use will eventually become out-of-date, and may stop working. In this case, simply get a new version of the webdriver that supports the version of the browser you have.
+
+Some features require a webdriver to be installed. You can use either:

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

+

If you're 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.

Create a file called debug.cfg in $/config/ (the same directory that contains a file called app.cfg) that looks like this: @@ -152,7 +155,7 @@ Configuring the program VASL extensions: C:\bin\vasl\extensions\ VASL boards: C:\bin\vasl\boards\ Java: C:\Program Files\VASSAL-3.5.5\jre\bin\java.exe -

Leave this field blank to use the Java that comes with VASSAL (Windows only), or on your PATH.
+
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: @@ -175,7 +178,7 @@ We'll set up The Streets Of Stalingrad, and the scenario card tells us In VASL Templates, open the save file for this scenario (The Streets Of Stalingrad (Scenario C).json; you'll find it in the examples/ directory).

Browse through the tabs, and you'll see all the scenario details e.g. Victory Conditions, SSR's, setup instructions.

Click on the info icon in the top-right corner of the Scenario panel to get more detailed information about the scenario. -

This information is provided by the ASL Scenario Archive.
+
This information is provided by the ASL Scenario Archive.


@@ -192,7 +195,7 @@ In particular, note the data tables for the vehicles, which contain useful infor We can pretty-up the labels by including pictures in them. Open the User Settings dialog and turn on the Images in scenarios settings.

Update the VASL scenario again (as above), open it again in VASSAL, and you will see that the labels now include nationality flags, and the vehicle data tables show the counter images:
-

Because images can't be stored inside a VASL scenario file, if you turn these options on, you must choose where VASSAL will get the images from: +
Because images can't be stored inside a VASL scenario file, if you turn these options on, you must choose where VASSAL will get the images from:
  • From this program: the VASL Templates program must be running before you open the scenario in VASSAL. If you are playing with someone online, they must have the program running as well.
  • From the internet: you must have a working internet connection when you open the scenario in VASSAL. There will be a short delay when opening the scenario, as VASSAL downloads the images. @@ -209,7 +212,7 @@ We can pretty-up the labels by including pictures in them. Open the User Set VASL Templates makes it easy to set up attractive VASL scenarios, with loads of useful information embedded to assist with game play.

    We'll show how by walking through a setup of everyone's favorite scenario, Hill 621. Click on the screenshot to the right to see the finished scenario. -

    You can find more examples here, with files that you can load into the program, together with the generated VASL scenarios.
    +
    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,13 +221,13 @@ We can pretty-up the labels by including pictures in them. Open the User Set We start by entering the basic scenario details, such as its name, location and date. The easiest way to do this is by searching the ASL Scenario Archive.

    Click on the search button, enter the name of the scenario, and once you've found the correct one, click on Import to transfer the details into VASL Templates.

    If the Downloads button is enabled, this means that somebody has contributed the entire scenario setup and/or VASL save file, and these are available for download. -

    The scenario card may list special rules and errata, and have screenshots of the map setup, all of which will help you set up your scenario correctly.
    +
    The scenario card may list special rules and errata, and have screenshots of the map setup, all of which will help you set up your scenario correctly.

    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!
    +
    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.
    @@ -237,7 +240,7 @@ Once you have a label in VASL, copy the HTML snippet generated above into it.

    Automatically adding labels to the VASL scenario

    Once you've got the hang of adding labels to your VASL scenario, you can get VASL Templates to do it automatically for you. After entering all the scenario details, choose Update VASL scenario from the menu, select the .vsav file you want to update, and all the labels will be inserted into the scenario (or updated, if they're already there). -

    VASSAL will be run to update the scenario, so you may see it temporarily appear on-screen. The process can be a little slow, and may take several minutes to complete.
    +
    VASSAL will be run to update the scenario, so you may see it temporarily appear on-screen. The process can be a little slow, and may take several minutes to complete.

    @@ -267,7 +270,7 @@ Once they're all in, click on the Snippet button to get a nicely format Adding each vehicle and ordnance for each player is just a matter of selecting them from a list, and the generated HTML snippet will produce a table of information for each one (see right). Very handy if you have a menagerie of armor and you're, say, looking for something that can fire Smoke.

    The scenario date is taken into account when generating these tables e.g. APCR for the Pz IVH is A52, but since the program knows the scenario is set in 1944, it just shows A5. Had the scenario been set in 1941, it wouldn't be shown at all. -

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

    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. @@ -307,11 +310,11 @@ You can add a scaling parameter to resize the image (as a percentage of

or a width and/or height parameter to explicitly set the image size (in pixels). -
If you use this feature in your scenarios, the images won't be available if you share the VASL scenario with someone else (since the files are only on your computer). However, if you upload them to a web server on the internet, you can configure the "User files" directory as a URL, and any image URL's that use {{USER_FILES}} will now get them from there.
- -
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.
- -
You should avoid having spaces in image URL's, since VASSAL seems to have problems with them.
+

+

If you use this feature in your scenarios, the images won't be available if you share the VASL scenario with someone else (since the files are only on your computer). However, if you upload them to a web server on the internet, you can configure the "User files" directory as a URL, and any image URL's that use {{USER_FILES}} will now get them from there.
+
You should avoid having spaces in image URL's, since VASSAL seems to have problems with them.
+
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.
+

Suggested workflow

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

When the scenario has been completed and checked, you can contribute it back to the community by uploading it to the ASL Scenario Archive, where it will be made available to everyone for download.

Just add your VASL scenario file (.vsav), a screenshot will be automatically generated (or you can add your own), then click Upload. -

For copyright reasons, some details will be removed
from the upload e.g. the Victory Conditions and SSR's.
+
For copyright reasons, some details will be removed from the upload e.g. the Victory Conditions and SSR's.

@@ -398,12 +401,12 @@ The report also calculates "hotness", which is a measure of how hot you
<p> MA and CMG (if so equipped) have AA capability - signified by "MA:AA" being printed on the counter.
-
Because Windows has case-insensitive filenames, the convention is that Multi-Applicable Note "A" is stored in a file called a.html, while Multi-Applicable Note "a" is stored in a_.html (with a trailing underscore).
+
Because Windows has case-insensitive filenames, the convention is that Multi-Applicable Note "A" is stored in a file called a.html, while Multi-Applicable Note "a" is stored in a_.html (with a trailing underscore).

The vehicle and ordnance notes themselves are stored as image files, so you need to scan your Chapter H pages, and crop each individual note. For example, an image for the German PSW 234/1 can be seen to the left. Right-click on it, download it, and save it on top of german/vehicles/74.png (because it's note #74).
-

It is also possible to store the vehicle/ordnance notes as HTML, and while it is significantly more work to set things up this way, it gives much better results. Using the placeholder files from the ZIP above, wherever there is a .png file, rename it to have a .html extension, and then put the HTML in there. +
It is also possible to store the vehicle/ordnance notes as HTML, and while it is significantly more work to set things up this way, it gives much better results. Using the placeholder files from the ZIP above, wherever there is a .png file, rename it to have a .html extension, and then put the HTML in there.

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.

@@ -421,8 +424,8 @@ The report also calculates "hotness", which is a measure of how hot you

Each individual vehicle and ordnance can also now have its own snippet button. Click on the one for the PSW 234/1, transfer the snippet to your VASL scenario, and you will see the image for Note 74 you set up earlier.

-

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.
+
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

diff --git a/vasl_templates/webapp/static/help/main.css b/vasl_templates/webapp/static/help/main.css index 24127ee..c6a7efd 100644 --- a/vasl_templates/webapp/static/help/main.css +++ b/vasl_templates/webapp/static/help/main.css @@ -41,18 +41,24 @@ table.settings td.val { font-family: monospace ; } /* -------------------------------------------------------------------- */ div.info { - margin: 0.5em ; padding: 0.5em 0.5em 0.5em 30px ; - background: url(images/info.gif) 2px 2px no-repeat ; + display: inline-block ; min-height: 18px ; + border: 1px dotted #444 ; border-radius: 5px ; + padding: 0.5em 0.5em 0.5em 32px ; + background: url(images/info.gif) 0.25em 0.25em no-repeat ; font-size: 80% ; font-style: italic ; } div.hint { - margin: 0.5em ; padding: 0.5em 0.5em 0.5em 30px ; - background: url(images/hint.gif) 2px 2px no-repeat ; + display: inline-block ; min-height: 22px ; + border: 1px dotted #444 ; border-radius: 5px ; + padding: 0.5em 0.5em 0.5em 32px ; + background: url(images/hint.gif) 0.25em 0.25em no-repeat ; font-size: 80% ; font-style: italic ; } div.warning { - margin: 0.5em ; padding: 0.5em 0.5em 0.5em 30px ; - background: url(images/warning.gif) 2px 2px no-repeat ; + display: inline-block ; min-height: 18px ; + border: 1px dotted #444 ; border-radius: 5px ; + padding: 0.5em 0.5em 0.5em 32px ; + background: url(images/warning.gif) 0.25em 0.25em no-repeat ; font-size: 80% ; font-style: italic ; }