Mercurial > MadButterfly
annotate pyink/MBScene.py @ 1185:9d784a987d87
Remove unused code
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Fri, 31 Dec 2010 13:37:45 +0800 |
parents | 05d33f0fbc76 |
children | ca4e89cc464b 45e3a9273af2 |
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 |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1149
diff
changeset
|
2 # -*- indent-tabs-mode: t; tab-width: 8; python-indent: 4; fill-column: 79 -*- |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1149
diff
changeset
|
3 # vim: sw=4:ts=8:sts=4:textwidth=79 |
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 |
1064
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
6 import glib |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
7 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
|
8 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
|
9 import random |
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
10 import traceback |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
11 import time |
1064
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
12 import pybInkscape |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
13 import math |
1140 | 14 from tween import TweenObject |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1149
diff
changeset
|
15 from frameline import frameline, frameruler |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
16 |
957 | 17 # Please refer to |
18 # http://www.assembla.com/wiki/show/MadButterfly/Inkscape_extention | |
19 # 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
|
20 |
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
21 |
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
22 # Algorithm: |
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
23 # |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
24 # 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
|
25 # layer and scene. |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
26 # - 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
|
27 # column of the grid. |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
28 # - 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
|
29 # grid. |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
30 # - 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
|
31 # 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
|
32 # 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
|
33 # 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
|
34 # for this purpose. |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
35 # - 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
|
36 # 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
|
37 # 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
|
38 # 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
|
39 # 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
|
40 # 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
|
41 # - 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
|
42 # 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
|
43 # |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
44 |
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
45 class Layer: |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
46 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
|
47 self.scenes = [] |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
48 self.node = node |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
49 self.nodes=[] |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
50 pass |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
51 pass |
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
52 |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
53 class Scene: |
1120
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
1099
diff
changeset
|
54 def __init__(self, node, start,end,typ): |
956 | 55 self.node = node |
56 self.start = int(start) | |
57 self.end = int(end) | |
1120
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
1099
diff
changeset
|
58 self.type = typ |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
59 pass |
956 | 60 pass |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
61 class DOM(pybInkscape.PYSPObject): |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
62 def __init__(self,obj=None): |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
63 self.proxy = obj |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
64 pass |
1149
0ffef2df6201
Rename MBScene.dom to MBScene.root
Thinker K.F. Li <thinker@codemud.net>
parents:
1148
diff
changeset
|
65 |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
66 def duplicate(self,doc): |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
67 return DOM(self.repr.duplicate(doc)) |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
68 |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
69 class ObjectWatcher(pybInkscape.PYNodeObserver): |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
70 def __init__(self,obj,type,func,arg): |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
71 self.obj = obj |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
72 self.type = type |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
73 self.func = func |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
74 self.arg = arg |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
75 |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
76 def notifyChildAdded(self,node,child,prev): |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
77 if self.type == 'DOMNodeInserted': |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
78 self.func(node) |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
79 def notifyChildRemoved(self,node,child,prev): |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
80 if self.type == 'DOMNodeRemoved': |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
81 self.func(node) |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
82 def notifyChildOrderChanged(self,node,child,prev): |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
83 pass |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
84 def notifyContentChanged(self,node,old_content,new_content): |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
85 if self.type == 'DOMSubtreeModified': |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
86 self.func(node) |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
87 def notifyAttributeChanged(self,node, name, old_value, new_value): |
1161
a7faab54e8f8
Fix broken of running animation
Thinker K.F. Li <thinker@codemud.net>
parents:
1160
diff
changeset
|
88 # print 'attr',node,name,old_value,new_value |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
89 if self.type == 'DOMAttrModified': |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
90 self.func(node,name) |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
91 |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
92 def addEventListener(obj, type, func,arg): |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
93 obs = ObjectWatcher(obj,type,func,arg) |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
94 obj.addSubtreeObserver(obs) |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
95 |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
96 |
957 | 97 _scenes = '{http://madbutterfly.sourceforge.net/DTD/madbutterfly.dtd}scenes' |
98 _scene = '{http://madbutterfly.sourceforge.net/DTD/madbutterfly.dtd}scene' | |
1064
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
99 class LayerAttributeWatcher(pybInkscape.PYNodeObserver): |
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
100 def __init__(self,ui): |
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
101 self.ui = ui |
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
102 def notifyChildAdded(self,node,child,prev): |
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
103 pass |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
104 |
1064
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
105 def notifyChildRemoved(self,node,child,prev): |
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
106 pass |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
107 |
1064
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
108 def notifyChildOrderChanged(self,node,child,prev): |
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
109 pass |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
110 |
1064
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
111 def notifyContentChanged(self,node,old_content,new_content): |
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
112 pass |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
113 |
1064
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
114 def notifyAttributeChanged(self,node, name, old_value, new_value): |
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
115 self.ui.updateUI() |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
116 pass |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
117 |
1064
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
118 class LayerAddRemoveWatcher(pybInkscape.PYNodeObserver): |
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
119 def __init__(self,ui): |
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
120 self.ui = ui |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
121 pass |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
122 |
1064
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
123 def notifyChildAdded(self,node,child,prev): |
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
124 self.ui.updateUI() |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
125 pass |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
126 |
1064
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
127 def notifyChildRemoved(self,node,child,prev): |
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
128 self.ui.updateUI() |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
129 pass |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
130 |
1064
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
131 def notifyChildOrderChanged(self,node,child,prev): |
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
132 self.ui.updateUI() |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
133 pass |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
134 |
1064
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
135 def notifyContentChanged(self,node,old_content,new_content): |
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
136 self.ui.updateUI() |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
137 pass |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
138 |
1064
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
139 def notifyAttributeChanged(self,node, name, old_value, new_value): |
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
140 self.ui.updateUI() |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
141 pass |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
142 |
1151
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
143 def _travel_DOM(node): |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
144 nodes = [node] |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
145 while nodes: |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
146 node = nodes.pop(0) |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
147 child = node.firstChild() |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
148 while child: |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
149 nodes.append(child) |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
150 child = child.next() |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
151 pass |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
152 yield node |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
153 pass |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
154 pass |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
155 |
1181
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
156 ## \brief Layer of MBScene to manipulate DOM tree. |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
157 # |
1176
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
158 class MBScene_dom(object): |
1183
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
159 def newID(self): |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
160 while True: |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
161 n = 's%d' % int(random.random()*10000) |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
162 #print "try %s" % n |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
163 if self.ID.has_key(n) == False: |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
164 return n |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
165 pass |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
166 pass |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
167 |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
168 def dumpID(self): |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
169 for a,v in self.ID.items(): |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
170 pass |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
171 pass |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
172 |
1176
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
173 def dumpattr(self, n): |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
174 s = "" |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
175 for a,v in n.attrib.items(): |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
176 s = s + ("%s=%s" % (a,v)) |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
177 pass |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
178 return s |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
179 |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
180 def dump(self, node, l=0): |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
181 print " " * l*2,"<", node.tag, self.dumpattr(node),">" |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
182 for n in node: |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
183 self.dump(n, l+1) |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
184 pass |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
185 print " " * l * 2,"/>" |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
186 pass |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
187 |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
188 def _parse_one_scenes(self, scenes): |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
189 self.scenemap = {} |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
190 try: |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
191 cur = int(n.getAttribute("current")) |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
192 except: |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
193 cur = 1 |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
194 pass |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
195 self.current = cur |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
196 |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
197 for scene in scenes.childList(): |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
198 if scene.name() != 'ns0:scene': |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
199 continue |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
200 |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
201 try: |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
202 start = int(scene.getAttribute("start")) |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
203 except: |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
204 traceback.print_exc() |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
205 continue |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
206 try: |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
207 end = int(scene.getAttribute("end")) |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
208 except: |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
209 end = start |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
210 pass |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
211 |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
212 if end > self.maxframe: |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
213 self.maxframe = end |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
214 pass |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
215 try: |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
216 scene_type = scene.getAttribute('type') |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
217 if scene_type == None: |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
218 scene_type = 'normal' |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
219 pass |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
220 except: |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
221 traceback.print_exc() |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
222 scene_type = 'normal' |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
223 pass |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
224 link = scene.getAttribute("ref") |
1184
05d33f0fbc76
Add comment for some TODO item
Thinker K.F. Li <thinker@codemud.net>
parents:
1183
diff
changeset
|
225 self.scenemap[link] = (int(start), int(end), scene_type) |
1176
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
226 if cur >= start and cur <= end: |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
227 self.currentscene = link |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
228 pass |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
229 pass |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
230 pass |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
231 |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
232 def parseMetadata(self, node): |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
233 for n in node.childList(): |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
234 if n.name() == 'ns0:scenes': |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
235 self._parse_one_scenes(n) |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
236 break |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
237 pass |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
238 else: |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
239 ns = "http://madbutterfly.sourceforge.net/DTD/madbutterfly.dtd" |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
240 self.root.setAttribute("xmlns:ns0", ns) |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
241 scenes = self.document.createElement("ns0:scenes") |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
242 node.appendChild(scenes) |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
243 pass |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
244 pass |
1181
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
245 |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
246 def insertKeyScene(self, line, frame): |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
247 """ |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
248 Insert a new key scene into the stage. If the nth is always a |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
249 key scene, we will return without changing anything. If the |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
250 nth is a filled scene, we will break the original scene into |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
251 two parts. If the nth is out of any scene, we will append a |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
252 new scene. |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
253 |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
254 """ |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
255 rdoc = self.document |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
256 ns = rdoc.createElement("svg:g") |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
257 found = False |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
258 for node in line.node.childList(): |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
259 try: |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
260 label = node.getAttribute("inkscape:label") |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
261 except: |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
262 continue |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
263 if label == "dup": |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
264 #FIXME: The duplication here is not perfect. We should |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
265 # get the element inside the group and apply the |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
266 # transformation matrix to it directly. |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
267 for n in node.childList(): |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
268 ns.appendChild(n.duplicate(self.document)) |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
269 found = True |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
270 node.setAttribute("style","display:none") |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
271 break |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
272 pass |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
273 pass |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
274 |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
275 if found == False: |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
276 txt = rdoc.createElement("svg:rect") |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
277 txt.setAttribute("x","0") |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
278 txt.setAttribute("y","0") |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
279 txt.setAttribute("width","100") |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
280 txt.setAttribute("height","100") |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
281 txt.setAttribute("style","fill:#ff00") |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
282 ns.appendChild(txt) |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
283 |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
284 gid = line.node.getAttribute('inkscape:label')+self.newID() |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
285 self.ID[gid]=1 |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
286 ns.setAttribute("id",gid) |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
287 ns.setAttribute("inkscape:groupmode","layer") |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
288 line.node.appendChild(ns) |
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
289 line.add_keyframe(frame, ns) |
1182
8b0e5e8a6b0c
Rename MBScene.update() to update_scenes_of_dom()
Thinker K.F. Li <thinker@codemud.net>
parents:
1181
diff
changeset
|
290 self.update_scenes_of_dom() |
1181
f14dbcf19e2b
Move MBScene.insertKeyScene() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1180
diff
changeset
|
291 pass |
1183
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
292 |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
293 def add_scene_on_dom(self, frameline, scenes_node): |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
294 doc = self.document |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
295 for start_idx, stop_idx, tween_type in frameline.get_frame_blocks(): |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
296 ref = frameline.get_frame_data(start_idx) |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
297 tween_type_idx = self._frameline_tween_types.index(tween_type) |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
298 tween_type_name = self._tween_type_names[tween_type_idx] |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
299 |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
300 scene_node = doc.createElement("ns0:scene") |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
301 scenes_node.appendChild(scene_node) |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
302 scene_node.setAttribute("start", str(start_idx + 1)) |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
303 if start_idx != stop_idx: |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
304 scene_node.setAttribute("end", str(stop_idx + 1)) |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
305 pass |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
306 scene_node.setAttribute("ref", ref.attribute("id")) |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
307 scene_node.setAttribute("type", tween_type_name) |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
308 pass |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
309 pass |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
310 |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
311 def update_scenes_of_dom(self): |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
312 doc = self.root |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
313 rdoc = self.document |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
314 for node in doc.childList(): |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
315 if node.name() == 'svg:metadata': |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
316 for t in node.childList(): |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
317 if t.name() == "ns0:scenes": |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
318 node.removeChild(t) |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
319 scenes = rdoc.createElement("ns0:scenes") |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
320 node.appendChild(scenes) |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
321 for layer in range(0, len(self._framelines)): |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
322 lobj = self._framelines[layer] |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
323 self.add_scene_on_dom(lobj, scenes) |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
324 pass |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
325 pass |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
326 pass |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
327 pass |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
328 pass |
e8446e138427
Move update_scenes_of_dom() to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1182
diff
changeset
|
329 pass |
1176
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
330 pass |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
331 |
0c1ceecb8ddb
Move parseMetadata to MBScene_dom
Thinker K.F. Li <thinker@codemud.net>
parents:
1174
diff
changeset
|
332 class MBScene(MBScene_dom): |
1151
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
333 _frameline_tween_types = (frameline.TWEEN_TYPE_NONE, |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
334 frameline.TWEEN_TYPE_SHAPE) |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
335 _tween_obj_tween_types = (TweenObject.TWEEN_TYPE_NORMAL, |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
336 TweenObject.TWEEN_TYPE_SCALE) |
1157
3a891dccabd8
Remove the locate tween. It is a special case for the scale tween
wycc
parents:
1155
diff
changeset
|
337 _tween_type_names = ('normal', 'scale') |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1149
diff
changeset
|
338 |
1149
0ffef2df6201
Rename MBScene.dom to MBScene.root
Thinker K.F. Li <thinker@codemud.net>
parents:
1148
diff
changeset
|
339 def __init__(self, desktop, win, root=None): |
956 | 340 self.desktop = desktop |
341 self.window = win | |
961
b6375e74c69e
Rename MBScene.layer to MBScene.layers
Thinker K.F. Li <thinker@codemud.net>
parents:
960
diff
changeset
|
342 self.layers = [] |
b6375e74c69e
Rename MBScene.layer to MBScene.layers
Thinker K.F. Li <thinker@codemud.net>
parents:
960
diff
changeset
|
343 self.layers.append(Layer(None)) |
956 | 344 self.scenemap = None |
1064
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
345 self.top = None |
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
346 self.last_update = None |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
347 pybInkscape.inkscape.connect('change_selection', self.show_selection) |
1099
5ba2cab1d505
Add name editor to edit the inkscape:label withgout using the object property editor. This is more Flash-like operation.
wycc
parents:
1097
diff
changeset
|
348 self.last_select = None |
1130
37a0f6ab2f91
Lock the UI from refreshing during the update procedure
wycc
parents:
1128
diff
changeset
|
349 self.lockui=False |
1140 | 350 self.tween=None |
351 self.document = None | |
1149
0ffef2df6201
Rename MBScene.dom to MBScene.root
Thinker K.F. Li <thinker@codemud.net>
parents:
1148
diff
changeset
|
352 self.root = root |
1147 | 353 self.framerate=12 |
354 self.maxframe=0 | |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1149
diff
changeset
|
355 self._disable_tween_type_selector = False |
956 | 356 pass |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
357 |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
358 def show_selection(self,w,obj): |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
359 objs = self.desktop.selection.list() |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
360 try: |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
361 o = objs[0] |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
362 print o.getCenter() |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
363 if o == self.last_select: |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
364 return |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
365 except: |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
366 self.nameEditor.set_text('') |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
367 self.last_select = None |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
368 return |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
369 self.last_select = o |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
370 try: |
1139
a2b068594412
Use pybind with new DOM API (at PYNode).
Thinker K.F. Li <thinker@codemud.net>
parents:
1136
diff
changeset
|
371 self.nameEditor.set_text(o.getAttribute("inkscape:label")) |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
372 except: |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
373 self.nameEditor.set_text('') |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
374 pass |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
375 pass |
1099
5ba2cab1d505
Add name editor to edit the inkscape:label withgout using the object property editor. This is more Flash-like operation.
wycc
parents:
1097
diff
changeset
|
376 |
956 | 377 def confirm(self,msg): |
378 vbox = gtk.VBox() | |
379 vbox.pack_start(gtk.Label(msg)) | |
380 self.button = gtk.Button('OK') | |
381 vbox.pack_start(self.button) | |
382 self.button.connect("clicked", self.onQuit) | |
383 self.window.add(vbox) | |
384 pass | |
385 | |
386 def parseScene(self): | |
387 """ | |
957 | 388 In this function, we will collect all items for the current |
389 scene and then relocate them back to the appropriate scene | |
390 object. | |
956 | 391 """ |
961
b6375e74c69e
Rename MBScene.layer to MBScene.layers
Thinker K.F. Li <thinker@codemud.net>
parents:
960
diff
changeset
|
392 self.layers = [] |
956 | 393 self.scenemap = None |
1149
0ffef2df6201
Rename MBScene.dom to MBScene.root
Thinker K.F. Li <thinker@codemud.net>
parents:
1148
diff
changeset
|
394 doc = self.root |
956 | 395 |
1184
05d33f0fbc76
Add comment for some TODO item
Thinker K.F. Li <thinker@codemud.net>
parents:
1183
diff
changeset
|
396 # TODO: Remove following code sicne this function is for parsing. |
05d33f0fbc76
Add comment for some TODO item
Thinker K.F. Li <thinker@codemud.net>
parents:
1183
diff
changeset
|
397 # Why do this here? |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
398 addEventListener(doc,'DOMNodeInserted',self.updateUI,None) |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
399 addEventListener(doc,'DOMNodeRemoved',self.updateUI,None) |
1184
05d33f0fbc76
Add comment for some TODO item
Thinker K.F. Li <thinker@codemud.net>
parents:
1183
diff
changeset
|
400 |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
401 doc.childList() |
1131 | 402 try: |
1141 | 403 self.width = float(doc.getAttribute("width")) |
404 self.height= float(doc.getAttribute("height")) | |
1131 | 405 except: |
406 self.width = 640 | |
407 self.height=480 | |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
408 pass |
1131 | 409 |
956 | 410 for node in doc.childList(): |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
411 print node.name() |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
412 if node.name() == 'svg:metadata': |
956 | 413 self.parseMetadata(node) |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
414 pass |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
415 elif node.name() == 'svg:g': |
956 | 416 oldscene = None |
417 lyobj = Layer(node) | |
961
b6375e74c69e
Rename MBScene.layer to MBScene.layers
Thinker K.F. Li <thinker@codemud.net>
parents:
960
diff
changeset
|
418 self.layers.append(lyobj) |
956 | 419 lyobj.current_scene = [] |
420 for scene in node.childList(): | |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
421 print scene.getCenter() |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
422 if scene.name() == 'svg:g': |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
423 try: |
1139
a2b068594412
Use pybind with new DOM API (at PYNode).
Thinker K.F. Li <thinker@codemud.net>
parents:
1136
diff
changeset
|
424 label = scene.getAttribute('inkscape:label') |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
425 if label == 'dup': |
1184
05d33f0fbc76
Add comment for some TODO item
Thinker K.F. Li <thinker@codemud.net>
parents:
1183
diff
changeset
|
426 # TODO: remove this since this functio is for |
05d33f0fbc76
Add comment for some TODO item
Thinker K.F. Li <thinker@codemud.net>
parents:
1183
diff
changeset
|
427 # parsing. Why do this here? |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
428 node.removeChild(scene) |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
429 except: |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
430 pass |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
431 |
956 | 432 try: |
1184
05d33f0fbc76
Add comment for some TODO item
Thinker K.F. Li <thinker@codemud.net>
parents:
1183
diff
changeset
|
433 scene_id = scene.getAttribute('id') |
05d33f0fbc76
Add comment for some TODO item
Thinker K.F. Li <thinker@codemud.net>
parents:
1183
diff
changeset
|
434 start, stop, tween_type = self.scenemap[scene_id] |
956 | 435 except: |
436 lyobj.current_scene.append(scene) | |
437 continue | |
438 | |
1184
05d33f0fbc76
Add comment for some TODO item
Thinker K.F. Li <thinker@codemud.net>
parents:
1183
diff
changeset
|
439 lyobj.scenes.append(Scene(scene, start, stop, |
05d33f0fbc76
Add comment for some TODO item
Thinker K.F. Li <thinker@codemud.net>
parents:
1183
diff
changeset
|
440 tween_type)) |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
441 pass |
956 | 442 else: |
443 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
|
444 pass |
956 | 445 pass |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
446 pass |
956 | 447 pass |
448 | |
1184
05d33f0fbc76
Add comment for some TODO item
Thinker K.F. Li <thinker@codemud.net>
parents:
1183
diff
changeset
|
449 # TODO: Remove following code, too. It is unreasonable. |
956 | 450 self.collectID() |
451 self.dumpID() | |
452 pass | |
453 | |
454 def collectID(self): | |
455 self.ID = {} | |
1149
0ffef2df6201
Rename MBScene.dom to MBScene.root
Thinker K.F. Li <thinker@codemud.net>
parents:
1148
diff
changeset
|
456 root = self.root |
956 | 457 for n in root.childList(): |
458 self.collectID_recursive(n) | |
459 pass | |
460 pass | |
461 | |
462 def collectID_recursive(self,node): | |
1139
a2b068594412
Use pybind with new DOM API (at PYNode).
Thinker K.F. Li <thinker@codemud.net>
parents:
1136
diff
changeset
|
463 try: |
a2b068594412
Use pybind with new DOM API (at PYNode).
Thinker K.F. Li <thinker@codemud.net>
parents:
1136
diff
changeset
|
464 self.ID[node.getAttribute('id')] = 1 |
1141 | 465 except: |
1139
a2b068594412
Use pybind with new DOM API (at PYNode).
Thinker K.F. Li <thinker@codemud.net>
parents:
1136
diff
changeset
|
466 pass |
956 | 467 for n in node.childList(): |
468 self.collectID_recursive(n) | |
469 pass | |
470 pass | |
471 | |
472 def getLayer(self, layer): | |
961
b6375e74c69e
Rename MBScene.layer to MBScene.layers
Thinker K.F. Li <thinker@codemud.net>
parents:
960
diff
changeset
|
473 for l in self.layers: |
1139
a2b068594412
Use pybind with new DOM API (at PYNode).
Thinker K.F. Li <thinker@codemud.net>
parents:
1136
diff
changeset
|
474 if l.node.getAttribute('id') == layer: |
956 | 475 return l |
476 pass | |
477 return None | |
478 | |
479 | |
480 def removeKeyScene(self): | |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
481 nth = self.last_frame |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
482 y = self.last_line |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
483 rdoc = self.document |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
484 i = 0 |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
485 layer = self.last_line |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
486 while i < len(layer._keys): |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
487 s = layer._keys[i] |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
488 print "nth:%d idx %d" % (nth,s.idx) |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
489 if nth > s.idx: |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
490 if i == len(layer._keys)-1: |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
491 return |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
492 if nth == s.idx: |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
493 if s.left_tween: |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
494 # This is left tween, we move the keyframe one frame ahead |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
495 if s.idx == layer._keys[i-1].idx: |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
496 layer._keys[i].ref.parent().removeChild(layer._keys[i].ref) |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
497 self.last_line.rm_keyframe(nth) |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
498 self.last_line.rm_keyframe(nth-1) |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
499 else: |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
500 s.idx = s.idx-1 |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
501 else: |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
502 layer._keys[i].ref.parent().removeChild(layer._keys[i].ref) |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
503 if s.right_tween: |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
504 self.last_line.rm_keyframe(layer._keys[i+1].idx) |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
505 self.last_line.rm_keyframe(nth) |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
506 else: |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
507 self.last_line.rm_keyframe(nth) |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
508 |
1182
8b0e5e8a6b0c
Rename MBScene.update() to update_scenes_of_dom()
Thinker K.F. Li <thinker@codemud.net>
parents:
1181
diff
changeset
|
509 self.update_scenes_of_dom() |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
510 self.last_line._draw_all_frames() |
976
ab09c536a137
Hide the hover of all inactive framelines. This fix the issue of multiple hover in every frameline objects.
wycc
parents:
975
diff
changeset
|
511 self.last_line.update() |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
512 return |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
513 i = i + 1 |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
514 pass |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
515 pass |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
516 |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
517 def extendScene(self): |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
518 nth = self.last_frame |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
519 layer = self.last_line |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
520 i = 0 |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
521 while i < len(layer._keys): |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
522 s = layer._keys[i] |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
523 if s.right_tween: |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
524 if nth > s.idx: |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
525 if nth <= layer._keys[i+1].idx: |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
526 return |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
527 try: |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
528 if nth <= layer._keys[i+2].idx: |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
529 layer._keys[i+1].idx = nth |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
530 layer.draw_all_frames() |
1182
8b0e5e8a6b0c
Rename MBScene.update() to update_scenes_of_dom()
Thinker K.F. Li <thinker@codemud.net>
parents:
1181
diff
changeset
|
531 self.update_scenes_of_dom() |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
532 self.setCurrentScene(nth) |
976
ab09c536a137
Hide the hover of all inactive framelines. This fix the issue of multiple hover in every frameline objects.
wycc
parents:
975
diff
changeset
|
533 self.last_line.update() |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
534 return |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
535 else: |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
536 # We may in the next scene |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
537 i = i + 2 |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
538 pass |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
539 except: |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
540 # This is the last keyframe, extend the keyframe by |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
541 # relocate the location of the keyframe |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
542 layer._keys[i+1].idx = nth |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
543 layer._draw_all_frames() |
1182
8b0e5e8a6b0c
Rename MBScene.update() to update_scenes_of_dom()
Thinker K.F. Li <thinker@codemud.net>
parents:
1181
diff
changeset
|
544 self.update_scenes_of_dom() |
976
ab09c536a137
Hide the hover of all inactive framelines. This fix the issue of multiple hover in every frameline objects.
wycc
parents:
975
diff
changeset
|
545 self.last_line.update() |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
546 self.setCurrentScene(nth) |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
547 return |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
548 else: |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
549 # We are in the front of all keyframes |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
550 return |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
551 else: |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
552 # This is a single keyframe |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
553 if nth < s.idx: |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
554 return |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
555 if nth == s.idx: |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
556 return |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
557 try: |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
558 if nth < layer._keys[i+1].idx: |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
559 # We are after a single keyframe and no scene is |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
560 # available here. Create a new tween here |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
561 idx = layer._keys[i].idx |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
562 layer.add_keyframe(nth,layer._keys[i].ref) |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
563 layer.tween(idx) |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
564 layer._draw_all_frames() |
1182
8b0e5e8a6b0c
Rename MBScene.update() to update_scenes_of_dom()
Thinker K.F. Li <thinker@codemud.net>
parents:
1181
diff
changeset
|
565 self.update_scenes_of_dom() |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
566 self.setCurrentScene(nth) |
976
ab09c536a137
Hide the hover of all inactive framelines. This fix the issue of multiple hover in every frameline objects.
wycc
parents:
975
diff
changeset
|
567 self.last_line.update() |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
568 return |
956 | 569 else: |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
570 # We may in the next scene |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
571 i = i + 1 |
956 | 572 pass |
573 pass | |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
574 except: |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
575 # This is the last scene, create a new one |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
576 idx = layer._keys[i].idx |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
577 layer.add_keyframe(nth,layer._keys[i].ref) |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
578 layer.tween(idx) |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
579 layer._draw_all_frames() |
1182
8b0e5e8a6b0c
Rename MBScene.update() to update_scenes_of_dom()
Thinker K.F. Li <thinker@codemud.net>
parents:
1181
diff
changeset
|
580 self.update_scenes_of_dom() |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
581 self.setCurrentScene(nth) |
976
ab09c536a137
Hide the hover of all inactive framelines. This fix the issue of multiple hover in every frameline objects.
wycc
parents:
975
diff
changeset
|
582 self.last_line.update() |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
583 return |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
584 pass |
956 | 585 pass |
586 pass | |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
587 |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
588 |
956 | 589 |
590 def setCurrentScene(self,nth): | |
1123 | 591 """ |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
592 Update the scene group according to the curretn scene |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
593 data. There are a couple of cases. |
1148 | 594 1. If the type of the scene is normal, we display it when |
595 it contains the current frame. Otherwise hide it. | |
596 2. If the type of the scene is relocate or scale, we need | |
597 to duplicate the scene group and then modify its | |
598 transform matrix according to the definition of the | |
599 scene. Then, hide the original scenr group and display | |
600 the duplciate scene group. In addition, we may need to | |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
601 delete the old duplicated scene group as well. |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
602 |
1148 | 603 For each layer, we will always use the duplicated scene |
604 group whose name as dup. | |
605 We will put the duplicated scene group inside it. We will | |
606 create this group if it is not | |
1123 | 607 available. |
608 """ | |
956 | 609 self.current = nth |
1140 | 610 self.tween.updateMapping() |
1151
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
611 idx = nth - 1 |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
612 for layer in self._framelines: |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
613 i=0 |
1123 | 614 |
615 # Check the duplicated scene group and create it if it is not available | |
616 try: | |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1149
diff
changeset
|
617 layer.duplicateGroup.setAttribute("style","display:none") |
1123 | 618 except: |
1146
e14ec6d1a661
CHange the implementation to set the transformation matrix only. This is be more friendly for the animation inside the inskcape.
wycc
parents:
1141
diff
changeset
|
619 print "*"*40 |
e14ec6d1a661
CHange the implementation to set the transformation matrix only. This is be more friendly for the animation inside the inskcape.
wycc
parents:
1141
diff
changeset
|
620 layer.duplicateGroup = self.document.createElement("svg:g") |
e14ec6d1a661
CHange the implementation to set the transformation matrix only. This is be more friendly for the animation inside the inskcape.
wycc
parents:
1141
diff
changeset
|
621 layer.duplicateGroup.setAttribute("inkscape:label","dup") |
e14ec6d1a661
CHange the implementation to set the transformation matrix only. This is be more friendly for the animation inside the inskcape.
wycc
parents:
1141
diff
changeset
|
622 layer.duplicateGroup.setAttribute("sodipodi:insensitive","1") |
e14ec6d1a661
CHange the implementation to set the transformation matrix only. This is be more friendly for the animation inside the inskcape.
wycc
parents:
1141
diff
changeset
|
623 layer.duplicateGroup.setAttribute("style","") |
e14ec6d1a661
CHange the implementation to set the transformation matrix only. This is be more friendly for the animation inside the inskcape.
wycc
parents:
1141
diff
changeset
|
624 layer.layer.node.appendChild(layer.duplicateGroup) |
1123 | 625 pass |
626 # Create a new group | |
1151
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
627 for start_idx, stop_idx, tween_type in layer.get_frame_blocks(): |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
628 if start_idx == stop_idx: |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
629 scene_group = layer.get_frame_data(start_idx) |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
630 if idx == start_idx: |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
631 scene_group.setAttribute('style', '') |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
632 else: |
1151
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
633 scene_group.setAttribute('style', 'display: none') |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
634 pass |
1155
5db4d769387c
Show the frame when we select the keyframe. The duplicated group must be shown only in the tweened frame
wycc
parents:
1151
diff
changeset
|
635 elif idx == start_idx: |
5db4d769387c
Show the frame when we select the keyframe. The duplicated group must be shown only in the tweened frame
wycc
parents:
1151
diff
changeset
|
636 layer.duplicateGroup.setAttribute("style","display:none") |
5db4d769387c
Show the frame when we select the keyframe. The duplicated group must be shown only in the tweened frame
wycc
parents:
1151
diff
changeset
|
637 scene_group = layer.get_frame_data(start_idx) |
5db4d769387c
Show the frame when we select the keyframe. The duplicated group must be shown only in the tweened frame
wycc
parents:
1151
diff
changeset
|
638 scene_group.setAttribute("style","") |
1151
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
639 elif start_idx <= idx and stop_idx >= idx: |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
640 scene_group = layer.get_frame_data(start_idx) |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
641 scene_group.setAttribute("style","display:none") |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
642 layer.duplicateGroup.setAttribute("style","") |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
643 tween_type_idx = \ |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
644 self._frameline_tween_types.index(tween_type) |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
645 tween_obj_tween_type = \ |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
646 self._tween_obj_tween_types[tween_type_idx] |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
647 |
1180
bfd7d466a022
Fix yeiling error message when select a scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1179
diff
changeset
|
648 try: |
bfd7d466a022
Fix yeiling error message when select a scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1179
diff
changeset
|
649 next_idx, next_stop_idx, next_tween_type = \ |
bfd7d466a022
Fix yeiling error message when select a scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1179
diff
changeset
|
650 layer.get_frame_block(stop_idx + 1) |
bfd7d466a022
Fix yeiling error message when select a scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1179
diff
changeset
|
651 except: |
1163 | 652 next_scene_group = scene_group |
653 else: | |
654 next_scene_group = layer.get_frame_data(next_idx) | |
1180
bfd7d466a022
Fix yeiling error message when select a scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1179
diff
changeset
|
655 pass |
1151
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
656 |
1160
1a699dc00fa3
Fix the issue of not removing node in old scene when switching scenes.
Thinker K.F. Li <thinker@codemud.net>
parents:
1159
diff
changeset
|
657 nframes = stop_idx - start_idx + 1 |
1151
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
658 percent = float(idx - start_idx) / nframes |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
659 self.tween.updateTweenContent(layer.duplicateGroup, |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
660 tween_obj_tween_type, |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
661 scene_group, |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
662 next_scene_group, |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
663 percent) |
959
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
664 else: |
1151
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
665 scene_group = layer.get_frame_data(start_idx) |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
666 scene_group.setAttribute("style","display:none") |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
667 pass |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
668 pass |
956 | 669 pass |
670 pass | |
1125 | 671 |
1070
afa42d5836cc
Call setCurrentLayer to enter the current scene group.
wycc
parents:
1064
diff
changeset
|
672 def enterGroup(self,obj): |
afa42d5836cc
Call setCurrentLayer to enter the current scene group.
wycc
parents:
1064
diff
changeset
|
673 for l in self.layers: |
afa42d5836cc
Call setCurrentLayer to enter the current scene group.
wycc
parents:
1064
diff
changeset
|
674 for s in l.node.childList(): |
1139
a2b068594412
Use pybind with new DOM API (at PYNode).
Thinker K.F. Li <thinker@codemud.net>
parents:
1136
diff
changeset
|
675 if s.getAttribute('id') == obj.getAttribute("id"): |
1142
dd6c60c6f41e
Use getAttribute()/spitem instead of .label and DOMtoItem().
Thinker K.F. Li <thinker@codemud.net>
parents:
1141
diff
changeset
|
676 self.desktop.setCurrentLayer(s.spitem) |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
677 pass |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
678 pass |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
679 pass |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
680 pass |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
681 |
1178
416e41952b76
Fix issue that pyink does not switch current layer to the new key scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1177
diff
changeset
|
682 def selectSceneObject(self, frameline, frame_idx): |
1177
ec1ea8555911
Stop selectSceneObject() from using private variable _keys of frameline
Thinker K.F. Li <thinker@codemud.net>
parents:
1176
diff
changeset
|
683 try: |
1178
416e41952b76
Fix issue that pyink does not switch current layer to the new key scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1177
diff
changeset
|
684 start, stop, tween_type = frameline.get_frame_block(frame_idx) |
1177
ec1ea8555911
Stop selectSceneObject() from using private variable _keys of frameline
Thinker K.F. Li <thinker@codemud.net>
parents:
1176
diff
changeset
|
685 except: |
ec1ea8555911
Stop selectSceneObject() from using private variable _keys of frameline
Thinker K.F. Li <thinker@codemud.net>
parents:
1176
diff
changeset
|
686 return |
1070
afa42d5836cc
Call setCurrentLayer to enter the current scene group.
wycc
parents:
1064
diff
changeset
|
687 |
1177
ec1ea8555911
Stop selectSceneObject() from using private variable _keys of frameline
Thinker K.F. Li <thinker@codemud.net>
parents:
1176
diff
changeset
|
688 scene_group = frameline.get_frame_data(start) |
ec1ea8555911
Stop selectSceneObject() from using private variable _keys of frameline
Thinker K.F. Li <thinker@codemud.net>
parents:
1176
diff
changeset
|
689 self.enterGroup(scene_group) |
ec1ea8555911
Stop selectSceneObject() from using private variable _keys of frameline
Thinker K.F. Li <thinker@codemud.net>
parents:
1176
diff
changeset
|
690 self.setTweenType(tween_type) |
ec1ea8555911
Stop selectSceneObject() from using private variable _keys of frameline
Thinker K.F. Li <thinker@codemud.net>
parents:
1176
diff
changeset
|
691 pass |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
692 |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1149
diff
changeset
|
693 def setTweenType(self, tween_type): |
1151
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
694 sel_type = MBScene._frameline_tween_types.index(tween_type) |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1149
diff
changeset
|
695 self._disable_tween_type_selector = True |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1149
diff
changeset
|
696 self.tweenTypeSelector.set_active(sel_type) |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1149
diff
changeset
|
697 self._disable_tween_type_selector = False |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
698 pass |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
699 |
956 | 700 def newCell(self,file): |
701 img = gtk.Image() | |
702 img.set_from_file(file) | |
703 btn = gtk.EventBox() | |
704 btn.add(img) | |
705 btn.connect("button_press_event", self.cellSelect) | |
706 btn.modify_bg(gtk.STATE_NORMAL, btn.get_colormap().alloc_color("gray")) | |
707 return btn | |
708 | |
1179
b65df4f0d30a
Change signature of MBScene.insertKeyScene()
Thinker K.F. Li <thinker@codemud.net>
parents:
1178
diff
changeset
|
709 def onCellClick(self, line, frame, but): |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
710 self.last_line = line |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
711 self.last_frame = frame |
976
ab09c536a137
Hide the hover of all inactive framelines. This fix the issue of multiple hover in every frameline objects.
wycc
parents:
975
diff
changeset
|
712 self.last_line.active_frame(frame) |
1130
37a0f6ab2f91
Lock the UI from refreshing during the update procedure
wycc
parents:
1128
diff
changeset
|
713 self.lockui = True |
1179
b65df4f0d30a
Change signature of MBScene.insertKeyScene()
Thinker K.F. Li <thinker@codemud.net>
parents:
1178
diff
changeset
|
714 self.doEditScene(None) |
1130
37a0f6ab2f91
Lock the UI from refreshing during the update procedure
wycc
parents:
1128
diff
changeset
|
715 self.lockui = False |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
716 pass |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
717 |
976
ab09c536a137
Hide the hover of all inactive framelines. This fix the issue of multiple hover in every frameline objects.
wycc
parents:
975
diff
changeset
|
718 def _remove_active_frame(self,widget,event): |
ab09c536a137
Hide the hover of all inactive framelines. This fix the issue of multiple hover in every frameline objects.
wycc
parents:
975
diff
changeset
|
719 """ |
ab09c536a137
Hide the hover of all inactive framelines. This fix the issue of multiple hover in every frameline objects.
wycc
parents:
975
diff
changeset
|
720 Hide all hover frames. This is a hack. We should use the lost focus event |
ab09c536a137
Hide the hover of all inactive framelines. This fix the issue of multiple hover in every frameline objects.
wycc
parents:
975
diff
changeset
|
721 instead in the future to reduce the overhead. |
ab09c536a137
Hide the hover of all inactive framelines. This fix the issue of multiple hover in every frameline objects.
wycc
parents:
975
diff
changeset
|
722 """ |
ab09c536a137
Hide the hover of all inactive framelines. This fix the issue of multiple hover in every frameline objects.
wycc
parents:
975
diff
changeset
|
723 for f in self._framelines: |
ab09c536a137
Hide the hover of all inactive framelines. This fix the issue of multiple hover in every frameline objects.
wycc
parents:
975
diff
changeset
|
724 if f != widget: |
ab09c536a137
Hide the hover of all inactive framelines. This fix the issue of multiple hover in every frameline objects.
wycc
parents:
975
diff
changeset
|
725 f.hide_hover() |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
726 pass |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
727 pass |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
728 pass |
976
ab09c536a137
Hide the hover of all inactive framelines. This fix the issue of multiple hover in every frameline objects.
wycc
parents:
975
diff
changeset
|
729 |
963
a05ec4fb1c20
update framelines according content 0f layers
Thinker K.F. Li <thinker@codemud.net>
parents:
962
diff
changeset
|
730 def _create_framelines(self): |
1166
d73ef03c96de
Refactory code of MBScene.updateUI() from MBScene.show()
Thinker K.F. Li <thinker@codemud.net>
parents:
1164
diff
changeset
|
731 if not hasattr(self, 'scrollwin'): |
d73ef03c96de
Refactory code of MBScene.updateUI() from MBScene.show()
Thinker K.F. Li <thinker@codemud.net>
parents:
1164
diff
changeset
|
732 self.scrollwin = gtk.ScrolledWindow() |
d73ef03c96de
Refactory code of MBScene.updateUI() from MBScene.show()
Thinker K.F. Li <thinker@codemud.net>
parents:
1164
diff
changeset
|
733 self.scrollwin.set_policy(gtk.POLICY_AUTOMATIC, |
d73ef03c96de
Refactory code of MBScene.updateUI() from MBScene.show()
Thinker K.F. Li <thinker@codemud.net>
parents:
1164
diff
changeset
|
734 gtk.POLICY_AUTOMATIC) |
d73ef03c96de
Refactory code of MBScene.updateUI() from MBScene.show()
Thinker K.F. Li <thinker@codemud.net>
parents:
1164
diff
changeset
|
735 self.scrollwin.set_size_request(-1,150) |
d73ef03c96de
Refactory code of MBScene.updateUI() from MBScene.show()
Thinker K.F. Li <thinker@codemud.net>
parents:
1164
diff
changeset
|
736 vbox = gtk.VBox() |
d73ef03c96de
Refactory code of MBScene.updateUI() from MBScene.show()
Thinker K.F. Li <thinker@codemud.net>
parents:
1164
diff
changeset
|
737 vbox.show() |
d73ef03c96de
Refactory code of MBScene.updateUI() from MBScene.show()
Thinker K.F. Li <thinker@codemud.net>
parents:
1164
diff
changeset
|
738 self.scrollwin.add_with_viewport(vbox) |
d73ef03c96de
Refactory code of MBScene.updateUI() from MBScene.show()
Thinker K.F. Li <thinker@codemud.net>
parents:
1164
diff
changeset
|
739 self.scrollwin_vbox = vbox |
d73ef03c96de
Refactory code of MBScene.updateUI() from MBScene.show()
Thinker K.F. Li <thinker@codemud.net>
parents:
1164
diff
changeset
|
740 else: |
1174 | 741 for c in self.scrollwin_vbox.get_children(): |
742 self.scrollwin_vbox.remove(c) | |
743 vbox = self.scrollwin_vbox | |
1166
d73ef03c96de
Refactory code of MBScene.updateUI() from MBScene.show()
Thinker K.F. Li <thinker@codemud.net>
parents:
1164
diff
changeset
|
744 pass |
959
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
745 |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
746 nframes = 100 |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
747 |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1149
diff
changeset
|
748 ruler = frameruler(nframes) |
959
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
749 ruler.set_size_request(nframes * 10, 20) |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
750 ruler.show() |
1032 | 751 hbox = gtk.HBox() |
752 label=gtk.Label('') | |
753 label.set_size_request(100,0) | |
754 hbox.pack_start(label,expand=False,fill=True) | |
755 hbox.pack_start(ruler) | |
756 vbox.pack_start(hbox, False) | |
959
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
757 |
960
8fd97e0becb3
Add a frameline for each layer
Thinker K.F. Li <thinker@codemud.net>
parents:
959
diff
changeset
|
758 # |
8fd97e0becb3
Add a frameline for each layer
Thinker K.F. Li <thinker@codemud.net>
parents:
959
diff
changeset
|
759 # Add a frameline for each layer |
8fd97e0becb3
Add a frameline for each layer
Thinker K.F. Li <thinker@codemud.net>
parents:
959
diff
changeset
|
760 # |
8fd97e0becb3
Add a frameline for each layer
Thinker K.F. Li <thinker@codemud.net>
parents:
959
diff
changeset
|
761 self._framelines = [] |
983
ee31add87843
Change the order of layer in the scene editor to make it consistent with the inkscape layer manager
wycc
parents:
982
diff
changeset
|
762 for i in range(len(self.layers)-1,-1,-1): |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1149
diff
changeset
|
763 line = frameline(nframes) |
983
ee31add87843
Change the order of layer in the scene editor to make it consistent with the inkscape layer manager
wycc
parents:
982
diff
changeset
|
764 hbox = gtk.HBox() |
1141 | 765 label = gtk.Label(self.layers[i].node.getAttribute("inkscape:label")) |
983
ee31add87843
Change the order of layer in the scene editor to make it consistent with the inkscape layer manager
wycc
parents:
982
diff
changeset
|
766 label.set_size_request(100,0) |
ee31add87843
Change the order of layer in the scene editor to make it consistent with the inkscape layer manager
wycc
parents:
982
diff
changeset
|
767 hbox.pack_start(label,expand=False,fill=True) |
ee31add87843
Change the order of layer in the scene editor to make it consistent with the inkscape layer manager
wycc
parents:
982
diff
changeset
|
768 hbox.pack_start(line) |
960
8fd97e0becb3
Add a frameline for each layer
Thinker K.F. Li <thinker@codemud.net>
parents:
959
diff
changeset
|
769 line.set_size_request(nframes * 10, 20) |
983
ee31add87843
Change the order of layer in the scene editor to make it consistent with the inkscape layer manager
wycc
parents:
982
diff
changeset
|
770 vbox.pack_start(hbox, False) |
ee31add87843
Change the order of layer in the scene editor to make it consistent with the inkscape layer manager
wycc
parents:
982
diff
changeset
|
771 line.label = label |
960
8fd97e0becb3
Add a frameline for each layer
Thinker K.F. Li <thinker@codemud.net>
parents:
959
diff
changeset
|
772 self._framelines.append(line) |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
773 line.connect(line.FRAME_BUT_PRESS, self.onCellClick) |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
774 line.nLayer = i |
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
775 line.node = self.layers[i].node |
983
ee31add87843
Change the order of layer in the scene editor to make it consistent with the inkscape layer manager
wycc
parents:
982
diff
changeset
|
776 line.layer = self.layers[i] |
976
ab09c536a137
Hide the hover of all inactive framelines. This fix the issue of multiple hover in every frameline objects.
wycc
parents:
975
diff
changeset
|
777 line.connect('motion-notify-event', self._remove_active_frame) |
960
8fd97e0becb3
Add a frameline for each layer
Thinker K.F. Li <thinker@codemud.net>
parents:
959
diff
changeset
|
778 pass |
1174 | 779 vbox.show_all() |
960
8fd97e0becb3
Add a frameline for each layer
Thinker K.F. Li <thinker@codemud.net>
parents:
959
diff
changeset
|
780 pass |
8fd97e0becb3
Add a frameline for each layer
Thinker K.F. Li <thinker@codemud.net>
parents:
959
diff
changeset
|
781 |
963
a05ec4fb1c20
update framelines according content 0f layers
Thinker K.F. Li <thinker@codemud.net>
parents:
962
diff
changeset
|
782 ## \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
|
783 # |
a05ec4fb1c20
update framelines according content 0f layers
Thinker K.F. Li <thinker@codemud.net>
parents:
962
diff
changeset
|
784 def _update_framelines(self): |
983
ee31add87843
Change the order of layer in the scene editor to make it consistent with the inkscape layer manager
wycc
parents:
982
diff
changeset
|
785 for frameline in self._framelines: |
ee31add87843
Change the order of layer in the scene editor to make it consistent with the inkscape layer manager
wycc
parents:
982
diff
changeset
|
786 layer = frameline.layer |
1141 | 787 if frameline.node.getAttribute("inkscape:label")==None: |
1064
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
788 frameline.label.set_text('???') |
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
789 else: |
1141 | 790 frameline.label.set_text(frameline.node.getAttribute("inkscape:label")) |
1164
2cb5047d8f2b
Add support to insert key frame in the middle of the tween.
wycc
parents:
1163
diff
changeset
|
791 last_scene = 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
|
792 for scene in layer.scenes: |
1164
2cb5047d8f2b
Add support to insert key frame in the middle of the tween.
wycc
parents:
1163
diff
changeset
|
793 if last_scene and last_scene.end == scene.start: |
2cb5047d8f2b
Add support to insert key frame in the middle of the tween.
wycc
parents:
1163
diff
changeset
|
794 frameline.setRightTween(last_scene.end) |
2cb5047d8f2b
Add support to insert key frame in the middle of the tween.
wycc
parents:
1163
diff
changeset
|
795 else: |
2cb5047d8f2b
Add support to insert key frame in the middle of the tween.
wycc
parents:
1163
diff
changeset
|
796 frameline.add_keyframe(scene.start-1,scene.node) |
2cb5047d8f2b
Add support to insert key frame in the middle of the tween.
wycc
parents:
1163
diff
changeset
|
797 last_scene = scene |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
798 if scene.start != scene.end: |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
799 frameline.add_keyframe(scene.end-1,scene.node) |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1149
diff
changeset
|
800 tween_type_idx = self._tween_type_names.index(scene.type) |
1151
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
801 tween_type = self._frameline_tween_types[tween_type_idx] |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1149
diff
changeset
|
802 frameline.tween(scene.start-1, tween_type) |
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
|
803 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
|
804 pass |
959
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
805 pass |
67823f7a0a17
Use frameline module in MBScene
Thinker K.F. Li <thinker@codemud.net>
parents:
957
diff
changeset
|
806 |
956 | 807 def cellSelect(self, cell, data): |
808 if self.last_cell: | |
957 | 809 color = self.last_cell.get_colormap().alloc_color("gray") |
810 self.last_cell.modify_bg(gtk.STATE_NORMAL, color) | |
956 | 811 pass |
955
53b0f8dc2284
Add tailing 'pass' commands to close indents
Thinker K.F. Li <thinker@codemud.net>
parents:
943
diff
changeset
|
812 |
956 | 813 self.last_cell = cell |
957 | 814 color = cell.get_colormap().alloc_color("green") |
815 cell.modify_bg(gtk.STATE_NORMAL, color) | |
956 | 816 pass |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
817 |
1097
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
818 def duplicateKeyScene(self): |
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
819 self.last_line.add_keyframe(self.last_frame) |
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
820 # Search for the current scene |
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
821 i = 0 |
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
822 while i < len(self.last_line._keys): |
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
823 key = self.last_line._keys[i] |
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
824 if key.idx == self.last_frame: |
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
825 if i == 0: |
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
826 # This is the first frame, we can not duplicate it |
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
827 self.last_line.rm_keyframe(self.last_frame) |
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
828 return |
1139
a2b068594412
Use pybind with new DOM API (at PYNode).
Thinker K.F. Li <thinker@codemud.net>
parents:
1136
diff
changeset
|
829 node = self.duplicateSceneGroup(last_key.ref.getAttribute("id")) |
1097
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
830 key.ref = node |
1182
8b0e5e8a6b0c
Rename MBScene.update() to update_scenes_of_dom()
Thinker K.F. Li <thinker@codemud.net>
parents:
1181
diff
changeset
|
831 self.update_scenes_of_dom() |
1166
d73ef03c96de
Refactory code of MBScene.updateUI() from MBScene.show()
Thinker K.F. Li <thinker@codemud.net>
parents:
1164
diff
changeset
|
832 self.updateUI() |
1097
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
833 self.doEditScene(None) |
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
834 return |
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
835 last_key = key |
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
836 i = i + 1 |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
837 pass |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
838 pass |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
839 |
1097
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
840 def duplicateSceneGroup(self,gid): |
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
841 # Search for the duplicated group |
1149
0ffef2df6201
Rename MBScene.dom to MBScene.root
Thinker K.F. Li <thinker@codemud.net>
parents:
1148
diff
changeset
|
842 doc = self.root |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
843 rdoc = self.document |
1097
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
844 orig = None |
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
845 for node in doc.childList(): |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
846 if node.name() == 'svg:g': |
1097
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
847 for t in node.childList(): |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
848 if t.name() == "svg:g": |
1139
a2b068594412
Use pybind with new DOM API (at PYNode).
Thinker K.F. Li <thinker@codemud.net>
parents:
1136
diff
changeset
|
849 if t.getAttribute("id") == gid: |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
850 orig = t |
1097
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
851 break |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
852 pass |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
853 pass |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
854 pass |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
855 pass |
1097
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
856 if orig == None: |
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
857 return None |
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
858 ns = orig.duplicate(rdoc) |
1151
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
859 |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
860 old_nodes = _travel_DOM(orig) |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
861 new_nodes = _travel_DOM(ns) |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
862 for old_node in old_nodes: |
1164
2cb5047d8f2b
Add support to insert key frame in the middle of the tween.
wycc
parents:
1163
diff
changeset
|
863 print old_node |
1151
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
864 old_node_id = old_node.getAttribute('id') |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
865 new_node = new_nodes.next() |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
866 new_node.setAttribute('ns0:duplicate-src', old_node_id) |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
867 pass |
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
868 |
1142
dd6c60c6f41e
Use getAttribute()/spitem instead of .label and DOMtoItem().
Thinker K.F. Li <thinker@codemud.net>
parents:
1141
diff
changeset
|
869 gid = self.last_line.node.getAttribute("inkscape:label")+self.newID() |
1097
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
870 self.ID[gid]=1 |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
871 ns.setAttribute("id",gid) |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
872 ns.setAttribute("inkscape:groupmode","layer") |
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
873 self.last_line.node.appendChild(ns) |
1097
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
874 return ns |
956 | 875 |
1178
416e41952b76
Fix issue that pyink does not switch current layer to the new key scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1177
diff
changeset
|
876 def doEditScene(self, w): |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
877 self.setCurrentScene(self.last_frame+1) |
1179
b65df4f0d30a
Change signature of MBScene.insertKeyScene()
Thinker K.F. Li <thinker@codemud.net>
parents:
1178
diff
changeset
|
878 self.selectSceneObject(self.last_line, self.last_frame) |
956 | 879 pass |
880 | |
881 def doInsertKeyScene(self,w): | |
1131 | 882 self.lockui=True |
1179
b65df4f0d30a
Change signature of MBScene.insertKeyScene()
Thinker K.F. Li <thinker@codemud.net>
parents:
1178
diff
changeset
|
883 self.insertKeyScene(self.last_line, self.last_frame) |
1178
416e41952b76
Fix issue that pyink does not switch current layer to the new key scene.
Thinker K.F. Li <thinker@codemud.net>
parents:
1177
diff
changeset
|
884 self.selectSceneObject(self.last_line, self.last_frame) |
1131 | 885 self.lockui=False |
956 | 886 # self.grid.show_all() |
887 return | |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
888 |
1097
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
889 def doDuplicateKeyScene(self,w): |
1131 | 890 self.lockui = True |
1097
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
891 self.duplicateKeyScene() |
1131 | 892 self.lockui = False |
956 | 893 |
894 def doRemoveScene(self,w): | |
1131 | 895 self.lockui = True |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
896 self.removeKeyScene() |
1131 | 897 self.lockui = False |
956 | 898 return |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
899 |
956 | 900 |
901 def doExtendScene(self,w): | |
1131 | 902 self.lockui = True |
956 | 903 self.extendScene() |
1131 | 904 self.lockui = False |
973
84f502fb3e40
Rewrite the MBScene to use framelines. The old layers/scenes data structure is used to load the scenes only. We should remove it completely in the future.
wycc
parents:
964
diff
changeset
|
905 #self.grid.show_all() |
956 | 906 pass |
1146
e14ec6d1a661
CHange the implementation to set the transformation matrix only. This is be more friendly for the animation inside the inskcape.
wycc
parents:
1141
diff
changeset
|
907 |
1099
5ba2cab1d505
Add name editor to edit the inkscape:label withgout using the object property editor. This is more Flash-like operation.
wycc
parents:
1097
diff
changeset
|
908 def changeObjectLabel(self,w): |
5ba2cab1d505
Add name editor to edit the inkscape:label withgout using the object property editor. This is more Flash-like operation.
wycc
parents:
1097
diff
changeset
|
909 o = self.desktop.selection.list()[0] |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
910 o.setAttribute("inkscape:label", self.nameEditor.get_text()) |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
911 pass |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
912 |
1099
5ba2cab1d505
Add name editor to edit the inkscape:label withgout using the object property editor. This is more Flash-like operation.
wycc
parents:
1097
diff
changeset
|
913 def addNameEditor(self,hbox): |
5ba2cab1d505
Add name editor to edit the inkscape:label withgout using the object property editor. This is more Flash-like operation.
wycc
parents:
1097
diff
changeset
|
914 self.nameEditor = gtk.Entry(max=40) |
5ba2cab1d505
Add name editor to edit the inkscape:label withgout using the object property editor. This is more Flash-like operation.
wycc
parents:
1097
diff
changeset
|
915 hbox.pack_start(self.nameEditor,expand=False,fill=False) |
5ba2cab1d505
Add name editor to edit the inkscape:label withgout using the object property editor. This is more Flash-like operation.
wycc
parents:
1097
diff
changeset
|
916 self.editDone = gtk.Button('Set') |
5ba2cab1d505
Add name editor to edit the inkscape:label withgout using the object property editor. This is more Flash-like operation.
wycc
parents:
1097
diff
changeset
|
917 hbox.pack_start(self.editDone,expand=False,fill=False) |
5ba2cab1d505
Add name editor to edit the inkscape:label withgout using the object property editor. This is more Flash-like operation.
wycc
parents:
1097
diff
changeset
|
918 self.editDone.connect('clicked', self.changeObjectLabel) |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
919 pass |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
920 |
1147 | 921 def doRun(self,arg): |
1146
e14ec6d1a661
CHange the implementation to set the transformation matrix only. This is be more friendly for the animation inside the inskcape.
wycc
parents:
1141
diff
changeset
|
922 """ |
e14ec6d1a661
CHange the implementation to set the transformation matrix only. This is be more friendly for the animation inside the inskcape.
wycc
parents:
1141
diff
changeset
|
923 Execute the current animation till the last frame. |
e14ec6d1a661
CHange the implementation to set the transformation matrix only. This is be more friendly for the animation inside the inskcape.
wycc
parents:
1141
diff
changeset
|
924 """ |
1147 | 925 if self.btnRun.get_label() == "Run": |
926 self.btnRun.set_label("Stop") | |
1161
a7faab54e8f8
Fix broken of running animation
Thinker K.F. Li <thinker@codemud.net>
parents:
1160
diff
changeset
|
927 self.lockui = True |
1147 | 928 self.last_update = glib.timeout_add(1000/self.framerate,self.doRunNext) |
929 else: | |
930 self.btnRun.set_label("Run") | |
931 glib.source_remove(self.last_update) | |
1161
a7faab54e8f8
Fix broken of running animation
Thinker K.F. Li <thinker@codemud.net>
parents:
1160
diff
changeset
|
932 self.lockui = False |
a7faab54e8f8
Fix broken of running animation
Thinker K.F. Li <thinker@codemud.net>
parents:
1160
diff
changeset
|
933 pass |
1147 | 934 |
935 def doRunNext(self): | |
936 if self.current >= self.maxframe: | |
937 self.current = 0 | |
1161
a7faab54e8f8
Fix broken of running animation
Thinker K.F. Li <thinker@codemud.net>
parents:
1160
diff
changeset
|
938 try: |
a7faab54e8f8
Fix broken of running animation
Thinker K.F. Li <thinker@codemud.net>
parents:
1160
diff
changeset
|
939 self.setCurrentScene(self.current+1) |
a7faab54e8f8
Fix broken of running animation
Thinker K.F. Li <thinker@codemud.net>
parents:
1160
diff
changeset
|
940 except: |
a7faab54e8f8
Fix broken of running animation
Thinker K.F. Li <thinker@codemud.net>
parents:
1160
diff
changeset
|
941 traceback.print_exc() |
a7faab54e8f8
Fix broken of running animation
Thinker K.F. Li <thinker@codemud.net>
parents:
1160
diff
changeset
|
942 raise |
1147 | 943 self.last_update = glib.timeout_add(1000/self.framerate,self.doRunNext) |
1174 | 944 |
945 def doInsertScene(self,w): | |
946 self.lockui=True | |
947 self.last_line.insert_frame(self.last_frame) | |
1182
8b0e5e8a6b0c
Rename MBScene.update() to update_scenes_of_dom()
Thinker K.F. Li <thinker@codemud.net>
parents:
1181
diff
changeset
|
948 self.update_scenes_of_dom() |
1174 | 949 self.lockui=False |
950 | |
951 def doRemoveScene(self,w): | |
952 self.lockui=True | |
953 self.last_line.remove_frame(self.last_frame) | |
1182
8b0e5e8a6b0c
Rename MBScene.update() to update_scenes_of_dom()
Thinker K.F. Li <thinker@codemud.net>
parents:
1181
diff
changeset
|
954 self.update_scenes_of_dom() |
1174 | 955 self.lockui=False |
956 | 956 |
957 def addButtons(self,hbox): | |
958 btn = gtk.Button('Insert Key') | |
959 btn.connect('clicked',self.doInsertKeyScene) | |
960 hbox.pack_start(btn,expand=False,fill=False) | |
1174 | 961 |
956 | 962 btn=gtk.Button('Remove Key') |
963 btn.connect('clicked', self.doRemoveScene) | |
964 hbox.pack_start(btn,expand=False,fill=False) | |
1174 | 965 |
956 | 966 btn=gtk.Button('Extend scene') |
967 btn.connect('clicked', self.doExtendScene) | |
968 hbox.pack_start(btn,expand=False,fill=False) | |
1174 | 969 |
970 btn=gtk.Button('Duplicate Key') | |
971 btn.connect('clicked', self.doDuplicateKeyScene) | |
972 hbox.pack_start(btn,expand=False,fill=False) | |
973 | |
1097
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
974 btn=gtk.Button('Duplicate Key') |
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
975 btn.connect('clicked', self.doDuplicateKeyScene) |
52d8bf5d12b4
Implement the function to duplicate the previous scene. This require the latest inkscape-pybind, which contains duplicate() for the Node
wycc
parents:
1070
diff
changeset
|
976 hbox.pack_start(btn,expand=False,fill=False) |
1174 | 977 |
978 btn=gtk.Button('Insert') | |
979 btn.connect('clicked', self.doInsertScene) | |
980 hbox.pack_start(btn,expand=False,fill=False) | |
981 | |
982 btn=gtk.Button('Remove') | |
983 btn.connect('clicked', self.doRemoveScene) | |
984 hbox.pack_start(btn,expand=False,fill=False) | |
985 | |
1146
e14ec6d1a661
CHange the implementation to set the transformation matrix only. This is be more friendly for the animation inside the inskcape.
wycc
parents:
1141
diff
changeset
|
986 btn=gtk.Button('Run') |
e14ec6d1a661
CHange the implementation to set the transformation matrix only. This is be more friendly for the animation inside the inskcape.
wycc
parents:
1141
diff
changeset
|
987 btn.connect('clicked', self.doRun) |
1147 | 988 self.btnRun = btn |
1146
e14ec6d1a661
CHange the implementation to set the transformation matrix only. This is be more friendly for the animation inside the inskcape.
wycc
parents:
1141
diff
changeset
|
989 hbox.pack_start(btn,expand=False,fill=False) |
1174 | 990 |
1099
5ba2cab1d505
Add name editor to edit the inkscape:label withgout using the object property editor. This is more Flash-like operation.
wycc
parents:
1097
diff
changeset
|
991 self.addNameEditor(hbox) |
1120
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
1099
diff
changeset
|
992 self.addTweenTypeSelector(hbox) |
956 | 993 pass |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
994 |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1149
diff
changeset
|
995 def onTweenTypeChange(self, w): |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1149
diff
changeset
|
996 if self._disable_tween_type_selector: |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1149
diff
changeset
|
997 return |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1149
diff
changeset
|
998 |
1120
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
1099
diff
changeset
|
999 if self.last_line == None: |
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
1099
diff
changeset
|
1000 return |
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
1099
diff
changeset
|
1001 frameline = self.last_line |
1159
e731a0eaa35f
Fix issue of chagne tween type when there is more than one tween block.
Thinker K.F. Li <thinker@codemud.net>
parents:
1157
diff
changeset
|
1002 idx = self.last_frame |
1120
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
1099
diff
changeset
|
1003 i = 0 |
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
1099
diff
changeset
|
1004 found = -1 |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1149
diff
changeset
|
1005 for start_idx, stop_idx, tween_type in frameline.get_frame_blocks(): |
1159
e731a0eaa35f
Fix issue of chagne tween type when there is more than one tween block.
Thinker K.F. Li <thinker@codemud.net>
parents:
1157
diff
changeset
|
1006 if start_idx <= idx and stop_idx >= idx: |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1149
diff
changeset
|
1007 n = self.tweenTypeSelector.get_active() |
1151
71c72e8d6755
Refactory cod eof TweenObject.updateTweenContent and MBScene.setCurrentScene().
Thinker K.F. Li <thinker@codemud.net>
parents:
1150
diff
changeset
|
1008 new_tween_type = MBScene._frameline_tween_types[n] |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1149
diff
changeset
|
1009 self.last_line.set_tween_type(start_idx, new_tween_type) |
1182
8b0e5e8a6b0c
Rename MBScene.update() to update_scenes_of_dom()
Thinker K.F. Li <thinker@codemud.net>
parents:
1181
diff
changeset
|
1010 self.update_scenes_of_dom() |
1120
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
1099
diff
changeset
|
1011 break |
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
1099
diff
changeset
|
1012 pass |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
1013 pass |
1120
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
1099
diff
changeset
|
1014 |
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
1099
diff
changeset
|
1015 def addTweenTypeSelector(self,hbox): |
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
1099
diff
changeset
|
1016 tweenbox = gtk.HBox() |
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
1099
diff
changeset
|
1017 label = gtk.Label('Tween Type') |
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
1099
diff
changeset
|
1018 tweenbox.pack_start(label) |
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
1099
diff
changeset
|
1019 |
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
1099
diff
changeset
|
1020 self.tweenTypeSelector = gtk.combo_box_new_text() |
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
1099
diff
changeset
|
1021 self.tweenTypeSelector.append_text('normal') |
1157
3a891dccabd8
Remove the locate tween. It is a special case for the scale tween
wycc
parents:
1155
diff
changeset
|
1022 #self.tweenTypeSelector.append_text('relocate') |
1120
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
1099
diff
changeset
|
1023 self.tweenTypeSelector.append_text('scale') |
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
1099
diff
changeset
|
1024 self.tweenTypeSelector.set_active(0) |
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
1099
diff
changeset
|
1025 tweenbox.pack_start(self.tweenTypeSelector, expand=False,fill=False) |
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
1099
diff
changeset
|
1026 hbox.pack_start(tweenbox,expand=False,fill=False) |
214e1f628d63
Add tween type selector into the UI. This UI can be used to update the type attribute of the SVG.
wycc
parents:
1099
diff
changeset
|
1027 self.tweenTypeSelector.connect('changed', self.onTweenTypeChange) |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
1028 pass |
956 | 1029 |
1030 def onQuit(self, event): | |
1031 self.OK = False | |
1032 gtk.main_quit() | |
1033 pass | |
1034 | |
1035 def onOK(self,event): | |
1036 self.OK = True | |
1037 gtk.main_quit() | |
1038 pass | |
941
9ba94c577a6f
Add scene editor. This vewrsion can only switch scene. It can not change the scene yet.
wycc
parents:
diff
changeset
|
1039 |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
1040 def updateUI(self,node=None,arg=None): |
1130
37a0f6ab2f91
Lock the UI from refreshing during the update procedure
wycc
parents:
1128
diff
changeset
|
1041 if self.lockui: return |
1166
d73ef03c96de
Refactory code of MBScene.updateUI() from MBScene.show()
Thinker K.F. Li <thinker@codemud.net>
parents:
1164
diff
changeset
|
1042 |
d73ef03c96de
Refactory code of MBScene.updateUI() from MBScene.show()
Thinker K.F. Li <thinker@codemud.net>
parents:
1164
diff
changeset
|
1043 if self.last_update!= None: |
d73ef03c96de
Refactory code of MBScene.updateUI() from MBScene.show()
Thinker K.F. Li <thinker@codemud.net>
parents:
1164
diff
changeset
|
1044 glib.source_remove(self.last_update) |
d73ef03c96de
Refactory code of MBScene.updateUI() from MBScene.show()
Thinker K.F. Li <thinker@codemud.net>
parents:
1164
diff
changeset
|
1045 self.last_update = glib.timeout_add(300,self._updateUI) |
d73ef03c96de
Refactory code of MBScene.updateUI() from MBScene.show()
Thinker K.F. Li <thinker@codemud.net>
parents:
1164
diff
changeset
|
1046 |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
1047 pass |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
1048 |
1130
37a0f6ab2f91
Lock the UI from refreshing during the update procedure
wycc
parents:
1128
diff
changeset
|
1049 def _updateUI(self,node=None,arg=None): |
1166
d73ef03c96de
Refactory code of MBScene.updateUI() from MBScene.show()
Thinker K.F. Li <thinker@codemud.net>
parents:
1164
diff
changeset
|
1050 self.parseScene() |
d73ef03c96de
Refactory code of MBScene.updateUI() from MBScene.show()
Thinker K.F. Li <thinker@codemud.net>
parents:
1164
diff
changeset
|
1051 self._create_framelines() |
d73ef03c96de
Refactory code of MBScene.updateUI() from MBScene.show()
Thinker K.F. Li <thinker@codemud.net>
parents:
1164
diff
changeset
|
1052 self._update_framelines() |
1144
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
1053 pass |
257beac7c982
Add blank line between methods.
Thinker K.F. Li <thinker@codemud.net>
parents:
1142
diff
changeset
|
1054 |
956 | 1055 def show(self): |
1056 self.OK = True | |
1149
0ffef2df6201
Rename MBScene.dom to MBScene.root
Thinker K.F. Li <thinker@codemud.net>
parents:
1148
diff
changeset
|
1057 if not self.root: |
0ffef2df6201
Rename MBScene.dom to MBScene.root
Thinker K.F. Li <thinker@codemud.net>
parents:
1148
diff
changeset
|
1058 self.root = self.desktop.doc().root().repr |
0ffef2df6201
Rename MBScene.dom to MBScene.root
Thinker K.F. Li <thinker@codemud.net>
parents:
1148
diff
changeset
|
1059 pass |
0ffef2df6201
Rename MBScene.dom to MBScene.root
Thinker K.F. Li <thinker@codemud.net>
parents:
1148
diff
changeset
|
1060 |
1128
b65ac686a7c5
Switch to the DOM-like API. The SPObject become the base of the DOM-like API.
wycc
parents:
1125
diff
changeset
|
1061 self.document = self.desktop.doc().rdoc |
1149
0ffef2df6201
Rename MBScene.dom to MBScene.root
Thinker K.F. Li <thinker@codemud.net>
parents:
1148
diff
changeset
|
1062 self.tween = TweenObject(self.document, self.root) |
1166
d73ef03c96de
Refactory code of MBScene.updateUI() from MBScene.show()
Thinker K.F. Li <thinker@codemud.net>
parents:
1164
diff
changeset
|
1063 self._updateUI() |
1064
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
1064 if self.top == None: |
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
1065 self.top = gtk.VBox(False,0) |
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
1066 self.desktop.getToplevel().child.child.pack_end(self.top,expand=False) |
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
1067 else: |
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
1068 self.top.remove(self.startWindow) |
1150
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1149
diff
changeset
|
1069 pass |
6586cd10c92f
Refactory frameline.py
Thinker K.F. Li <thinker@codemud.net>
parents:
1149
diff
changeset
|
1070 |
981 | 1071 vbox = gtk.VBox(False,0) |
1064
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
1072 self.startWindow = vbox |
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
1073 self.top.pack_start(vbox,expand=False) |
981 | 1074 vbox.pack_start(self.scrollwin,expand=False) |
1075 hbox=gtk.HBox(False,0) | |
1076 self.addButtons(hbox) | |
1077 vbox.pack_start(hbox,expand=False) | |
1078 | |
1064
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
1079 self.top.show_all() |
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
1080 self.last_update = None |
16c69756ef5d
Add NodeObserver to monitor the change of the layer and update it in the scene editor.
wycc
parents:
1032
diff
changeset
|
1081 return False |
956 | 1082 pass |