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.
Files changed (150) hide show
  1. pywargame/__init__.py +2 -0
  2. pywargame/common/__init__.py +3 -0
  3. pywargame/common/collector.py +87 -0
  4. pywargame/common/dicedraw.py +363 -0
  5. pywargame/common/drawdice.py +40 -0
  6. pywargame/common/singleton.py +22 -0
  7. pywargame/common/test.py +25 -0
  8. pywargame/common/verbose.py +59 -0
  9. pywargame/common/verboseguard.py +53 -0
  10. pywargame/cyberboard/__init__.py +18 -0
  11. pywargame/cyberboard/archive.py +283 -0
  12. pywargame/cyberboard/base.py +63 -0
  13. pywargame/cyberboard/board.py +462 -0
  14. pywargame/cyberboard/cell.py +200 -0
  15. pywargame/cyberboard/collect.py +49 -0
  16. pywargame/cyberboard/collectgbx0pwd.py +30 -0
  17. pywargame/cyberboard/collectgbxext.py +30 -0
  18. pywargame/cyberboard/collectgsnexp.py +32 -0
  19. pywargame/cyberboard/collectgsnext.py +30 -0
  20. pywargame/cyberboard/draw.py +396 -0
  21. pywargame/cyberboard/exporter.py +1132 -0
  22. pywargame/cyberboard/extractor.py +240 -0
  23. pywargame/cyberboard/features.py +17 -0
  24. pywargame/cyberboard/gamebox.py +81 -0
  25. pywargame/cyberboard/gbxexp.py +76 -0
  26. pywargame/cyberboard/gbxext.py +64 -0
  27. pywargame/cyberboard/gsnexp.py +147 -0
  28. pywargame/cyberboard/gsnext.py +59 -0
  29. pywargame/cyberboard/head.py +111 -0
  30. pywargame/cyberboard/image.py +76 -0
  31. pywargame/cyberboard/main.py +47 -0
  32. pywargame/cyberboard/mark.py +102 -0
  33. pywargame/cyberboard/palette.py +36 -0
  34. pywargame/cyberboard/piece.py +169 -0
  35. pywargame/cyberboard/player.py +36 -0
  36. pywargame/cyberboard/scenario.py +115 -0
  37. pywargame/cyberboard/testgrid.py +156 -0
  38. pywargame/cyberboard/tile.py +121 -0
  39. pywargame/cyberboard/tray.py +68 -0
  40. pywargame/cyberboard/windows.py +41 -0
  41. pywargame/cyberboard/zeropwd.py +45 -0
  42. pywargame/cyberboard.py +2728 -0
  43. pywargame/gbx0pwd.py +2776 -0
  44. pywargame/gbxextract.py +2795 -0
  45. pywargame/gsnexport.py +16499 -0
  46. pywargame/gsnextract.py +2790 -0
  47. pywargame/latex/__init__.py +2 -0
  48. pywargame/latex/collect.py +34 -0
  49. pywargame/latex/latexexporter.py +4010 -0
  50. pywargame/latex/main.py +184 -0
  51. pywargame/vassal/__init__.py +66 -0
  52. pywargame/vassal/base.py +139 -0
  53. pywargame/vassal/board.py +243 -0
  54. pywargame/vassal/buildfile.py +60 -0
  55. pywargame/vassal/chart.py +79 -0
  56. pywargame/vassal/chessclock.py +197 -0
  57. pywargame/vassal/collect.py +98 -0
  58. pywargame/vassal/collectpatch.py +28 -0
  59. pywargame/vassal/command.py +21 -0
  60. pywargame/vassal/documentation.py +322 -0
  61. pywargame/vassal/dumpcollect.py +28 -0
  62. pywargame/vassal/dumpvsav.py +28 -0
  63. pywargame/vassal/element.py +439 -0
  64. pywargame/vassal/exporter.py +89 -0
  65. pywargame/vassal/extension.py +101 -0
  66. pywargame/vassal/folder.py +103 -0
  67. pywargame/vassal/game.py +940 -0
  68. pywargame/vassal/gameelements.py +1091 -0
  69. pywargame/vassal/globalkey.py +127 -0
  70. pywargame/vassal/globalproperty.py +433 -0
  71. pywargame/vassal/grid.py +573 -0
  72. pywargame/vassal/map.py +1061 -0
  73. pywargame/vassal/mapelements.py +1020 -0
  74. pywargame/vassal/merge.py +57 -0
  75. pywargame/vassal/merger.py +460 -0
  76. pywargame/vassal/moduledata.py +275 -0
  77. pywargame/vassal/mrgcollect.py +31 -0
  78. pywargame/vassal/patch.py +44 -0
  79. pywargame/vassal/patchcollect.py +28 -0
  80. pywargame/vassal/player.py +83 -0
  81. pywargame/vassal/save.py +495 -0
  82. pywargame/vassal/skel.py +380 -0
  83. pywargame/vassal/trait.py +224 -0
  84. pywargame/vassal/traits/__init__.py +36 -0
  85. pywargame/vassal/traits/area.py +50 -0
  86. pywargame/vassal/traits/basic.py +35 -0
  87. pywargame/vassal/traits/calculatedproperty.py +22 -0
  88. pywargame/vassal/traits/cargo.py +29 -0
  89. pywargame/vassal/traits/click.py +41 -0
  90. pywargame/vassal/traits/clone.py +28 -0
  91. pywargame/vassal/traits/delete.py +24 -0
  92. pywargame/vassal/traits/deselect.py +32 -0
  93. pywargame/vassal/traits/dynamicproperty.py +112 -0
  94. pywargame/vassal/traits/globalcommand.py +55 -0
  95. pywargame/vassal/traits/globalhotkey.py +26 -0
  96. pywargame/vassal/traits/globalproperty.py +54 -0
  97. pywargame/vassal/traits/hide.py +67 -0
  98. pywargame/vassal/traits/label.py +76 -0
  99. pywargame/vassal/traits/layer.py +105 -0
  100. pywargame/vassal/traits/mark.py +20 -0
  101. pywargame/vassal/traits/mask.py +85 -0
  102. pywargame/vassal/traits/mat.py +26 -0
  103. pywargame/vassal/traits/moved.py +35 -0
  104. pywargame/vassal/traits/movefixed.py +51 -0
  105. pywargame/vassal/traits/nonrect.py +95 -0
  106. pywargame/vassal/traits/nostack.py +55 -0
  107. pywargame/vassal/traits/place.py +104 -0
  108. pywargame/vassal/traits/prototype.py +20 -0
  109. pywargame/vassal/traits/report.py +34 -0
  110. pywargame/vassal/traits/restrictaccess.py +28 -0
  111. pywargame/vassal/traits/restrictcommand.py +32 -0
  112. pywargame/vassal/traits/return.py +40 -0
  113. pywargame/vassal/traits/rotate.py +62 -0
  114. pywargame/vassal/traits/sendto.py +59 -0
  115. pywargame/vassal/traits/sheet.py +129 -0
  116. pywargame/vassal/traits/skel.py +9 -0
  117. pywargame/vassal/traits/stack.py +28 -0
  118. pywargame/vassal/traits/submenu.py +27 -0
  119. pywargame/vassal/traits/trail.py +61 -0
  120. pywargame/vassal/traits/trigger.py +72 -0
  121. pywargame/vassal/turn.py +272 -0
  122. pywargame/vassal/upgrade.py +191 -0
  123. pywargame/vassal/vmod.py +323 -0
  124. pywargame/vassal/vsav.py +100 -0
  125. pywargame/vassal/widget.py +358 -0
  126. pywargame/vassal/withtraits.py +634 -0
  127. pywargame/vassal/xml.py +4 -0
  128. pywargame/vassal/zone.py +399 -0
  129. pywargame/vassal.py +12500 -0
  130. pywargame/vmodpatch.py +12548 -0
  131. pywargame/vsavdump.py +12533 -0
  132. pywargame/vslmerge.py +13015 -0
  133. pywargame/wgexport.py +16689 -0
  134. pywargame/ztexport.py +14351 -0
  135. pywargame/zuntzu/__init__.py +5 -0
  136. pywargame/zuntzu/base.py +82 -0
  137. pywargame/zuntzu/collect.py +38 -0
  138. pywargame/zuntzu/countersheet.py +250 -0
  139. pywargame/zuntzu/dicehand.py +48 -0
  140. pywargame/zuntzu/exporter.py +936 -0
  141. pywargame/zuntzu/gamebox.py +154 -0
  142. pywargame/zuntzu/map.py +36 -0
  143. pywargame/zuntzu/piece.py +37 -0
  144. pywargame/zuntzu/scenario.py +208 -0
  145. pywargame/zuntzu/ztexp.py +115 -0
  146. pywargame-0.3.1.dist-info/METADATA +353 -0
  147. pywargame-0.3.1.dist-info/RECORD +150 -0
  148. pywargame-0.3.1.dist-info/WHEEL +5 -0
  149. pywargame-0.3.1.dist-info/licenses/LICENSE +5 -0
  150. pywargame-0.3.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,940 @@
