gui/backend/gui_plugin/modules/Modules.py
def add_data_category(name, parent_category_id=None, web_session=None):
    """Add a new data category to the list of available data categories for this module

    Args:
        name (str): The name of the data category
        parent_category_id (int): The id of the parent category
        web_session (object): The webserver session object, optional. Will be
            passed in my the webserver automatically


    Returns:
        The id of added category.
    """

    if name.strip() == "":
        raise MSGException(Error.CORE_INVALID_PARAMETER, f"Parameter 'name' cannot be empty.")

    with BackendDatabase(web_session) as db:
        search = db.execute("""SELECT id from data_category
                                WHERE name=?""",
                                (name,)).fetch_one()

        if search:
            raise MSGException(Error.MODULES_INVALID_DATA_CATEGORY, "Data category already exists.")
        else:
            res = db.execute("""SELECT MAX(id) FROM data_category""").fetch_one()
            # First 100 ids are reserved for predefined data categories
            id = res[0] + 1 if res[0] > 100 else 101
            db.execute("""INSERT INTO data_category (id, parent_category_id, name)
                            VALUES (?, ?, ?)""",
                            (id, parent_category_id, name, ))
            category_id = db.get_last_row_id()


        return category_id
Add a new data category to the list of available data categories for this module

    Args:
        name (str): The name of the data category
        parent_category_id (int): The id of the parent category
        web_session (object): The webserver session object, optional. Will be
            passed in my the webserver automatically


    Returns:
        The id of added category.
    
Add a new data category to the list of available data categories for this module
Add a new data category to the list of available data categories for this module
def add_data_category(name, parent_category_id=None, web_session=None):
    if name.strip() == "":
        raise MSGException(Error.CORE_INVALID_PARAMETER, f"Parameter 'name' cannot be empty.")
    with BackendDatabase(web_session) as db:
        search = db.execute("""SELECT id from data_category
                                WHERE name=?""",
                                (name,)).fetch_one()
        if search:
            raise MSGException(Error.MODULES_INVALID_DATA_CATEGORY, "Data category already exists.")
        else:
            res = db.execute("""SELECT MAX(id) FROM data_category""").fetch_one()
            id = res[0] + 1 if res[0] > 100 else 101
            db.execute("""INSERT INTO data_category (id, parent_category_id, name)
                            VALUES (?, ?, ?)""",
                            (id, parent_category_id, name, ))
            category_id = db.get_last_row_id()
        return category_id
def add_data_category ( name , parent_category_id = None , web_session = None ) : if name . strip ( ) == "" : raise MSGException ( Error . CORE_INVALID_PARAMETER , f"Parameter 'name' cannot be empty." ) with BackendDatabase ( web_session ) as db : search = db . execute ( """SELECT id from data_category
                                WHERE name=?""" , ( name , ) ) . fetch_one ( ) if search : raise MSGException ( Error . MODULES_INVALID_DATA_CATEGORY , "Data category already exists." ) else : res = db . execute ( """SELECT MAX(id) FROM data_category""" ) . fetch_one ( ) id = res [ 0 ] + 1 if res [ 0 ] > 100 else 101 db . execute ( """INSERT INTO data_category (id, parent_category_id, name)
                            VALUES (?, ?, ?)""" , ( id , parent_category_id , name , ) ) category_id = db . get_last_row_id ( ) return category_id
Add a new data category to the list of available data categories for this module
Add a new data category to the list of available data categories for this module
"""Add a new data category to the list of available data categories for this module

    Args:
        name (str): The name of the data category
        parent_category_id (int): The id of the parent category
        web_session (object): The webserver session object, optional. Will be
            passed in my the webserver automatically


    Returns:
        The id of added category.
    """ # First 100 ids are reserved for predefined data categories
The id of added category.
The id of added category .
name
The name of the data category
The name of the data category
parent_category_id
The id of the parent category
The id of the parent category
web_session
The webserver session object, optional. Will be
passed in my the webserver automatically
The webserver session object optional . Will be passed in my the webserver automatically