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,275 @@
|
|
1
|
+
## BEGIN_IMPORT
|
2
|
+
from common import VerboseGuard
|
3
|
+
from . base import *
|
4
|
+
from . element import Element
|
5
|
+
## END_IMPORT
|
6
|
+
|
7
|
+
# --------------------------------------------------------------------
|
8
|
+
class Data(Element):
|
9
|
+
TAG = 'data'
|
10
|
+
def __init__(self,doc,node=None,version='1'):
|
11
|
+
super(Data,self).__init__(doc,self.TAG,node=node,version=version)
|
12
|
+
|
13
|
+
def addVersion(self,**kwargs):
|
14
|
+
'''Add a `Version` element to this
|
15
|
+
|
16
|
+
Parameters
|
17
|
+
----------
|
18
|
+
kwargs : dict
|
19
|
+
Dictionary of attribute key-value pairs
|
20
|
+
|
21
|
+
Returns
|
22
|
+
-------
|
23
|
+
element : Version
|
24
|
+
The added element
|
25
|
+
'''
|
26
|
+
return self.add(Version,**kwargs)
|
27
|
+
def addVASSALVersion(self,**kwargs):
|
28
|
+
'''Add a `VASSALVersion` element to this
|
29
|
+
|
30
|
+
Parameters
|
31
|
+
----------
|
32
|
+
kwargs : dict
|
33
|
+
Dictionary of attribute key-value pairs
|
34
|
+
|
35
|
+
Returns
|
36
|
+
-------
|
37
|
+
element : VASSALVersion
|
38
|
+
The added element
|
39
|
+
'''
|
40
|
+
return self.add(VASSALVersion,**kwargs)
|
41
|
+
def addName(self,**kwargs):
|
42
|
+
'''Add a `Name` element to this
|
43
|
+
|
44
|
+
Parameters
|
45
|
+
----------
|
46
|
+
kwargs : dict
|
47
|
+
Dictionary of attribute key-value pairs
|
48
|
+
|
49
|
+
Returns
|
50
|
+
-------
|
51
|
+
element : Name
|
52
|
+
The added element
|
53
|
+
'''
|
54
|
+
return self.add(Name,**kwargs)
|
55
|
+
def addDescription(self,**kwargs):
|
56
|
+
'''Add a `Description` element to this
|
57
|
+
|
58
|
+
Parameters
|
59
|
+
----------
|
60
|
+
kwargs : dict
|
61
|
+
Dictionary of attribute key-value pairs
|
62
|
+
|
63
|
+
Returns
|
64
|
+
-------
|
65
|
+
element : Description
|
66
|
+
The added element
|
67
|
+
'''
|
68
|
+
return self.add(Description,**kwargs)
|
69
|
+
def addDateSaved(self,**kwargs):
|
70
|
+
'''Add a `DateSaved` element to this
|
71
|
+
|
72
|
+
Parameters
|
73
|
+
----------
|
74
|
+
kwargs : dict
|
75
|
+
Dictionary of attribute key-value pairs
|
76
|
+
|
77
|
+
Returns
|
78
|
+
-------
|
79
|
+
element : DateSaved
|
80
|
+
The added element
|
81
|
+
'''
|
82
|
+
return self.add(DateSaved,**kwargs)
|
83
|
+
def getVersion(self,single=True):
|
84
|
+
'''Get all or a sole `Version` element(s) from this
|
85
|
+
|
86
|
+
Parameters
|
87
|
+
----------
|
88
|
+
single : bool
|
89
|
+
If `True`, there can be only one `Version` child, otherwise fail.
|
90
|
+
If `False` return all `Version` children in this element
|
91
|
+
|
92
|
+
Returns
|
93
|
+
-------
|
94
|
+
children : list
|
95
|
+
List of `Version` children (even if `single=True`)
|
96
|
+
'''
|
97
|
+
return self.getAllElements(Version,single=single)
|
98
|
+
def getVASSALVersion(self,single=True):
|
99
|
+
'''Get all or a sole `VASSALVersion` element(s) from this
|
100
|
+
|
101
|
+
Parameters
|
102
|
+
----------
|
103
|
+
single : bool
|
104
|
+
If `True`, there can be only one `VASSALVersion` child,
|
105
|
+
otherwise fail. If `False` return all `VASSALVersion`
|
106
|
+
children in this element
|
107
|
+
|
108
|
+
Returns
|
109
|
+
-------
|
110
|
+
children : list
|
111
|
+
List of `VASSALVersion` children (even if `single=True`)
|
112
|
+
|
113
|
+
'''
|
114
|
+
return self.getAllElements(VASSALVersion,single=single)
|
115
|
+
def getName(self,single=True):
|
116
|
+
return self.getAllElements(Name,single=single)
|
117
|
+
def getDescription(self,single=True):
|
118
|
+
'''Get all or a sole `Description` element(s) from this
|
119
|
+
|
120
|
+
Parameters
|
121
|
+
----------
|
122
|
+
single : bool
|
123
|
+
If `True`, there can be only one `Description` child,
|
124
|
+
otherwise fail. If `False` return all `De` children in
|
125
|
+
this element
|
126
|
+
|
127
|
+
Returns
|
128
|
+
-------
|
129
|
+
children : list
|
130
|
+
List of `De` children (even if `single=True`)
|
131
|
+
|
132
|
+
'''
|
133
|
+
return self.getAllElements(Description,single=single)
|
134
|
+
def getDateSaved(self,single=True):
|
135
|
+
'''Get all or a sole `DateSaved` element(s) from this
|
136
|
+
|
137
|
+
Parameters
|
138
|
+
----------
|
139
|
+
single : bool
|
140
|
+
If `True`, there can be only one `DateSaved` child, otherwise fail.
|
141
|
+
If `False` return all `DateSaved` children in this element
|
142
|
+
|
143
|
+
Returns
|
144
|
+
-------
|
145
|
+
children : list
|
146
|
+
List of `DateSaved` children (even if `single=True`)
|
147
|
+
'''
|
148
|
+
return self.getAllElements(DateSaved,single=single)
|
149
|
+
|
150
|
+
registerElement(Data)
|
151
|
+
|
152
|
+
# --------------------------------------------------------------------
|
153
|
+
class DataElement(Element):
|
154
|
+
def __init__(self,data,tag,node=None,**kwargs):
|
155
|
+
super(DataElement,self).__init__(data,tag,node=node,**kwargs)
|
156
|
+
|
157
|
+
def getData(self):
|
158
|
+
return self.getParent(Data)
|
159
|
+
|
160
|
+
# --------------------------------------------------------------------
|
161
|
+
class Version(DataElement):
|
162
|
+
TAG = 'version'
|
163
|
+
def __init__(self,data,node=None,version=''):
|
164
|
+
super(Version,self).__init__(data,self.TAG,node=node)
|
165
|
+
if node is None:
|
166
|
+
self.addText(version)
|
167
|
+
|
168
|
+
registerElement(Version)
|
169
|
+
|
170
|
+
# --------------------------------------------------------------------
|
171
|
+
class Extra1(DataElement):
|
172
|
+
TAG = 'extra1'
|
173
|
+
def __init__(self,data,node=None,extra=''):
|
174
|
+
super(Extra1,self).__init__(data,self.TAG,node=node)
|
175
|
+
if node is None:
|
176
|
+
self.addText(extra)
|
177
|
+
|
178
|
+
registerElement(Extra1)
|
179
|
+
|
180
|
+
# --------------------------------------------------------------------
|
181
|
+
class Extra2(DataElement):
|
182
|
+
TAG = 'extra2'
|
183
|
+
def __init__(self,data,node=None,extra=''):
|
184
|
+
super(Extra2,self).__init__(data,self.TAG,node=node)
|
185
|
+
if node is None:
|
186
|
+
self.addText(extra)
|
187
|
+
|
188
|
+
registerElement(Extra2)
|
189
|
+
|
190
|
+
# --------------------------------------------------------------------
|
191
|
+
class VASSALVersion(DataElement):
|
192
|
+
TAG = 'VassalVersion'
|
193
|
+
def __init__(self,data,node=None,version='3.6.7'):
|
194
|
+
super(VASSALVersion,self).__init__(data,self.TAG,node=node)
|
195
|
+
if node is None:
|
196
|
+
self.addText(version)
|
197
|
+
|
198
|
+
registerElement(VASSALVersion)
|
199
|
+
|
200
|
+
# --------------------------------------------------------------------
|
201
|
+
class Name(DataElement):
|
202
|
+
TAG = 'name'
|
203
|
+
def __init__(self,data,node=None,name=''):
|
204
|
+
super(Name,self).__init__(data,self.TAG,node=node)
|
205
|
+
if node is None:
|
206
|
+
self.addText(name)
|
207
|
+
|
208
|
+
registerElement(Name)
|
209
|
+
|
210
|
+
# --------------------------------------------------------------------
|
211
|
+
class Description(DataElement):
|
212
|
+
TAG = 'description'
|
213
|
+
def __init__(self,data,node=None,description=''):
|
214
|
+
super(Description,self).__init__(data,self.TAG,node=node)
|
215
|
+
if node is None:
|
216
|
+
self.addText(description)
|
217
|
+
|
218
|
+
registerElement(Description)
|
219
|
+
|
220
|
+
# --------------------------------------------------------------------
|
221
|
+
class DateSaved(DataElement):
|
222
|
+
TAG = 'dateSaved'
|
223
|
+
def __init__(self,data,node=None,milisecondsSinceEpoch=-1):
|
224
|
+
super(DateSaved,self).__init__(data,self.TAG,node=node)
|
225
|
+
if node is None:
|
226
|
+
from time import time
|
227
|
+
s = f'{int(time()*1000)}' if milisecondsSinceEpoch < 0 else \
|
228
|
+
str(milisecondsSinceEpoch)
|
229
|
+
self.addText(s)
|
230
|
+
|
231
|
+
registerElement(DateSaved)
|
232
|
+
|
233
|
+
# --------------------------------------------------------------------
|
234
|
+
class ModuleData(Element):
|
235
|
+
|
236
|
+
def __init__(self,root=None):
|
237
|
+
'''Construct from a DOM object, if given, otherwise make new'''
|
238
|
+
#from xml.dom.minidom import Document
|
239
|
+
super(ModuleData,self).__init__(None,'',None)
|
240
|
+
|
241
|
+
self._root = root
|
242
|
+
self._tag = 'moduledata'
|
243
|
+
if self._root is None:
|
244
|
+
self._root = xmlns.Document()
|
245
|
+
|
246
|
+
self._node = self._root
|
247
|
+
|
248
|
+
def addData(self,**kwargs):
|
249
|
+
'''Add a `Data` element to this
|
250
|
+
|
251
|
+
Parameters
|
252
|
+
----------
|
253
|
+
kwargs : dict
|
254
|
+
Dictionary of attribute key-value pairs
|
255
|
+
|
256
|
+
Returns
|
257
|
+
-------
|
258
|
+
element : Data
|
259
|
+
The added element
|
260
|
+
'''
|
261
|
+
return Data(self,**kwargs)
|
262
|
+
|
263
|
+
def getData(self):
|
264
|
+
return Data(self,
|
265
|
+
node=self._root.getElementsByTagName(Data.TAG)[0])
|
266
|
+
|
267
|
+
def encode(self):
|
268
|
+
return self._root.toprettyxml(indent=' ',
|
269
|
+
encoding="UTF-8",
|
270
|
+
standalone=False)
|
271
|
+
|
272
|
+
|
273
|
+
#
|
274
|
+
# EOF
|
275
|
+
#
|
@@ -0,0 +1,31 @@
|
|
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='vslmerge.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(executable=True)
|
26
|
+
c.run(args.output,
|
27
|
+
'vassal.py',
|
28
|
+
'merger.py',
|
29
|
+
'merge.py')
|
30
|
+
|
31
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
#
|
3
|
+
# Patch a module
|
4
|
+
## BEGIN_IMPORTS
|
5
|
+
from vassal.vmod import VMod
|
6
|
+
from common import Verbose
|
7
|
+
## END_IMPORT
|
8
|
+
|
9
|
+
# ====================================================================
|
10
|
+
def patchIt(args):
|
11
|
+
Verbose().setVerbose(args.verbose)
|
12
|
+
|
13
|
+
vmodname = args.output.name
|
14
|
+
patchname = args.patch.name
|
15
|
+
args.output.close()
|
16
|
+
args.patch .close()
|
17
|
+
|
18
|
+
VMod.patch(vmodname, patchname, args.verbose)
|
19
|
+
|
20
|
+
# ====================================================================
|
21
|
+
if __name__ == '__main__':
|
22
|
+
from argparse import ArgumentParser, FileType
|
23
|
+
|
24
|
+
ap = ArgumentParser(description='Patch a module with a Python script')
|
25
|
+
ap.add_argument('output',
|
26
|
+
help='Module to patch, will be overwritten',
|
27
|
+
type=FileType('r'))
|
28
|
+
ap.add_argument('patch',
|
29
|
+
help='Python script to patch module',
|
30
|
+
type=FileType('r'),
|
31
|
+
nargs='?',
|
32
|
+
default='patch.py')
|
33
|
+
ap.add_argument('-V','--verbose',
|
34
|
+
help='Be verbose',
|
35
|
+
action='store_true')
|
36
|
+
|
37
|
+
args = ap.parse_args()
|
38
|
+
|
39
|
+
|
40
|
+
patchIt(args)
|
41
|
+
|
42
|
+
#
|
43
|
+
# EOF
|
44
|
+
#
|
@@ -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='vmodpatch.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
|
+
'patch.py')
|
@@ -0,0 +1,83 @@
|
|
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
|
+
class PlayerRoster(GameElement):
|
10
|
+
TAG = Element.MODULE+'PlayerRoster'
|
11
|
+
def __init__(self,doc,node=None,buttonKeyStroke='',
|
12
|
+
buttonText='Retire',
|
13
|
+
buttonToolTip='Switch sides, become observer, or release faction'):
|
14
|
+
'''Add a player roster to the module
|
15
|
+
|
16
|
+
Parameters
|
17
|
+
----------
|
18
|
+
doc : Element
|
19
|
+
Parent
|
20
|
+
node : xml.dom.Element
|
21
|
+
Node to read state from
|
22
|
+
buttonText : str
|
23
|
+
Text on button
|
24
|
+
buttonTooltip : str
|
25
|
+
Tool tip to show when hovering over button
|
26
|
+
'''
|
27
|
+
super(PlayerRoster,self).__init__(doc,self.TAG,node=node,
|
28
|
+
buttonKeyStroke = buttonKeyStroke,
|
29
|
+
buttonText = buttonText,
|
30
|
+
buttonToolTip = buttonToolTip)
|
31
|
+
def addSide(self,name):
|
32
|
+
'''Add a `Side` element to this
|
33
|
+
|
34
|
+
Parameters
|
35
|
+
----------
|
36
|
+
kwargs : dict
|
37
|
+
Dictionary of attribute key-value pairs
|
38
|
+
|
39
|
+
Returns
|
40
|
+
-------
|
41
|
+
element : Side
|
42
|
+
The added element
|
43
|
+
'''
|
44
|
+
return self.add(PlayerSide,name=name)
|
45
|
+
def getSides(self):
|
46
|
+
'''Get all sides'''
|
47
|
+
return self.getAllElements(PlayerSide,False)
|
48
|
+
def encode(self):
|
49
|
+
'''Encode for save'''
|
50
|
+
return ['PLAYER\ta\ta\t<observer>']
|
51
|
+
|
52
|
+
registerElement(PlayerRoster)
|
53
|
+
|
54
|
+
# --------------------------------------------------------------------
|
55
|
+
class PlayerSide(Element):
|
56
|
+
TAG = 'entry'
|
57
|
+
UNIQUE = ['name']
|
58
|
+
def __init__(self,doc,node=None,name=''):
|
59
|
+
'''Adds a side to the player roster
|
60
|
+
|
61
|
+
Parameters
|
62
|
+
----------
|
63
|
+
doc : Element
|
64
|
+
Parent
|
65
|
+
node : xml.dom.Element
|
66
|
+
Node to read state from
|
67
|
+
name : str
|
68
|
+
Name of side
|
69
|
+
'''
|
70
|
+
super(PlayerSide,self).__init__(doc,self.TAG,node=node)
|
71
|
+
if node is None:
|
72
|
+
self.addText(name)
|
73
|
+
|
74
|
+
def getPlayerRoster(self):
|
75
|
+
'''Get Parent element'''
|
76
|
+
return self.getParent(PlayerRoster)
|
77
|
+
|
78
|
+
registerElement(PlayerSide)
|
79
|
+
|
80
|
+
|
81
|
+
#
|
82
|
+
# EOF
|
83
|
+
#
|