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.iteritems(): self.state_machines[sm_id] = StateMachineModel(sm) self._selected_state_machine_id = None if len(self.state_machines.keys()) > 0: self.selected_state_machine_id = 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)
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)
def __init__(self): ModelMT.__init__(self) #przypisanie paru zmiennych z glownej klasy #self.gui=guiclass #self.vars=vars #self.settings=settings #pare zmiennych self.i=0.00 #licznik czasu polaczenie
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()
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()
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
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)