Exemplo n.º 1
0
    def __init__(self):
        self.choose_unique_old_alarms = None
        self.OLD_THRESHOLD = coreaux_api.get_extension_configuration("organism_alarms").get_int("old_alarms_threshold")

        self.databases = {}

        self._create_copy_table()

        core_api.bind_to_open_database_dirty(self._handle_open_database_dirty)
        core_api.bind_to_open_database(self._handle_open_database)
        core_api.bind_to_check_pending_changes(self._handle_check_pending_changes)
        core_api.bind_to_reset_modified_state(self._handle_reset_modified_state)
        # No need to bind to close_database, as specific filenames will be
        # deleted from self.databases in self._handle_history_clean
        core_api.bind_to_history_remove(self._handle_history_remove)
        core_api.bind_to_history_clean(self._handle_history_clean)

        # Do not bind directly to core_api.bind_to_deleted_item because it
        # would create a race hazard with organism.items.delete_item_rules,
        # which is bound to the same event
        organism_api.bind_to_delete_item_rules(self._handle_delete_item_rules)
        organism_api.bind_to_get_alarms(self._handle_get_alarms)

        organism_timer_api.bind_to_get_next_occurrences(self._handle_get_next_occurrences)
        organism_timer_api.bind_to_activate_occurrences_range(self._handle_activate_occurrences_range)
        organism_timer_api.bind_to_activate_old_occurrences(self._handle_activate_old_occurrences)
        organism_timer_api.bind_to_activate_occurrences(self._handle_activate_occurrences)

        if copypaste_api:
            copypaste_api.bind_to_copy_items(self._handle_copy_items)
            copypaste_api.bind_to_copy_item(self._handle_copy_item)
            copypaste_api.bind_to_paste_item(self._handle_paste_item)
            copypaste_api.bind_to_safe_paste_check(self._handle_safe_paste_check)
Exemplo n.º 2
0
def add(cursor):
    LIMIT = coreaux_api.get_extension_configuration('organism_alarms').get_int(
        'default_log_soft_limit')

    cursor.execute(queries.alarmsproperties_create)
    cursor.execute(queries.alarmsproperties_insert_init, (LIMIT, ))
    cursor.execute(queries.alarms_create)
    cursor.execute(queries.alarmsofflog_create)
Exemplo n.º 3
0
def add(cursor):
    LIMIT = coreaux_api.get_extension_configuration('organism_alarms'
                                        ).get_int('default_log_soft_limit')

    cursor.execute(queries.alarmsproperties_create)
    cursor.execute(queries.alarmsproperties_insert_init, (LIMIT, ))
    cursor.execute(queries.alarms_create)
    cursor.execute(queries.alarmsofflog_create)
Exemplo n.º 4
0
def upgrade_0_to_1(cursor):
    # These queries must stay here because they must not be updated with the
    # normal queries
    cursor.execute('CREATE TABLE AlarmsProperties '
                              '(AP_id INTEGER PRIMARY KEY, '
                               'AP_log_limit INTEGER)')
    LIMIT = coreaux_api.get_extension_configuration('organism_alarms'
                                        ).get_int('default_log_soft_limit')
    cursor.execute('INSERT INTO AlarmsProperties (AP_id, AP_log_limit) '
                                                'VALUES (NULL, ?)', (LIMIT, ))
Exemplo n.º 5
0
def upgrade_0_to_1(cursor):
    # These queries must stay here because they must not be updated with the
    # normal queries
    cursor.execute('CREATE TABLE AlarmsProperties '
                              '(AP_id INTEGER PRIMARY KEY, '
                               'AP_log_limit INTEGER)')
    LIMIT = coreaux_api.get_extension_configuration('organism_alarms'
                                        ).get_int('default_log_soft_limit')
    cursor.execute('INSERT INTO AlarmsProperties (AP_id, AP_log_limit) '
                                                'VALUES (NULL, ?)', (LIMIT, ))
Exemplo n.º 6
0
    def post_init(self):
        conf = coreaux_api.get_extension_configuration('organism_alarms')

        qconn = core_api.get_connection(self.filename)
        cursor = qconn.cursor()
        cursor.execute(queries.alarmsproperties_select_history)
        core_api.give_connection(self.filename, qconn)

        self.log_limits = [cursor.fetchone()[0],
                                            conf.get_int('log_time_limit'),
                                            conf.get_int('log_hard_limit')]
