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,1061 @@
1
+ ## BEGIN_IMPORT
2
+ from common import VerboseGuard
3
+ from . base import *
4
+ from . element import Element
5
+ from . mapelements import *
6
+ from . board import *
7
+ from . gameelements import *
8
+ ## END_IMPORT
9
+
10
+ # --------------------------------------------------------------------
11
+ class BaseMap(Element):
12
+ UNIQUE = ['mapName']
13
+ def __init__(self,doc,tag,node=None,
14
+ mapName = '',
15
+ allowMultiple = 'false',
16
+ backgroundcolor = rgb(255,255,255),
17
+ buttonName = '',
18
+ changeFormat = '$message$',
19
+ color = rgb(0,0,0), # Selected pieces
20
+ createFormat = '$pieceName$ created in $location$ *',
21
+ edgeHeight = '0',
22
+ edgeWidth = '0',
23
+ hideKey = '',
24
+ hotkey = key('M',ALT),
25
+ icon = '/images/map.gif',
26
+ launch = 'false',
27
+ markMoved = 'Always',
28
+ markUnmovedHotkey = '',
29
+ markUnmovedIcon = '/images/unmoved.gif',
30
+ markUnmovedReport = '',
31
+ markUnmovedText = '',
32
+ markUnmovedTooltip = 'Mark all pieces on this map as not moved',
33
+ moveKey = '',
34
+ moveToFormat = '$pieceName$ moves $previousLocation$ → $location$ *',
35
+ moveWithinFormat = '$pieceName$ moves $previousLocation$ → $location$ *',
36
+ showKey = '',
37
+ thickness = '3',
38
+ **kwargs):
39
+ '''Create a map
40
+
41
+ Parameters
42
+ ----------
43
+ doc : xml.minidom.Document
44
+ Parent document
45
+ tag : str
46
+ XML tag
47
+ node : xml.minidom.Node or None
48
+ Existing node or None
49
+ mapName : str
50
+ Name of map
51
+ allowMultiple : bool
52
+ Allow multiple boards
53
+ backgroundcolor : color
54
+ Bckground color
55
+ buttonName : str
56
+ Name on button to show map = '',
57
+ changeFormat :
58
+ Message format to show on changes
59
+ color : color
60
+ Color of selected pieces
61
+ createFormat : str
62
+ Message format when creating a piece
63
+ edgeHeight : int
64
+ Height of edge (margin)
65
+ edgeWidth : int
66
+ Width of edge (margin)
67
+ hideKey : Key
68
+ Hot-key or key-command to hide map
69
+ hotkey : Key
70
+ Hot-key or key-command to show map
71
+ icon : path
72
+ Icon image
73
+ launch : bool
74
+ Show on launch
75
+ markMoved : str
76
+ Show moved
77
+ markUnmovedHotkey : key
78
+ Remove moved markers
79
+ markUnmovedIcon : path
80
+ Icon for unmoved
81
+ markUnmovedReport : str
82
+ Message when marking as unmoved
83
+ markUnmovedText : str
84
+ Text on button
85
+ markUnmovedTooltip : str
86
+ Tooltip on button
87
+ moveKey : key
88
+ Key to set moved marker
89
+ moveToFormat : str
90
+ Message format when moving
91
+ moveWithinFormat : str
92
+ Message when moving within map
93
+ showKey : str,
94
+ Key to show map
95
+ thickness : int
96
+ Thickness of line around selected pieces
97
+ '''
98
+ super(BaseMap,self).__init__(doc,tag,node=node,
99
+ allowMultiple = allowMultiple,
100
+ backgroundcolor = backgroundcolor,
101
+ buttonName = buttonName,
102
+ changeFormat = changeFormat,
103
+ color = color,
104
+ createFormat = createFormat,
105
+ edgeHeight = edgeHeight,
106
+ edgeWidth = edgeWidth,
107
+ hideKey = hideKey,
108
+ hotkey = hotkey,
109
+ icon = icon,
110
+ launch = launch,
111
+ mapName = mapName,
112
+ markMoved = markMoved,
113
+ markUnmovedHotkey = markUnmovedHotkey,
114
+ markUnmovedIcon = markUnmovedIcon,
115
+ markUnmovedReport = markUnmovedReport,
116
+ markUnmovedText = markUnmovedText,
117
+ markUnmovedTooltip = markUnmovedTooltip,
118
+ moveKey = moveKey,
119
+ moveToFormat = moveToFormat,
120
+ moveWithinFormat = moveWithinFormat,
121
+ showKey = showKey,
122
+ thickness = thickness,
123
+ **kwargs)
124
+
125
+ def getGame(self):
126
+ '''Get the game'''
127
+ ## BEGIN_IMPORT
128
+ from . game import Game
129
+ ## END_IMPORT
130
+ return self.getParentOfClass([Game])
131
+ def addPicker(self,**kwargs):
132
+ '''Add a `Picker` element to this
133
+
134
+ Parameters
135
+ ----------
136
+ kwargs : dict
137
+ Dictionary of attribute key-value pairs
138
+
139
+ Returns
140
+ -------
141
+ element : Picker
142
+ The added element
143
+ '''
144
+ return self.add(BoardPicker,**kwargs)
145
+ def addFolder(self,**kwargs):
146
+ '''Add a `ModuleFolder` element to this
147
+
148
+ Parameters
149
+ ----------
150
+ kwargs : dict
151
+ Dictionary of attribute key-value pairs
152
+
153
+ Returns
154
+ -------
155
+ element : ModuleFolder
156
+ The added element
157
+ '''
158
+ return self.add(MapFolder,**kwargs)
159
+ def getBoardPicker(self,single=True):
160
+ '''Get all or a sole `BoardPicker` element(s) from this
161
+
162
+ Parameters
163
+ ----------
164
+ single : bool
165
+ If `True`, there can be only one `BoardPicker` child, otherwise fail.
166
+ If `False` return all `BoardPicker` children in this element
167
+
168
+ Returns
169
+ -------
170
+ children : list
171
+ List of `BoardPicker` children (even if `single=True`)
172
+ '''
173
+ return self.getAllElements(BoardPicker,single)
174
+ def getPicker(self,single=True):
175
+ '''Get all or a sole `BoardPicker` element(s) from this
176
+
177
+ Parameters
178
+ ----------
179
+ single : bool
180
+ If `True`, there can be only one `BoardPicker` child, otherwise fail.
181
+ If `False` return all `BoardPicker` children in this element
182
+
183
+ Returns
184
+ -------
185
+ children : list
186
+ List of `BoardPicker` children (even if `single=True`)
187
+ '''
188
+ return self.getAllElements(BoardPicker,single)
189
+ def getStackMetrics(self,single=True):
190
+ '''Get all or a sole `StackMetric` element(s) from this
191
+
192
+ Parameters
193
+ ----------
194
+ single : bool
195
+ If `True`, there can be only one `StackMetric` child, otherwise fail.
196
+ If `False` return all `StackMetric` children in this element
197
+
198
+ Returns
199
+ -------
200
+ children : list
201
+ List of `StackMetric` children (even if `single=True`)
202
+ '''
203
+ return self.getAllElements(StackMetrics,single)
204
+ def getImageSaver(self,single=True):
205
+ '''Get all or a sole `ImageSaver` element(s) from this
206
+
207
+ Parameters
208
+ ----------
209
+ single : bool
210
+ If `True`, there can be only one `ImageSaver` child, otherwise fail.
211
+ If `False` return all `ImageSaver` children in this element
212
+
213
+ Returns
214
+ -------
215
+ children : list
216
+ List of `ImageSaver` children (even if `single=True`)
217
+ '''
218
+ return self.getAllElements(ImageSaver,single)
219
+ def getTextSaver(self,single=True):
220
+ '''Get all or a sole `TextSaver` element(s) from this
221
+
222
+ Parameters
223
+ ----------
224
+ single : bool
225
+ If `True`, there can be only one `TextSaver` child, otherwise fail.
226
+ If `False` return all `TextSaver` children in this element
227
+
228
+ Returns
229
+ -------
230
+ children : list
231
+ List of `TextSaver` children (even if `single=True`)
232
+ '''
233
+ return self.getAllElements(TextSaver,single)
234
+ def getForwardToChatter(self,single=True):
235
+ '''Get all or a sole `ForwardToChatter` element(s) from this
236
+
237
+ Parameters
238
+ ----------
239
+ single : bool
240
+ If `True`, there can be only one `ForwardToChatter` child, otherwise fail.
241
+ If `False` return all `ForwardToChatter` children in this element
242
+
243
+ Returns
244
+ -------
245
+ children : list
246
+ List of `ForwardToChatter` children (even if `single=True`)
247
+ '''
248
+ return self.getAllElements(ForwardToChatter,single)
249
+ def getMenuDisplayer(self,single=True):
250
+ '''Get all or a sole `MenuDi` element(s) from this
251
+
252
+ Parameters
253
+ ----------
254
+ single : bool
255
+ If `True`, there can be only one `MenuDi` child, otherwise fail.
256
+ If `False` return all `MenuDi` children in this element
257
+
258
+ Returns
259
+ -------
260
+ children : list
261
+ List of `MenuDi` children (even if `single=True`)
262
+ '''
263
+ return self.getAllElements(MenuDisplayer,single)
264
+ def getMapCenterer(self,single=True):
265
+ '''Get all or a sole `MapCenterer` element(s) from this
266
+
267
+ Parameters
268
+ ----------
269
+ single : bool
270
+ If `True`, there can be only one `MapCenterer` child, otherwise fail.
271
+ If `False` return all `MapCenterer` children in this element
272
+
273
+ Returns
274
+ -------
275
+ children : list
276
+ List of `MapCenterer` children (even if `single=True`)
277
+ '''
278
+ return self.getAllElements(MapCenterer,single)
279
+ def getStackExpander(self,single=True):
280
+ '''Get all or a sole `StackExpander` element(s) from this
281
+
282
+ Parameters
283
+ ----------
284
+ single : bool
285
+ If `True`, there can be only one `StackExpander` child, otherwise fail.
286
+ If `False` return all `StackExpander` children in this element
287
+
288
+ Returns
289
+ -------
290
+ children : list
291
+ List of `StackExpander` children (even if `single=True`)
292
+ '''
293
+ return self.getAllElements(StackExpander,single)
294
+ def getPieceMover(self,single=True):
295
+ '''Get all or a sole `PieceMover` element(s) from this
296
+
297
+ Parameters
298
+ ----------
299
+ single : bool
300
+ If `True`, there can be only one `PieceMover` child, otherwise fail.
301
+ If `False` return all `PieceMover` children in this element
302
+
303
+ Returns
304
+ -------
305
+ children : list
306
+ List of `PieceMover` children (even if `single=True`)
307
+ '''
308
+ return self.getAllElements(PieceMover,single)
309
+ def getSelectionHighlighters(self,single=True):
310
+ '''Get all or a sole `SelectionHighlighter` element(s) from this
311
+
312
+ Parameters
313
+ ----------
314
+ single : bool
315
+ If `True`, there can be only one `SelectionHighlighter` child, otherwise fail.
316
+ If `False` return all `SelectionHighlighter` children in this element
317
+
318
+ Returns
319
+ -------
320
+ children : list
321
+ List of `SelectionHighlighter` children (even if `single=True`)
322
+ '''
323
+ return self.getAllElements(SelectionHighlighters,single)
324
+ def getKeyBufferer(self,single=True):
325
+ return self.getAllElements(KeyBufferer,single)
326
+ def getHighlightLastMoved(self,single=True):
327
+ '''Get all or a sole `HighlightLa` element(s) from this
328
+
329
+ Parameters
330
+ ----------
331
+ single : bool
332
+ If `True`, there can be only one `HighlightLa` child, otherwise fail.
333
+ If `False` return all `HighlightLa` children in this element
334
+
335
+ Returns
336
+ -------
337
+ children : list
338
+ List of `HighlightLa` children (even if `single=True`)
339
+ '''
340
+ return self.getAllElements(HighlightLastMoved,single)
341
+ def getCounterDetailViewer(self,single=True):
342
+ '''Get all or a sole `CounterDetailViewer` element(s) from this
343
+
344
+ Parameters
345
+ ----------
346
+ single : bool
347
+ If `True`, there can be only one `CounterDetailViewer` child, otherwise fail.
348
+ If `False` return all `CounterDetailViewer` children in this element
349
+
350
+ Returns
351
+ -------
352
+ children : list
353
+ List of `CounterDetailViewer` children (even if `single=True`)
354
+ '''
355
+ return self.getAllElements(CounterDetailViewer,single)
356
+ def getGlobalMap(self,single=True):
357
+ '''Get all or a sole `GlobalMap` element(s) from this
358
+
359
+ Parameters
360
+ ----------
361
+ single : bool
362
+ If `True`, there can be only one `GlobalMap` child, otherwise fail.
363
+ If `False` return all `GlobalMap` children in this element
364
+
365
+ Returns
366
+ -------
367
+ children : list
368
+ List of `GlobalMap` children (even if `single=True`)
369
+ '''
370
+ return self.getAllElements(GlobalMap,single)
371
+ def getZoomer(self,single=True):
372
+ '''Get all or a sole `Zoomer` element(s) from this
373
+
374
+ Parameters
375
+ ----------
376
+ single : bool
377
+ If `True`, there can be only one `Zoomer` child, otherwise fail.
378
+ If `False` return all `Zoomer` children in this element
379
+
380
+ Returns
381
+ -------
382
+ children : list
383
+ List of `Zoomer` children (even if `single=True`)
384
+ '''
385
+ return self.getAllElements(Zoomer,single)
386
+ def getHidePiecesButton(self,single=True):
387
+ '''Get all or a sole `HidePiece` element(s) from this
388
+
389
+ Parameters
390
+ ----------
391
+ single : bool
392
+ If `True`, there can be only one `HidePiece` child, otherwise fail.
393
+ If `False` return all `HidePiece` children in this element
394
+
395
+ Returns
396
+ -------
397
+ children : list
398
+ List of `HidePiece` children (even if `single=True`)
399
+ '''
400
+ return self.getAllElements(HidePiecesButton,single)
401
+ def getMassKeys(self,asdict=True):
402
+ '''Get all MassKey element(s) from this
403
+
404
+ Parameters
405
+ ----------
406
+ asdict : bool
407
+ If `True`, return a dictonary that maps key to `MassKey` elements. If `False`, return a list of all MassKey` children.
408
+
409
+ Returns
410
+ -------
411
+ children : dict or list
412
+ Dictionary or list of `MassKey` children
413
+ '''
414
+ return self.getElementsByKey(MassKey,'name',asdict)
415
+ def getFlare(self,single=True):
416
+ '''Get all or a sole `Flare` element(s) from this
417
+
418
+ Parameters
419
+ ----------
420
+ single : bool
421
+ If `True`, there can be only one `Flare` child, otherwise fail.
422
+ If `False` return all `Flare` children in this element
423
+
424
+ Returns
425
+ -------
426
+ children : list
427
+ List of `Flare` children (even if `single=True`)
428
+ '''
429
+ return self.getAllElements(Flare,single)
430
+ def getAtStarts(self,single=True):
431
+ '''Get all or a sole `AtStart` element(s) from this
432
+
433
+ Parameters
434
+ ----------
435
+ single : bool
436
+ If `True`, there can be only one `AtStart` child, otherwise fail.
437
+ If `False` return all `AtStart` children in this element
438
+
439
+ Returns
440
+ -------
441
+ children : list
442
+ List of `AtStart` children (even if `single=True`)
443
+ '''
444
+ return self.getAllElements(AtStart,single)
445
+ def getBoards(self,asdict=True):
446
+ '''Get all Board element(s) from this
447
+
448
+ Parameters
449
+ ----------
450
+ asdict : bool
451
+ If `True`, return a dictonary that maps key to `Board` elements. If `False`, return a list of all Board` children.
452
+
453
+ Returns
454
+ -------
455
+ children : dict or list
456
+ Dictionary or list of `Board` children
457
+ '''
458
+ picker = self.getPicker()
459
+ if picker is None: return None
460
+ return picker[0].getBoards(asdict=asdict)
461
+ def getLayers(self,asdict=True):
462
+ '''Get all `PieceLayer` element(s) from this
463
+
464
+ Parameters
465
+ ----------
466
+ asdict : bool
467
+ If `True`, return a dictonary that maps property name
468
+ `PieceLayers` elements. If `False`, return a list of all
469
+ `PieceLayers` children.
470
+
471
+ Returns
472
+ -------
473
+ children : dict or list
474
+ Dictionary or list of `PieceLayers` children
475
+
476
+ '''
477
+ return self.getElementsByKey(PieceLayers,'property',asdict)
478
+ def getMenus(self,asdict=True):
479
+ '''Get all Menu element(s) from this
480
+
481
+ Parameters
482
+ ----------
483
+ asdict : bool
484
+ If `True`, return a dictonary that maps key to `Board`
485
+ elements. If `False`, return a list of all Board`
486
+ children.
487
+
488
+
489
+ Returns
490
+ -------
491
+ children : dict or list
492
+ Dictionary or list of `Board` children
493
+
494
+ '''
495
+ return self.getElementsByKey(Menu,'name',asdict)
496
+ def getFolders(self,asdict=True):
497
+ '''Get all Menu element(s) from this
498
+
499
+ Parameters
500
+ ----------
501
+ asdict : bool
502
+ If `True`, return a dictonary that maps key to `Folder`
503
+ elements. If `False`, return a list of all `Folder`
504
+ children.
505
+
506
+ Returns
507
+ -------
508
+ children : dict or list
509
+ Dictionary or list of `Folder` children
510
+
511
+ '''
512
+ return self.getElementsByKey(MapFolder,'name',asdict)
513
+ def getLOSs(self,asdict=True):
514
+ '''Get all Menu element(s) from this
515
+
516
+ Parameters
517
+ ----------
518
+ asdict : bool
519
+ If `True`, return a dictonary that maps key to `Board`
520
+ elements. If `False`, return a list of all Board`
521
+ children.
522
+
523
+
524
+ Returns
525
+ -------
526
+ children : dict or list
527
+ Dictionary or list of `Board` children
528
+
529
+ '''
530
+ return self.getElementsByKey(LineOfSight,'threadName',asdict)
531
+ def addBoardPicker(self,**kwargs):
532
+ '''Add a `BoardPicker` element to this
533
+
534
+ Parameters
535
+ ----------
536
+ kwargs : dict
537
+ Dictionary of attribute key-value pairs
538
+
539
+ Returns
540
+ -------
541
+ element : BoardPicker
542
+ The added element
543
+ '''
544
+ return self.add(BoardPicker,**kwargs)
545
+ def addStackMetrics(self,**kwargs):
546
+ '''Add a `StackMetrics` element to this
547
+
548
+ Parameters
549
+ ----------
550
+ kwargs : dict
551
+ Dictionary of attribute key-value pairs
552
+
553
+ Returns
554
+ -------
555
+ element : StackMetrics
556
+ The added element
557
+ '''
558
+ return self.add(StackMetrics,**kwargs)
559
+ def addImageSaver(self,**kwargs):
560
+ '''Add a `ImageSaver` element to this
561
+
562
+ Parameters
563
+ ----------
564
+ kwargs : dict
565
+ Dictionary of attribute key-value pairs
566
+
567
+ Returns
568
+ -------
569
+ element : ImageSaver
570
+ The added element
571
+ '''
572
+ return self.add(ImageSaver,**kwargs)
573
+ def addTextSaver(self,**kwargs):
574
+ '''Add a `TextSaver` element to this
575
+
576
+ Parameters
577
+ ----------
578
+ kwargs : dict
579
+ Dictionary of attribute key-value pairs
580
+
581
+ Returns
582
+ -------
583
+ element : TextSaver
584
+ The added element
585
+ '''
586
+ return self.add(TextSaver,**kwargs)
587
+ def addForwardToChatter(self,**kwargs):
588
+ '''Add a `ForwardToChatter` element to this
589
+
590
+ Parameters
591
+ ----------
592
+ kwargs : dict
593
+ Dictionary of attribute key-value pairs
594
+
595
+ Returns
596
+ -------
597
+ element : ForwardToChatter
598
+ The added element
599
+ '''
600
+ return self.add(ForwardToChatter,**kwargs)
601
+ def addForwardKeys(self,**kwargs):
602
+ '''Add a `ForwardKeys` element to this
603
+
604
+ Parameters
605
+ ----------
606
+ kwargs : dict
607
+ Dictionary of attribute key-value pairs
608
+
609
+ Returns
610
+ -------
611
+ element : ForwardToChatter
612
+ The added element
613
+ '''
614
+ return self.add(ForwardKeys,**kwargs)
615
+ def addScroller(self,**kwargs):
616
+ '''Add a `ForwardKeys` element to this
617
+
618
+ Parameters
619
+ ----------
620
+ kwargs : dict
621
+ Dictionary of attribute key-value pairs
622
+
623
+ Returns
624
+ -------
625
+ element : ForwardToChatter
626
+ The added element
627
+ '''
628
+ return self.add(Scroller,**kwargs)
629
+ def addMenuDisplayer(self,**kwargs):
630
+ '''Add a `MenuDisplayer` element to this
631
+
632
+ Parameters
633
+ ----------
634
+ kwargs : dict
635
+ Dictionary of attribute key-value pairs
636
+
637
+ Returns
638
+ -------
639
+ element : MenuDisplayer
640
+ The added element
641
+ '''
642
+ return self.add(MenuDisplayer,**kwargs)
643
+ def addMapCenterer(self,**kwargs):
644
+ '''Add a `MapCenterer` element to this
645
+
646
+ Parameters
647
+ ----------
648
+ kwargs : dict
649
+ Dictionary of attribute key-value pairs
650
+
651
+ Returns
652
+ -------
653
+ element : MapCenterer
654
+ The added element
655
+ '''
656
+ return self.add(MapCenterer,**kwargs)
657
+ def addStackExpander(self,**kwargs):
658
+ '''Add a `StackExpander` element to this
659
+
660
+ Parameters
661
+ ----------
662
+ kwargs : dict
663
+ Dictionary of attribute key-value pairs
664
+
665
+ Returns
666
+ -------
667
+ element : StackExpander
668
+ The added element
669
+ '''
670
+ return self.add(StackExpander,**kwargs)
671
+ def addPieceMover(self,**kwargs):
672
+ '''Add a `PieceMover` element to this
673
+
674
+ Parameters
675
+ ----------
676
+ kwargs : dict
677
+ Dictionary of attribute key-value pairs
678
+
679
+ Returns
680
+ -------
681
+ element : PieceMover
682
+ The added element
683
+ '''
684
+ return self.add(PieceMover,**kwargs)
685
+ def addSelectionHighlighters(self,**kwargs):
686
+ '''Add a `SelectionHighlighters` element to this
687
+
688
+ Parameters
689
+ ----------
690
+ kwargs : dict
691
+ Dictionary of attribute key-value pairs
692
+
693
+ Returns
694
+ -------
695
+ element : SelectionHighlighters
696
+ The added element
697
+ '''
698
+ return self.add(SelectionHighlighters,**kwargs)
699
+ def addKeyBufferer(self,**kwargs):
700
+ '''Add a `KeyBufferer` element to this
701
+
702
+ Parameters
703
+ ----------
704
+ kwargs : dict
705
+ Dictionary of attribute key-value pairs
706
+
707
+ Returns
708
+ -------
709
+ element : KeyBufferer
710
+ The added element
711
+ '''
712
+ return self.add(KeyBufferer,**kwargs)
713
+ def addHighlightLastMoved(self,**kwargs):
714
+ '''Add a `HighlightLastMoved` element to this
715
+
716
+ Parameters
717
+ ----------
718
+ kwargs : dict
719
+ Dictionary of attribute key-value pairs
720
+
721
+ Returns
722
+ -------
723
+ element : HighlightLastMoved
724
+ The added element
725
+ '''
726
+ return self.add(HighlightLastMoved,**kwargs)
727
+ def addCounterDetailViewer(self,**kwargs):
728
+ '''Add a `CounterDetailViewer` element to this
729
+
730
+ Parameters
731
+ ----------
732
+ kwargs : dict
733
+ Dictionary of attribute key-value pairs
734
+
735
+ Returns
736
+ -------
737
+ element : CounterDetailViewer
738
+ The added element
739
+ '''
740
+ return self.add(CounterDetailViewer,**kwargs)
741
+ def addGlobalMap(self,**kwargs):
742
+ '''Add a `GlobalMap` element to this
743
+
744
+ Parameters
745
+ ----------
746
+ kwargs : dict
747
+ Dictionary of attribute key-value pairs
748
+
749
+ Returns
750
+ -------
751
+ element : GlobalMap
752
+ The added element
753
+ '''
754
+ return self.add(GlobalMap,**kwargs)
755
+ def addZoomer(self,**kwargs):
756
+ '''Add a `Zoomer` element to this
757
+
758
+ Parameters
759
+ ----------
760
+ kwargs : dict
761
+ Dictionary of attribute key-value pairs
762
+
763
+ Returns
764
+ -------
765
+ element : Zoomer
766
+ The added element
767
+ '''
768
+ return self.add(Zoomer,**kwargs)
769
+ def addHidePiecesButton(self,**kwargs):
770
+ '''Add a `HidePiecesButton` element to this
771
+
772
+ Parameters
773
+ ----------
774
+ kwargs : dict
775
+ Dictionary of attribute key-value pairs
776
+
777
+ Returns
778
+ -------
779
+ element : HidePiecesButton
780
+ The added element
781
+ '''
782
+ return self.add(HidePiecesButton,**kwargs)
783
+ def addMassKey(self,**kwargs):
784
+ '''Add a `MassKey` element to this
785
+
786
+ Parameters
787
+ ----------
788
+ kwargs : dict
789
+ Dictionary of attribute key-value pairs
790
+
791
+ Returns
792
+ -------
793
+ element : MassKey
794
+ The added element
795
+ '''
796
+ return self.add(MassKey,**kwargs)
797
+ def addStartupMassKey(self,**kwargs):
798
+ '''Add a `StartupMassKey` element to this
799
+
800
+ Parameters
801
+ ----------
802
+ kwargs : dict
803
+ Dictionary of attribute key-value pairs
804
+
805
+ Returns
806
+ -------
807
+ element : StartupMassKey
808
+ The added element
809
+ '''
810
+ return self.add(MassKey,**kwargs)
811
+ def addFlare(self,**kwargs):
812
+ '''Add a `Flare` element to this
813
+
814
+ Parameters
815
+ ----------
816
+ kwargs : dict
817
+ Dictionary of attribute key-value pairs
818
+
819
+ Returns
820
+ -------
821
+ element : Flare
822
+ The added element
823
+ '''
824
+ return self.add(Flare,**kwargs)
825
+ def addAtStart(self,**kwargs):
826
+ '''Add a `AtStart` element to this
827
+
828
+ Parameters
829
+ ----------
830
+ kwargs : dict
831
+ Dictionary of attribute key-value pairs
832
+
833
+ Returns
834
+ -------
835
+ element : AtStart
836
+ The added element
837
+ '''
838
+ return self.add(AtStart,**kwargs)
839
+
840
+
841
+ def addLayers(self,**kwargs):
842
+ '''Add `PieceLayers` element to this
843
+
844
+ Parameters
845
+ ----------
846
+ kwargs : dict
847
+ Dictionary of attribute key-value pairs
848
+
849
+ Returns
850
+ -------
851
+ element : PieceLayers
852
+ The added element
853
+ '''
854
+ return self.add(PieceLayers,**kwargs)
855
+ def addMenu(self,**kwargs):
856
+ '''Add a `Menu` element to this
857
+
858
+ Parameters
859
+ ----------
860
+ kwargs : dict
861
+ Dictionary of attribute key-value pairs
862
+
863
+ Returns
864
+ -------
865
+ element : Menu
866
+ The added element
867
+ '''
868
+ return self.add(Menu,**kwargs)
869
+ def addLOS(self,**kwargs):
870
+ '''Add a `Menu` element to this
871
+
872
+ Parameters
873
+ ----------
874
+ kwargs : dict
875
+ Dictionary of attribute key-value pairs
876
+
877
+ Returns
878
+ -------
879
+ element : Menu
880
+ The added element
881
+ '''
882
+ return self.add(LineOfSight,**kwargs)
883
+
884
+ # --------------------------------------------------------------------
885
+ class Map(BaseMap):
886
+ TAG = Element.MODULE+'Map'
887
+ def __init__(self,doc,node=None,
888
+ mapName = '',
889
+ allowMultiple = 'false',
890
+ backgroundcolor = rgb(255,255,255),
891
+ buttonName = '',
892
+ changeFormat = '$message$',
893
+ color = rgb(0,0,0),
894
+ createFormat = '$pieceName$ created in $location$ *',
895
+ edgeHeight = '0',
896
+ edgeWidth = '0',
897
+ hideKey = '',
898
+ hotkey = key('M',ALT),
899
+ icon = '/images/map.gif',
900
+ launch = 'false',
901
+ markMoved = 'Always',
902
+ markUnmovedHotkey = '',
903
+ markUnmovedIcon = '/images/unmoved.gif',
904
+ markUnmovedReport = '',
905
+ markUnmovedText = '',
906
+ markUnmovedTooltip = 'Mark all pieces on this map as not moved',
907
+ moveKey = '',
908
+ moveToFormat = '$pieceName$ moves $previousLocation$ → $location$ *',
909
+ moveWithinFormat = '$pieceName$ moves $previousLocation$ → $location$ *',
910
+ showKey = '',
911
+ thickness = '3'):
912
+ super(Map,self).__init__(doc,self.TAG,node=node,
913
+ allowMultiple = allowMultiple,
914
+ backgroundcolor = backgroundcolor,
915
+ buttonName = buttonName,
916
+ changeFormat = changeFormat,
917
+ color = color,
918
+ createFormat = createFormat,
919
+ edgeHeight = edgeHeight,
920
+ edgeWidth = edgeWidth,
921
+ hideKey = hideKey,
922
+ hotkey = hotkey,
923
+ icon = icon,
924
+ launch = launch,
925
+ mapName = mapName,
926
+ markMoved = markMoved,
927
+ markUnmovedHotkey = markUnmovedHotkey,
928
+ markUnmovedIcon = markUnmovedIcon,
929
+ markUnmovedReport = markUnmovedReport,
930
+ markUnmovedText = markUnmovedText,
931
+ markUnmovedTooltip = markUnmovedTooltip,
932
+ moveKey = moveKey,
933
+ moveToFormat = moveToFormat,
934
+ moveWithinFormat = moveWithinFormat,
935
+ showKey = showKey,
936
+ thickness = thickness)
937
+
938
+ def getGame(self):
939
+ ## BEGIN_IMPORT
940
+ from . game import Game
941
+ ## END_IMPORT
942
+ return self.getParent(Game)
943
+
944
+ registerElement(Map)
945
+
946
+ # --------------------------------------------------------------------
947
+ class WidgetMap(BaseMap):
948
+ TAG = Element.WIDGET+'WidgetMap'
949
+ def __init__(self,doc,node=None,**attr):
950
+ super(WidgetMap,self).__init__(doc,self.TAG,node=node,**attr)
951
+
952
+ def getGame(self):
953
+ ## BEGIN_IMPORT
954
+ from . game import Game
955
+ ## END_IMPORT
956
+ return self.getParentOfClass([Game])
957
+ def getMapWidget(self):
958
+ return self.getParent(MapWidget)
959
+
960
+ registerElement(WidgetMap)
961
+
962
+ # --------------------------------------------------------------------
963
+ class BasePrivateMap(BaseMap):
964
+ def __init__(self,
965
+ doc,
966
+ tag,
967
+ node = None,
968
+ mapName = '',
969
+ allowMultiple = 'false',
970
+ backgroundcolor = rgb(255,255,255),
971
+ buttonName = '',
972
+ changeFormat = '$message$',
973
+ color = rgb(0,0,0),
974
+ createFormat = '$pieceName$ created in $location$ *',
975
+ edgeHeight = '0',
976
+ edgeWidth = '0',
977
+ hideKey = '',
978
+ hotkey = key('M',ALT),
979
+ icon = '/images/map.gif',
980
+ launch = 'false',
981
+ markMoved = 'Always',
982
+ markUnmovedHotkey = '',
983
+ markUnmovedIcon = '/images/unmoved.gif',
984
+ markUnmovedReport = '',
985
+ markUnmovedText = '',
986
+ markUnmovedTooltip = 'Mark all pieces on this map as not moved',
987
+ moveKey = '',
988
+ moveToFormat = '$pieceName$ moves $previousLocation$ → $location$ *',
989
+ moveWithinFormat = '$pieceName$ moves $previousLocation$ → $location$ *',
990
+ showKey = '',
991
+ thickness = '3',
992
+ side = [],
993
+ visible = False,
994
+ use_boards = ''):
995
+ lsides = [side] if isinstance(side,str) else ','.join(side)
996
+ super().__init__(doc,
997
+ self.TAG,
998
+ node = node,
999
+ allowMultiple = allowMultiple,
1000
+ backgroundcolor = backgroundcolor,
1001
+ buttonName = buttonName,
1002
+ changeFormat = changeFormat,
1003
+ color = color,
1004
+ createFormat = createFormat,
1005
+ edgeHeight = edgeHeight,
1006
+ edgeWidth = edgeWidth,
1007
+ hideKey = hideKey,
1008
+ hotkey = hotkey,
1009
+ icon = icon,
1010
+ launch = launch,
1011
+ mapName = mapName,
1012
+ markMoved = markMoved,
1013
+ markUnmovedHotkey = markUnmovedHotkey,
1014
+ markUnmovedIcon = markUnmovedIcon,
1015
+ markUnmovedReport = markUnmovedReport,
1016
+ markUnmovedText = markUnmovedText,
1017
+ markUnmovedTooltip = markUnmovedTooltip,
1018
+ moveKey = moveKey,
1019
+ moveToFormat = moveToFormat,
1020
+ moveWithinFormat = moveWithinFormat,
1021
+ showKey = showKey,
1022
+ thickness = thickness,
1023
+ side = lsides,
1024
+ visible = visible,
1025
+ use_boards = use_boards)
1026
+
1027
+ def getSides(self):
1028
+ return self['side'].split(',')
1029
+
1030
+ def setSides(self,*sides):
1031
+ self['side'] = ','.join(sides)
1032
+
1033
+ def getMap(self):
1034
+ game = self.getGame()
1035
+ maps = game.getMaps()
1036
+ return maps.get(self['use_boards'])
1037
+
1038
+ def setMap(self,map):
1039
+ self['use_boards'] = map if isinstance(map,str) else map['mapName']
1040
+
1041
+ # --------------------------------------------------------------------
1042
+ class PrivateMap(BasePrivateMap):
1043
+ TAG = Element.MODULE+'PrivateMap'
1044
+ def __init__(self,
1045
+ doc,
1046
+ **kwargs):
1047
+ super().__init__(doc,self.TAG,**kwargs)
1048
+
1049
+ registerElement(PrivateMap)
1050
+
1051
+ # --------------------------------------------------------------------
1052
+ class PlayerHand(BasePrivateMap):
1053
+ TAG = Element.MODULE + 'PlayerHand'
1054
+ def __init__(self,doc,**kwargs):
1055
+ super().__init__(doc,self.TAG,**kwargs)
1056
+
1057
+ registerElement(PlayerHand)
1058
+
1059
+ #
1060
+ # EOF
1061
+ #