Show in the UI which VASL extension vehicles/ordnance came from.

master
Pacman Ghost 4 years ago
parent 04f1755415
commit 6d06fdc082
  1. 2
      vasl_templates/webapp/data/extensions/bfp-bj-v403.json
  2. 2
      vasl_templates/webapp/data/extensions/bfp-cobra-v403.json
  3. 2
      vasl_templates/webapp/data/extensions/bfp-pif-v403.json
  4. 2
      vasl_templates/webapp/data/extensions/kgs-v1.1.json
  5. 15
      vasl_templates/webapp/main.py
  6. 4
      vasl_templates/webapp/static/css/select-vo-dialog.css
  7. 9
      vasl_templates/webapp/static/vo.js
  8. 5
      vasl_templates/webapp/tests/test_vehicles_ordnance.py
  9. 1
      vasl_templates/webapp/vo.py

@ -3,6 +3,8 @@
"parentExtensionId": "adf",
"extensionId": "adf-bj",
"version": "4.03",
"displayName": "Blood & Jungle",
"displayNameAbbrev": "B+J",
"id_range": [ 900, 999 ],
"japanese": {

@ -3,6 +3,8 @@
"parentExtensionId": "adf",
"extensionId": "adf-cobra",
"version": "4.03",
"displayName": "Operation Cobra",
"displayNameAbbrev": "Op. Cobra",
"id_range": [ 850, 899 ],
"comment": "These are F (flamethrower) and C (Culin) versions of the same vehicles (from Operation Cobra).",

@ -2,6 +2,8 @@
"parentExtensionId": "adf",
"extensionId": "adf-pif",
"displayName": "Poland In Flames",
"displayNameAbbrev": "PiF",
"version": "4.03",
"id_range": [ 800, 849 ],

@ -2,6 +2,8 @@
"extensionId": "f97",
"version": "v1.1",
"displayName": "Kampfgruppe Scherer",
"displayNameAbbrev": "KGS",
"russian": {

@ -67,12 +67,16 @@ _APP_CONFIG_DEFAULTS = { # Bodhgaya, India (APR/19)
@app.route( "/app-config" )
def get_app_config():
"""Get the application config."""
# include the basic app config
vals = {
key: app.config.get( key, default )
for key,default in _APP_CONFIG_DEFAULTS.items()
}
for key in ["APP_NAME","APP_VERSION","APP_DESCRIPTION","APP_HOME_URL"]:
vals[ key ] = getattr( vasl_templates.webapp.config.constants, key )
# include information about VASSAL and VASL
from vasl_templates.webapp.vassal import VassalShim
try:
vals[ "VASSAL_VERSION" ] = VassalShim.get_version()
@ -80,6 +84,17 @@ def get_app_config():
logging.error( "Can't check the VASSAL version: %s", str(ex) )
if globvars.vasl_mod:
vals["VASL_VERSION"] = globvars.vasl_mod.vasl_version
# include information about VASL extensions
if globvars.vasl_mod and globvars.vasl_mod.extns:
vals["VASL_EXTENSIONS"] = {}
for extn in globvars.vasl_mod.extns:
extn_info = {}
for key in ("version","displayName","displayNameAbbrev"):
if key in extn[1]:
extn_info[ key ] = extn[1][ key ]
vals["VASL_EXTENSIONS"][ extn[1]["extensionId"] ] = extn_info
return jsonify( vals )
# ---------------------------------------------------------------------

@ -13,8 +13,10 @@
#select-vo .select2-dropdown .vo-entry img { height: 3.5em ; margin-right: 0.5em ; }
#select-vo .select2-dropdown .vo-entry .content { display: flex ; flex-direction: column ; justify-content: center ; }
#select-vo .select2-dropdown .vo-entry.small-piece img { height: 2.7em ; margin-left: 0.4em ; margin-right: 0.9em ; }
#select-vo .select2-dropdown .vo-entry .vo-type { font-size: 80% ; font-style: italic ; color: #888 ; }
#select-vo .select2-dropdown .vo-entry .vo-type { font-size: 80% ; font-style: italic ; color: #666 ; }
#select-vo .select2-dropdown .vo-entry .vo-extn { font-size: 70% ; font-style: italic ; color: #888 ; }
#select-vo .select2-results__option--highlighted[aria-selected] .vo-type { color: #eee ; }
#select-vo .select2-results__option--highlighted[aria-selected] .vo-extn { color: #eee ; }
#select-vo .select2-dropdown .vo-entry input.select-vo-image { width: 15px ; position: relative ; top: 10px ; }
/* -------------------------------------------------------------------- */

@ -20,11 +20,20 @@ function add_vo( vo_type, player_no )
var div_class = "vo-entry" ;
if ( is_small_vasl_piece( vo_entry ) )
div_class += " small-piece" ;
var extn_name ;
if ( vo_entry.extn_id ) {
extn_name = gAppConfig.VASL_EXTENSIONS[ vo_entry.extn_id ].displayNameAbbrev ;
if ( ! extn_name )
extn_name = gAppConfig.VASL_EXTENSIONS[ vo_entry.extn_id ].displayName ;
if ( ! extn_name )
extn_name = vo_entry.extn_id ;
}
var buf2 = [ "<div class='" + div_class + "' data-index='" + opt.id + "'>",
"<img src='" + get_vo_image_url(vo_entry,null,true,false) + "' class='vasl-image'>",
"<div class='content'><div>",
vo_entry.name,
vo_entry.type ? "&nbsp;<span class='vo-type'>("+vo_entry.type+")</span>" : "",
extn_name ? "&nbsp;<span class='vo-extn'>[" + extn_name + "]</span>" : "",
"</div></div>",
"</div>"
] ;

@ -795,7 +795,10 @@ def add_vo( webdriver, vo_type, player_no, name ):
entries = find_children( "#select-vo .select2-results li" )
if name.endswith( "s" ):
name = name[:-1]
matches = [ e for e in entries if e.text == name ]
matches = [ e
for e in entries
if re.sub( r" \[.+\]$", "", e.text ) == name # nb: remove extension ID's
]
assert len(matches) == 1
elem = matches[0]
webdriver.execute_script( "arguments[0].scrollIntoView()", elem )

@ -198,6 +198,7 @@ def _apply_extn_info( listings, extn_fname, extn_info, vo_index, vo_type ):
else:
prev_gpids = "(none)"
vo_entry["gpid"] = entry["gpid"]
# NOTE: We can't really set the extension ID here because the counter is also in the core VASL module.
logger.debug( " - %s => %s", prev_gpids, vo_entry["gpid"] )
else:
# add a new vehicle/ordnance

Loading…
Cancel
Save