Mercurial > MadButterfly
changeset 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 | ce19a11657a7 |
children | f1fa284fc9c9 |
files | pyink/domview.py pyink/html5css3.py |
diffstat | 2 files changed, 14 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- 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.
--- 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