diff --git a/chapter-h/README.md b/chapter-h/README.md index edc6fbb..cb9f7bd 100644 --- a/chapter-h/README.md +++ b/chapter-h/README.md @@ -1,5 +1,5 @@ # Chapter H Vehicle/Ordnance notes -*VASL Templates* supports including Chapter H notes in your VASL scenarios, but since this is copyrighted material, it is not included in releases, and you will need to set up the data yourself. +It is possible to include Chapter H notes in your VASL scenarios, but since this is copyrighted material, it is not included in releases, and you will need to set up the data yourself. The ZIP file in this directory contains placeholder files for the Chapter H notes, refer to the [documentation](https://rawgit.com/pacman-ghost/vasl-templates/master/vasl_templates/webapp/static/help/index.html?tab=chapterh) for instructions on how to set things up. diff --git a/vasl_templates/webapp/static/help/images/hill-621.png b/vasl_templates/webapp/static/help/images/hill-621.png index 02fdb70..904ea77 100644 Binary files a/vasl_templates/webapp/static/help/images/hill-621.png and b/vasl_templates/webapp/static/help/images/hill-621.png differ diff --git a/vasl_templates/webapp/static/help/images/hill-621.small.png b/vasl_templates/webapp/static/help/images/hill-621.small.png index 3110d4c..d70fc45 100644 Binary files a/vasl_templates/webapp/static/help/images/hill-621.small.png and b/vasl_templates/webapp/static/help/images/hill-621.small.png differ diff --git a/vasl_templates/webapp/static/help/images/user-file.png b/vasl_templates/webapp/static/help/images/user-file.png new file mode 100644 index 0000000..4fdc414 Binary files /dev/null and b/vasl_templates/webapp/static/help/images/user-file.png differ diff --git a/vasl_templates/webapp/static/help/images/user-file.small.png b/vasl_templates/webapp/static/help/images/user-file.small.png new file mode 100644 index 0000000..86c5bad Binary files /dev/null and b/vasl_templates/webapp/static/help/images/user-file.small.png differ diff --git a/vasl_templates/webapp/static/help/index.html b/vasl_templates/webapp/static/help/index.html index 8823975..eb4559c 100644 --- a/vasl_templates/webapp/static/help/index.html +++ b/vasl_templates/webapp/static/help/index.html @@ -73,10 +73,37 @@ 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: +

+docker run --rm -it --name vasl-templates \ + -p 5010:5010 \ + -v /home/pacman-ghost/vasl/vasl-6.4.3.vmod:/data/vasl.vmod \ + vasltemplates/images:latest +
+If you have Chapter H data, add the following: +
-v /home/pacman-ghost/vasl/chapter-h:/data/chapter-h-notes
+

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

Note that some features (e.g. updating a VASL scenario file) may not be available. +

If you have SElinux enabled, it may prevent the container from accessing the VASL .vmod file, in which case, you can allow access like this: +
chcon -Rt svirt_sandbox_file_t /home/pacman-ghost/vasl/vasl-6.4.3.vmod
+
+ +

Installing a webdriver

+ +

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

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 $/lib/vasl_templates/webapp/config/ (the same directory that contains a file called app.cfg) that looks like this: +

Create a file called debug.cfg in $/config/ (the same directory that contains a file called app.cfg) that looks like this:

[Debug] OPENGL_TYPE = AA_UseSoftwareOpenGL @@ -145,6 +172,8 @@ 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.

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.

@@ -160,6 +189,27 @@ Finally, if special support weapons such as PF and BAZ are in play, snippets are

Extra templates are also available to generate ad-hoc 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

+ +

+You can also include your own images in scenarios e.g. the picture from the scenario card, or CG reinforcement tables. + +

In the Server Settings dialog, configure the directory where you keep your files, then in a template, use {{USER_FILES}} at the start of an image URL e.g. +

+<img src="{{USER_FILES}}/hill-621.png"> +
+You can add a scaling parameter to resize the image (as a percentage of the original) e.g. +
+<img src="{{USER_FILES}}/hill-621.png?scaling=50"> +
+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.
+ +
+

Configuring the program

Showing VASL counter images in the UI

@@ -167,9 +217,9 @@ Finally, if special support weapons such as PF and BAZ are in play, snippets are

If you want VASL counter images to appear in the UI, you need to tell the program where to find the VASL module (i.e. the vasl-X.X.X.vmod file you load into VASSAL):

