scistag.addons.addon_manager.AddonManager

class AddonManager[source]

Bases: object

Manages the optional SciStag addons and their installation from the web.

Methods

build_helper_data

Fills helper variables such as the all_addons list for easier enumeration

get_addon_data

Returns the addon dictionary

get_addon_healthy

Returns if an addon with given name is installed and it's data file healthy

get_addon_installed

Returns if an addon with given name is installed

get_addons_paths

Returns the addon paths for FileStag for all addons matching given filter_mask, e.g.

get_all_addons

Returns a list of all addon packages and their respective unique identifier.

get_groups

Returns a dictionary containing all groups (and their elements) :rtype: Dict :return: The addon dictionary cleared from (future) features.

get_installed_addons

Returns a list of all installed addon packages and their respective unique identifier.

get_local_path

Returns the local path of a feature

install_addon

Installs given feature

remove_addon

Removes given addons, removes all associated files and unregisters in the shared archive registry.

Attributes

__annotations__

__dict__

__doc__

__module__

__weakref__

list of weak references to the object (if defined)

access_lock

Data access lock

addon_data

The addon main dictionary

all_addons

A sorted dictionary of all addons

classmethod build_helper_data()[source]

Fills helper variables such as the all_addons list for easier enumeration

Return type

None

classmethod get_addon_data()[source]

Returns the addon dictionary

Return type

Optional[Dict]

Returns

The dictionary. See data/addon_packages.json for details.

classmethod get_addon_healthy(feature_name)[source]

Returns if an addon with given name is installed and it’s data file healthy

Parameters

feature_name – The addon’s name, see get_all_addons()

Return type

(bool, str)

Returns

(Health status (bool), Error_text)

classmethod get_addon_installed(feature_name)[source]

Returns if an addon with given name is installed

Parameters

feature_name – The addon’s name, see get_all_addons()

Return type

bool

Returns

True if the addon exists.

classmethod get_addons_paths(filter_mask)[source]

Returns the addon paths for FileStag for all addons matching given filter_mask, e.g. emoji.*

Parameters

filter_mask (str) – The addons to search for. Can contains * and ? placeholders.

Return type

Dict

Returns

A dictionary of the format str: str for every matched addon and it’s corresponding FileStag path, e.g. {“emojis.512”: “zip://@addons.emojis.512/”}

classmethod get_all_addons()[source]

Returns a list of all addon packages and their respective unique identifier. This identifier can then be used by install_addon and remove_addon to install or remove a feature.

Returns

A dictionary containing all installable addons

classmethod get_groups()[source]

Returns a dictionary containing all groups (and their elements) :rtype: Dict :return: The addon dictionary cleared from (future) features.

A single element has the structure: ```javascript

“groupName”: {

“elements”

}

```

classmethod get_installed_addons()[source]

Returns a list of all installed addon packages and their respective unique identifier. This identifier can then be used by install_addon and remove_addon to install or remove a feature.

Returns

A dictionary containing all installable addons

classmethod get_local_path(feature_name)[source]

Returns the local path of a feature

Parameters

feature_name – The feature’s name

Returns

The feature’s path. Empty string if invalid

classmethod install_addon(feature_name, verbose_if_installed=True)[source]

Installs given feature

Parameters
  • feature_name – The feature’s key. As defined in

  • verbose_if_installed – Defines if no message shall be printed if the addon is already installed

Return type

bool

Returns

classmethod remove_addon(feature_name)[source]

Removes given addons, removes all associated files and unregisters in the shared archive registry.

Parameters

feature_name – The feature’s key. As defined in

Return type

bool

Returns

True if the addon existed and could successfully be removed

access_lock = <unlocked _thread.RLock object owner=0 count=0>

Data access lock

addon_data: Optional[Dict] = None

The addon main dictionary

all_addons: Dict = {}

A sorted dictionary of all addons