Mercurial > MadButterfly
annotate pyink/MBScene.py @ 1020:f25b8ad338b4 refine_backend_if
Fix error on error checking for mb_timer_man_new()
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Mon, 22 Nov 2010 13:57:59 +0800 |
parents | 1028f6278ead |
children | 84f502fb3e40 |
rev | line source |
---|---|
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
1 #!/usr/bin/python |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
2 # -*- indent-tabs-mode: t; tab-width: 8; python-indent: 4; -*- |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
3 # vim: sw=4:ts=8:sts=4 |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
4 import pygtk |
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
5 import gtk |
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
6 from copy import deepcopy |
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
7 from lxml import etree |
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
8 import random |
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
9 import traceback |
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
10 |
957 | 11 # Please refer to |
12 # http://www.assembla.com/wiki/show/MadButterfly/Inkscape_extention | |
13 # for the designed document. | |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
14 |
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
15 |
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
16 # Algorithm: |
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
17 # |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
18 # We will parse the first two level of the SVG DOM. collect a table of |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
19 # layer and scene. |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
20 # - 1. Collect the layer table which will be displayed as the first |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
21 # column of the grid. |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
22 # - 2. Get the maximum scene number. This will decide the size of the |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
23 # grid. |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
24 # - 3. When F6 is pressed, we will check if this scene has been |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
25 # defined. This can be done by scan all second level group and |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
26 # check if the current scene number is within the range specified |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
27 # by scene field. The function IsSceneDefined(scene) can be used |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
28 # for this purpose. |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
29 # - 4. If this is a new scene, we will append a new group which |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
30 # duplication the content of the last scene in the same |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
31 # group. The scene field will contain the number from the last |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
32 # scene number of the last scene to the current scenen |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
33 # number. For example, if the last scene is from 4-7 and the new |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
34 # scene is 10, we will set the scene field as "8-10". |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
35 # - 5. If this scene are filled screne, we will split the existing |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
36 # scene into two scenes with the same content. |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
37 # |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
38 |
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
39 class Layer: |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
40 def __init__(self,node): |
962
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
41 self.scenes = [] |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
42 self.node = node |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
43 self.nodes=[] |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
44 pass |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
45 pass |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
46 |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
47 class Scene: |
956 | 48 def __init__(self, node, start,end): |
49 self.node = node | |
50 self.start = int(start) | |
51 self.end = int(end) | |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
52 pass |
956 | 53 pass |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
54 |
957 | 55 _scenes = '{http://madbutterfly.sourceforge.net/DTD/madbutterfly.dtd}scenes' |
56 _scene = '{http://madbutterfly.sourceforge.net/DTD/madbutterfly.dtd}scene' | |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
57 |
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
58 class MBScene(): |
956 | 59 def __init__(self,desktop,win): |
60 self.desktop = desktop | |
61 self.window = win | |
961
b6375e74c69e
Rename MBScene.layer to MBScene.layers
Thinker K.F. Li <thinker@codemud.net>
parents:
960
diff
changeset
|
62 self.layers = [] |
b6375e74c69e
Rename MBScene.layer to MBScene.layers
Thinker K.F. Li <thinker@codemud.net>
parents:
960
diff
changeset
|
63 self.layers.append(Layer(None)) |
956 | 64 self.scenemap = None |
65 pass | |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
66 |
956 | 67 def confirm(self,msg): |
68 vbox = gtk.VBox() | |
69 vbox.pack_start(gtk.Label(msg)) | |
70 self.button = gtk.Button('OK') | |
71 vbox.pack_start(self.button) | |
72 self.button.connect("clicked", self.onQuit) | |
73 self.window.add(vbox) | |
74 pass | |
75 | |
76 def dumpattr(self,n): | |
77 s = "" | |
78 for a,v in n.attrib.items(): | |
79 s = s + ("%s=%s" % (a,v)) | |
80 pass | |
81 return s | |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
82 |
956 | 83 def dump(self,node,l=0): |
84 print " " * l*2,"<", node.tag, self.dumpattr(node),">" | |
85 for n in node: | |
86 self.dump(n,l+1) | |
87 pass | |
88 print " " * l * 2,"/>" | |
89 pass | |
90 | |
91 def parseMetadata(self,node): | |
92 self.current = 1 | |
93 for n in node.childList(): | |
94 if n.repr.name() == 'ns0:scenes': | |
95 self.scenemap={} | |
96 cur = int(n.repr.attribute("current")) | |
97 self.current = cur | |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
98 |
956 | 99 for s in n.childList(): |
100 print '--->',s.repr.name() | |
101 if s.repr.name() == 'ns0:scene': | |
102 try: | |
103 start = int(s.repr.attribute("start")) | |
104 except: | |
105 traceback.print_exc() | |
106 continue | |
107 try: | |
108 end = s.repr.attribute("end") | |
109 if end == None: | |
110 end = start | |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
111 pass |
956 | 112 except: |
113 end = start | |
114 pass | |
115 link = s.repr.attribute("ref") | |
116 self.scenemap[link] = [int(start),int(end)] | |
957 | 117 print "scene %d to %d" % (self.scenemap[link][0], |
118 self.scenemap[link][1]) | |
956 | 119 if cur >= start and cur <= end: |
120 self.currentscene = link | |
121 pass | |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
122 pass |
956 | 123 pass |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
124 pass |
956 | 125 pass |
126 pass | |
127 | |
128 | |
129 def parseScene(self): | |
130 """ | |
957 | 131 In this function, we will collect all items for the current |
132 scene and then relocate them back to the appropriate scene | |
133 object. | |
956 | 134 """ |
961
b6375e74c69e
Rename MBScene.layer to MBScene.layers
Thinker K.F. Li <thinker@codemud.net>
parents:
960
diff
changeset
|
135 self.layers = [] |
956 | 136 self.scenemap = None |
137 doc = self.desktop.doc().root() | |
138 | |
139 for node in doc.childList(): | |
140 if node.repr.name() == 'svg:metadata': | |
141 self.parseMetadata(node) | |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
142 pass |
956 | 143 elif node.repr.name() == 'svg:g': |
144 oldscene = None | |
145 #print layer.attrib.get("id") | |
146 lyobj = Layer(node) | |
961
b6375e74c69e
Rename MBScene.layer to MBScene.layers
Thinker K.F. Li <thinker@codemud.net>
parents:
960
diff
changeset
|
147 self.layers.append(lyobj) |
956 | 148 lyobj.current_scene = [] |
149 for scene in node.childList(): | |
150 if scene.repr.name() == 'svg:g': | |
151 try: | |
152 scmap = self.scenemap[scene.getId()] | |
153 if scmap == None: | |
154 lyobj.current_scene.append(scene) | |
155 continue | |
957 | 156 if self.current <= scmap[1] and \ |
157 self.current >= scmap[0]: | |
956 | 158 oldscene = scene |
159 pass | |
160 except: | |
161 lyobj.current_scene.append(scene) | |
162 continue | |
163 | |
962
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
164 lyobj.scenes.append(Scene(scene,scmap[0],scmap[1])) |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
165 pass |
956 | 166 else: |
167 lyobj.current_scene.append(scene) | |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
168 pass |
956 | 169 pass |
170 | |
171 if oldscene != None: | |
172 # Put the objects back to the current scene | |
173 # for o in lyobj.current_scene: | |
174 # print o.tag | |
175 # oldscene.append(o) | |
176 pass | |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
177 pass |
956 | 178 pass |
179 | |
180 self.collectID() | |
181 self.dumpID() | |
182 pass | |
183 | |
184 def collectID(self): | |
185 self.ID = {} | |
186 root = self.desktop.doc().root() | |
187 for n in root.childList(): | |
188 self.collectID_recursive(n) | |
189 pass | |
190 pass | |
191 | |
192 def collectID_recursive(self,node): | |
193 self.ID[node.getId()] = 1 | |
194 for n in node.childList(): | |
195 self.collectID_recursive(n) | |
196 pass | |
197 pass | |
198 | |
199 def newID(self): | |
200 while True: | |
201 n = 's%d' % int(random.random()*10000) | |
202 #print "try %s" % n | |
203 if self.ID.has_key(n) == False: | |
204 return n | |
205 pass | |
206 pass | |
207 | |
208 def dumpID(self): | |
209 for a,v in self.ID.items(): | |
210 print a | |
211 pass | |
212 pass | |
213 | |
214 def getLayer(self, layer): | |
961
b6375e74c69e
Rename MBScene.layer to MBScene.layers
Thinker K.F. Li <thinker@codemud.net>
parents:
960
diff
changeset
|
215 for l in self.layers: |
956 | 216 if l.node.getId() == layer: |
217 return l | |
218 pass | |
219 return None | |
220 | |
221 | |
222 def insertKeyScene(self): | |
223 """ | |
957 | 224 Insert a new key scene into the stage. If the nth is always a |
225 key scene, we will return without changing anything. If the | |
226 nth is a filled scene, we will break the original scene into | |
227 two parts. If the nth is out of any scene, we will append a | |
228 new scene. | |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
229 |
956 | 230 """ |
231 nth = self.last_cell.nScene | |
232 layer = self.getLayer(self.last_cell.layer) | |
233 x = self.last_cell.nScene | |
234 y = self.last_cell.nLayer | |
235 if layer == None: return | |
962
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
236 for i in range(0,len(layer.scenes)): |
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
237 s = layer.scenes[i] |
956 | 238 if nth >= s.start and nth <= s.end: |
239 if nth == s.start: return | |
240 newscene = Scene(DuplicateNode(s.node),nth,s.end) | |
241 newscene.node.setId(self.newID()) | |
962
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
242 layer.scenes.insert(i+1,newscene) |
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
243 layer.scenes[i].end = nth-1 |
956 | 244 btn = self.newCell('start.png') |
245 btn.nScene = nth | |
246 btn.layer = layer | |
247 btn.nLayer = y | |
248 self.grid.remove(self.last_cell) | |
249 self.grid.attach(btn, x,x+1,y,y+1,0,0,0,0) | |
250 return | |
251 pass | |
252 | |
962
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
253 if len(layer.scenes) > 0: |
956 | 254 last = nth |
255 lastscene = None | |
962
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
256 for s in layer.scenes: |
956 | 257 if s.end < nth and last < s.end: |
258 last = s.end | |
259 lastscene = s | |
260 pass | |
261 pass | |
262 | |
263 for x in range(last+1, nth): | |
264 btn = self.newCell('fill.png') | |
265 btn.nScene = x | |
266 btn.layer = layer.node.getId() | |
267 btn.nLayer = y | |
268 self.grid.attach(btn, x, x+1, y , y+1,0,0,0,0) | |
269 pass | |
270 | |
271 if lastscene == None: | |
957 | 272 node = etree.Element(_scene) |
956 | 273 node.setId(self.newID()) |
274 newscene = Scene(node,nth,nth) | |
275 else: | |
276 lastscene.end = nth-1 | |
277 newscene = Scene(DuplicateNode(lastscene.node),nth,nth) | |
278 newscene.node.setId(self.newID()) | |
279 pass | |
280 | |
962
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
281 layer.scenes.append(newscene) |
956 | 282 btn = self.newCell('start.png') |
283 x = self.last_cell.nScene | |
284 y = self.last_cell.nLayer | |
285 btn.nScene = nth | |
286 btn.layer = layer.node.getId() | |
287 btn.nLayer = y | |
288 self.grid.attach(btn, x, x+1, y, y+1,0,0,0,0) | |
289 else: | |
290 # This is the first scene in the layer | |
957 | 291 node = etree.Element(_scene) |
956 | 292 node.repr.setId(self.newID()) |
293 newscene = Scene(node,nth,nth) | |
962
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
294 layer.scenes.append(newscene) |
956 | 295 btn = self.newCell('start.png') |
296 btn.nScene = nth | |
297 btn.layer = layer.node.getId() | |
298 btn.nLayer = y | |
299 self.grid.attach(btn, x, x+1, y, y+1,0,0,0,0) | |
300 pass | |
301 pass | |
302 | |
303 | |
304 def removeKeyScene(self): | |
305 nth = self.last_cell.nScene | |
306 try: | |
307 layer = self.getLayer(self.last_cell.layer) | |
308 except: | |
309 return | |
310 x = self.last_cell.nScene | |
311 y = self.last_cell.nLayer | |
962
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
312 for i in range(0,len(layer.scenes)): |
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
313 s = layer.scenes[i] |
956 | 314 if nth == s.start: |
315 if i == 0: | |
316 for j in range(s.start,s.end+1): | |
317 btn = self.newCell('empty.png') | |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
318 btn.nScene = nth |
956 | 319 btn.layer = layer |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
320 btn.nLayer = y |
956 | 321 self.grid.attach(btn, j,j+1,y,y+1,0,0,0,0) |
322 pass | |
962
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
323 layer.scenes.remove(s) |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
324 else: |
962
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
325 if s.start == layer.scenes[i-1].end+1: |
957 | 326 # If the start of the delete scene segment is |
327 # the end of the last scene segmenet, convert | |
328 # all scenes in the deleted scene segmenet to | |
329 # the last one | |
962
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
330 layer.scenes[i-1].end = s.end |
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
331 layer.scenes.remove(s) |
956 | 332 btn = self.newCell('fill.png') |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
333 |
956 | 334 btn.nScene = nth |
335 btn.layer = layer | |
336 btn.nLayer = y | |
337 self.grid.attach(btn, x,x+1,y,y+1,0,0,0,0) | |
338 else: | |
339 # Convert all scenes into empty cell | |
962
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
340 layer.scenes.remove(s) |
956 | 341 for j in range(s.start,s.end+1): |
342 btn = self.newCell('empty.png') | |
343 btn.nScene = nth | |
344 btn.layer = layer | |
345 btn.nLayer = y | |
346 self.grid.attach(btn, j,j+1,y,y+1,0,0,0,0) | |
347 pass | |
348 pass | |
349 pass | |
350 return | |
351 pass | |
352 pass | |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
353 |
956 | 354 def extendScene(self): |
355 nth = self.last_cell.nScene | |
356 try: | |
357 layer = self.getLayer(self.last_cell.layer) | |
358 except: | |
359 traceback.print_exc() | |
360 return | |
361 x = self.last_cell.nScene | |
362 y = self.last_cell.nLayer | |
363 if layer == None: | |
364 return | |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
365 |
962
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
366 for i in range(0,len(layer.scenes)-1): |
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
367 s = layer.scenes[i] |
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
368 if nth >= layer.scenes[i].start and nth <= layer.scenes[i].end: |
956 | 369 return |
370 pass | |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
371 |
962
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
372 for i in range(0,len(layer.scenes)-1): |
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
373 s = layer.scenes[i] |
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
374 if nth >= layer.scenes[i].start and nth < layer.scenes[i+1].start: |
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
375 for j in range(layer.scenes[i].end+1, nth+1): |
956 | 376 btn = self.newCell('fill.png') |
377 btn.nScene = nth | |
378 btn.nLayer = y | |
379 btn.layer = self.last_cell.layer | |
380 self.grid.attach(btn, j,j+1,y,y+1,0,0,0,0) | |
962
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
381 layer.scenes[i].end = nth |
956 | 382 return |
383 pass | |
962
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
384 if len(layer.scenes) > 0 and \ |
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
385 nth > layer.scenes[len(layer.scenes)-1].end: |
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
386 for j in range(layer.scenes[len(layer.scenes)-1].end+1, nth+1): |
956 | 387 btn = self.newCell('fill.png') |
388 btn.nScene = nth | |
389 btn.nLayer = y | |
390 btn.layer = self.last_cell.layer | |
391 self.grid.attach(btn, j,j+1,y,y+1,0,0,0,0) | |
392 pass | |
962
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
393 layer.scenes[len(layer.scenes)-1].end = nth |
956 | 394 pass |
395 pass | |
396 pass | |
397 | |
398 def setCurrentScene(self,nth): | |
399 self.current = nth | |
961
b6375e74c69e
Rename MBScene.layer to MBScene.layers
Thinker K.F. Li <thinker@codemud.net>
parents:
960
diff
changeset
|
400 for layer in self.layers: |
962
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
401 for s in layer.scenes: |
956 | 402 if nth >= s.start and nth <= s.end: |
403 s.node.repr.setAttribute("style","",True) | |
959
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
404 # print "Put the elemenets out" |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
405 layer.nodes = [] |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
406 |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
407 # for o in s.node: |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
408 # print " ",o.tag |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
409 # layer.nodes.append(o) |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
410 # for o in s.node: |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
411 # s.node.remove(o) |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
412 else: |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
413 s.node.repr.setAttribute("style","display:none",True) |
956 | 414 pass |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
415 pass |
956 | 416 pass |
417 pass | |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
418 |
956 | 419 def generate(self): |
420 newdoc = deepcopy(self.document) | |
421 root = newdoc.getroot() | |
422 has_scene = False | |
423 for n in root: | |
424 if n.tag == '{http://www.w3.org/2000/svg}metadata': | |
425 for nn in n: | |
957 | 426 if nn.tag == _scenes: |
956 | 427 nn.clear() |
428 nn.set("current", "%d" % self.current) | |
429 scenes = [] | |
961
b6375e74c69e
Rename MBScene.layer to MBScene.layers
Thinker K.F. Li <thinker@codemud.net>
parents:
960
diff
changeset
|
430 for l in self.layers: |
962
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
431 for s in l.scenes: |
956 | 432 id = s.node.get("id") |
957 | 433 scene = etree.Element(_scene) |
956 | 434 scene.set("ref", id) |
435 if s.start == s.end: | |
436 scene.set("start", "%d" % s.start) | |
437 else: | |
438 scene.set("start", "%d" % s.start) | |
439 scene.set("end", "%d" % s.end) | |
440 pass | |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
441 |
956 | 442 scenes.append(scene) |
443 pass | |
444 pass | |
445 for s in scenes: | |
446 nn.append(s) | |
447 pass | |
448 has_scene = True | |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
449 pass |
956 | 450 pass |
451 if has_scene == False: | |
957 | 452 scenes = etree.Element(_scenes) |
956 | 453 scenes.set("current","%d" % self.current) |
961
b6375e74c69e
Rename MBScene.layer to MBScene.layers
Thinker K.F. Li <thinker@codemud.net>
parents:
960
diff
changeset
|
454 for l in self.layers: |
962
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
455 for s in l.scenes: |
957 | 456 scene = etree.Element(_scene) |
956 | 457 scene.set("ref", s.node.get("id")) |
458 if s.start == s.end: | |
459 scene.set("start", "%d" % s.start) | |
460 else: | |
461 scene.set("start", "%d" % s.start) | |
462 scene.set("end", "%d" % s.end) | |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
463 pass |
956 | 464 scenes.append(scene) |
465 pass | |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
466 pass |
956 | 467 n.append(scenes) |
468 pass | |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
469 pass |
956 | 470 if n.tag == '{http://www.w3.org/2000/svg}g': |
471 root.remove(n) | |
472 pass | |
473 pass | |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
474 |
961
b6375e74c69e
Rename MBScene.layer to MBScene.layers
Thinker K.F. Li <thinker@codemud.net>
parents:
960
diff
changeset
|
475 for l in self.layers: |
956 | 476 # Duplicate all attribute of the layer |
477 lnode = etree.Element("{http://www.w3.org/2000/svg}g") | |
478 for a,v in l.node.attrib.items(): | |
479 lnode.set(a,v) | |
480 pass | |
481 for n in l.nodes: | |
482 lnode.append(n) | |
483 pass | |
484 root.append(lnode) | |
962
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
485 for s in l.scenes: |
956 | 486 snode = etree.Element("{http://www.w3.org/2000/svg}g") |
487 for a,v in s.node.attrib.items(): | |
488 snode.set(a,v) | |
489 pass | |
490 for n in s.node: | |
491 snode.append(deepcopy(n)) | |
492 pass | |
493 lnode.append(snode) | |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
494 pass |
956 | 495 pass |
496 self.document = newdoc | |
497 pass | |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
498 |
956 | 499 def newCell(self,file): |
500 img = gtk.Image() | |
501 img.set_from_file(file) | |
502 btn = gtk.EventBox() | |
503 btn.add(img) | |
504 btn.connect("button_press_event", self.cellSelect) | |
505 btn.modify_bg(gtk.STATE_NORMAL, btn.get_colormap().alloc_color("gray")) | |
506 return btn | |
507 | |
963
a05ec4fb1c20
update framelines according content 0f layers
Thinker K.F. Li <thinker@codemud.net>
parents:
962
diff
changeset
|
508 def _create_framelines(self): |
959
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
509 import frameline |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
510 self.scrollwin = gtk.ScrolledWindow() |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
511 self.scrollwin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
512 self.scrollwin.set_size_request(-1,150) |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
513 |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
514 nframes = 100 |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
515 |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
516 vbox = gtk.VBox() |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
517 vbox.show() |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
518 self.scrollwin.add_with_viewport(vbox) |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
519 |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
520 ruler = frameline.frameruler(nframes) |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
521 ruler.set_size_request(nframes * 10, 20) |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
522 ruler.show() |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
523 vbox.pack_start(ruler, False) |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
524 |
960
8fd97e0becb3
Add a frameline for each layer
Thinker K.F. Li <thinker@codemud.net>
parents:
959
diff
changeset
|
525 # |
8fd97e0becb3
Add a frameline for each layer
Thinker K.F. Li <thinker@codemud.net>
parents:
959
diff
changeset
|
526 # Add a frameline for each layer |
8fd97e0becb3
Add a frameline for each layer
Thinker K.F. Li <thinker@codemud.net>
parents:
959
diff
changeset
|
527 # |
8fd97e0becb3
Add a frameline for each layer
Thinker K.F. Li <thinker@codemud.net>
parents:
959
diff
changeset
|
528 self._framelines = [] |
961
b6375e74c69e
Rename MBScene.layer to MBScene.layers
Thinker K.F. Li <thinker@codemud.net>
parents:
960
diff
changeset
|
529 for i in range(len(self.layers)): |
960
8fd97e0becb3
Add a frameline for each layer
Thinker K.F. Li <thinker@codemud.net>
parents:
959
diff
changeset
|
530 line = frameline.frameline(nframes) |
8fd97e0becb3
Add a frameline for each layer
Thinker K.F. Li <thinker@codemud.net>
parents:
959
diff
changeset
|
531 line.set_size_request(nframes * 10, 20) |
8fd97e0becb3
Add a frameline for each layer
Thinker K.F. Li <thinker@codemud.net>
parents:
959
diff
changeset
|
532 vbox.pack_start(line, False) |
8fd97e0becb3
Add a frameline for each layer
Thinker K.F. Li <thinker@codemud.net>
parents:
959
diff
changeset
|
533 self._framelines.append(line) |
8fd97e0becb3
Add a frameline for each layer
Thinker K.F. Li <thinker@codemud.net>
parents:
959
diff
changeset
|
534 pass |
8fd97e0becb3
Add a frameline for each layer
Thinker K.F. Li <thinker@codemud.net>
parents:
959
diff
changeset
|
535 pass |
8fd97e0becb3
Add a frameline for each layer
Thinker K.F. Li <thinker@codemud.net>
parents:
959
diff
changeset
|
536 |
963
a05ec4fb1c20
update framelines according content 0f layers
Thinker K.F. Li <thinker@codemud.net>
parents:
962
diff
changeset
|
537 ## \brief Update conetent of frameliens according layers. |
a05ec4fb1c20
update framelines according content 0f layers
Thinker K.F. Li <thinker@codemud.net>
parents:
962
diff
changeset
|
538 # |
a05ec4fb1c20
update framelines according content 0f layers
Thinker K.F. Li <thinker@codemud.net>
parents:
962
diff
changeset
|
539 def _update_framelines(self): |
a05ec4fb1c20
update framelines according content 0f layers
Thinker K.F. Li <thinker@codemud.net>
parents:
962
diff
changeset
|
540 for layer_i, layer in enumerate(self.layers): |
962
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
541 for scene in layer.scenes: |
963
a05ec4fb1c20
update framelines according content 0f layers
Thinker K.F. Li <thinker@codemud.net>
parents:
962
diff
changeset
|
542 frameline = self._framelines[layer_i] |
a05ec4fb1c20
update framelines according content 0f layers
Thinker K.F. Li <thinker@codemud.net>
parents:
962
diff
changeset
|
543 for scene_i in range(scene.start, scene.stop + 1): |
a05ec4fb1c20
update framelines according content 0f layers
Thinker K.F. Li <thinker@codemud.net>
parents:
962
diff
changeset
|
544 frameline.add_keyframe(scene_i) |
a05ec4fb1c20
update framelines according content 0f layers
Thinker K.F. Li <thinker@codemud.net>
parents:
962
diff
changeset
|
545 pass |
962
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
546 pass |
6612fd386ea9
Rename Layer.scene to Layer.scenes since it is a list of scenes
Thinker K.F. Li <thinker@codemud.net>
parents:
961
diff
changeset
|
547 pass |
959
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
548 pass |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
549 |
956 | 550 def cellSelect(self, cell, data): |
551 if self.last_cell: | |
957 | 552 color = self.last_cell.get_colormap().alloc_color("gray") |
553 self.last_cell.modify_bg(gtk.STATE_NORMAL, color) | |
956 | 554 pass |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
555 |
956 | 556 self.last_cell = cell |
957 | 557 color = cell.get_colormap().alloc_color("green") |
558 cell.modify_bg(gtk.STATE_NORMAL, color) | |
956 | 559 pass |
560 | |
561 def doEditScene(self,w): | |
562 self.setCurrentScene(self.last_cell.nScene) | |
563 pass | |
564 | |
565 def doInsertKeyScene(self,w): | |
566 # self.insertKeyScene() | |
567 # self.grid.show_all() | |
568 return | |
569 | |
570 def doRemoveScene(self,w): | |
571 # self.removeKeyScene() | |
572 # self.grid.show_all() | |
573 # self.generate() | |
574 return | |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
575 |
956 | 576 |
577 def doExtendScene(self,w): | |
578 self.extendScene() | |
579 self.grid.show_all() | |
580 pass | |
581 | |
582 def addButtons(self,hbox): | |
583 btn = gtk.Button('Edit') | |
584 btn.connect('clicked', self.doEditScene) | |
585 hbox.pack_start(btn,expand=False,fill=False) | |
586 btn = gtk.Button('Insert Key') | |
587 btn.connect('clicked',self.doInsertKeyScene) | |
588 hbox.pack_start(btn,expand=False,fill=False) | |
589 btn=gtk.Button('Remove Key') | |
590 btn.connect('clicked', self.doRemoveScene) | |
591 hbox.pack_start(btn,expand=False,fill=False) | |
592 btn=gtk.Button('Extend scene') | |
593 btn.connect('clicked', self.doExtendScene) | |
594 hbox.pack_start(btn,expand=False,fill=False) | |
595 pass | |
596 | |
597 def onQuit(self, event): | |
598 self.OK = False | |
599 gtk.main_quit() | |
600 pass | |
601 | |
602 def onOK(self,event): | |
603 self.OK = True | |
604 gtk.main_quit() | |
605 pass | |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
606 |
956 | 607 def onConfirmDelete(self): |
608 if self.scenemap == None: | |
609 vbox = gtk.VBox(False,0) | |
957 | 610 vbox.pack_start(gtk.Label('Convert the SVG into a MadButterfly' |
611 ' SVG file. All current element will' | |
612 ' be delted')) | |
956 | 613 hbox = gtk.HBox(False,0) |
614 self.button = gtk.Button('OK') | |
615 hbox.pack_start(self.button,expand=False,fill=False) | |
616 self.button.connect('clicked', self.onOK) | |
617 self.button = gtk.Button('Cancel') | |
618 hbox.pack_start(self.button,expand=False,fill=False) | |
619 self.button.connect("clicked", self.onQuit) | |
620 vbox.pack_start(hbox,expand=False,fill=False) | |
621 self.window.add(vbox) | |
622 self.window.show_all() | |
623 gtk.main() | |
624 self.window.remove(vbox) | |
625 pass | |
626 pass | |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
627 |
956 | 628 def show(self): |
629 self.OK = True | |
630 self.parseScene() | |
963
a05ec4fb1c20
update framelines according content 0f layers
Thinker K.F. Li <thinker@codemud.net>
parents:
962
diff
changeset
|
631 self._create_framelines() |
a05ec4fb1c20
update framelines according content 0f layers
Thinker K.F. Li <thinker@codemud.net>
parents:
962
diff
changeset
|
632 self._update_framelines() |
956 | 633 vbox = gtk.VBox(False,0) |
634 self.desktop.getToplevel().child.child.pack_end(vbox,expand=False) | |
635 self.window = vbox | |
636 # self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) | |
637 # self.window.connect("destroy", gtk.main_quit) | |
638 # self.window.set_position(gtk.WIN_POS_MOUSE) | |
639 if self.scenemap == None: | |
640 self.onConfirmDelete() | |
641 pass | |
642 if self.OK: | |
643 vbox = gtk.VBox(False,0) | |
644 self.window.pack_start(vbox,expand=False) | |
645 vbox.pack_start(self.scrollwin,expand=False) | |
646 self.vbox = vbox | |
647 hbox=gtk.HBox(False,0) | |
648 self.addButtons(hbox) | |
649 vbox.pack_start(hbox,expand=False) | |
650 else: | |
651 return | |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
652 |
956 | 653 # self.window.set_size_request(600,200) |
654 | |
655 self.window.show_all() | |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
656 pass |
956 | 657 pass |