9 |
class _Empty: |
class _Empty: |
10 |
pass |
pass |
11 |
|
|
12 |
class UIState: |
class AnimationState: |
13 |
""" |
""" |
14 |
|
|
15 |
The following fields are public: |
The following fields are public: |
40 |
self.lastVs = vs |
self.lastVs = vs |
41 |
self.animate = 1 |
self.animate = 1 |
42 |
|
|
43 |
|
class UIState_Menu: |
44 |
|
""" |
45 |
|
|
46 |
|
The fields are accessible and are allowed |
47 |
|
to be read, but they |
48 |
|
should only be written to using the |
49 |
|
UIState_Menu object methods. |
50 |
|
|
51 |
|
shown -- If a menu is currently shown. |
52 |
|
|
53 |
|
originatingNode -- the node (may be None) |
54 |
|
on which the context menu |
55 |
|
was clicked open |
56 |
|
|
57 |
|
originatingMainNode -- the main view on which |
58 |
|
the context menu was clicked |
59 |
|
open. If originatingNode is |
60 |
|
non-null, this should be too. |
61 |
|
|
62 |
|
originatingBuoy -- the buoy on which the context |
63 |
|
menu was clicked open. |
64 |
|
XXX data format? |
65 |
|
|
66 |
|
""" |
67 |
|
|
68 |
|
def __init__(self): |
69 |
|
self.shown = 0 |
70 |
|
self.originatingMainNode = None |
71 |
|
self.originatingNode = None |
72 |
|
self.originatingBuoy = None |
73 |
|
def originateFromBuoy(self, buoy): |
74 |
|
self.originatingBuoy = buoy |
75 |
|
self.originatingNode = None |
76 |
|
self.originatingMainNode = None |
77 |
|
self.shown = 1 |
78 |
|
def originateFromMainNode(self, mainNode, node): |
79 |
|
self.originatingBuoy = None |
80 |
|
self.originatingNode = node |
81 |
|
self.originatingMainNode = mainNode |
82 |
|
self.shown = 1 |
83 |
|
def clear(self): |
84 |
|
self.__init__() |
85 |
|
|
86 |
|
|
87 |
class FenPDF: |
class FenPDF: |
88 |
"""This class represents a complete fenpdf "application". |
"""This class represents a complete fenpdf "application". |
89 |
|
|
103 |
|
|
104 |
mouse -- an object like org.fenfire.fenpdf.actions.mouse.MouseActions |
mouse -- an object like org.fenfire.fenpdf.actions.mouse.MouseActions |
105 |
key -- |
key -- |
106 |
|
menu -- |
107 |
|
|
108 |
structure -- an object with no methods, just fields: |
structure -- an object with no methods, just fields: |
109 |
|
|
114 |
|
|
115 |
window -- the GraphicsAPI.window object |
window -- the GraphicsAPI.window object |
116 |
|
|
117 |
uistate -- an UIState object |
animation -- an AnimationState object |
118 |
The internal members are prefixed by underscore. |
|
119 |
""" |
uistate -- just fields: |
120 |
|
This object stores **ALL** state about the |
121 |
|
user interface interactions, except |
122 |
|
the focuses of the main nodes, which are |
123 |
|
inside views. |
124 |
|
|
125 |
|
Any selections, cursors, &c are here. |
126 |
|
|
127 |
|
cursor -- the accursed node or plane |
128 |
|
|
129 |
|
menu -- State of the ui context menu. |
130 |
|
|
131 |
|
|
132 |
|
Any internal members are prefixed by underscore and should |
133 |
|
not be used by anyone else. |
134 |
|
""" |
135 |
|
|
136 |
def __init__(self, fen, treeTime): |
def __init__(self, fen, treeTime): |
137 |
self.fen = fen |
self.fen = fen |
139 |
self.events = _Empty() |
self.events = _Empty() |
140 |
self.actions = _Empty() |
self.actions = _Empty() |
141 |
self.structure = _Empty() |
self.structure = _Empty() |
142 |
self.uistate = UIState() |
self.animation = AnimationState() |
143 |
|
self.uistate = _Empty() |
144 |
|
self.uistate.menu = UIState_Menu() |
145 |
|
|
146 |
|
|
147 |
self.structure.structLink = ff.structure.StructLink.create(fen.graph) |
self.structure.structLink = ff.structure.StructLink.create(fen.graph) |
148 |
self.structure.alphContent = ff.util.AlphContent(fen) |
self.structure.alphContent = ff.util.AlphContent(fen) |