Mercurial > MadButterfly
comparison pyink/domview.py @ 1317:e2ad9eb7f7a4
Show timelines correctly
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Sat, 22 Jan 2011 19:44:07 +0800 |
parents | 9ab8d50dcf7e |
children | b1776f441e8a |
comparison
equal
deleted
inserted
replaced
1316:9ab8d50dcf7e | 1317:e2ad9eb7f7a4 |
---|---|
107 scenes_node.setAttribute('name', name) | 107 scenes_node.setAttribute('name', name) |
108 node_id = self._comp_mgr.new_id() | 108 node_id = self._comp_mgr.new_id() |
109 scenes_node.setAttribute('id', node_id) | 109 scenes_node.setAttribute('id', node_id) |
110 | 110 |
111 comp_node.appendChild(scenes_node) | 111 comp_node.appendChild(scenes_node) |
112 | |
113 tl = Timeline(scenes_node) | |
114 self.timelines.append(tl) | |
112 pass | 115 pass |
113 | 116 |
114 ## \brief Add a timeline for an existed scenes node. | 117 ## \brief Add a timeline for an existed scenes node. |
115 # | 118 # |
116 def add_timeline_scenes(self, scenes_node): | 119 def add_timeline_scenes(self, scenes_node): |
117 tl = Timeline(scenes_node) | 120 tl = Timeline(scenes_node) |
118 name = tl.name() | 121 name = tl.name() |
119 if self.has_timeline(name): | 122 if self.has_timeline(name): |
120 raise ValueError, \ | 123 raise ValueError, \ |
121 'name of scenes node of a timeline is duplicated' | 124 'name of scenes node of a timeline is duplicated' |
125 | |
126 self.timeline.append(tl) | |
122 pass | 127 pass |
123 | 128 |
124 def rm_timeline(self, name): | 129 def rm_timeline(self, name): |
125 for i, tl in enumerate(self.timelines): | 130 for i, tl in enumerate(self.timelines): |
126 if tl.name() == name: | 131 if tl.name() == name: |
132 comp_node = self.node | |
133 comp_node.removeChild(tl.scenes_node) | |
134 | |
127 del self.timelines[i] | 135 del self.timelines[i] |
128 return | 136 return |
129 pass | 137 pass |
130 raise ValueError, 'try to remove a non-existed timeline - %s' % (name) | 138 raise ValueError, 'try to remove a non-existed timeline - %s' % (name) |
131 pass | 139 pass |
285 layer_group.setAttribute('inkscape:label', layer_name) | 293 layer_group.setAttribute('inkscape:label', layer_name) |
286 comp_group.appendChild(layer_group) | 294 comp_group.appendChild(layer_group) |
287 pass | 295 pass |
288 | 296 |
289 def all_comp_names(self): | 297 def all_comp_names(self): |
290 return list(self._comp_names) | 298 return [comp.name() for comp in self._components] |
291 | 299 |
292 def has_component(self, name): | 300 def has_component(self, name): |
293 return name in self._comp_names | 301 return name in self._comp_names |
294 | 302 |
295 def switch_component(self, comp_name): | 303 def switch_component(self, comp_name): |