Default to showing images in snippets, and using custom list bullets.

master
Pacman Ghost 2 years ago
parent 7a0c4044e4
commit 560f2e3e65
  1. BIN
      vasl_templates/webapp/static/help/images/quick-start/updated-scenario.png
  2. BIN
      vasl_templates/webapp/static/help/images/quick-start/updated-scenario.small.png
  3. 14
      vasl_templates/webapp/static/help/index.html
  4. 7
      vasl_templates/webapp/static/user_settings.js
  5. 40
      vasl_templates/webapp/tests/test_user_settings.py
  6. 14
      vasl_templates/webapp/tests/test_vasl_extensions.py
  7. 18
      vasl_templates/webapp/tests/test_vassal.py

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 KiB

After

Width:  |  Height:  |  Size: 128 KiB

@ -188,20 +188,6 @@ We now want to create labels in the VASL scenario for all this information. Choo
<img src="images/quick-start/updated-scenario.png" class="preview" style="margin:0.5em 0 0 2em;"> <br>
In particular, note the data tables for the vehicles, which contain useful information that you can refer to during your game.
<a name="qs-include-pictures"></a>
<h2> Including pictures in the labels </h2>
<p> <img src="images/quick-start/user-settings.png" class="preview" style="float:right;">
We can pretty-up the labels by including pictures in them. Open the <em>User Settings</em> dialog and turn on the <em>Images in scenarios</em> settings.
<p> 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: <br>
<img src="images/quick-start/images-in-labels.png" class="preview" style="margin:0.5em 0 0 2em;">
<div class="warning" style="width:60%;"> 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:
<ul>
<li> <span style="border-bottom:1px solid #ccc;">From this program</span>: the <em>VASL Templates</em> 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.
<li> <span style="border-bottom:1px solid #ccc;">From the internet</span>: 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.
</ul>
</div>
</div>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

