comparison pyink/domview.py @ 1354:f92be354ad24

Refactory code to layer_parser.reset_layers()
author Thinker K.F. Li <thinker@codemud.net>
date Sun, 13 Feb 2011 13:12:10 +0800
parents 9164a0782ba7
children ac61d86987af
comparison
equal deleted inserted replaced
1353:ce19a11657a7 1354:f92be354ad24
1033 continue 1033 continue
1034 1034
1035 layer.scenes.append(scene_node) 1035 layer.scenes.append(scene_node)
1036 pass 1036 pass
1037 pass 1037 pass
1038
1039 def get_layer_num(self):
1040 return len(self._layers)
1041
1042 def reset_layers(self):
1043 self._layers[:] = []
1044 self.parse_all_layers()
1045 pass
1038 pass 1046 pass
1039 1047
1040 ## \brief This layer provide a data view to the DOM-tree. 1048 ## \brief This layer provide a data view to the DOM-tree.
1041 # 1049 #
1042 # This class maintains layers information, and provides functions to create, 1050 # This class maintains layers information, and provides functions to create,
1099 pass 1107 pass
1100 1108
1101 def handle_doc_root(self, doc, root): 1109 def handle_doc_root(self, doc, root):
1102 self._doc = doc 1110 self._doc = doc
1103 self._root = root 1111 self._root = root
1104 self._layers[:] = []
1105 1112
1106 self._init_metadata() 1113 self._init_metadata()
1107 self._start_monitor() # from domview_monitor 1114 self._start_monitor() # from domview_monitor
1108 self._start_component_manager() 1115 self._start_component_manager()
1109 self.parse_all_layers() 1116 self.reset_layers()
1110 pass 1117 pass
1111 1118
1112 def reset(self): 1119 def reset(self):
1113 self._monitor_reparse() # from domview_monitor 1120 self._monitor_reparse() # from domview_monitor
1114 self._layers[:] = [] 1121 self.reset_layers()
1115 self.parse_all_layers()
1116 pass 1122 pass
1117 1123
1118 def dumpattr(self, n): 1124 def dumpattr(self, n):
1119 s = "" 1125 s = ""
1120 for a,v in n.attrib.items(): 1126 for a,v in n.attrib.items():
1335 1341
1336 for idx in range(layer_idx, len(layers)): 1342 for idx in range(layer_idx, len(layers)):
1337 layers[idx].idx = idx 1343 layers[idx].idx = idx
1338 pass 1344 pass
1339 pass 1345 pass
1340
1341 def get_layer_num(self):
1342 return len(self._layers)
1343 1346
1344 ## \brief Find layer index and scene info for a given scene node. 1347 ## \brief Find layer index and scene info for a given scene node.
1345 # 1348 #
1346 # \return (-1, None) for error. 1349 # \return (-1, None) for error.
1347 # 1350 #