def __init__(self, parameters): """ Instantiates a new backend. Please note that this is called also for disabled backends. Those are not initialized, so you might want to check out the initialize() function. """ if self.KEY_DEFAULT_BACKEND not in parameters: # if it's not specified, then this is the default backend #(for retro-compatibility with the GTG 0.2 series) parameters[self.KEY_DEFAULT_BACKEND] = True # default backends should get all the tasks if parameters[self.KEY_DEFAULT_BACKEND] or \ (not self.KEY_ATTACHED_TAGS in parameters and self._general_description[self.BACKEND_TYPE] == self.TYPE_READWRITE): parameters[self.KEY_ATTACHED_TAGS] = [self.ALLTASKS_TAG] self._parameters = parameters self._signal_manager = BackendSignals() self._is_initialized = False # if debugging mode is enabled, tasks should be saved as soon as # they're marked as modified. If in normal mode, we prefer speed over # easier debugging. if Log.is_debugging_mode(): self.timer_timestep = 5 else: self.timer_timestep = 1 self.to_set_timer = None self.please_quit = False self.cancellation_point = lambda: _cancellation_point(lambda: self. please_quit) self.to_set = deque() self.to_remove = deque()
def __init__(self, parameters): """ Instantiates a new backend. Please note that this is called also for disabled backends. Those are not initialized, so you might want to check out the initialize() function. """ if self.KEY_DEFAULT_BACKEND not in parameters: # if it's not specified, then this is the default backend #(for retro-compatibility with the GTG 0.2 series) parameters[self.KEY_DEFAULT_BACKEND] = True # default backends should get all the tasks if parameters[self.KEY_DEFAULT_BACKEND] or \ (not self.KEY_ATTACHED_TAGS in parameters and self._general_description[self.BACKEND_TYPE] == self.TYPE_READWRITE): parameters[self.KEY_ATTACHED_TAGS] = [self.ALLTASKS_TAG] self._parameters = parameters self._signal_manager = BackendSignals() self._is_initialized = False # if debugging mode is enabled, tasks should be saved as soon as # they're marked as modified. If in normal mode, we prefer speed over # easier debugging. if Log.is_debugging_mode(): self.timer_timestep = 5 else: self.timer_timestep = 1 self.to_set_timer = None self.please_quit = False self.cancellation_point = lambda: _cancellation_point( lambda: self.please_quit) self.to_set = deque() self.to_remove = deque()
def __init__(self, requester, backend, datastore): """ Instantiates a TaskSource object. @param requester: a Requester @param backend: the backend being wrapped @param datastore: a FilteredDatastore """ self.backend = backend self.req = requester self.backend.register_datastore(datastore) self.tasktree = datastore.get_tasks_tree().get_main_view() self.to_set = deque() self.to_remove = deque() self.please_quit = False self.task_filter = self.get_task_filter_for_backend() if Log.is_debugging_mode(): self.timer_timestep = 5 else: self.timer_timestep = 1 self.set_task_handle = None self.remove_task_handle = None self.to_set_timer = None
def __init__(self, requester, backend, datastore): """ Instantiates a TaskSource object. @param requester: a Requester @param backend: the backend being wrapped @param datastore: a FilteredDatastore """ self.backend = backend self.req = requester self.backend.register_datastore(datastore) self.tasktree = datastore.get_tasks_tree().get_main_view() self.to_set = deque() self.to_remove = deque() self.please_quit = False self.task_filter = self.get_task_filter_for_backend() if Log.is_debugging_mode(): self.timer_timestep = 5 else: self.timer_timestep = 1 self.add_task_handle = None self.set_task_handle = None self.remove_task_handle = None self.to_set_timer = None