Mercurial > MadButterfly
annotate pyink/consistency.py @ 1267:2318a094a277
Move function around to separate do_* from others
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Wed, 12 Jan 2011 20:42:31 +0800 |
parents | ca301f6abef7 |
children | cd848c2ec29f |
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 |
1253
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
4 ## \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
|
5 # |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
6 # 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
|
7 # 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
|
8 # 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
|
9 # DOM-tree. |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
10 # |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
11 # 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
|
12 # 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
|
13 # 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
|
14 # 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
|
15 # 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
|
16 # domview_ui. |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
17 # |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
18 # 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
|
19 # 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
|
20 # |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
21 # 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
|
22 # accessing to domview_ui. |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
23 # |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
24 class consistency_checker(object): |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
25 __metaclass__ = data_monitor |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
26 |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
27 def __init__(self, domview_ui): |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
28 self._domview = domview_ui |
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
|
29 self._locker = self._domview |
1253
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
30 self._doc = None |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
31 self._root = None |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
32 pass |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
33 |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
34 def _start_check(self): |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
35 doc = self._doc |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
36 dom_event.addEventListener(doc, 'DOMNodeInserted', |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
37 self.do_insert_node, None) |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
38 dom_event.addEventListener(doc, 'DOMNodeRemoved', |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
39 self.do_remove_node, None) |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
40 dom_event.addEventListener(doc, 'DOMAttrModified', |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
41 self.do_attr_modified, None) |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
42 pass |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
43 |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
44 ## \brief Handle a new document. |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
45 # |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
46 # 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
|
47 # |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
48 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
|
49 self._doc = doc |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
50 self._root = root |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
51 |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
52 self._start_check() |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
53 pass |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
54 |
1262
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
55 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
|
56 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
|
57 |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
58 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
|
59 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
|
60 try: |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
61 scene_group = self._domview.get_node(scene_group_id) |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
62 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
|
63 pass |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
64 else: |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
65 self._domview.manage_scene_node(child, scene_group) |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
66 pass |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
67 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
|
68 if node.name() == 'svg:svg': |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
69 self._domview.manage_layer_group(child) |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
70 pass |
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 |
2f861eea1214
Make domview_ui manages scenes and layers found by checker
Thinker K.F. Li <thinker@codemud.net>
parents:
1261
diff
changeset
|
73 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
|
74 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
|
75 pass |
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 |
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
|
78 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
|
79 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
|
80 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
|
81 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
|
82 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
|
83 |
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 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
|
85 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
|
86 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
|
87 |
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 # 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
|
90 # 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
|
91 # |
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 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
|
93 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
|
94 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
|
95 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
|
96 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
|
97 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
|
98 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
|
99 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
|
100 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
|
101 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
|
102 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
|
103 |
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 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
|
105 layer_idx, (start, end, tween_type) = \ |
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 self._domview.find_key_from_group(group_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
|
107 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
|
108 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
|
109 else: # We have found 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
|
110 self._domview.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
|
111 return |
6177f5d0ef01
Remove the layer when a layer group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1257
diff
changeset
|
112 |
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 # Remove layers |
6177f5d0ef01
Remove the layer when a layer group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1257
diff
changeset
|
115 # |
6177f5d0ef01
Remove the layer when a layer group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1257
diff
changeset
|
116 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
|
117 try: |
6177f5d0ef01
Remove the layer when a layer group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1257
diff
changeset
|
118 layer_idx = self._domview.find_layer_from_group(group_id) |
6177f5d0ef01
Remove the layer when a layer group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1257
diff
changeset
|
119 except ValueError: |
6177f5d0ef01
Remove the layer when a layer group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1257
diff
changeset
|
120 pass |
6177f5d0ef01
Remove the layer when a layer group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1257
diff
changeset
|
121 else: # It is a layer group |
6177f5d0ef01
Remove the layer when a layer group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1257
diff
changeset
|
122 self._domview.rm_layer(layer_idx) |
6177f5d0ef01
Remove the layer when a layer group being removed.
Thinker K.F. Li <thinker@codemud.net>
parents:
1257
diff
changeset
|
123 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
|
124 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
|
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 |
1253
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
127 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
|
128 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
|
129 pass |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
130 |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
131 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
|
132 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
|
133 pass |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
134 |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
135 def do_attr_modified(self, node, name, old_value, new_value): |
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
|
136 if node.name() == 'ns0:scene' and name == 'ref': |
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
|
137 try: |
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
|
138 if new_value: |
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
|
139 raise ValueError('The new_value is not empty') |
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
|
140 self._domview.reset() |
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
|
141 except: |
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
|
142 traceback.print_exc() |
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
|
143 pass |
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
|
144 pass |
1253
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
145 pass |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
146 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
|
147 |
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
|
148 def lock(self): |
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
|
149 self._domview.lock() |
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
|
150 pass |
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
|
151 |
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
|
152 def unlock(self): |
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
|
153 self._domview.unlock() |
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
|
154 pass |