@ -1,7 +1,12 @@
SCENARIO_IMAGES_SOURCE_THIS_PROGRAM = 1 ;
SCENARIO_IMAGES_SOURCE_INTERNET = 2 ;
DEFAULT_USER_SETTINGS = { "scenario-images-source": SCENARIO_IMAGES_SOURCE_INTERNET } ;
DEFAULT_USER_SETTINGS = {
"scenario-images-source": SCENARIO_IMAGES_SOURCE_INTERNET,
"include-vasl-images-in-snippets": true,
"include-flags-in-snippets": true,
"custom-list-bullets": true,
} ;
gUserSettings = Cookies.getJSON( "user-settings" ) || DEFAULT_USER_SETTINGS ;
USER_SETTINGS = {

@ -32,30 +32,30 @@ def test_include_vasl_images_in_snippets( webapp, webdriver ):
set_player( 1, "german" )
add_vo( webdriver, "vehicles", 1, "PzKpfw IB" )
# enable "show VASL images in snippets"
# disable "show VASL images in snippets"
select_menu_option( "user_settings" )
elem = find_child( ".ui-dialog.user-settings input[name='include-vasl-images-in-snippets']" )
assert not elem.is_selected()
assert elem.is_selected()
elem.click()
click_dialog_button( "OK" )
_check_cookies( webdriver, "include-vasl-images-in-snippets", True )
_check_cookies( webdriver, "include-vasl-images-in-snippets", False )
# make sure that it took effect
snippet_btn = find_child( "button[data-id='ob_vehicles_1']" )
snippet_btn.click()
wait_for_clipboard( 2, "/counter/2524/front", contains=True )
wait_for_clipboard( 2, "/counter/2524/front", contains=False )
# disable "show VASL images in snippets"
# enable "show VASL images in snippets"
select_menu_option( "user_settings" )
elem = find_child( ".ui-dialog.user-settings input[name='include-vasl-images-in-snippets']" )
assert elem.is_selected()
assert not elem.is_selected()
elem.click()
click_dialog_button( "OK" )
_check_cookies( webdriver, "include-vasl-images-in-snippets", False )
_check_cookies( webdriver, "include-vasl-images-in-snippets", True )
# make sure that it took effect
snippet_btn.click()
wait_for_clipboard( 2, "/counter/2524/front", contains=False )
wait_for_clipboard( 2, "/counter/2524/front", contains=True )
# ---------------------------------------------------------------------
@ -72,44 +72,44 @@ def test_include_flags_in_snippets( webapp, webdriver ):
sortable = find_child( "#ob_setups-sortable_1" )
add_simple_note( sortable, "OB setup note", None )
# enable "show flags in snippets"
# disable "show flags in snippets"
select_menu_option( "user_settings" )
elem = find_child( ".ui-dialog.user-settings input[name='include-flags-in-snippets']" )
assert not elem.is_selected()
assert elem.is_selected()
elem.click()
click_dialog_button( "OK" )
_check_cookies( webdriver, "include-flags-in-snippets", True )
_check_cookies( webdriver, "include-flags-in-snippets", False )
# make sure that it took effect
ob_setup_snippet_btn = find_child( "li img.snippet", sortable )
ob_setup_snippet_btn.click()
wait_for_clipboard( 2, "/flags/german", contains=True )
wait_for_clipboard( 2, "/flags/german", contains=False )
# make sure it also affects vehicle/ordnance snippets
ob_vehicles_snippet_btn = find_child( "button.generate[data-id='ob_vehicles_1']" )
ob_vehicles_snippet_btn.click()
wait_for_clipboard( 2, "/flags/german", contains=True )
wait_for_clipboard( 2, "/flags/german", contains=False )
ob_ordnance_snippet_btn = find_child( "button.generate[data-id='ob_ordnance_1']" )
ob_ordnance_snippet_btn.click()
wait_for_clipboard( 2, "/flags/german", contains=True )
wait_for_clipboard( 2, "/flags/german", contains=False )
# disable "show flags in snippets"
# enable "show flags in snippets"
select_menu_option( "user_settings" )
elem = find_child( ".ui-dialog.user-settings input[name='include-flags-in-snippets']" )
assert elem.is_selected()
assert not elem.is_selected()
elem.click()
click_dialog_button( "OK" )
_check_cookies( webdriver, "include-flags-in-snippets", False )
_check_cookies( webdriver, "include-flags-in-snippets", True )
# make sure that it took effect
ob_setup_snippet_btn.click()
wait_for_clipboard( 2, "/flags/german", contains=False )
wait_for_clipboard( 2, "/flags/german", contains=True )
# make sure it also affects vehicle/ordnance snippets
ob_vehicles_snippet_btn.click()
wait_for_clipboard( 2, "/flags/german", contains=False )
wait_for_clipboard( 2, "/flags/german", contains=True )
ob_ordnance_snippet_btn.click()
wait_for_clipboard( 2, "/flags/german", contains=False )
wait_for_clipboard( 2, "/flags/german", contains=True )
# ---------------------------------------------------------------------

@ -250,10 +250,10 @@ def test_bfp_extensions( webapp, webdriver ):
btn.click()
wait_for_clipboard( 2, re.compile(
'Type 97A CHI-HA'
'.+<div class="note"'
'.+<td class="note"'
'.+8\u2020, B\u2020<sup>1</sup>, C\u2020<sup>2</sup>'
r'.+M3A1 Scout Car\(a\)'
'.+<div class="note"'
'.+<td class="note"'
'.+&#x2756;'
'.+17, A, C, AllM 34\u2020<sup>2</sup>, Jp A\u2020<sup>1</sup>, Ch F\u2020',
re.DOTALL
@ -312,14 +312,14 @@ def test_bfp_extensions2( webapp, webdriver ):
btn.click()
wait_for_clipboard( 2, re.compile(
r'\bM5A1\b'
'.+<div class="note"'
'.+<td class="note"'
'.+5\u2020, C\u2020<sup>2</sup>, F\u2020<sup>1</sup>, G, N, Y'
r'.+\bM5A1F\b'
'.+<div class="note"'
'.+<td class="note"'
'.+&#x2756;'
'.+5\u2020, US C\u2020<sup>2</sup>, US F\u2020<sup>1</sup>, US G, US N, US Y, C'
r'.+\bM5A1C\b'
'.+<div class="note"'
'.+<td class="note"'
'.+&#x2756;'
'.+5\u2020, US C\u2020<sup>2</sup>, US F\u2020<sup>1</sup>, US G, US N, US Y, A, B',
re.DOTALL
@ -383,7 +383,7 @@ def test_ffs_extensions( webapp, webdriver ):
btn.click()
wait_for_clipboard( 2, re.compile(
'POA-CWS-H5'
'.+<div class="note"'
'.+<td class="note"'
'.+&#x2756;'
'.+5\u2020, C, M',
re.DOTALL
@ -409,7 +409,7 @@ def test_ffs_extensions( webapp, webdriver ):
btn.click()
wait_for_clipboard( 2, re.compile(
r'M20\(L\) 75mm Recoilless Rifle'
'.+<div class="note"'
'.+<td class="note"'
'.+&#x2756;'
'.+25\u2020, K, M, O, P, R',
re.DOTALL

@ -15,6 +15,7 @@ from vasl_templates.webapp.tests.utils import \
new_scenario, set_player, find_child
from vasl_templates.webapp.tests.test_scenario_persistence import load_scenario, load_scenario_params, save_scenario, \
assert_scenario_params_complete
from vasl_templates.webapp.tests.test_user_settings import set_user_settings
# ---------------------------------------------------------------------
@ -28,6 +29,7 @@ def test_full_update( webapp, webdriver ):
.set_data_dir( "{REAL}" ) \
.set_vo_notes_dir( "{TEST}" if enable_vo_notes else None )
init_webapp( webapp, webdriver, vsav_persistence=1, no_app_config_snippet_params=1 )
_disable_snippet_images()
# load the scenario fields
SCENARIO_PARAMS = {
@ -211,6 +213,7 @@ def test_latw_autocreate( webapp, webdriver ):
# initialize
webapp.control_tests.set_data_dir( "{REAL}" )
init_webapp( webapp, webdriver, vsav_persistence=1 )
_disable_snippet_images()
# check the VASL scenario
fname = os.path.join( os.path.split(__file__)[0], "fixtures/update-vsav/empty.vsav" )
@ -277,6 +280,7 @@ def test_latw_update( webapp, webdriver ):
# initialize
webapp.control_tests.set_data_dir( "{REAL}" )
init_webapp( webapp, webdriver, vsav_persistence=1 )
_disable_snippet_images()
# check the VASL scenario
fname = os.path.join( os.path.split(__file__)[0], "fixtures/update-vsav/latw.vsav" )
@ -360,6 +364,7 @@ def test_update_legacy_labels( webapp, webdriver ):
.set_data_dir( "{REAL}" ) \
.set_vo_notes_dir( "{TEST}" if enable_vo_notes else None )
init_webapp( webapp, webdriver, vsav_persistence=1, scenario_persistence=1 )
_disable_snippet_images()
# dump the VASL scenario
# NOTE: We implemented snippet ID's in v0.5, this scenario is the "Hill 621" example from v0.4.
@ -448,6 +453,7 @@ def test_update_legacy_latw_labels( webapp, webdriver ):
# initialize
webapp.control_tests.set_data_dir( "{REAL}" )
init_webapp( webapp, webdriver, vsav_persistence=1, scenario_persistence=1 )
_disable_snippet_images()
# dump the VASL scenario
# NOTE: This scenario contains LATW labels created using v0.4 i.e. they have no snippet ID's.
@ -529,6 +535,7 @@ def test_player_owned_labels( webapp, webdriver ):
# initialize
webapp.control_tests.set_data_dir( "{REAL}" )
init_webapp( webapp, webdriver, vsav_persistence=1 )
_disable_snippet_images()
load_scenario_params( {
"scenario": {
"SCENARIO_NAME": "Player-owned labels",
@ -956,3 +963,14 @@ def analyze_vsav( fname, expected_ob1, expected_ob2, expected_report ):
if msg == prev_info_msg:
msg = get_stored_msg( "_last-warning_" )
assert all( e in msg for e in expected_report )
def _disable_snippet_images():
"""Disable images in snippets."""
# NOTE: These used to default to off, but we changed that to on (v1.9), and since this will cause many labels
# to update when we are not expecting them to (because they now have an image in them), we turn everything off
# before running tests.
set_user_settings( {
"include-vasl-images-in-snippets": False,
"include-flags-in-snippets": False,
"custom-list-bullets": False,
} )

Loading…
Cancel
Save