pywargame 0.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pywargame/__init__.py +2 -0
- pywargame/common/__init__.py +3 -0
- pywargame/common/collector.py +87 -0
- pywargame/common/dicedraw.py +363 -0
- pywargame/common/drawdice.py +40 -0
- pywargame/common/singleton.py +22 -0
- pywargame/common/test.py +25 -0
- pywargame/common/verbose.py +59 -0
- pywargame/common/verboseguard.py +53 -0
- pywargame/cyberboard/__init__.py +18 -0
- pywargame/cyberboard/archive.py +283 -0
- pywargame/cyberboard/base.py +63 -0
- pywargame/cyberboard/board.py +462 -0
- pywargame/cyberboard/cell.py +200 -0
- pywargame/cyberboard/collect.py +49 -0
- pywargame/cyberboard/collectgbx0pwd.py +30 -0
- pywargame/cyberboard/collectgbxext.py +30 -0
- pywargame/cyberboard/collectgsnexp.py +32 -0
- pywargame/cyberboard/collectgsnext.py +30 -0
- pywargame/cyberboard/draw.py +396 -0
- pywargame/cyberboard/exporter.py +1132 -0
- pywargame/cyberboard/extractor.py +240 -0
- pywargame/cyberboard/features.py +17 -0
- pywargame/cyberboard/gamebox.py +81 -0
- pywargame/cyberboard/gbxexp.py +76 -0
- pywargame/cyberboard/gbxext.py +64 -0
- pywargame/cyberboard/gsnexp.py +147 -0
- pywargame/cyberboard/gsnext.py +59 -0
- pywargame/cyberboard/head.py +111 -0
- pywargame/cyberboard/image.py +76 -0
- pywargame/cyberboard/main.py +47 -0
- pywargame/cyberboard/mark.py +102 -0
- pywargame/cyberboard/palette.py +36 -0
- pywargame/cyberboard/piece.py +169 -0
- pywargame/cyberboard/player.py +36 -0
- pywargame/cyberboard/scenario.py +115 -0
- pywargame/cyberboard/testgrid.py +156 -0
- pywargame/cyberboard/tile.py +121 -0
- pywargame/cyberboard/tray.py +68 -0
- pywargame/cyberboard/windows.py +41 -0
- pywargame/cyberboard/zeropwd.py +45 -0
- pywargame/cyberboard.py +2728 -0
- pywargame/gbx0pwd.py +2776 -0
- pywargame/gbxextract.py +2795 -0
- pywargame/gsnexport.py +16499 -0
- pywargame/gsnextract.py +2790 -0
- pywargame/latex/__init__.py +2 -0
- pywargame/latex/collect.py +34 -0
- pywargame/latex/latexexporter.py +4010 -0
- pywargame/latex/main.py +184 -0
- pywargame/vassal/__init__.py +66 -0
- pywargame/vassal/base.py +139 -0
- pywargame/vassal/board.py +243 -0
- pywargame/vassal/buildfile.py +60 -0
- pywargame/vassal/chart.py +79 -0
- pywargame/vassal/chessclock.py +197 -0
- pywargame/vassal/collect.py +98 -0
- pywargame/vassal/collectpatch.py +28 -0
- pywargame/vassal/command.py +21 -0
- pywargame/vassal/documentation.py +322 -0
- pywargame/vassal/dumpcollect.py +28 -0
- pywargame/vassal/dumpvsav.py +28 -0
- pywargame/vassal/element.py +439 -0
- pywargame/vassal/exporter.py +89 -0
- pywargame/vassal/extension.py +101 -0
- pywargame/vassal/folder.py +103 -0
- pywargame/vassal/game.py +940 -0
- pywargame/vassal/gameelements.py +1091 -0
- pywargame/vassal/globalkey.py +127 -0
- pywargame/vassal/globalproperty.py +433 -0
- pywargame/vassal/grid.py +573 -0
- pywargame/vassal/map.py +1061 -0
- pywargame/vassal/mapelements.py +1020 -0
- pywargame/vassal/merge.py +57 -0
- pywargame/vassal/merger.py +460 -0
- pywargame/vassal/moduledata.py +275 -0
- pywargame/vassal/mrgcollect.py +31 -0
- pywargame/vassal/patch.py +44 -0
- pywargame/vassal/patchcollect.py +28 -0
- pywargame/vassal/player.py +83 -0
- pywargame/vassal/save.py +495 -0
- pywargame/vassal/skel.py +380 -0
- pywargame/vassal/trait.py +224 -0
- pywargame/vassal/traits/__init__.py +36 -0
- pywargame/vassal/traits/area.py +50 -0
- pywargame/vassal/traits/basic.py +35 -0
- pywargame/vassal/traits/calculatedproperty.py +22 -0
- pywargame/vassal/traits/cargo.py +29 -0
- pywargame/vassal/traits/click.py +41 -0
- pywargame/vassal/traits/clone.py +28 -0
- pywargame/vassal/traits/delete.py +24 -0
- pywargame/vassal/traits/deselect.py +32 -0
- pywargame/vassal/traits/dynamicproperty.py +112 -0
- pywargame/vassal/traits/globalcommand.py +55 -0
- pywargame/vassal/traits/globalhotkey.py +26 -0
- pywargame/vassal/traits/globalproperty.py +54 -0
- pywargame/vassal/traits/hide.py +67 -0
- pywargame/vassal/traits/label.py +76 -0
- pywargame/vassal/traits/layer.py +105 -0
- pywargame/vassal/traits/mark.py +20 -0
- pywargame/vassal/traits/mask.py +85 -0
- pywargame/vassal/traits/mat.py +26 -0
- pywargame/vassal/traits/moved.py +35 -0
- pywargame/vassal/traits/movefixed.py +51 -0
- pywargame/vassal/traits/nonrect.py +95 -0
- pywargame/vassal/traits/nostack.py +55 -0
- pywargame/vassal/traits/place.py +104 -0
- pywargame/vassal/traits/prototype.py +20 -0
- pywargame/vassal/traits/report.py +34 -0
- pywargame/vassal/traits/restrictaccess.py +28 -0
- pywargame/vassal/traits/restrictcommand.py +32 -0
- pywargame/vassal/traits/return.py +40 -0
- pywargame/vassal/traits/rotate.py +62 -0
- pywargame/vassal/traits/sendto.py +59 -0
- pywargame/vassal/traits/sheet.py +129 -0
- pywargame/vassal/traits/skel.py +9 -0
- pywargame/vassal/traits/stack.py +28 -0
- pywargame/vassal/traits/submenu.py +27 -0
- pywargame/vassal/traits/trail.py +61 -0
- pywargame/vassal/traits/trigger.py +72 -0
- pywargame/vassal/turn.py +272 -0
- pywargame/vassal/upgrade.py +191 -0
- pywargame/vassal/vmod.py +323 -0
- pywargame/vassal/vsav.py +100 -0
- pywargame/vassal/widget.py +358 -0
- pywargame/vassal/withtraits.py +634 -0
- pywargame/vassal/xml.py +4 -0
- pywargame/vassal/zone.py +399 -0
- pywargame/vassal.py +12500 -0
- pywargame/vmodpatch.py +12548 -0
- pywargame/vsavdump.py +12533 -0
- pywargame/vslmerge.py +13015 -0
- pywargame/wgexport.py +16689 -0
- pywargame/ztexport.py +14351 -0
- pywargame/zuntzu/__init__.py +5 -0
- pywargame/zuntzu/base.py +82 -0
- pywargame/zuntzu/collect.py +38 -0
- pywargame/zuntzu/countersheet.py +250 -0
- pywargame/zuntzu/dicehand.py +48 -0
- pywargame/zuntzu/exporter.py +936 -0
- pywargame/zuntzu/gamebox.py +154 -0
- pywargame/zuntzu/map.py +36 -0
- pywargame/zuntzu/piece.py +37 -0
- pywargame/zuntzu/scenario.py +208 -0
- pywargame/zuntzu/ztexp.py +115 -0
- pywargame-0.3.1.dist-info/METADATA +353 -0
- pywargame-0.3.1.dist-info/RECORD +150 -0
- pywargame-0.3.1.dist-info/WHEEL +5 -0
- pywargame-0.3.1.dist-info/licenses/LICENSE +5 -0
- pywargame-0.3.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,322 @@
|
|
1
|
+
## BEGIN_IMPORT
|
2
|
+
from common import VerboseGuard
|
3
|
+
from . base import *
|
4
|
+
from . element import Element
|
5
|
+
from . gameelements import GameElement
|
6
|
+
## END_IMPORT
|
7
|
+
|
8
|
+
# ====================================================================
|
9
|
+
def createKeyHelp(*args,**kwargs):
|
10
|
+
'''Creates a help file with key-bindings
|
11
|
+
|
12
|
+
See Documentation.createKeyHelp
|
13
|
+
'''
|
14
|
+
return Documentation.createKeyHelp(*args,**kwargs)
|
15
|
+
|
16
|
+
# --------------------------------------------------------------------
|
17
|
+
class Documentation(GameElement):
|
18
|
+
TAG=Element.MODULE+'Documentation'
|
19
|
+
def __init__(self,doc,node=None,**kwargs):
|
20
|
+
'''Documentation (or help menu)
|
21
|
+
|
22
|
+
Parameters
|
23
|
+
----------
|
24
|
+
doc : Element
|
25
|
+
Parent
|
26
|
+
node : xml.dom.Element
|
27
|
+
Node to read state from
|
28
|
+
kwargs : dict
|
29
|
+
Attributes
|
30
|
+
'''
|
31
|
+
super(Documentation,self).__init__(doc,self.TAG,node=node,**kwargs)
|
32
|
+
|
33
|
+
def addAboutScreen(self,**kwargs):
|
34
|
+
'''Add a `AboutScreen` element to this
|
35
|
+
|
36
|
+
Parameters
|
37
|
+
----------
|
38
|
+
kwargs : dict
|
39
|
+
Dictionary of attribute key-value pairs
|
40
|
+
|
41
|
+
Returns
|
42
|
+
-------
|
43
|
+
element : AboutScreen
|
44
|
+
The added element
|
45
|
+
'''
|
46
|
+
return self.add(AboutScreen,**kwargs)
|
47
|
+
def addHelpFile(self,**kwargs):
|
48
|
+
'''Add a `HelpFile` element to this
|
49
|
+
|
50
|
+
Parameters
|
51
|
+
----------
|
52
|
+
kwargs : dict
|
53
|
+
Dictionary of attribute key-value pairs
|
54
|
+
|
55
|
+
Returns
|
56
|
+
-------
|
57
|
+
element : HelpFile
|
58
|
+
The added element
|
59
|
+
'''
|
60
|
+
return self.add(HelpFile,**kwargs)
|
61
|
+
def addBrowserHelpFile(self,**kwargs):
|
62
|
+
'''Add a `BrowserHelpFile` element to this
|
63
|
+
|
64
|
+
Parameters
|
65
|
+
----------
|
66
|
+
kwargs : dict
|
67
|
+
Dictionary of attribute key-value pairs
|
68
|
+
|
69
|
+
Returns
|
70
|
+
-------
|
71
|
+
element : BrowserHelpFile
|
72
|
+
The added element
|
73
|
+
'''
|
74
|
+
return self.add(BrowserHelpFile,**kwargs)
|
75
|
+
def addBrowserPDFFile(self,**kwargs):
|
76
|
+
'''Add a `BrowserPDFFile` element to this
|
77
|
+
|
78
|
+
Parameters
|
79
|
+
----------
|
80
|
+
kwargs : dict
|
81
|
+
Dictionary of attribute key-value pairs
|
82
|
+
|
83
|
+
Returns
|
84
|
+
-------
|
85
|
+
element : BrowserPDFFile
|
86
|
+
The added element
|
87
|
+
'''
|
88
|
+
return self.add(BrowserPDFFile,**kwargs)
|
89
|
+
def addTutorial(self,**kwargs):
|
90
|
+
'''Add a `Tutorial` element to this
|
91
|
+
|
92
|
+
Parameters
|
93
|
+
----------
|
94
|
+
kwargs : dict
|
95
|
+
Dictionary of attribute key-value pairs
|
96
|
+
|
97
|
+
Returns
|
98
|
+
-------
|
99
|
+
element : Tutorial
|
100
|
+
The added element
|
101
|
+
'''
|
102
|
+
return self.add(Tutorial,**kwargs)
|
103
|
+
def getAboutScreens(self):
|
104
|
+
return self.getElementsByKey(AboutScreen,'title')
|
105
|
+
def getHelpFiles(self):
|
106
|
+
return self.getElementsByKey(HelpFile,'title')
|
107
|
+
def getBrowserHelpFiles(self):
|
108
|
+
return self.getElementsByKey(BrowserHelpFile,'title')
|
109
|
+
def getBrowserPDFFiles(self):
|
110
|
+
return self.getElementsByKey(BrowserPDFFile,'title')
|
111
|
+
def getTutorials(self):
|
112
|
+
return self.getElementsByKey(Tutorial,'name')
|
113
|
+
|
114
|
+
@classmethod
|
115
|
+
def createKeyHelp(cls,keys,title='',version=''):
|
116
|
+
'''Creates a help file with key-bindings
|
117
|
+
|
118
|
+
Parameters
|
119
|
+
----------
|
120
|
+
keys : list of list of str
|
121
|
+
List of key-binding documentation
|
122
|
+
title : str
|
123
|
+
Title of help file
|
124
|
+
version : str
|
125
|
+
Version number
|
126
|
+
|
127
|
+
Returns
|
128
|
+
-------
|
129
|
+
txt : str
|
130
|
+
File content
|
131
|
+
'''
|
132
|
+
txt = f'''
|
133
|
+
<html>
|
134
|
+
<body>
|
135
|
+
<h1>{title} (Version {version}) Key bindings</h1>
|
136
|
+
<table>
|
137
|
+
<tr><th>Key</th><th>Where</th><th>Effect</th></tr>'''
|
138
|
+
|
139
|
+
for key, where, description in keys:
|
140
|
+
txt += (f'<tr><td>{key}</td>'
|
141
|
+
f'<td>{where}</td>'
|
142
|
+
f'<td>{description}</td></tr>')
|
143
|
+
|
144
|
+
txt += '''
|
145
|
+
</table>
|
146
|
+
</body>
|
147
|
+
</html>'''
|
148
|
+
|
149
|
+
return txt
|
150
|
+
|
151
|
+
registerElement(Documentation)
|
152
|
+
|
153
|
+
# --------------------------------------------------------------------
|
154
|
+
class AboutScreen(Element):
|
155
|
+
TAG = Element.MODULE+'documentation.AboutScreen'
|
156
|
+
UNIQUE = ['title']
|
157
|
+
def __init__(self,doc,node=None,title='',fileName=""):
|
158
|
+
'''Create an about screen element that shows image
|
159
|
+
|
160
|
+
Parameters
|
161
|
+
----------
|
162
|
+
doc : Element
|
163
|
+
Parent
|
164
|
+
node : xml.dom.Element
|
165
|
+
Node to read state from
|
166
|
+
title : str
|
167
|
+
Entry title
|
168
|
+
fileName : str
|
169
|
+
Internal file name
|
170
|
+
'''
|
171
|
+
super(AboutScreen,self).__init__(doc,
|
172
|
+
self.TAG,
|
173
|
+
node = node,
|
174
|
+
fileName = fileName,
|
175
|
+
title = title)
|
176
|
+
def getDocumentation(self):
|
177
|
+
'''Get Parent element'''
|
178
|
+
return self.getParent(Documentation)
|
179
|
+
|
180
|
+
registerElement(AboutScreen)
|
181
|
+
|
182
|
+
# --------------------------------------------------------------------
|
183
|
+
class BrowserPDFFile(Element):
|
184
|
+
TAG = Element.MODULE+'documentation.BrowserPDFFile'
|
185
|
+
UNIQUE = ['title','pdfFile']
|
186
|
+
def __init__(self,doc,node=None,title='',pdfFile=''):
|
187
|
+
'''Create help menu item that opens an embedded PDF
|
188
|
+
|
189
|
+
Parameters
|
190
|
+
----------
|
191
|
+
doc : Element
|
192
|
+
Parent
|
193
|
+
node : xml.dom.Element
|
194
|
+
Node to read state from
|
195
|
+
title : str
|
196
|
+
Entry title
|
197
|
+
pdfFile : str
|
198
|
+
Internal file name
|
199
|
+
'''
|
200
|
+
super(BrowserPDFFile,self).__init__(doc,self.TAG,
|
201
|
+
node = node,
|
202
|
+
pdfFile = pdfFile,
|
203
|
+
title = title)
|
204
|
+
def getDocumentation(self):
|
205
|
+
'''Get Parent element'''
|
206
|
+
return self.getParent(Documentation)
|
207
|
+
|
208
|
+
registerElement(BrowserPDFFile)
|
209
|
+
|
210
|
+
# --------------------------------------------------------------------
|
211
|
+
class HelpFile(Element):
|
212
|
+
TAG = Element.MODULE+'documentation.HelpFile'
|
213
|
+
ARCHIVE = 'archive'
|
214
|
+
UNIQUE = ['title','fileName']
|
215
|
+
def __init__(self,doc,node=None,
|
216
|
+
title='',
|
217
|
+
fileName='',
|
218
|
+
fileType=ARCHIVE):
|
219
|
+
'''Create a help menu entry that opens an embeddded file
|
220
|
+
|
221
|
+
Parameters
|
222
|
+
----------
|
223
|
+
doc : Element
|
224
|
+
Parent
|
225
|
+
node : xml.dom.Element
|
226
|
+
Node to read state from
|
227
|
+
title : str
|
228
|
+
Entry title
|
229
|
+
fileName : str
|
230
|
+
Internal file name
|
231
|
+
fileType : str
|
232
|
+
How to find the file
|
233
|
+
'''
|
234
|
+
super(HelpFile,self).__init__(doc,self.TAG,node=node,
|
235
|
+
fileName = fileName,
|
236
|
+
fileType = fileType,
|
237
|
+
title = title)
|
238
|
+
|
239
|
+
def getDocumentation(self):
|
240
|
+
'''Get Parent element'''
|
241
|
+
return self.getParent(Documentation)
|
242
|
+
|
243
|
+
registerElement(HelpFile)
|
244
|
+
|
245
|
+
# --------------------------------------------------------------------
|
246
|
+
class BrowserHelpFile(Element):
|
247
|
+
TAG = Element.MODULE+'documentation.BrowserHelpFile'
|
248
|
+
UNIQUE = ['title','startingPage']
|
249
|
+
def __init__(self,doc,node=None,
|
250
|
+
title='',
|
251
|
+
startingPage='index.html'):
|
252
|
+
'''Create a help menu entry that opens an embeddded HTML
|
253
|
+
page (with possible sub-pages) file
|
254
|
+
|
255
|
+
Parameters
|
256
|
+
----------
|
257
|
+
doc : Element
|
258
|
+
Parent
|
259
|
+
node : xml.dom.Element
|
260
|
+
Node to read state from
|
261
|
+
title : str
|
262
|
+
Entry title
|
263
|
+
startingPage : str
|
264
|
+
which file to start at
|
265
|
+
'''
|
266
|
+
super(BrowserHelpFile,self).__init__(doc,self.TAG,node=node,
|
267
|
+
startingPage=startingPage,
|
268
|
+
title=title)
|
269
|
+
|
270
|
+
def getDocumentation(self):
|
271
|
+
'''Get Parent element'''
|
272
|
+
return self.getParent(Documentation)
|
273
|
+
|
274
|
+
registerElement(BrowserHelpFile)
|
275
|
+
|
276
|
+
# --------------------------------------------------------------------
|
277
|
+
class Tutorial(Element):
|
278
|
+
TAG = Element.MODULE+'documentation.Tutorial'
|
279
|
+
UNIQUE = ['name','logfile']
|
280
|
+
def __init__(self,doc,node=None,
|
281
|
+
name = 'Tutorial',
|
282
|
+
logfile = 'tutorial.vlog',
|
283
|
+
promptMessage = 'Load the tutorial?',
|
284
|
+
welcomeMessage = 'Press "Step forward" (PnDn) to step through the tutorial',
|
285
|
+
launchOnStartup = True):
|
286
|
+
'''Add a help menu item that loads the tutorial
|
287
|
+
|
288
|
+
Also adds the start-up option to run the tutorial
|
289
|
+
|
290
|
+
|
291
|
+
Parameters
|
292
|
+
----------
|
293
|
+
doc : Element
|
294
|
+
Parent
|
295
|
+
node : xml.dom.Element
|
296
|
+
Node to read state from
|
297
|
+
name : str
|
298
|
+
Name of entry
|
299
|
+
logfile : str
|
300
|
+
Internal file name
|
301
|
+
promptMessage : str
|
302
|
+
What to show
|
303
|
+
launchOnStartup : bool
|
304
|
+
By default, launch tutorial first time running module
|
305
|
+
'''
|
306
|
+
super(Tutorial,self).__init__(doc,self.TAG,node=node,
|
307
|
+
name = name,
|
308
|
+
logfile = logfile,
|
309
|
+
promptMessage = promptMessage,
|
310
|
+
welcomeMessage = welcomeMessage,
|
311
|
+
launchOnStartup = launchOnStartup)
|
312
|
+
|
313
|
+
def getDocumentation(self):
|
314
|
+
'''Get Parent element'''
|
315
|
+
return self.getParent(Documentation)
|
316
|
+
|
317
|
+
registerElement(Tutorial)
|
318
|
+
|
319
|
+
|
320
|
+
#
|
321
|
+
# EOF
|
322
|
+
#
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
import sys
|
3
|
+
sys.path.append('..')
|
4
|
+
|
5
|
+
from common import Verbose, VerboseGuard
|
6
|
+
from common.collector import Collector
|
7
|
+
|
8
|
+
|
9
|
+
if __name__ == '__main__':
|
10
|
+
from argparse import ArgumentParser, FileType
|
11
|
+
|
12
|
+
ap = ArgumentParser(description='Collect to single script')
|
13
|
+
ap.add_argument('output',
|
14
|
+
type=FileType('w'),
|
15
|
+
nargs='?',
|
16
|
+
default='vsavdump.py',
|
17
|
+
help='Output script name')
|
18
|
+
ap.add_argument('-v','--verbose',action='store_true',
|
19
|
+
help='Be verbose')
|
20
|
+
|
21
|
+
args = ap.parse_args()
|
22
|
+
|
23
|
+
Verbose().setVerbose(args.verbose)
|
24
|
+
|
25
|
+
c = Collector()
|
26
|
+
c.run(args.output,
|
27
|
+
'vassal.py',
|
28
|
+
'dumpvsav.py')
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
## BEGIN_IMPORT
|
3
|
+
from vassal import SaveIO
|
4
|
+
## END_IMPORT
|
5
|
+
|
6
|
+
if __name__ == '__main__':
|
7
|
+
from argparse import ArgumentParser
|
8
|
+
|
9
|
+
ap = ArgumentParser(description='Dump VASSAL save or log')
|
10
|
+
ap.add_argument('input',type=str,help='Input save')
|
11
|
+
ap.add_argument('-m','--meta',action='store_true',help='Also metadata')
|
12
|
+
|
13
|
+
args = ap.parse_args()
|
14
|
+
|
15
|
+
ret = SaveIO.readSave(args.input,args.meta)
|
16
|
+
|
17
|
+
key, lines = ret[0], ret[1]
|
18
|
+
if args.meta:
|
19
|
+
savemeta, modulemeta = ret[2], ret[3]
|
20
|
+
|
21
|
+
print('\n'.join(lines))
|
22
|
+
#
|
23
|
+
#
|
24
|
+
#
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|