Exemplo n.º 7
0
    def post_init(self):
        conf = coreaux_api.get_extension_configuration('organism_alarms')

        qconn = core_api.get_connection(self.filename)
        cursor = qconn.cursor()
        cursor.execute(queries.alarmsproperties_select_history)
        core_api.give_connection(self.filename, qconn)

        self.log_limits = [
            cursor.fetchone()[0],
            conf.get_int('log_time_limit'),
            conf.get_int('log_hard_limit')
        ]
Exemplo n.º 8
0
def main():
    create_copy_table()

    core_api.bind_to_open_database_dirty(handle_open_database_dirty)
    core_api.bind_to_open_database(handle_open_database)
    core_api.bind_to_close_database(handle_close_database)
    core_api.bind_to_deleting_item(handle_delete_item)
    core_api.bind_to_history(handle_history)

    if coreaux_api.get_extension_configuration('links').get_bool('sync_text'):
        core_api.bind_to_update_item_text(handle_update_item_text)

    if copypaste_api:
        copypaste_api.bind_to_copy_items(handle_copy_items)
        copypaste_api.bind_to_copy_item(handle_copy_item)
        copypaste_api.bind_to_paste_item(handle_paste_item)
        copypaste_api.bind_to_safe_paste_check(handle_safe_paste_check)
Exemplo n.º 9
0
def main():
    create_copy_table()

    core_api.bind_to_open_database_dirty(handle_open_database_dirty)
    core_api.bind_to_open_database(handle_open_database)
    core_api.bind_to_close_database(handle_close_database)
    core_api.bind_to_deleting_item(handle_delete_item)
    core_api.bind_to_history(handle_history)

    if coreaux_api.get_extension_configuration("links").get_bool("sync_text"):
        core_api.bind_to_update_item_text(handle_update_item_text)

    if copypaste_api:
        copypaste_api.bind_to_copy_items(handle_copy_items)
        copypaste_api.bind_to_copy_item(handle_copy_item)
        copypaste_api.bind_to_paste_item(handle_paste_item)
        copypaste_api.bind_to_safe_paste_check(handle_safe_paste_check)
Exemplo n.º 10
0
    def __init__(self):
        self.choose_unique_old_alarms = None
        self.OLD_THRESHOLD = coreaux_api.get_extension_configuration(
            'organism_alarms').get_int('old_alarms_threshold')

        self.databases = {}

        self._create_copy_table()

        core_api.bind_to_open_database_dirty(self._handle_open_database_dirty)
        core_api.bind_to_open_database(self._handle_open_database)
        core_api.bind_to_check_pending_changes(
            self._handle_check_pending_changes)
        core_api.bind_to_reset_modified_state(
            self._handle_reset_modified_state)
        # No need to bind to close_database, as specific filenames will be
        # deleted from self.databases in self._handle_history_clean
        core_api.bind_to_history_remove(self._handle_history_remove)
        core_api.bind_to_history_clean(self._handle_history_clean)

        # Do not bind directly to core_api.bind_to_deleted_item because it
        # would create a race hazard with organism.items.delete_item_rules,
        # which is bound to the same event
        organism_api.bind_to_delete_item_rules(self._handle_delete_item_rules)
        organism_api.bind_to_get_alarms(self._handle_get_alarms)

        organism_timer_api.bind_to_get_next_occurrences(
            self._handle_get_next_occurrences)
        organism_timer_api.bind_to_activate_occurrences_range(
            self._handle_activate_occurrences_range)
        organism_timer_api.bind_to_activate_old_occurrences(
            self._handle_activate_old_occurrences)
        organism_timer_api.bind_to_activate_occurrences(
            self._handle_activate_occurrences)

        if copypaste_api:
            copypaste_api.bind_to_copy_items(self._handle_copy_items)
            copypaste_api.bind_to_copy_item(self._handle_copy_item)
            copypaste_api.bind_to_paste_item(self._handle_paste_item)
            copypaste_api.bind_to_safe_paste_check(
                self._handle_safe_paste_check)
Exemplo n.º 11
0
 def __init__(self, database, filename):
     self.database = database
     self.filename = filename
     self.DELAY = coreaux_api.get_extension_configuration('organism_timer'
                                     ).get_float('old_alarms_delay') / 1000
Exemplo n.º 12
0
 def __init__(self, database, filename):
     self.database = database
     self.filename = filename
     self.DELAY = coreaux_api.get_extension_configuration('organism_timer'
                                     ).get_float('old_alarms_delay') / 1000