def assign_notification_states_before(self, model, prop_name, info): if self.busy: # if proceeding undo or redo return else: # avoid to vast computation time if 'kwargs' in info and 'method_name' in info['kwargs'] and \ info['kwargs']['method_name'] in BY_EXECUTION_TRIGGERED_OBSERVABLE_STATE_METHODS: return overview = NotificationOverview(info) # skipped state modifications if not overview.get_change( ) == 'state_change' or overview.get_cause() == 'parent': return # increase counter and generate new action if not locked by action that is performed if self.locked: self.before_count() else: if self.start_new_action(overview): self.before_count() else: logger.error( "FAILED to start NEW HISTORY ELEMENT [states]")
def assign_notification_states_after(self, model, prop_name, info): """ This method is called, when any state, transition, data flow, etc. within the state machine modifications. This then typically requires a redraw of the graphical editor, to display these modifications immediately. :param model: The state machine model :param prop_name: The property that was changed :param info: Information about the change """ if self.busy or info.method_name == 'state_change' and \ info.kwargs.prop_name == 'state' and \ info.kwargs.method_name in BY_EXECUTION_TRIGGERED_OBSERVABLE_STATE_METHODS: return else: # avoid to vast computation time if 'kwargs' in info and 'method_name' in info['kwargs'] and \ info['kwargs']['method_name'] in BY_EXECUTION_TRIGGERED_OBSERVABLE_STATE_METHODS: return overview = NotificationOverview(info) # handle interrupts of action caused by exceptions if overview.get_result() == "CRASH in FUNCTION" or isinstance( overview.get_result(), Exception): if self.count_before == 1: return self._interrupt_active_action(info) pass # modifications of parent are not observed if not overview.get_change( ) == 'state_change' or overview.get_cause() == 'parent': return # decrease counter and finish action if count_before = 0 if self.locked: self.after_count() if self.count_before == 0: self.finish_new_action(overview) else: logger.error( "HISTORY after not count [states] -> For every before there should be a after." )