summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/wargame/source/utils
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/wargame/source/utils')
-rwxr-xr-xmacros/latex/contrib/wargame/source/utils/wgexport.py (renamed from macros/latex/contrib/wargame/source/utils/export.py)248
-rwxr-xr-xmacros/latex/contrib/wargame/source/utils/wgsvg2tikz.py (renamed from macros/latex/contrib/wargame/source/utils/svg2tikz.py)0
2 files changed, 123 insertions, 125 deletions
diff --git a/macros/latex/contrib/wargame/source/utils/export.py b/macros/latex/contrib/wargame/source/utils/wgexport.py
index d62c9e5f77..9ad370cfcd 100755
--- a/macros/latex/contrib/wargame/source/utils/export.py
+++ b/macros/latex/contrib/wargame/source/utils/wgexport.py
@@ -320,6 +320,10 @@ def get_helpfiles(doc,key='fileName',asdict=True):
return get_asdict(doc,MODULE+'documentation.HelpFile',key,asdict)
# --------------------------------------------------------------------
+def get_tutorials(doc,key='name',asdict=True):
+ return get_asdict(doc,MODULE+'documentation.Tutorial',key,asdict)
+
+# --------------------------------------------------------------------
def get_inventories(doc,key='name',asdict=False):
return get_asdict(doc,MODULE+'Inventory',key,asdict)
@@ -723,6 +727,20 @@ def add_htmlfile(root,doc,title,startingPage='index.html'):
title=title)
# --------------------------------------------------------------------
+def add_tutorial(root,doc,
+ name = 'Tutorial',
+ logfile = 'tutorial.vlog',
+ promptMessage = 'Load the tutorial?',
+ welcomeMessage = 'Press "Step forward" (PnDn) to step through the tutorial',
+ launchOnStartup = True):
+ return add_node(root,doc,MODULE+'documentation.Tutorial',
+ name = name,
+ logfile = logfile,
+ promptMessage = promptMessage,
+ welcomeMessage = welcomeMessage,
+ launchOnStartup = launchOnStartup)
+
+# --------------------------------------------------------------------
def add_roster(root,doc,buttonKeyStroke='',
buttonText='Retire',
buttonToolTip='Switch sides, become observer, or release faction'):
@@ -775,7 +793,7 @@ def add_inventory(root,doc,
foldersOnly = False,
forwardKeystroke = True,
groupBy = '',
- hotkey = key('I'),
+ hotkey = key('I',ALT),
icon = '/images/inventory.gif',
include = '{}',
launchFunction = 'functionHide',
@@ -786,7 +804,7 @@ def add_inventory(root,doc,
pieceZoom2 = '0.5',
pieceZoom3 = '0.6',
propertyGate = '',
- refreshHotkey = key('I',195),
+ refreshHotkey = key('I',ALT_SHIFT),
showMenu = True,
sides = '',
sortFormat = '$PieceName$',
@@ -1292,7 +1310,7 @@ def add_counterviewer(root,map,
def add_globalmap(root,map,
buttonText = '',
color = rgb(255,0,0),
- hotkey = '79,195',
+ hotkey = key('O',CTRL_SHIFT),
icon = '/images/overview.gif',
scale = 0.2,
tooltip = 'Show/Hide overview window'):
@@ -1315,7 +1333,7 @@ def add_zoomer(root,map,
pickButtonText = '',
pickIconName = '/images/zoom.png',
pickTooltip = 'Select Zoom',
- zoomInKey = '61,195',
+ zoomInKey = key('=',CTRL_SHIFT),
zoomLevels = [0.2,0.25,0.333,0.4,0.5,0.555,0.625,0.75,1.0,1.25,1.6],
zoomOutKey = key('-'),
zoomPickKey = key('='),
@@ -2240,7 +2258,7 @@ def add_notes(root,doc,zipfile,title,version,sides,pdffile,infofile,rules,
</ul>
<p>
both generated by LaTeX using the <b>wargame</b> [1] package, and
- processed by the Python script <code>export.py</code> from that
+ processed by the Python script <code>wgexport.py</code> from that
package.
</p>
<p>
@@ -2252,7 +2270,7 @@ def add_notes(root,doc,zipfile,title,version,sides,pdffile,infofile,rules,
</p>
<h2>Content of the module</h2>
<p>
- The <code>export.py</code> Python script has identified the
+ The <code>wgexport.py</code> Python script has identified the
factions of the game to be
</p>
<ul>
@@ -2305,94 +2323,11 @@ def add_notes(root,doc,zipfile,title,version,sides,pdffile,infofile,rules,
then that has been included in the module and is accessible from
the "Help" menu.
</p>
- <h2>Key-bindings</h2>
- <p>
- The following key bindings have been defined
- </p>
- <table>
- <tr>
- <td>Alt-A</td>
- <td>Show the charts panel</td>
- </tr>
- <tr>
- <td>Alt-B</td>
- <td>Show the OOBs</td>
- </tr>
- <tr>
- <td>Alt-C</td>
- <td>Show the counters panel</td>
- </tr>
- <tr>
- <td>Alt-E</td>
- <td>Show the eliminated units</td>
- </tr>
- <tr>
- <td>Alt-6</td>
- <td>Roll the die</td>
- </tr>
- <tr>
- <td>Ctrl-O</td>
- <td>Hide/show counters</td>
- </tr>
- <tr>
- <td>Ctrl-F</td>
- <td>Flip selected counters</td>
- </tr>
- <tr>
- <td>Ctrl-E</td>
- <td>Eliminate selected counters</td>
- </tr>
- <tr>
- <td>Ctrl-+</td>
- <td>Zoom in</td>
- </tr>
- <tr>
- <td>Ctrl--</td>
- <td>Zoom out</td>
- </tr>
- <tr>
- <td>Ctrl-=</td>
- <td>Select zoom</td>
- </tr>
- <tr>
- <td>Ctrl-Shift-O</td>
- <td>Show overview map</td>
- </tr>
- </table>
-
- Counter short cuts (may not work, right click and use context menu)
- <table>
- <tr>
- <td>Ctrl-F</td>
- <td>Flip counter</td>
- </tr>
- <tr>
- <td>Ctrl-D</td>
- <td>Delete counter</td>
- </tr>
- <tr>
- <td>Ctrl-M</td>
- <td>Toggle "moved" marker</td>
- </tr>
- <tr>
- <td>Ctrl-T</td>
- <td>Toggle move trail</td>
- </tr>
- <tr>
- <td>Ctrl-E</td>
- <td>Eliminate unit</td>
- </tr>
- <tr>
- <td>Ctrl-R</td>
- <td>Restore unit (from dead pool)</td>
- </tr>
- </table>
<h2>After finalising the module</h2>
<p>
After the developer has finalised the module (added more pieces,
fixed board zones a and grids, add in more commands), then this
- Help menu entry should be deleted. You may want to keep key
- bindings information in some help file.
+ Help menu entry should be deleted.
</p>
</body>
</html>
@@ -2436,24 +2371,64 @@ def add_notes(root,doc,zipfile,title,version,sides,pdffile,infofile,rules,
<td>Show the eliminated units</td>
</tr>
<tr>
+ <td>Alt-I</td>
+ <td>-</td>
+ <td>Show/refresh inventory window</td>
+ </tr>
+ <tr>
+ <td>Alt-M</td>
+ <td>-</td>
+ <td>Show map</td>
+ </tr>
+ <tr>
+ <td>Alt-T</td>
+ <td>-</td>
+ <td>Increase turn track</td>
+ </tr>
+ <tr>
+ <td>Alt-Shift-T</td>
+ <td>-</td>
+ <td>Decrease turn track</td>
+ </tr>
+ <tr>
<td>Alt-6</td>
<td>-</td>
<td>Roll the dice</td>
</tr>
<tr>
- <td>Ctrl-O</td>
- <td>Board</td>
- <td>Hide/show counters</td>
+ <td>Ctrl-D</td>
+ <td>Board,Counter</td>
+ <td>Delete selected counters</td>
+ </tr>
+ <tr>
+ <td>Ctrl-E</td>
+ <td>Board,Counter</td>
+ <td>Eliminate selected counters</td>
</tr>
<tr>
<td>Ctrl-F</td>
- <td>Board</td>
+ <td>Board,Counter</td>
<td>Flip selected counters</td>
</tr>
<tr>
- <td>Ctrl-E</td>
+ <td>Ctrl-M</td>
+ <td>Board,Counter</td>
+ <td>Toggle "moved" markers on selected counters</td>
+ </tr>
+ <tr>
+ <td>Ctrl-O</td>
<td>Board</td>
- <td>Eliminate selected counters</td>
+ <td>Hide/show counters</td>
+ </tr>
+ <tr>
+ <td>Ctrl-R</td>
+ <td>Board,Counter</td>
+ <td>Restore unit (from dead pool)</td>
+ </tr>
+ <tr>
+ <td>Ctrl-T</td>
+ <td>Board,Counter</td>
+ <td>Toggle move trail</td>
</tr>
<tr>
<td>Ctrl-+</td>
@@ -2476,40 +2451,41 @@ def add_notes(root,doc,zipfile,title,version,sides,pdffile,infofile,rules,
<td>Show overview map</td>
</tr>
<tr>
- <td>Ctrl-F</td>
- <td>Counter</td>
- <td>Flip counter</td>
+ <td>&larr;,&rarr;,&uarr;&darr;</td>
+ <td>Board</td>
+ <td>Scroll board left, right, up, down (slowly)</td>
</tr>
<tr>
- <td>Ctrl-D</td>
- <td>Counter</td>
- <td>Delete counter</td>
+ <td>PnUp,PnDn</td>
+ <td>Board</td>
+ <td>Scroll board up/down (fast)</td>
</tr>
<tr>
- <td>Ctrl-M</td>
- <td>Counter</td>
- <td>Toggle "moved" marker</td>
+ <td>Ctrl-PnUp,Ctrl-PnDn</td>
+ <td>Board</td>
+ <td>Scroll board left/right (fast)</td>
</tr>
<tr>
- <td>Ctrl-T</td>
- <td>Counter</td>
- <td>Toggle move trail</td>
+ <td>Mouse-scroll up/down</td>
+ <td>Board</td>
+ <td>Scroll board up//down</td>
</tr>
<tr>
- <td>Ctrl-E</td>
- <td>Counter</td>
- <td>Eliminate unit</td>
+ <td>Shift-Mouse-scroll up/down</td>
+ <td>Board</td>
+ <td>Scroll board right/leftown</td>
</tr>
<tr>
- <td>Ctrl-R</td>
- <td>Counter</td>
- <td>Restore unit (from dead pool)</td>
+ <td>Ctrl-Mouse-scroll up/down</td>
+ <td>Board</td>
+ <td>Zoom board out/in</td>
+ </tr>
+ <tr>
+ <td>Mouse-2</td>
+ <td>Board</td>
+ <td>Centre on mouse</td>
</tr>
</table>
- <p>
- Counter short cuts (may not work, right click and use context
- menu)
- </p>
</body>
</html>
'''
@@ -2522,6 +2498,17 @@ def add_notes(root,doc,zipfile,title,version,sides,pdffile,infofile,rules,
return notes
# --------------------------------------------------------------------
+def add_tut(root,doc,zipfile,tutorial,verbose=False):
+ if tutorial is None:
+ return None
+
+ if verbose:
+ print(f'Adding tutorial {tutorial}')
+ zipfile.write(tutorial,'tutorial.vlog')
+
+ return add_tutorial(root,doc,name='Tutorial',logfile='tutorial.vlog')
+
+# --------------------------------------------------------------------
def add_basics_to_map(root,map,**attr):
'''Add a map to the document
@@ -2555,6 +2542,7 @@ def add_basics_to_map(root,map,**attr):
add_keybufferer (root,map)
add_selectionhighlighters(root,map) # TBD
add_highlightlastmoved (root,map)
+ add_zoomer (root,map)
return stacking
@@ -2976,7 +2964,6 @@ def add_map_board(root,game,name,board,gpid,verbose=False,visible=False):
add_counterviewer (root,map)
add_hidepieces (root,map)
add_globalmap (root,map)
- add_zoomer (root,map)
add_basics_to_map (root,map)
add_masskey (root,map,'Flip', key('F'),key('F'),
icon = '/images/Undo16.gif',
@@ -3054,7 +3041,6 @@ def add_oob(root,widget,name,oob,gpid,hotkey='',verbose=False,visible=False):
bpicker = add_boardpicker(root,map)
add_counterviewer (root,map)
- add_zoomer (root,map)
add_basics_to_map (root,map)
@@ -3305,6 +3291,7 @@ def create_build(info,
version,
desc = '',
rules = None,
+ tutorial = None,
pdffile = '',
infofile = '',
verbose = False,
@@ -3365,7 +3352,8 @@ def create_build(info,
# Add document parts
doc = add_documentation(root,game)
add_splash(root, doc, categories, title,verbose)
- add_rules(root, doc, zipfile, rules,verbose)
+ add_rules(root, doc, zipfile, rules, verbose)
+ add_tut(root, doc, zipfile, tutorial, verbose)
notes = add_notes(root,doc,zipfile,title,version,
sides,pdffile,infofile,rules,verbose)
@@ -3479,6 +3467,7 @@ def create_vmod(vmodname,
version,
desc = '',
rules = None,
+ tutorial = None,
pdfname = '',
infoname = '',
patch = None,
@@ -3580,6 +3569,7 @@ def create_vmod(vmodname,
version,
desc,
rules,
+ tutorial,
pdfname,
infoname,
verbose,
@@ -3628,6 +3618,7 @@ def export(vmodname = 'Draft.vmod',
version = 'Draft',
desc = '',
rules = None,
+ tutorial = None,
patch = None,
verbose = False,
visible = False):
@@ -3649,7 +3640,8 @@ def export(vmodname = 'Draft.vmod',
f'Title : {title}\n'
f'Version : {version}\n'
f'Description : {desc}\n'
- f'Rules : {rules}\n')
+ f'Rules : {rules}\n'
+ f'Tutorial : {tutorial}')
info = convert_pages(pdfname=pdfname,infoname=infoname)
return create_vmod(vmodname = vmodname,
info = info,
@@ -3657,6 +3649,7 @@ def export(vmodname = 'Draft.vmod',
version = version,
desc = desc,
rules = rules,
+ tutorial = tutorial,
pdfname = pdfname,
infoname = infoname,
patch = patch,
@@ -3695,6 +3688,9 @@ if __name__ == '__main__':
ap.add_argument('-r','--rules',
help='Rules PDF file',
type=FileType('r'))
+ ap.add_argument('-T','--tutorial',
+ help='Tutorial (v)log file',
+ type=FileType('r'))
ap.add_argument('-d','--description',
help='Short description of module',
type=str,
@@ -3711,9 +3707,10 @@ if __name__ == '__main__':
args = ap.parse_args()
-
- vmodname = args.output.name
- rulesname = args.rules.name if args.rules is not None else None
+
+ vmodname = args.output.name
+ rulesname = args.rules.name if args.rules is not None else None
+ tutname = args.tutorial.name if args.tutorial is not None else None
args.output.close()
patchname = args.patch.name if args.patch is not None else None
@@ -3731,6 +3728,7 @@ if __name__ == '__main__':
version = args.version,
desc = args.description,
rules = rulesname,
+ tutorial = tutname,
patch = patchname,
verbose = args.verbose,
visible = args.visible_grids)
diff --git a/macros/latex/contrib/wargame/source/utils/svg2tikz.py b/macros/latex/contrib/wargame/source/utils/wgsvg2tikz.py
index a9f3c60203..a9f3c60203 100755
--- a/macros/latex/contrib/wargame/source/utils/svg2tikz.py
+++ b/macros/latex/contrib/wargame/source/utils/wgsvg2tikz.py