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,32 @@
1
+ ## BEGIN_IMPORT
2
+ from common import VerboseGuard
3
+ from .. trait import Trait
4
+ ## END_IMPORT
5
+
6
+ # --------------------------------------------------------------------
7
+ class RestrictCommandsTrait(Trait):
8
+ ID = 'hideCmd'
9
+ HIDE = 'Hide'
10
+ DISABLE = 'Disable'
11
+ def __init__(self,
12
+ name = '',
13
+ hideOrDisable = HIDE,
14
+ expression = '',# Restrict when true
15
+ keys = []):
16
+ '''Create a layer trait (VASSAL.counter.RestrictCommands)'''
17
+ super(RestrictCommandsTrait,self).__init__()
18
+ encKeys = ','.join([k.replace(',',r'\,') for k in keys])
19
+ self.setType(name = name,
20
+ hideOrDisable = hideOrDisable,
21
+ expression = expression,
22
+ keys = encKeys)
23
+ self.setState(state='')
24
+ def setKeys(self,keys):
25
+ self['keys'] = ','.join([k.replace(',',r'\,') for k in keys])
26
+
27
+
28
+ Trait.known_traits.append(RestrictCommandsTrait)
29
+
30
+ #
31
+ # EOF
32
+ #
@@ -0,0 +1,40 @@
1
+ ## BEGIN_IMPORT
2
+ from common import VerboseGuard
3
+ from .. trait import Trait
4
+ from .. base import *
5
+ ## END_IMPORT
6
+
7
+ # --------------------------------------------------------------------
8
+ class ReturnTrait(Trait):
9
+ ID = 'return'
10
+ def __init__(self,
11
+ command = '',
12
+ key = '',
13
+ deckId = '',
14
+ prompt = '',
15
+ description = '',
16
+ version = 2,
17
+ select = False, # If true, select at run-time
18
+ expression = ''
19
+ ):
20
+ '''Create a return trait (VASSAL.counter.ReturnToDeck)'''
21
+ super().__init__()
22
+
23
+ self.setType(command = command, # Context menu name
24
+ key = key, # Context menu key
25
+ deckId = deckId,
26
+ prompt = prompt,
27
+ description = description,
28
+ version = version,
29
+ select = select,
30
+ expression = expression
31
+ )
32
+ self.setState(state='')
33
+
34
+
35
+
36
+ Trait.known_traits.append(ReturnTrait)
37
+
38
+ #
39
+ # EOF
40
+ #
@@ -0,0 +1,62 @@
1
+ ## BEGIN_IMPORT
2
+ from common import VerboseGuard
3
+ from .. trait import Trait
4
+ from .. base import *
5
+ ## END_IMPORT
6
+
7
+ # --------------------------------------------------------------------
8
+ class RotateTrait(Trait):
9
+ ID = 'rotate'
10
+ def __init__(self,
11
+ nangles = 6,
12
+ rotateCWKey = key(']'),
13
+ rotateCCWKey = key('['),
14
+ rotateCW = 'Rotate CW',
15
+ rotateCCW = 'Rotate CCW',
16
+ rotateFree = 'Rotate ...',
17
+ rotateFreeKey = key(']'),
18
+ rotateRndKey = '',
19
+ rotateRnd = '',
20
+ name = 'Rotate',
21
+ description = 'Rotate piece',
22
+ rotateDirectKey = '',
23
+ rotateDirect = '',
24
+ directExpression = '',
25
+ directIsFacing = True,
26
+ angle = 0):
27
+ '''Create a Rotate trait'''
28
+ super(RotateTrait,self).__init__()
29
+ if nangles == 1:
30
+ self.setType(nangles = nangles,
31
+ rotateKey = rotateFreeKey,
32
+ rotate = rotateFree,
33
+ rotateRndKey = rotateRndKey,
34
+ rotateRnd = rotateRnd,
35
+ name = name,
36
+ description = description,
37
+ rotateDirectKey = rotateDirectKey,
38
+ rotateDirect = rotateDirect,
39
+ directExpression = directExpression,
40
+ directIsFacing = directIsFacing)
41
+ else:
42
+ self.setType(nangles = nangles,
43
+ rotateCWKey = rotateCWKey,
44
+ rotateCCWKey = rotateCCWKey,
45
+ rotateCW = rotateCW,
46
+ rotateCCW = rotateCCW,
47
+ rotateRndKey = rotateRndKey,
48
+ rotateRnd = rotateRnd,
49
+ name = name,
50
+ description = description,
51
+ rotateDirectKey = rotateDirectKey,
52
+ rotateDirect = rotateDirect,
53
+ directExpression = directExpression,
54
+ directIsFacing = directIsFacing)
55
+
56
+ self.setState(angle = int(angle) if nangles > 1 else float(angle))
57
+
58
+ Trait.known_traits.append(RotateTrait)
59
+
60
+ #
61
+ # EOF
62
+ #
@@ -0,0 +1,59 @@
1
+ ## BEGIN_IMPORT
2
+ from common import VerboseGuard
3
+ from .. trait import Trait
4
+ from .. base import *
5
+ ## END_IMPORT
6
+
7
+ # --------------------------------------------------------------------
8
+ class SendtoTrait(Trait):
9
+ ID = 'sendto'
10
+ LOCATION = 'L'
11
+ ZONE = 'Z'
12
+ REGION = 'R'
13
+ GRID = 'G'
14
+ COUNTER = 'A'
15
+ def __init__(self,
16
+ mapName = '',
17
+ boardName = '',
18
+ name = '',
19
+ key = key('E'),
20
+ restoreName = 'Restore',
21
+ restoreKey = key('R'),
22
+ x = 200,# Location
23
+ y = 200,# Location
24
+ xidx = 0, # All - extra x
25
+ yidx = 0, # All - extra y
26
+ xoff = 1, # All - factor on xidx
27
+ yoff = 1, # All - factor on yidx
28
+ description = '',
29
+ destination = LOCATION,
30
+ zone = '', # Zone and region - expression
31
+ region = '', # Region - expression
32
+ expression = '', # Counter - expression?
33
+ position = ''): # Grid - Fixed
34
+ '''Create a send to trait (VASSAL.counter.SendToLocation)'''
35
+ self.setType(name = name,# NAME
36
+ key = key,# KEY , MODIFIER
37
+ mapName = mapName,# MAP
38
+ boardName = boardName,# BOARD
39
+ x = x,
40
+ y = y,# X ; Y
41
+ restoreName = restoreName,# BACK
42
+ restoreKey = restoreKey,# KEY , MODIFIER
43
+ xidx = xidx,
44
+ yidx = yidx,# XIDX ; YIDX
45
+ xoff = xoff,
46
+ yoff = yoff,# XOFF ; YOFF
47
+ description = description,# DESC
48
+ destination = destination,# DEST type
49
+ zone = zone,# ZONE
50
+ region = region,# REGION
51
+ expression = expression,# EXPRESSION
52
+ position = position) # GRIDPOS
53
+ self.setState(backMap = '', backX = '', backY = '')
54
+
55
+ Trait.known_traits.append(SendtoTrait)
56
+
57
+ #
58
+ # EOF
59
+ #
@@ -0,0 +1,129 @@
1
+ ## BEGIN_IMPORT
2
+ from common import VerboseGuard
3
+ from .. trait import Trait
4
+ from .. base import *
5
+ ## END_IMPORT
6
+
7
+ # --------------------------------------------------------------------
8
+ class SheetTrait(Trait):
9
+ ID = 'propertysheet'
10
+ EVERY_KEY_TEXT = 'Every Keystroke'
11
+ APPLY_TEXT = 'Apply Button or Enter Key'
12
+ CLOSE_TEXT = 'Close Window or Enter Key'
13
+ EVERY_KEY = 0
14
+ APPLY = 1
15
+ CLOSE = 2
16
+ TEXT = 0
17
+ AREA = 1
18
+ LABEL = 2
19
+ TICKS = 3
20
+ TICKS_MAX = 4
21
+ TICKS_VAL = 5
22
+ TICKS_BOTH = 6
23
+ SPINNER = 7
24
+ TYPE_DELIM = ';'
25
+ DEF_DELIM = '~'
26
+ STATE_DELIM = '~'
27
+ LINE_DELIM = '|'
28
+ VALUE_DELIM = '/'
29
+
30
+ @classmethod
31
+ def encodeState(cls,k,e):
32
+ type = e['type']
33
+ if type == cls.TEXT: return f'{e["value"]}'
34
+ if type == cls.AREA: return f'{e["value"].replace("\n",LINE_DELIM)}'
35
+ if type == cls.SPINNER: return f'{e["value"]}'
36
+ if type in [cls.TICKS,cls.TICKS_MAX,cls.TICKS_VAL,cls.TICKS_BOTH]:
37
+ try:
38
+ val = int(e["value"])
39
+ except:
40
+ val = 0
41
+ try:
42
+ max = int(e["max"])
43
+ except:
44
+ max = 0
45
+ return f'{val}{cls.VALUE_DELIM}{max}'
46
+ return ''
47
+
48
+ @classmethod
49
+ def encodeDefinition(cls,rows):
50
+ definition = cls.DEF_DELIM.join([f'{e["type"]}{k}'
51
+ for k,e in rows.items()])
52
+
53
+ state = cls.STATE_DELIM.join([self.encodeState(k,e)
54
+ for k,e in rows.items()])
55
+ return definition, state
56
+
57
+ @classmethod
58
+ def decodeDefinition(cls,definitions,state):
59
+ tns = definitions.split(cls.DEF_DELIM)
60
+ sts = state .split(cls.STATE_DELIM)
61
+ def decodeDef(d):
62
+ try:
63
+ type = int(d[0])
64
+ except:
65
+ type = cls.TEXT
66
+ return type, d[1:]
67
+ rows = {}
68
+ for tn, st in zip(tns,sts):
69
+ type, name = decodeDef(tn)
70
+ rows[name] = { 'type': type }
71
+ rows[name].update(cls.decodeState(name,type,st))
72
+ return rows
73
+
74
+ @classmethod
75
+ def decodeState(cls,name,type,state):
76
+ if type == cls.TEXT: return {'value': state}
77
+ if type == cls.AREA: return {'value': state.replace('|','\n') }
78
+ if type == cls.SPINNER: return {'value': state}
79
+ if type in [cls.TICKS,
80
+ cls.TICKS_MAX,
81
+ cls.TICKS_VAL,
82
+ cls.TICKS_BOTH]:
83
+ fields = state.split(VALUE_DELIM)
84
+ try:
85
+ value = int(fields[0])
86
+ except:
87
+ value = 0
88
+ try:
89
+ max = int(fields[1])
90
+ except:
91
+ max = 0
92
+ return {'value': value, 'max': max }
93
+ return {}
94
+
95
+ def __init__(self,
96
+ command = '',
97
+ commit = EVERY_KEY,
98
+ color = ',,',
99
+ key = '',
100
+ description = '',
101
+ rows = {}):
102
+ '''Create a clone trait (VASSAL.counter.Clone)'''
103
+ super().__init__()
104
+ definition, state = self.encodeDefinition(rows)
105
+ rgbcol = color.split(',')
106
+ self.setType(definition = definition,
107
+ command = command, # Context menu name
108
+ letter = '',
109
+ commit = commit,
110
+ red = rgbcol[0],
111
+ green = rgbcol[1],
112
+ blue = rgbcol[2],
113
+ key = key, # Context menu key
114
+ description = description)
115
+ self.setState(state=state)
116
+
117
+
118
+ def getDefinitionState(self):
119
+ return self.decodeDefinition(self['definition'],self['state'])
120
+
121
+ def setDefinitionState(self,rows):
122
+ self['definition'], self['state'] = self.encodeDefinition(rows)
123
+
124
+
125
+ Trait.known_traits.append(SheetTrait)
126
+
127
+ #
128
+ # EOF
129
+ #
@@ -0,0 +1,9 @@
1
+ ## BEGIN_IMPORT
2
+ from common import VerboseGuard
3
+ from .. trait import Trait
4
+ ## END_IMPORT
5
+
6
+
7
+ #
8
+ # EOF
9
+ #
@@ -0,0 +1,28 @@
1
+ ## BEGIN_IMPORT
2
+ from common import VerboseGuard
3
+ from .. trait import Trait
4
+ ## END_IMPORT
5
+
6
+ # --------------------------------------------------------------------
7
+ class StackTrait(Trait):
8
+ ID = 'stack'
9
+ def __init__(self,
10
+ board = '',
11
+ x = '',
12
+ y = '',
13
+ pieceIds = [],
14
+ layer = -1):
15
+ '''Create a stack trait in a save file'''
16
+ self.setType() # NAME
17
+ # print('Piece IDs:',pieceIds)
18
+ self.setState(board = board,
19
+ x = x,
20
+ y = y,
21
+ pieceIds = ';'.join([str(p) for p in pieceIds]),
22
+ layer = f'@@{layer}')
23
+
24
+ Trait.known_traits.append(StackTrait)
25
+
26
+ #
27
+ # EOF
28
+ #
@@ -0,0 +1,27 @@
1
+ ## BEGIN_IMPORT
2
+ from common import VerboseGuard
3
+ from .. trait import Trait
4
+ ## END_IMPORT
5
+
6
+ # --------------------------------------------------------------------
7
+ class SubMenuTrait(Trait):
8
+ ID = 'submenu'
9
+ def __init__(self,
10
+ subMenu = '', # Title
11
+ keys = [], # Keys
12
+ description = ''):
13
+ '''Create a sub menu (VASSAL.counters.SubMenu)'''
14
+ self.setType(subMenu = subMenu, # CLONEKEY
15
+ keys = ','.join([k.replace(',',r'\,')
16
+ for k in keys]),
17
+ description = description)
18
+ self.setState() # PROPERTY COUNT (followed by [; KEY; VALUE]+)
19
+ def setKeys(self,keys):
20
+ '''Set the keys'''
21
+ self['keys'] = ','.join([k.replace(',',r'\,') for k in keys])
22
+
23
+ Trait.known_traits.append(SubMenuTrait)
24
+
25
+ #
26
+ # EOF
27
+ #
@@ -0,0 +1,61 @@
1
+ ## BEGIN_IMPORT
2
+ from common import VerboseGuard
3
+ from .. trait import Trait
4
+ from .. base import *
5
+ ## END_IMPORT
6
+
7
+ # --------------------------------------------------------------------
8
+ class TrailTrait(Trait):
9
+ ID = 'footprint'
10
+ def __init__(self,
11
+ key = key('T'),
12
+ name = 'Movement Trail',
13
+ localVisible = False, # Start on
14
+ globalVisible = True, # Visible to all players
15
+ radius = 10,
16
+ fillColor = rgb(255,255,255),
17
+ lineColor = rgb(0,0,0),
18
+ activeOpacity = 100,
19
+ inactiveOpacity = 50,
20
+ edgesBuffer = 20,
21
+ displayBuffer = 30,
22
+ lineWidth = 5,
23
+ turnOn = key(NONE,0)+',wgTrailsOn',
24
+ turnOff = key(NONE,0)+',wgTrailsOff',
25
+ reset = '',
26
+ description = 'Enable or disable movement trail'):
27
+ ''' Create a movement trail trait ( VASSAL.counters.Footprint)'''
28
+ super(TrailTrait,self).__init__()
29
+ lw = (lineWidth
30
+ if isinstance(lineWidth,str) and lineWidth.startswith('{') else
31
+ int(lineWidth))
32
+ ra = (radius
33
+ if isinstance(radius,str) and radius.startswith('{') else
34
+ int(radius))
35
+
36
+ self.setType(key = key,# ENABLE KEY
37
+ name = name,# MENU
38
+ localVisible = localVisible,# LOCAL VISABLE
39
+ globalVisible = globalVisible,# GLOBAL VISABLE
40
+ radius = ra,# RADIUS
41
+ fillColor = fillColor,# FILL COLOR
42
+ lineColor = lineColor,# LINE COLOR
43
+ activeOpacity = activeOpacity,# ACTIVE OPACITY
44
+ inactiveOpacity = inactiveOpacity,# INACTIVE OPACITY
45
+ edgesBuffer = edgesBuffer,# EDGES BUFFER
46
+ displayBuffer = displayBuffer,# DISPLAY BUFFER
47
+ lineWidth = lw,# LINE WIDTH
48
+ turnOn = turnOn,# TURN ON KEY
49
+ turnOff = turnOff,# TURN OFF KEY
50
+ reset = reset,# RESET KEY
51
+ description = description) # DESC
52
+ self.setState(isGlobal = False,
53
+ map = '',
54
+ points = 0, # POINTS (followed by [; [X,Y]*]
55
+ init = False)
56
+
57
+ Trait.known_traits.append(TrailTrait)
58
+
59
+ #
60
+ # EOF
61
+ #
@@ -0,0 +1,72 @@
1
+ ## BEGIN_IMPORT
2
+ from common import VerboseGuard
3
+ from .. trait import Trait
4
+ from .. base import *
5
+ ## END_IMPORT
6
+
7
+ # --------------------------------------------------------------------
8
+ class TriggerTrait(Trait):
9
+ ID = 'macro'
10
+ WHILE = 'while'
11
+ UNTIL = 'until'
12
+ COUNTED = 'counted' # - Always one "do ... while"
13
+ def __init__(self,
14
+ name = '',
15
+ command = '', # Context menu name
16
+ key = '', # Context menu key
17
+ property = '', # Enable/Disable
18
+ watchKeys = [],
19
+ actionKeys = [], # What to do
20
+ loop = False,
21
+ preLoop = '', # Key
22
+ postLoop = '', # Key
23
+ loopType = COUNTED, # Loop type
24
+ whileExpression = '',
25
+ untilExpression = '',
26
+ count = 0,
27
+ index = False,
28
+ indexProperty = '',
29
+ indexStart = '',
30
+ indexStep = ''):
31
+ '''Create a layer trait (VASSAL.counter.Trigger)'''
32
+ super(TriggerTrait,self).__init__()
33
+ encWKeys = Trait.encodeKeys(watchKeys, ',')
34
+ encAKeys = Trait.encodeKeys(actionKeys,',')
35
+ self.setType(name = name,
36
+ command = command, # Context menu name
37
+ key = key, # Context menu key
38
+ property = property, # Enable/Disable
39
+ watchKeys = encWKeys,
40
+ actionKeys = encAKeys, # What to do
41
+ loop = loop,
42
+ preLoop = preLoop, # Key
43
+ postLoop = postLoop, # Key
44
+ loopType = loopType, # Loop type
45
+ whileExpression = whileExpression,
46
+ untilExpression = untilExpression,
47
+ count = count,
48
+ index = index,
49
+ indexProperty = indexProperty,
50
+ indexStart = indexStart,
51
+ indexStep = indexStep)
52
+ self.setState(state='')
53
+
54
+ def getActionKeys(self):
55
+ return Trait.decodeKeys(self['actionKeys'],',')
56
+
57
+ def getWatchKeys(self):
58
+ return Trait.decodeKeys(self['watchKeys'],',')
59
+
60
+ def setActionKeys(self,keys):
61
+ self['actionKeys'] = Trait.encodeKeys(keys,',')
62
+
63
+ def setWatchKeys(self,keys):
64
+ self['watchKeys'] = Trait.encodeKeys(keys,',')
65
+
66
+
67
+
68
+ Trait.known_traits.append(TriggerTrait)
69
+
70
+ #
71
+ # EOF
72
+ #