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,79 @@
1
+ ## BEGIN_IMPORT
2
+ from common import VerboseGuard
3
+ from . base import *
4
+ from . element import Element
5
+ from . gameelements import GameElement
6
+ from . widget import WidgetElement
7
+ ## END_IMPORT
8
+
9
+ # --------------------------------------------------------------------
10
+ class ChartWindow(GameElement,WidgetElement):
11
+ TAG=Element.MODULE+'ChartWindow'
12
+ UNIQUE = ['name']
13
+ def __init__(self,elem,node=None,
14
+ name = '',
15
+ hotkey = key('A',ALT),
16
+ description = '',
17
+ text = '',
18
+ tooltip = 'Show/hide Charts',
19
+ icon = '/images/chart.gif'):
20
+ super(ChartWindow,self).__init__(elem,self.TAG,node=node,
21
+ name = name,
22
+ hotkey = hotkey,
23
+ description = description,
24
+ text = text,
25
+ tooltip = tooltip,
26
+ icon = icon)
27
+
28
+ def addChart(self,**kwargs):
29
+ '''Add a `Chart` element to this
30
+
31
+ Parameters
32
+ ----------
33
+ kwargs : dict
34
+ Dictionary of attribute key-value pairs
35
+
36
+ Returns
37
+ -------
38
+ element : Chart
39
+ The added element
40
+ '''
41
+ return self.add(Chart,**kwargs)
42
+ def getCharts(self,asdict=True):
43
+ '''Get all Chart element(s) from this
44
+
45
+ Parameters
46
+ ----------
47
+ asdict : bool
48
+ If `True`, return a dictonary that maps key to `Chart`
49
+ elements. If `False`, return a list of all Chart`
50
+ children.
51
+
52
+ Returns
53
+ -------
54
+ children : dict or list
55
+ Dictionary or list of `Chart` children
56
+
57
+ '''
58
+ return self.getElementsById(Chart,'chartName',asdict=asdict)
59
+
60
+ registerElement(ChartWindow)
61
+
62
+ # --------------------------------------------------------------------
63
+ class Chart(Element):
64
+ TAG=Element.WIDGET+'Chart'
65
+ UNIQUE = ['chartName','fileName']
66
+ def __init__(self,elem,node=None,
67
+ chartName = '',
68
+ fileName = '',
69
+ description = ''):
70
+ super(Chart,self).__init__(elem,self.TAG,node=node,
71
+ chartName = chartName,
72
+ description = description,
73
+ fileName = fileName)
74
+
75
+ registerElement(Chart)
76
+
77
+ #
78
+ # EOF
79
+ #
@@ -0,0 +1,197 @@
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 ChessClock(Element):
10
+ TAG=Element.MODULE+'chessclockcontrol.ChessClock'
11
+ UNIQUE = ['side']
12
+ def __init__(self,
13
+ doc,
14
+ node = None,
15
+ icon = '',
16
+ description = '',
17
+ side = '',
18
+ tooltip = 'Individual clock control',
19
+ buttonText = '',
20
+ startHotkey = '',
21
+ stopHotkey = '',
22
+ tickingBackgroundColor = rgb(255,255,0),
23
+ tickingFontColor = rgb(0,0,0),
24
+ tockingFontColor = rgb(51,51,51)):
25
+ '''Individual clock for a side
26
+
27
+ When the clock is running, the background colour may be
28
+ changed, and the colour of the numbers alternate between
29
+ `tickingFontColor` and `tockingFontColor`.
30
+
31
+ Parameters
32
+ ----------
33
+ doc : Element
34
+ Parent element
35
+ node : xml.dom.Element
36
+ Read from this node
37
+ icon : str
38
+ File name of button icon
39
+ description : str
40
+ Note on this clock
41
+ side : str
42
+ Name of side this clock belongs to
43
+ tooltop : str
44
+ Hover help text
45
+ buttonText : str
46
+ Text on button
47
+ startHotkey : str (key code)
48
+ Key or command to start timer
49
+ stopHotkey : str (key code)
50
+ Key or command to stop timer
51
+ tickingBackgroundColor : str (color)
52
+ Background color of time display when clock is running
53
+ tickingFontColor : str (color)
54
+ First color of numbers in display when clock is running.
55
+ tockingFontColor : str (color)
56
+ Second color of numbers in display when clock is running.
57
+ '''
58
+ super(ChessClock,self).__init__(#ChessClock
59
+ doc,
60
+ self.TAG,
61
+ node = node,
62
+ icon = icon,
63
+ description = description,
64
+ side = side,
65
+ tooltip = tooltip,
66
+ buttonText = buttonText,
67
+ startHotkey = startHotkey,
68
+ stopHotkey = stopHotkey,
69
+ tickingBackgroundColor = tickingBackgroundColor,
70
+ tickingFontColor = tickingFontColor,
71
+ tockingFontColor = tockingFontColor)
72
+
73
+ def getControl(self):
74
+ '''Get Parent element'''
75
+ return self.getParent(ChessClockControl)
76
+
77
+ registerElement(ChessClock)
78
+
79
+ # ====================================================================
80
+ class ChessClockControl(GameElement):
81
+ TAG=Element.MODULE+'ChessClockControl'
82
+ ALWAYS = 'Always'
83
+ AUTO = 'Auto'
84
+ NEVER = 'Never'
85
+ UNIQUE = ['name']
86
+ def __init__(self,
87
+ doc,
88
+ node = None,
89
+ name = 'Chess clock',
90
+ description = '',
91
+ buttonIcon = 'chess_clock.png',
92
+ buttonText = '',
93
+ buttonTooltip = 'Show/stop/hide chess clocks',
94
+ showHotkey = key('U',ALT),
95
+ pauseHotkey = key('U',CTRL_SHIFT),
96
+ nextHotkey = key('U'),
97
+ startOpponentKey = '',
98
+ showTenths = AUTO,
99
+ showSeconds = AUTO,
100
+ showHours = AUTO,
101
+ showDays = AUTO,
102
+ allowReset = False,
103
+ addClocks = True):
104
+ '''A set of chess clocs
105
+
106
+ Parameters
107
+ ----------
108
+ doc : Element
109
+ Parent
110
+ node : xml.dom.Element
111
+ Node to read state from
112
+ name : str
113
+ Name of clock control
114
+ description : str
115
+ Note on the chess clocks control
116
+ buttonIcon : str
117
+ Icon file name for button (chess_clock.png)
118
+ buttonText : str
119
+ Text on button
120
+ buttonTooltip : str
121
+ Hower help
122
+ showHotkey : str (key code)
123
+ Show or hide interface hot key
124
+ nextHotkey : str (key code)
125
+ Start the next clock hot key
126
+ pauseHotkey : str (key code)
127
+ Pause all clocks hot key
128
+ startOpponentKey : str (key code)
129
+ Start opponens clock
130
+ showTenths : one of AUTO, ALWAYS, NEVER
131
+ Whether to show tenths of seconds
132
+ showSeconds : one of AUTO, ALWAYS, NEVER
133
+ Whether to show seconds in clock
134
+ showHours : one of AUTO, ALWAYS, NEVER
135
+ Whether to show hours in clock
136
+ showDays : one of AUTO, ALWAYS, NEVER
137
+ Whether to show days in clock
138
+ allowReset : boolean
139
+ If true, allow manual reset of all clocks
140
+ '''
141
+ super(ChessClockControl,self).__init__(# ChessclockControl
142
+ doc,
143
+ self.TAG,
144
+ node = node,
145
+ name = name,
146
+ description = description,
147
+ buttonIcon = buttonIcon,
148
+ buttonText = buttonText,
149
+ buttonTooltip = buttonTooltip,
150
+ showHotkey = showHotkey,
151
+ pauseHotkey = pauseHotkey,
152
+ nextHotkey = nextHotkey,
153
+ startOpponentKey = startOpponentKey,
154
+ showTenths = showTenths,
155
+ showSeconds = showSeconds,
156
+ showHours = showHours,
157
+ showDays = showDays,
158
+ allowReset = allowReset)
159
+ print(node,addClocks)
160
+ if node is not None or not addClocks:
161
+ return
162
+
163
+ print('--- Will add clocks')
164
+ game = self.getGame()
165
+ roster = game.getPlayerRoster()[0]
166
+ sides = roster.getSides()
167
+ for side in sides:
168
+ name = side.getText()
169
+ self.addClock(side = name,
170
+ tooltip = f'Clock for {name}',
171
+ buttonText = name,
172
+ startHotkey = key('U'),
173
+ stopHotkey = key('U'))
174
+
175
+ def addClock(self,**kwargs):
176
+ '''Add a clock element to this
177
+
178
+ Parameters
179
+ ----------
180
+ kwargs : dict
181
+ Dictionary of attribute key-value pairs
182
+
183
+ Returns
184
+ -------
185
+ element : AboutScreen
186
+ The added element
187
+ '''
188
+ return self.add(ChessClock,**kwargs)
189
+ def getClocks(self,asdict=True):
190
+ '''Return dictionary of clocs'''
191
+ return self.getElementsByKey(ChessClock,'side',asdict)
192
+
193
+ registerElement(ChessClockControl)
194
+
195
+ #
196
+ # EOF
197
+ #
@@ -0,0 +1,98 @@
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='vassal.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=False)
26
+ c.run(args.output,
27
+ '../common/singleton.py',
28
+ '../common/verbose.py',
29
+ '../common/verboseguard.py',
30
+ '../common/dicedraw.py',
31
+ 'xml.py',
32
+ 'base.py',
33
+ 'element.py',
34
+ 'folder.py',
35
+ 'globalkey.py',
36
+ 'gameelements.py',
37
+ 'mapelements.py',
38
+ 'globalproperty.py',
39
+ 'turn.py',
40
+ 'documentation.py',
41
+ 'player.py',
42
+ 'chessclock.py',
43
+ 'widget.py',
44
+ 'grid.py',
45
+ 'zone.py',
46
+ 'board.py',
47
+ 'map.py',
48
+ 'chart.py',
49
+ 'command.py',
50
+ 'trait.py',
51
+ 'withtraits.py',
52
+ 'extension.py',
53
+ 'traits/area.py',
54
+ 'traits/clone.py',
55
+ 'traits/dynamicproperty.py',
56
+ 'traits/globalproperty.py',
57
+ 'traits/prototype.py',
58
+ 'traits/place.py',
59
+ 'traits/report.py',
60
+ 'traits/calculatedproperty.py',
61
+ 'traits/restrictcommand.py',
62
+ 'traits/label.py',
63
+ 'traits/layer.py',
64
+ 'traits/globalcommand.py',
65
+ 'traits/globalhotkey.py',
66
+ 'traits/nostack.py',
67
+ 'traits/deselect.py',
68
+ 'traits/restrictaccess.py',
69
+ 'traits/rotate.py',
70
+ 'traits/stack.py',
71
+ 'traits/mark.py',
72
+ 'traits/mask.py',
73
+ 'traits/trail.py',
74
+ 'traits/delete.py',
75
+ 'traits/sendto.py',
76
+ 'traits/moved.py',
77
+ 'traits/skel.py',
78
+ 'traits/submenu.py',
79
+ 'traits/basic.py',
80
+ 'traits/trigger.py',
81
+ 'traits/nonrect.py',
82
+ 'traits/click.py',
83
+ 'traits/mat.py',
84
+ 'traits/cargo.py',
85
+ 'traits/movefixed.py',
86
+ 'traits/sheet.py',
87
+ 'traits/hide.py',
88
+ 'traits/return.py',
89
+ 'game.py',
90
+ 'buildfile.py',
91
+ 'moduledata.py',
92
+ 'save.py',
93
+ 'vsav.py',
94
+ 'vmod.py',
95
+ 'upgrade.py',
96
+ 'exporter.py')
97
+
98
+
@@ -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,21 @@
1
+ ## BEGIN_IMPORT
2
+ from common import VerboseGuard
3
+ from . base import *
4
+ from . element import Element
5
+ ## END_IMPORT
6
+
7
+ # --------------------------------------------------------------------
8
+ class Command:
9
+ def __init__(self,what,iden,tpe,state):
10
+ self.cmd = '/'.join([what,iden,tpe,state])
11
+
12
+ # --------------------------------------------------------------------
13
+ class AddCommand(Command):
14
+ ID = '+'
15
+ def __init__(self,iden,tpe,state):
16
+ super(AddCommand,self).__init__(self.ID,iden,tpe,state)
17
+
18
+
19
+ #
20
+ # EOF
21
+ #