# HG changeset patch # User Thinker K.F. Li # Date 1313740849 -28800 # Node ID 8bc2e824f1555fe0900a7a3aa883bc5cf69f478a # Parent 74635b07a83a7ae485e574eab161974845ce1153 Fix various bug of code for parsing finite state machines. diff -r 74635b07a83a -r 8bc2e824f155 pyink/domview.py --- a/pyink/domview.py Tue May 17 12:17:15 2011 +0800 +++ b/pyink/domview.py Fri Aug 19 16:00:49 2011 +0800 @@ -80,6 +80,7 @@ pass def reparse(self): + node = self.node condition = node.getAttribute('condition') target = node.getAttribute('target') try: @@ -258,7 +259,7 @@ @staticmethod def parse_state(node): state = State(node) - state.parse() + state.reparse() return state @@ -393,7 +394,8 @@ # def parse_states(self): comp_node = self._get_comp_node() - assert (not comp_node) or comp_node.name() == 'ns0:component' + assert (not comp_node) or comp_node.name() in ('ns0:component', + 'svg:metadata') states_nodes = [node for node in comp_node.childList() @@ -409,9 +411,9 @@ pass state_nodes = [child - for child in states_node.childList + for child in states_node.childList() if child.name() == 'ns0:state'] - states = [State.parse_state(node) for state_node in state_nodes] + states = [State.parse_state(state_node) for state_node in state_nodes] self.fsm_states = dict([(state.name, state) for state in states]) self.fsm_states_node = states_node @@ -638,6 +640,7 @@ scenes_node = self._scenes_node timeline = Timeline(scenes_node) comp.timelines = [timeline] + comp.parse_states() self._components.append(comp) self._comp_names.add('main')