# HG changeset patch # User Thinker K.F. Li # Date 1297573930 -28800 # Node ID f92be354ad2436adde545f8f4502051e7ad13928 # Parent ce19a11657a77273521c24b25ad6552f54edd513 Refactory code to layer_parser.reset_layers() diff -r ce19a11657a7 -r f92be354ad24 pyink/domview.py --- a/pyink/domview.py Sun Feb 13 12:49:44 2011 +0800 +++ b/pyink/domview.py Sun Feb 13 13:12:10 2011 +0800 @@ -1035,6 +1035,14 @@ layer.scenes.append(scene_node) pass pass + + def get_layer_num(self): + return len(self._layers) + + def reset_layers(self): + self._layers[:] = [] + self.parse_all_layers() + pass pass ## \brief This layer provide a data view to the DOM-tree. @@ -1101,18 +1109,16 @@ def handle_doc_root(self, doc, root): self._doc = doc self._root = root - self._layers[:] = [] self._init_metadata() self._start_monitor() # from domview_monitor self._start_component_manager() - self.parse_all_layers() + self.reset_layers() pass def reset(self): self._monitor_reparse() # from domview_monitor - self._layers[:] = [] - self.parse_all_layers() + self.reset_layers() pass def dumpattr(self, n): @@ -1338,9 +1344,6 @@ pass pass - def get_layer_num(self): - return len(self._layers) - ## \brief Find layer index and scene info for a given scene node. # # \return (-1, None) for error. diff -r ce19a11657a7 -r f92be354ad24 pyink/html5css3.py --- a/pyink/html5css3.py Sun Feb 13 12:49:44 2011 +0800 +++ b/pyink/html5css3.py Sun Feb 13 13:12:10 2011 +0800 @@ -63,8 +63,7 @@ pass def reset(self): - self._layers[:] = [] - self._parse_all_layers() + self.reset_layers() pass pass @@ -73,7 +72,9 @@ def save(self, module, doc, filename): parser = dom_parser() parser.start_handle(doc.rdoc) - print parser._metadata_node + + print parser.all_comp_names() + print parser._layers print 'save to ' + filename pass pass