1
+ ## BEGIN_IMPORT
2
+ from common import VerboseGuard
3
+ from . base import *
4
+ from . element import Element
5
+ from . documentation import Documentation
6
+ from . gameelements import *
7
+ from . widget import *
8
+ from . player import *
9
+ from . globalproperty import *
10
+ from . chessclock import *
11
+ from . turn import TurnTrack
12
+ from . map import Map
13
+ from . mapelements import *
14
+ from . chart import *
15
+ from . board import *
16
+ ## END_IMPORT
17
+
18
+ # --------------------------------------------------------------------
19
+ class Game(Element):
20
+ TAG = Element.BUILD+'GameModule'
21
+ UNIQUE = ['name']
22
+ def __init__(self,build,node=None,
23
+ name = '',
24
+ version = '',
25
+ ModuleOther1 = "",
26
+ ModuleOther2 = "",
27
+ VassalVersion = "3.6.7",
28
+ description = "",
29
+ nextPieceSlotId = 20):
30
+ '''Create a new Game object
31
+
32
+ Parameters
33
+ ----------
34
+ build : xml.dom.Document
35
+ root note
36
+ node : xml.dom.Node
37
+ To read from, or None
38
+ name : str
39
+ Name of module
40
+ version : str
41
+ Version of module
42
+ ModuleOther1 : str
43
+ Free form string
44
+ ModuleOther2 : str
45
+ Free form string
46
+ VassalVersion : str
47
+ VASSAL version this was created for
48
+ description : str
49
+ Speaks volumes
50
+ nextPieceSlotId : int
51
+ Starting slot ID.
52
+ '''
53
+ super(Game,self).__init__(build, self.TAG,
54
+ node = node,
55
+ name = name,
56
+ version = version,
57
+ ModuleOther1 = ModuleOther1,
58
+ ModuleOther2 = ModuleOther2,
59
+ VassalVersion = VassalVersion,
60
+ description = description,
61
+ nextPieceSlotId = nextPieceSlotId)
62
+ def nextPieceSlotId(self):
63
+ '''Increment next piece slot ID'''
64
+ ret = int(self.getAttribute('nextPieceSlotId'))
65
+ self.setAttribute('nextPieceSlotId',str(ret+1))
66
+ return ret
67
+ #
68
+ def addBasicCommandEncoder(self,**kwargs):
69
+ '''Add a `BasicCommandEncoder` element to this
70
+
71
+ Parameters
72
+ ----------
73
+ kwargs : dict
74
+ Dictionary of attribute key-value pairs
75
+
76
+ Returns
77
+ -------
78
+ element : BasicCommandEncoder
79
+ The added element
80
+ '''
81
+ return self.add(BasicCommandEncoder,**kwargs)
82
+ def addGlobalTranslatableMessages(self,**kwargs):
83
+ '''Add a `GlobalTranslatableMessages` element to this
84
+
85
+ Parameters
86
+ ----------
87
+ kwargs : dict
88
+ Dictionary of attribute key-value pairs
89
+
90
+ Returns
91
+ -------
92
+ element : GlobalTranslatableMessages
93
+ The added element
94
+ '''
95
+ return self.add(GlobalTranslatableMessages,**kwargs)
96
+ def addPlayerRoster(self,**kwargs):
97
+ '''Add a `PlayerRoster` element to this
98
+
99
+ Parameters
100
+ ----------
101
+ kwargs : dict
102
+ Dictionary of attribute key-value pairs
103
+
104
+ Returns
105
+ -------
106
+ element : PlayerRoster
107
+ The added element
108
+ '''
109
+ return self.add(PlayerRoster,**kwargs)
110
+ def addChessClock(self,**kwargs):
111
+ '''Add a `ChessClockControl` element to this
112
+
113
+ Parameters
114
+ ----------
115
+ kwargs : dict
116
+ Dictionary of attribute key-value pairs
117
+
118
+ Returns
119
+ -------
120
+ element : PlayerRoster
121
+ The added element
122
+ '''
123
+ return self.add(ChessClockControl,**kwargs)
124
+ def addLanguage(self,**kwargs):
125
+ '''Add a `Language` element to this
126
+
127
+ Parameters
128
+ ----------
129
+ kwargs : dict
130
+ Dictionary of attribute key-value pairs
131
+
132
+ Returns
133
+ -------
134
+ element : Language
135
+ The added element
136
+ '''
137
+ return self.add(Language,**kwargs)
138
+ def addChatter(self,**kwargs):
139
+ '''Add a `Chatter` element to this
140
+
141
+ Parameters
142
+ ----------
143
+ kwargs : dict
144
+ Dictionary of attribute key-value pairs
145
+
146
+ Returns
147
+ -------
148
+ element : Chatter
149
+ The added element
150
+ '''
151
+ return self.add(Chatter,**kwargs)
152
+ def addKeyNamer(self,**kwargs):
153
+ '''Add a `KeyNamer` element to this
154
+
155
+ Parameters
156
+ ----------
157
+ kwargs : dict
158
+ Dictionary of attribute key-value pairs
159
+
160
+ Returns
161
+ -------
162
+ element : KeyNamer
163
+ The added element
164
+ '''
165
+ return self.add(KeyNamer,**kwargs)
166
+ def addNotes(self,**kwargs):
167
+ '''Add a `Notes` element to this
168
+
169
+ Parameters
170
+ ----------
171
+ kwargs : dict
172
+ Dictionary of attribute key-value pairs
173
+
174
+ Returns
175
+ -------
176
+ element : Notes
177
+ The added element
178
+ '''
179
+ return self.add(Notes,**kwargs)
180
+ def addLanguage(self,**kwargs):
181
+ '''Add a `Language` element to this
182
+
183
+ Parameters
184
+ ----------
185
+ kwargs : dict
186
+ Dictionary of attribute key-value pairs
187
+
188
+ Returns
189
+ -------
190
+ element : Language
191
+ The added element
192
+ '''
193
+ return self.add(Language,**kwargs)
194
+ def addChatter(self,**kwargs):
195
+ '''Add a `Chatter` element to this
196
+
197
+ Parameters
198
+ ----------
199
+ kwargs : dict
200
+ Dictionary of attribute key-value pairs
201
+
202
+ Returns
203
+ -------
204
+ element : Chatter
205
+ The added element
206
+ '''
207
+ return self.add(Chatter,**kwargs)
208
+ def addKeyNamer(self,**kwargs):
209
+ '''Add a `KeyNamer` element to this
210
+
211
+ Parameters
212
+ ----------
213
+ kwargs : dict
214
+ Dictionary of attribute key-value pairs
215
+
216
+ Returns
217
+ -------
218
+ element : KeyNamer
219
+ The added element
220
+ '''
221
+ return self.add(KeyNamer,**kwargs)
222
+ def addGlobalProperties(self,**kwargs):
223
+ '''Add a `GlobalProperties` element to this
224
+
225
+ Parameters
226
+ ----------
227
+ kwargs : dict
228
+ Dictionary of attribute key-value pairs
229
+
230
+ Returns
231
+ -------
232
+ element : GlobalProperties
233
+ The added element
234
+ '''
235
+ return self.add(GlobalProperties,**kwargs)
236
+ def addGlobalOptions(self,**kwargs):
237
+ '''Add a `GlobalOptions` element to this
238
+
239
+ Parameters
240
+ ----------
241
+ kwargs : dict
242
+ Dictionary of attribute key-value pairs
243
+
244
+ Returns
245
+ -------
246
+ element : GlobalOptions
247
+ The added element
248
+ '''
249
+ return self.add(GlobalOptions,**kwargs)
250
+ def addTurnTrack(self,**kwargs):
251
+ '''Add a `TurnTrack` element to this
252
+
253
+ Parameters
254
+ ----------
255
+ kwargs : dict
256
+ Dictionary of attribute key-value pairs
257
+
258
+ Returns
259
+ -------
260
+ element : TurnTrack
261
+ The added element
262
+ '''
263
+ return self.add(TurnTrack,**kwargs)
264
+ def addDocumentation(self,**kwargs):
265
+ '''Add a `Documentation` element to this
266
+
267
+ Parameters
268
+ ----------
269
+ kwargs : dict
270
+ Dictionary of attribute key-value pairs
271
+
272
+ Returns
273
+ -------
274
+ element : Documentation
275
+ The added element
276
+ '''
277
+ return self.add(Documentation,**kwargs)
278
+ def addPrototypes(self,**kwargs):
279
+ '''Add a `Prototypes` element to this
280
+
281
+ Parameters
282
+ ----------
283
+ kwargs : dict
284
+ Dictionary of attribute key-value pairs
285
+
286
+ Returns
287
+ -------
288
+ element : Prototypes
289
+ The added element
290
+ '''
291
+ return self.add(Prototypes,**kwargs)
292
+ def addPieceWindow(self,**kwargs):
293
+ '''Add a `PieceWindow` element to this
294
+
295
+ Parameters
296
+ ----------
297
+ kwargs : dict
298
+ Dictionary of attribute key-value pairs
299
+
300
+ Returns
301
+ -------
302
+ element : PieceWindow
303
+ The added element
304
+ '''
305
+ return self.add(PieceWindow,**kwargs)
306
+ def addChartWindow(self,**kwargs):
307
+ '''Add a `ChartWindow` element to this
308
+
309
+ Parameters
310
+ ----------
311
+ kwargs : dict
312
+ Dictionary of attribute key-value pairs
313
+
314
+ Returns
315
+ -------
316
+ element : ChartWindow
317
+ The added element
318
+ '''
319
+ return self.add(ChartWindow,**kwargs)
320
+ def addInventory(self,**kwargs):
321
+ '''Add a `Inventory` element to this
322
+
323
+ Parameters
324
+ ----------
325
+ kwargs : dict
326
+ Dictionary of attribute key-value pairs
327
+
328
+ Returns
329
+ -------
330
+ element : Inventory
331
+ The added element
332
+ '''
333
+ return self.add(Inventory,**kwargs)
334
+ def addMap(self,**kwargs):
335
+ '''Add a `Map` element to this
336
+
337
+ Parameters
338
+ ----------
339
+ kwargs : dict
340
+ Dictionary of attribute key-value pairs
341
+
342
+ Returns
343
+ -------
344
+ element : Map
345
+ The added element
346
+ '''
347
+ return self.add(Map,**kwargs)
348
+ def addDiceButton(self,**kwargs):
349
+ '''Add a `DiceButton` element to this
350
+
351
+ Parameters
352
+ ----------
353
+ kwargs : dict
354
+ Dictionary of attribute key-value pairs
355
+
356
+ Returns
357
+ -------
358
+ element : DiceButton
359
+ The added element
360
+ '''
361
+ return self.add(DiceButton,**kwargs)
362
+ def addPredefinedSetup(self,**kwargs):
363
+ '''Add a `PredefinedSetup` element to this
364
+
365
+ Parameters
366
+ ----------
367
+ kwargs : dict
368
+ Dictionary of attribute key-value pairs
369
+
370
+ Returns
371
+ -------
372
+ element : PredefinedSetup
373
+ The added element
374
+ '''
375
+ return self.add(PredefinedSetup,**kwargs)
376
+ def addGameMassKey(self,**kwargs):
377
+ '''Add a `GameMassKey` element to this
378
+
379
+ Parameters
380
+ ----------
381
+ kwargs : dict
382
+ Dictionary of attribute key-value pairs
383
+
384
+ Returns
385
+ -------
386
+ element : GameMassKey
387
+ The added element
388
+ '''
389
+ return self.add(GameMassKey,**kwargs)
390
+ def addStartupMassKey(self,**kwargs):
391
+ '''Add a `StartupMassKey` element to this
392
+
393
+ Parameters
394
+ ----------
395
+ kwargs : dict
396
+ Dictionary of attribute key-value pairs
397
+
398
+ Returns
399
+ -------
400
+ element : StartupMassKey
401
+ The added element
402
+ '''
403
+ return self.add(StartupMassKey,**kwargs)
404
+ def addMenu(self,**kwargs):
405
+ '''Add a `Menu` element to this
406
+
407
+ Parameters
408
+ ----------
409
+ kwargs : dict
410
+ Dictionary of attribute key-value pairs
411
+
412
+ Returns
413
+ -------
414
+ element : Menu
415
+ The added element
416
+ '''
417
+ return self.add(Menu,**kwargs)
418
+ def addSymbolicDice(self,**kwargs):
419
+ '''Add a `SymbolicDice` element to this
420
+
421
+ Parameters
422
+ ----------
423
+ kwargs : dict
424
+ Dictionary of attribute key-value pairs
425
+
426
+ Returns
427
+ -------
428
+ element : SymbolicDice
429
+ The added element
430
+ '''
431
+ return self.add(SymbolicDice,**kwargs)
432
+
433
+ def addFolder(self,**kwargs):
434
+ '''Add a `ModuleFolder` element to this
435
+
436
+ Parameters
437
+ ----------
438
+ kwargs : dict
439
+ Dictionary of attribute key-value pairs
440
+
441
+ Returns
442
+ -------
443
+ element : ModuleFolder
444
+ The added element
445
+ '''
446
+ return self.add(ModuleFolder,**kwargs)
447
+
448
+
449
+ # ----------------------------------------------------------------
450
+ def getGlobalProperties(self,single=True):
451
+ '''Get all or a sole `GlobalPropertie` element(s) from this
452
+
453
+ Parameters
454
+ ----------
455
+ single : bool
456
+ If `True`, there can be only one `GlobalPropertie` child, otherwise fail.
457
+ If `False` return all `GlobalPropertie` children in this element
458
+
459
+ Returns
460
+ -------
461
+ children : list
462
+ List of `GlobalPropertie` children (even if `single=True`)
463
+ '''
464
+ return self.getAllElements(GlobalProperties,single)
465
+ def getBasicCommandEncoder(self,single=True):
466
+ '''Get all or a sole `Ba` element(s) from this
467
+
468
+ Parameters
469
+ ----------
470
+ single : bool
471
+ If `True`, there can be only one `Ba` child, otherwise fail.
472
+ If `False` return all `Ba` children in this element
473
+
474
+ Returns
475
+ -------
476
+ children : list
477
+ List of `Ba` children (even if `single=True`)
478
+ '''
479
+ return self.getAllElements(BasicCommandEncoder,single)
480
+ def getGlobalTranslatableMessages(self,single=True):
481
+ '''Get all or a sole `GlobalTranslatableMessage` element(s) from this
482
+
483
+ Parameters
484
+ ----------
485
+ single : bool
486
+ If `True`, there can be only one `GlobalTranslatableMessage` child, otherwise fail.
487
+ If `False` return all `GlobalTranslatableMessage` children in this element
488
+
489
+ Returns
490
+ -------
491
+ children : list
492
+ List of `GlobalTranslatableMessage` children (even if `single=True`)
493
+ '''
494
+ return self.getAllElements(GlobalTranslatableMessages,single)
495
+ def getLanguages(self,single=False):
496
+ '''Get all or a sole `Language` element(s) from this
497
+
498
+ Parameters
499
+ ----------
500
+ single : bool
501
+ If `True`, there can be only one `Language` child, otherwise fail.
502
+ If `False` return all `Language` children in this element
503
+
504
+ Returns
505
+ -------
506
+ children : list
507
+ List of `Language` children (even if `single=True`)
508
+ '''
509
+ return self.getAllElements(Language,single)
510
+ def getChessClocks(self,asdict=False):
511
+ '''Get all or a sole `Language` element(s) from this
512
+
513
+ Parameters
514
+ ----------
515
+ single : bool
516
+ If `True`, there can be only one `Language` child, otherwise fail.
517
+ If `False` return all `Language` children in this element
518
+
519
+ Returns
520
+ -------
521
+ children : list
522
+ List of `Language` children (even if `single=True`)
523
+ '''
524
+ return self.getElementsByKey(ChessClockControl,'name',asdict)
525
+ def getChatter(self,single=True):
526
+ '''Get all or a sole `Chatter` element(s) from this
527
+
528
+ Parameters
529
+ ----------
530
+ single : bool
531
+ If `True`, there can be only one `Chatter` child, otherwise fail.
532
+ If `False` return all `Chatter` children in this element
533
+
534
+ Returns
535
+ -------
536
+ children : list
537
+ List of `Chatter` children (even if `single=True`)
538
+ '''
539
+ return self.getAllElements(Chatter,single)
540
+ def getKeyNamer(self,single=True):
541
+ '''Get all or a sole `KeyNamer` element(s) from this
542
+
543
+ Parameters
544
+ ----------
545
+ single : bool
546
+ If `True`, there can be only one `KeyNamer` child, otherwise fail.
547
+ If `False` return all `KeyNamer` children in this element
548
+
549
+ Returns
550
+ -------
551
+ children : list
552
+ List of `KeyNamer` children (even if `single=True`)
553
+ '''
554
+ return self.getAllElements(KeyNamer,single)
555
+ def getDocumentation(self,single=True):
556
+ '''Get all or a sole `Documentation` element(s) from this
557
+
558
+ Parameters
559
+ ----------
560
+ single : bool
561
+ If `True`, there can be only one `Documentation` child, otherwise fail.
562
+ If `False` return all `Documentation` children in this element
563
+
564
+ Returns
565
+ -------
566
+ children : list
567
+ List of `Documentation` children (even if `single=True`)
568
+ '''
569
+ return self.getAllElements(Documentation,single)
570
+ def getPrototypes(self,single=True):
571
+ '''Get all or a sole `Prototypes` (i.e., the containers of
572
+ prototypes, not a list of actual prototypes) element(s) from
573
+ this
574
+
575
+ Parameters
576
+ ----------
577
+ single : bool
578
+ If `True`, there can be only one `Prototypes` child, otherwise fail.
579
+ If `False` return all `Prototypes` children in this element
580
+
581
+ Returns
582
+ -------
583
+ children : list
584
+ List of `Prototype` children (even if `single=True`)
585
+
586
+ '''
587
+ return self.getAllElements(Prototypes,single)
588
+ def getPlayerRoster(self,single=True):
589
+ '''Get all or a sole `PlayerRo` element(s) from this
590
+
591
+ Parameters
592
+ ----------
593
+ single : bool
594
+ If `True`, there can be only one `PlayerRo` child, otherwise fail.
595
+ If `False` return all `PlayerRo` children in this element
596
+
597
+ Returns
598
+ -------
599
+ children : list
600
+ List of `PlayerRo` children (even if `single=True`)
601
+ '''
602
+ return self.getAllElements(PlayerRoster,single)
603
+ def getGlobalOptions(self,single=True):
604
+ '''Get all or a sole `GlobalOption` element(s) from this
605
+
606
+ Parameters
607
+ ----------
608
+ single : bool
609
+ If `True`, there can be only one `GlobalOption` child, otherwise fail.
610
+ If `False` return all `GlobalOption` children in this element
611
+
612
+ Returns
613
+ -------
614
+ children : list
615
+ List of `GlobalOption` children (even if `single=True`)
616
+ '''
617
+ return self.getAllElements(GlobalOptions,single)
618
+ def getInventories(self,asdict=True):
619
+ '''Get all Inventorie element(s) from this
620
+
621
+ Parameters
622
+ ----------
623
+ asdict : bool
624
+ If `True`, return a dictonary that maps key to `Inventorie` elements. If `False`, return a list of all Inventorie` children.
625
+
626
+ Returns
627
+ -------
628
+ children : dict or list
629
+ Dictionary or list of `Inventorie` children
630
+ '''
631
+ return self.getElementsByKey(Inventory,'name',asdict)
632
+ def getPieceWindows(self,asdict=True):
633
+ '''Get all PieceWindow element(s) from this
634
+
635
+ Parameters
636
+ ----------
637
+ asdict : bool
638
+ If `True`, return a dictonary that maps key to `PieceWindow` elements. If `False`, return a list of all PieceWindow` children.
639
+
640
+ Returns
641
+ -------
642
+ children : dict or list
643
+ Dictionary or list of `PieceWindow` children
644
+ '''
645
+ return self.getElementsByKey(PieceWindow,'name',asdict)
646
+ def getChartWindows(self,asdict=True):
647
+ '''Get all ChartWindow element(s) from this
648
+
649
+ Parameters
650
+ ----------
651
+ asdict : bool
652
+ If `True`, return a dictonary that maps key to `ChartWindow` elements. If `False`, return a list of all ChartWindow` children.
653
+
654
+ Returns
655
+ -------
656
+ children : dict or list
657
+ Dictionary or list of `ChartWindow` children
658
+ '''
659
+ return self.getElementsByKey(ChartWindow,'name',asdict)
660
+ def getDiceButtons(self,asdict=True):
661
+ '''Get all DiceButton element(s) from this
662
+
663
+ Parameters
664
+ ----------
665
+ asdict : bool
666
+ If `True`, return a dictonary that maps key to `DiceButton` elements. If `False`, return a list of all DiceButton` children.
667
+
668
+ Returns
669
+ -------
670
+ children : dict or list
671
+ Dictionary or list of `DiceButton` children
672
+ '''
673
+ return self.getElementsByKey(DiceButton,'name',asdict)
674
+ def getPredefinedSetups(self,asdict=True):
675
+ '''Get all PredefinedSetup element(s) from this
676
+
677
+ Parameters
678
+ ----------
679
+ asdict : bool
680
+ If `True`, return a dictonary that maps key to `PredefinedSetup` elements. If `False`, return a list of all PredefinedSetup` children.
681
+
682
+ Returns
683
+ -------
684
+ children : dict or list
685
+ Dictionary or list of `PredefinedSetup` children
686
+ '''
687
+ return self.getElementsByKey(PredefinedSetup,'name',asdict)
688
+ def getNotes(self,single=True):
689
+ '''Get all or a sole `Note` element(s) from this
690
+
691
+ Parameters
692
+ ----------
693
+ single : bool
694
+ If `True`, there can be only one `Note` child, otherwise fail.
695
+ If `False` return all `Note` children in this element
696
+
697
+ Returns
698
+ -------
699
+ children : list
700
+ List of `Note` children (even if `single=True`)
701
+ '''
702
+ return self.getAllElements(Notes,single)
703
+ def getTurnTracks(self,asdict=True):
704
+ '''Get all TurnTrack element(s) from this
705
+
706
+ Parameters
707
+ ----------
708
+ asdict : bool
709
+ If `True`, return a dictonary that maps key to `TurnTrack` elements. If `False`, return a list of all TurnTrack` children.
710
+
711
+ Returns
712
+ -------
713
+ children : dict or list
714
+ Dictionary or list of `TurnTrack` children
715
+ '''
716
+ return self.getElementsByKey(TurnTrack,'name',asdict)
717
+ def getPieces(self,asdict=False):
718
+ '''Get all Piece element(s) from this
719
+
720
+ Parameters
721
+ ----------
722
+ asdict : bool
723
+ If `True`, return a dictonary that maps key to `Piece` elements. If `False`, return a list of all Piece` children.
724
+
725
+ Returns
726
+ -------
727
+ children : dict or list
728
+ Dictionary or list of `Piece` children
729
+ '''
730
+ return self.getElementsByKey(PieceSlot,'entryName',asdict)
731
+ def getCards(self,asdict=False):
732
+ '''Get all Cards element(s) from this
733
+
734
+ Parameters
735
+ ----------
736
+ asdict : bool
737
+ If `True`, return a dictonary that maps key to `Piece` elements. If `False`, return a list of all Piece` children.
738
+
739
+ Returns
740
+ -------
741
+ children : dict or list
742
+ Dictionary or list of `Piece` children
743
+ '''
744
+ return self.getElementsByKey(CardSlot,'entryName',asdict)
745
+ def getSpecificPieces(self,*names,asdict=False):
746
+ '''Get all SpecificPiece element(s) from this
747
+
748
+ Parameters
749
+ ----------
750
+ asdict : bool
751
+ If `True`, return a dictonary that maps key to `SpecificPiece` elements. If `False`, return a list of all SpecificPiece` children.
752
+
753
+ Returns
754
+ -------
755
+ children : dict or list
756
+ Dictionary or list of `SpecificPiece` children
757
+ '''
758
+ return self.getSpecificElements(PieceSlot,'entryName',
759
+ *names,asdict=asdict)
760
+ def getMap(self,asdict=False):
761
+ return self.getElementsByKey(Map,'mapName',asdict)
762
+ def getWidgetMaps(self,asdict=True):
763
+ '''Get all WidgetMap element(s) from this
764
+
765
+ Parameters
766
+ ----------
767
+ asdict : bool
768
+ If `True`, return a dictonary that maps key to `WidgetMap` elements. If `False`, return a list of all WidgetMap` children.
769
+
770
+ Returns
771
+ -------
772
+ children : dict or list
773
+ Dictionary or list of `WidgetMap` children
774
+ '''
775
+ return self.getElementsByKey(WidgetMap,'mapName',asdict=asdict)
776
+ def getMaps(self,asdict=True):
777
+ '''Get all Map element(s) from this
778
+
779
+ Parameters
780
+ ----------
781
+ asdict : bool
782
+ If `True`, return a dictonary that maps key to `Map` elements. If `False`, return a list of all Map` children.
783
+
784
+ Returns
785
+ -------
786
+ children : dict or list
787
+ Dictionary or list of `Map` children
788
+ '''
789
+ maps = self.getMap(asdict=asdict)
790
+ wmaps = self.getWidgetMaps(asdict=asdict)
791
+ if asdict:
792
+ maps.update(wmaps)
793
+ else:
794
+ maps.extend(wmaps)
795
+ return maps
796
+ def getBoards(self,asdict=True):
797
+ '''Get all Board element(s) from this
798
+
799
+ Parameters
800
+ ----------
801
+ asdict : bool
802
+ If `True`, return a dictonary that maps key to `Board`
803
+ elements. If `False`, return a list of all Board`
804
+ children.
805
+
806
+
807
+ Returns
808
+ -------
809
+ children : dict or list
810
+ Dictionary or list of `Board` children
811
+
812
+ '''
813
+ return self.getElementsByKey(Board,'name',asdict)
814
+ def getGameMassKeys(self,asdict=True):
815
+ '''Get all GameMassKey element(s) from this
816
+
817
+ Parameters
818
+ ----------
819
+ asdict : bool
820
+ If `True`, return a dictonary that maps key to `Board`
821
+ elements. If `False`, return a list of all Board`
822
+ children.
823
+
824
+
825
+ Returns
826
+ -------
827
+ children : dict or list
828
+ Dictionary or list of `Board` children
829
+
830
+ '''
831
+ return self.getElementsByKey(GameMassKey,'name',asdict)
832
+ def getStartupMassKeys(self,asdict=True):
833
+ '''Get all StartupMassKey element(s) from this
834
+
835
+ Parameters
836
+ ----------
837
+ asdict : bool
838
+ If `True`, return a dictonary that maps key to `Board`
839
+ elements. If `False`, return a list of all Board`
840
+ children.
841
+
842
+
843
+ Returns
844
+ -------
845
+ children : dict or list
846
+ Dictionary or list of `Board` children
847
+
848
+ '''
849
+ return self.getElementsByKey(StartupMassKey,'name',asdict)
850
+ def getMenus(self,asdict=True):
851
+ '''Get all Menu element(s) from this
852
+
853
+ Parameters
854
+ ----------
855
+ asdict : bool
856
+ If `True`, return a dictonary that maps key to `Board`
857
+ elements. If `False`, return a list of all Board`
858
+ children.
859
+
860
+
861
+ Returns
862
+ -------
863
+ children : dict or list
864
+ Dictionary or list of `Board` children
865
+
866
+ '''
867
+ return self.getElementsByKey(Menu,'text',asdict)
868
+ def getSymbolicDices(self,asdict=True):
869
+ '''Get all Menu element(s) from this
870
+
871
+ Parameters
872
+ ----------
873
+ asdict : bool
874
+ If `True`, return a dictonary that maps key to `SymbolicDice`
875
+ elements. If `False`, return a list of all `SymbolicDice`
876
+ children.
877
+
878
+ Returns
879
+ -------
880
+ children : dict or list
881
+ Dictionary or list of `SymbolicDice` children
882
+
883
+ '''
884
+ return self.getElementsByKey(SymbolicDice,'name',asdict)
885
+ def getFolders(self,asdict=True):
886
+ '''Get all Menu element(s) from this
887
+
888
+ Parameters
889
+ ----------
890
+ asdict : bool
891
+ If `True`, return a dictonary that maps key to `Folder`
892
+ elements. If `False`, return a list of all `Folder`
893
+ children.
894
+
895
+ Returns
896
+ -------
897
+ children : dict or list
898
+ Dictionary or list of `Folder` children
899
+
900
+ '''
901
+ return self.getElementsByKey(ModuleFolder,'name',asdict)
902
+
903
+ def getAtStarts(self,single=False):
904
+ '''Get all or a sole `AtStart` element(s) from this
905
+
906
+ Parameters
907
+ ----------
908
+ single : bool
909
+ If `True`, there can be only one `AtStart` child, otherwise fail.
910
+ If `False` return all `AtStart` children in this element
911
+
912
+ Returns
913
+ -------
914
+ children : list
915
+ List of `AtStart` children (even if `single=True`)
916
+ '''
917
+ return self.getAllElements(AtStart,single)
918
+
919
+ registerElement(Game)
920
+
921
+ # --------------------------------------------------------------------
922
+ # Old game module class
923
+ class OldGame(Game):
924
+ TAG = 'VASSAL.launch.BasicModule'
925
+ def __init__(self,build,**kwargs):
926
+ super().__init__(build,**kwargs)
927
+
928
+ registerElement(OldGame)
929
+
930
+ # --------------------------------------------------------------------
931
+ class BasicCommandEncoder(GameElement):
932
+ TAG = Element.MODULE+'BasicCommandEncoder'
933
+ def __init__(self,doc,node=None):
934
+ super(BasicCommandEncoder,self).__init__(doc,self.TAG,node=node)
935
+
936
+ registerElement(BasicCommandEncoder)
937
+
938
+ #
939
+ # EOF
940
+ #