コード例 #1
0
    def __init__(self, state_machine_model):
        ModelMT.__init__(self)

        assert isinstance(state_machine_model, StateMachineModel)
        self.state_machine_model = state_machine_model
        self.__state_machine_id = state_machine_model.state_machine.state_machine_id
        self._tmp_meta_storage = None
        self.tmp_meta_storage = self.get_root_state_element_meta()

        self.observe_model(self.state_machine_model)
        self.observe_model(self.state_machine_model.root_state)
        self.__buffered_root_state_model = self.state_machine_model.root_state

        self._active_action = None
        self.locked = False
        self.busy = False
        self.count_before = 0

        self.modifications = ModificationsHistory()
        self.change_count = 0

        self.fake = False

        self.refactored_history = True
        self.with_meta_data_actions = True
        self.check_gaphas_consistency = False

        self.re_initiate_meta_data()
コード例 #2
0
    def __init__(self, state_machine_manager, meta=None):
        """Constructor"""
        ModelMT.__init__(self)  # pass columns as separate parameters
        self.register_observer(self)

        assert isinstance(state_machine_manager, StateMachineManager)

        self.state_machine_manager = state_machine_manager
        self.state_machines = {}
        for sm_id, sm in state_machine_manager.state_machines.items():
            self.state_machines[sm_id] = StateMachineModel(sm)

        self._selected_state_machine_id = None
        if len(self.state_machines) > 0:
            self.selected_state_machine_id = list(
                self.state_machines.keys())[0]

        if isinstance(meta, Vividict):
            self.meta = meta
        else:
            self.meta = Vividict()

        # check if the sm_manager_model exists several times
        self.__class__.__sm_manager_creation_counter += 1
        if self.__class__.__sm_manager_creation_counter == 2:
            logger.error("Sm_manager_model exists several times!")
            os._exit(0)
コード例 #3
0
    def __init__(self,
                 status=[],
                 ping=[],
                 history_list=[],
                 message_list=[],
                 config_list=[],
                 meta=None):
        ModelMT.__init__(self)
        self.connected_ip_port = []
        self.status = status
        self.id = []
        self.ping = ping
        self.controller = None
        self.history_list = history_list
        self.history_store_list = []
        self.message_list = message_list
        self.message_store_list = []
        self.config_list = config_list
        self.register_observer(self)

        self.params = {
            'SERVER_IP', 'SERVER_UDP_PORT', 'SPACEBOT_CUP_MODE', 'HASH_LENGTH',
            'SALT_LENGTH', 'MAX_TIME_WAITING_FOR_ACKNOWLEDGEMENTS',
            'MAX_TIME_WAITING_BETWEEN_CONNECTION_TRY_OUTS', 'BURST_NUMBER',
            'TIME_BETWEEN_BURSTS', 'SERVER', 'HISTORY_LENGTH', 'ENABLED',
            'TYPE', 'CLIENT_ID', 'SERVER_ID'
        }
コード例 #4
0
    def __init__(self, meta=None):
        """Constructor"""
        ModelMT.__init__(self)  # pass columns as separate parameters

        if isinstance(meta, Vividict):
            self.meta = meta
        else:
            self.meta = Vividict()
コード例 #5
0
    def __init__(self, state_machine_model):
        ModelMT.__init__(self)

        assert isinstance(state_machine_model, StateMachineModel)
        self.state_machine_model = state_machine_model

        # variables used for lock files
        # TODO reduce those variables
        self.__destroyed = False
        self.AUTO_RECOVERY_LOCK_ENABLED = False
        if os.path.exists(os.path.join(RAFCON_TEMP_PATH_BASE, 'lock')) and \
                global_gui_config.get_config_value('AUTO_RECOVERY_LOCK_ENABLED'):
            self.AUTO_RECOVERY_LOCK_ENABLED = True
        self.lock_file_lock = threading.Lock()
        self.lock_file = None
        self.last_lock_file_name = None

        # general auto-backup variable
        self.timed_temp_storage_enabled = global_gui_config.get_config_value(
            'AUTO_BACKUP_ENABLED')
        self.only_fix_interval = global_gui_config.get_config_value(
            'AUTO_BACKUP_ONLY_FIX_FORCED_INTERVAL')
        self.force_temp_storage_interval = global_gui_config.get_config_value(
            'AUTO_BACKUP_FORCED_STORAGE_INTERVAL')
        self.timed_temp_storage_interval = global_gui_config.get_config_value(
            'AUTO_BACKUP_DYNAMIC_STORAGE_INTERVAL')
        self.last_backup_time = time.time(
        )  # used as 'last-backup' and 'last-modification-not-backup-ed' time
        self.marked_dirty = False
        self.__perform_storage = False
        self._timer_request_time = None
        self.timer_request_lock = threading.Lock()
        self.tmp_timed_storage_thread = None
        self.meta = Vividict()
        if state_machine_model.state_machine.file_system_path is not None:
            # logger.info("store meta data of {0} to {1}".format(self, meta_data_path))
            # data used for restore tabs -> (having the information to load state machines without loading them)
            self.meta['last_saved'][
                'time'] = state_machine_model.state_machine.last_update
            self.meta['last_saved'][
                'file_system_path'] = state_machine_model.state_machine.file_system_path

        logger.debug(
            "The auto-backup for state-machine {2} is {0} and set to '{1}'"
            "".format(
                'ENABLED' if self.timed_temp_storage_enabled else 'DISABLED',
                'fix interval mode'
                if self.only_fix_interval else 'dynamic interval mode',
                self.state_machine_model.state_machine.state_machine_id))

        # register observer before initializing check loop
        self.observe_model(self.state_machine_model)
        # initializing check loop to fully initialize the model
        if not self.only_fix_interval:
            self.perform_temp_storage()
        else:
            self.check_for_auto_backup(force=True)
コード例 #6
0
ファイル: meta.py プロジェクト: ylshimp/RAFCON
    def __init__(self, meta=None):
        ModelMT.__init__(self)

        if isinstance(meta, dict):
            self.meta = Vividict(meta)
        else:
            self.meta = Vividict()
        self.temp = Vividict()

        self.meta_signal = Signal()
コード例 #7
0
    def __init__(self, execution_engine, meta=None):
        """Constructor"""
        ModelMT.__init__(self)  # pass columns as separate parameters
        self.register_observer(self)

        assert isinstance(execution_engine, ExecutionEngine)
        self.execution_engine = execution_engine

        if isinstance(meta, Vividict):
            self.meta = meta
        else:
            self.meta = Vividict()
コード例 #8
0
ファイル: selection.py プロジェクト: moritzmaier/RAFCON
    def __init__(self, parent_signal=None):
        ModelMT.__init__(self)

        self._selected = set()
        self._input_data_ports = set()
        self._output_data_ports = set()
        self._outcomes = set()
        self._data_flows = set()
        self._transitions = set()
        self._states = set()
        self._scoped_variables = set()
        self.selection_changed_signal = Signal()
        self.focus_signal = Signal()
        self.parent_signal = parent_signal
コード例 #9
0
    def __init__(self, library_manager, meta=None):
        """Constructor
        """

        ModelMT.__init__(self)  # pass columns as separate parameters

        assert isinstance(library_manager, LibraryManager)

        self.library_manager = library_manager

        if isinstance(meta, Vividict):
            self.meta = meta
        else:
            self.meta = Vividict()

        # this class is an observer of its own properties:
        self.register_observer(self)