Mercurial > MadButterfly
annotate pyink/consistency.py @ 1299:6949e2b6cae2
Add unlink clone checker.
- Monitor changes of DOM-tree of the document
- Unlinking a clone is actually removing the clone and copying nodes
from the source.
- Copy value of ID of a node to saved_id to track source of copy
nodes.
- For a new node with 'saved_id' is a copy of another node.
- Copy vulae of 'saved_id' to 'ns0:duplicate-src' to keep the source
- Change value of 'saved_id' to the value of ID of the node for
later copying.
- For a new node without 'saved_id' is not a copy of another node.
- only set 'saved_id' to the value of its ID.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Sun, 16 Jan 2011 16:13:37 +0800 |
parents | e12472f8eef3 |
children | 194c7a831083 |
rev | line source |
---|---|
1253
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
1 import dom_event |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
2 from data_monitor import data_monitor |
1265
ca301f6abef7
Support undo for insert key frame/rm keyframe. We will refresh all layers and scenes since it is not feasible to collect these changes and update the layers and scenes. We may scan two level only in the future to improve the performance.
wycc
parents:
1262
diff
changeset
|
3 import traceback |
1277
4686f3131f2a
Leave a blank between import statements at head
Thinker K.F. Li <thinker@codemud.net>
parents:
1268
diff
changeset
|
4 |
1253
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
5 ## \brief Check consistency of a DOM-tree associated with a domview_ui. |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
6 # |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
7 # This is a co-worker of \ref domview_ui to check DOM-tree and make |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
8 # sure consistency of scenes, scene groups in the DOM-tree. It also |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
9 # updates layer list of \ref domview_ui to reflect last changes of the |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
10 # DOM-tree. |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
11 # |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
12 # Since it is a consistency checker, it must well understanding |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
13 # structure that expected by domview_ui. So, this class is highly |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
14 # closed to the internal of \ref domview_ui. It is separated from |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
15 # domview_ui for collecting related logic and functions in a place to |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
16 # set up a clear boundary from the functions provided by \ref |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
17 # domview_ui. |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
18 # |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
19 # This class is expected to access private variables of \ref |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
20 # domview_ui. But, use public interface of domview_ui if possible. |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
21 # |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
22 # This class is also monitored by \ref data_monitor to monitor the |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
23 # accessing to domview_ui. |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
24 # |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
25 class consistency_checker(object): |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
26 __metaclass__ = data_monitor |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
27 |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
28 def __init__(self, domview_ui): |
1279 | 29 self._domviewui = domview_ui |
30 self._locker = self._domviewui | |
1253
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
31 self._doc = None |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
32 self._root = None |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
33 pass |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
34 |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
35 def _start_check(self): |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
36 doc = self._doc |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
37 dom_event.addEventListener(doc, 'DOMNodeInserted', |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
38 self.do_insert_node, None) |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
39 dom_event.addEventListener(doc, 'DOMNodeRemoved', |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
40 self.do_remove_node, None) |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
41 dom_event.addEventListener(doc, 'DOMAttrModified', |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
42 self.do_attr_modified, None) |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
43 pass |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
44 |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
45 ## \brief Handle a new document. |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
46 # |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
47 # This method is called by domview_ui.handle_doc_root(). |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
48 # |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
49 def handle_doc_root(self, doc, root): |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
50 self._doc = doc |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
51 self._root = root |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
52 |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
53 self._start_check() |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
54 pass |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
55 |
1262
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
56 def _insert_node_recursive(self, node, child): |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
57 child_name = child.name() |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
58 |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
59 if child_name == 'ns0:scene': |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
60 scene_group_id = child.getAttribute('ref') |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
61 try: |
1279 | 62 scene_group = self._domviewui.get_node(scene_group_id) |
1262
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
63 except KeyError: # can not find associated scene group. |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
64 pass |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
65 else: |
1279 | 66 self._domviewui.manage_scene_node(child, scene_group) |
1262
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
67 pass |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
68 elif child_name == 'svg:g': |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
69 if node.name() == 'svg:svg': |
1279 | 70 self._domviewui.manage_layer_group(child) |
1262
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
71 pass |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
72 pass |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
73 |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
74 for cchild in child.childList(): |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
75 self._remove_node_recursive(child, cchild) |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
76 pass |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
77 pass |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
78 |
1257
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
79 def _remove_node_recursive(self, node, child): |
1265
ca301f6abef7
Support undo for insert key frame/rm keyframe. We will refresh all layers and scenes since it is not feasible to collect these changes and update the layers and scenes. We may scan two level only in the future to improve the performance.
wycc
parents:
1262
diff
changeset
|
80 return |
1257
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
81 for cchild in child.childList(): |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
82 self._remove_node_recursive(child, cchild) |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
83 pass |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
84 |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
85 child_name = child.name() |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
86 if child_name not in ('ns0:scene', 'svg:g'): |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
87 return |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
88 |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
89 # |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
90 # Remove the key frame assocated with a removed scene node or |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
91 # scene group if we can find the key frame. |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
92 # |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
93 if child_name == 'ns0:scene': |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
94 try: |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
95 group_id = child.getAttribute('ref') |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
96 except: |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
97 return |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
98 elif child_name == 'svg:g': |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
99 try: |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
100 group_id = child.getAttribute('id') |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
101 except: |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
102 return |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
103 pass |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
104 |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
105 try: |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
106 layer_idx, (start, end, tween_type) = \ |
1279 | 107 self._domviewui.find_key_from_group(group_id) |
1257
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
108 except ValueError: |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
109 pass |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
110 else: # We have found the key frame. |
1279 | 111 self._domviewui.unmark_key(layer_idx, start) |
1261
6177f5d0ef01
Remove the layer when a layer group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1257
diff
changeset
|
112 return |
6177f5d0ef01
Remove the layer when a layer group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1257
diff
changeset
|
113 |
6177f5d0ef01
Remove the layer when a layer group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1257
diff
changeset
|
114 # |
6177f5d0ef01
Remove the layer when a layer group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1257
diff
changeset
|
115 # Remove layers |
6177f5d0ef01
Remove the layer when a layer group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1257
diff
changeset
|
116 # |
6177f5d0ef01
Remove the layer when a layer group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1257
diff
changeset
|
117 if child_name == 'svg:g': |
6177f5d0ef01
Remove the layer when a layer group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1257
diff
changeset
|
118 try: |
1279 | 119 layer_idx = self._domviewui.find_layer_from_group(group_id) |
1261
6177f5d0ef01
Remove the layer when a layer group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1257
diff
changeset
|
120 except ValueError: |
6177f5d0ef01
Remove the layer when a layer group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1257
diff
changeset
|
121 pass |
6177f5d0ef01
Remove the layer when a layer group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1257
diff
changeset
|
122 else: # It is a layer group |
1279 | 123 self._domviewui.rm_layer(layer_idx) |
1261
6177f5d0ef01
Remove the layer when a layer group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1257
diff
changeset
|
124 pass |
1257
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
125 pass |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
126 pass |
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
127 |
1253
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
128 def do_insert_node(self, node, child): |
1262
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
129 self._insert_node_recursive(node, child) |
1253
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
130 pass |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
131 |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
132 def do_remove_node(self, node, child): |
1257
027cd060d9ba
Remove the key frame if associated scene node or scene group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
133 self._remove_node_recursive(node, child) |
1253
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
134 pass |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
135 |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
136 def do_attr_modified(self, node, name, old_value, new_value): |
1280
434f588fcde4
Handle the change of attribute 'start' and 'end'. We do reset here. However, we should be able to optimize it latter to update the scenes directly.
wycc
parents:
1279
diff
changeset
|
137 if node.name() == 'ns0:scene': |
434f588fcde4
Handle the change of attribute 'start' and 'end'. We do reset here. However, we should be able to optimize it latter to update the scenes directly.
wycc
parents:
1279
diff
changeset
|
138 if name == 'ref': |
434f588fcde4
Handle the change of attribute 'start' and 'end'. We do reset here. However, we should be able to optimize it latter to update the scenes directly.
wycc
parents:
1279
diff
changeset
|
139 try: |
434f588fcde4
Handle the change of attribute 'start' and 'end'. We do reset here. However, we should be able to optimize it latter to update the scenes directly.
wycc
parents:
1279
diff
changeset
|
140 if new_value: |
434f588fcde4
Handle the change of attribute 'start' and 'end'. We do reset here. However, we should be able to optimize it latter to update the scenes directly.
wycc
parents:
1279
diff
changeset
|
141 raise ValueError('The new_value is not empty') |
434f588fcde4
Handle the change of attribute 'start' and 'end'. We do reset here. However, we should be able to optimize it latter to update the scenes directly.
wycc
parents:
1279
diff
changeset
|
142 self._domviewui.reset() |
434f588fcde4
Handle the change of attribute 'start' and 'end'. We do reset here. However, we should be able to optimize it latter to update the scenes directly.
wycc
parents:
1279
diff
changeset
|
143 except: |
434f588fcde4
Handle the change of attribute 'start' and 'end'. We do reset here. However, we should be able to optimize it latter to update the scenes directly.
wycc
parents:
1279
diff
changeset
|
144 traceback.print_exc() |
434f588fcde4
Handle the change of attribute 'start' and 'end'. We do reset here. However, we should be able to optimize it latter to update the scenes directly.
wycc
parents:
1279
diff
changeset
|
145 pass |
1265
ca301f6abef7
Support undo for insert key frame/rm keyframe. We will refresh all layers and scenes since it is not feasible to collect these changes and update the layers and scenes. We may scan two level only in the future to improve the performance.
wycc
parents:
1262
diff
changeset
|
146 pass |
1280
434f588fcde4
Handle the change of attribute 'start' and 'end'. We do reset here. However, we should be able to optimize it latter to update the scenes directly.
wycc
parents:
1279
diff
changeset
|
147 elif name == 'end' or name == 'start': |
434f588fcde4
Handle the change of attribute 'start' and 'end'. We do reset here. However, we should be able to optimize it latter to update the scenes directly.
wycc
parents:
1279
diff
changeset
|
148 self._domviewui.reset() |
434f588fcde4
Handle the change of attribute 'start' and 'end'. We do reset here. However, we should be able to optimize it latter to update the scenes directly.
wycc
parents:
1279
diff
changeset
|
149 pass |
1281
e12472f8eef3
Handle type attribute to implemen the tween type change action undo.
wycc
parents:
1280
diff
changeset
|
150 elif name == 'type': |
e12472f8eef3
Handle type attribute to implemen the tween type change action undo.
wycc
parents:
1280
diff
changeset
|
151 self._domviewui.reset() |
e12472f8eef3
Handle type attribute to implemen the tween type change action undo.
wycc
parents:
1280
diff
changeset
|
152 pass |
e12472f8eef3
Handle type attribute to implemen the tween type change action undo.
wycc
parents:
1280
diff
changeset
|
153 pass |
1253
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
154 pass |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
155 pass |