-
You should configure version 6.3.3, or 6.4.0 thru 6.4.3, of the VASL module.
+
You should configure version 6.4.0 thru 6.4.3, of the VASL module.

Once you've configured the VASL module, if you want to also show VASL counter images in the OB snippets that you copy in the VASL scenario, turn this on in the User settings dialog from the main application menu.

If you turn this feature on, the program must be running every time you load the scenario into VASL.
@@ -179,19 +229,19 @@ Finally, if special support weapons such as PF and BAZ are in play, snippets are
-

VASL Templates supports including 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. +

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

The ZIP file contains placeholder files for the Chapter H notes and multi-applicable notes, so all you have to do is replace these files with the real content. +

The ZIP file contains placeholder files for the Chapter H vehicle/ordnance notes and multi-applicable notes, so all you have to do is update these files with the real content. -

Multi-applicable notes are stored as HTML, so, for example, for German Multi-Applicable Vehicle Note A, change the file german/vehicles/a.html as follows: +

Multi-applicable notes are stored as HTML, so for example, for German Multi-Applicable Vehicle Note A, change the file german/vehicles/a.html as follows:

<p> MA and CMG (if so equipped) have AA capability - signified by "MA:AA" being printed on the counter.
-
NOTE: 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).
@@ -207,11 +257,13 @@ Finally, if special support weapons such as PF and BAZ are in play, snippets are

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

NOTE: 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. Note, however, that 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.
+
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! +

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

This feature requires a webdriver to be installed.
@@ -223,7 +275,7 @@ Finally, if special support weapons such as PF and BAZ are in play, snippets are

The HTML snippets are generated from template files, which are simply text files that contain the HTML you want to insert into the VASL labels, but with placeholders for the scenario name, victory conditions, each player's OB, etc. The user enters these details into the program, and when they want to generate a snippet, all the placeholders are replaced in the template with the real values, thus producing an HTML snippet specific to that scenario. -

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

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

Placeholders and template conditionals

@@ -329,13 +381,13 @@ When you're writing a new template file, it would be painful to have to ZIP up a
pip install --editable .[dev]
-The tests use pytest and Selenium WebDriver, so you will need geckodriver and chromedriver somewhere in your PATH. The driver to use can be specified via the --webdriver parameter, and you can also run the tests headless e.g +The tests use pytest and Selenium WebDriver, so you will need geckodriver and/or chromedriver somewhere in your PATH. The driver to use can be specified via the --webdriver parameter, and you can also run the tests headless e.g
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. -

NOTE: Internet Explorer is also supported as a WebDriver, but due to differences in the way it works, some tests are currently failing for this. +

Internet Explorer is also supported as a WebDriver, but due to differences in the way it works, some tests are currently failing for this.

Compiling the VASSAL shim

@@ -363,7 +415,7 @@ Note that both of these are run as part of a normal pytest run.
docker build --tag vasl-templates .
-NOTE: To allow the test suite to be run against the container, add --build-arg ENABLE_TESTS=1 to the command. +
To allow the test suite to be run against the container, add --build-arg ENABLE_TESTS=1 to the command.

Then run the container:

@@ -372,7 +424,7 @@ docker run --rm -it --name vasl-templates \ -v /home/pacman-ghost/vasl/vasl-6.4.3.vmod:/data/vasl.vmod \ vasl-templates
-NOTE: The "Update VASL scenario" feature is currently not working in a container.. +
The "Update VASL scenario" feature is currently not working in a container.

Note that if you have SElinux enabled, it may prevent the container from accessing the VASL .vmod file, in which case, you can allow access like this:

diff --git a/vasl_templates/webapp/static/help/main.js b/vasl_templates/webapp/static/help/main.js index 3ee7538..b682807 100644 --- a/vasl_templates/webapp/static/help/main.js +++ b/vasl_templates/webapp/static/help/main.js @@ -72,3 +72,12 @@ $(document).ready( function() { if ( tab_id ) $( "a[href='#helptabs-" + tab_id + "']" ).click() ; } ) ; + +// -------------------------------------------------------------------- + +function select_tab( tab_id ) +{ + // select the specified tab + $( "a[href='#helptabs-" + tab_id + "']" ).click() ; + $( "#helptabs-content" ).animate( { scrollTop: 0 }, 0 ) ; +}