qgis_deployment_toolbelt.plugins.plugin module¶
Plugin object model.
Author: Julien Moura (https://github.com/guts)
- class qgis_deployment_toolbelt.plugins.plugin.QgisPlugin(name: str, folder_name: str = None, location: QgisPluginLocation = 'remote', official_repository: bool = None, plugin_id: int = None, qgis_maximum_version: str = None, qgis_minimum_version: str = None, repository_url_xml: str = None, url: str = None, version: str = 'latest')¶
Bases:
object
Model describing a QGIS plugin.
- ATTR_MAP = {'location': 'type', 'qgis_maximum_version': 'qgisMaximumVersion', 'qgis_minimum_version': 'qgisMinimumVersion'}¶
- OFFICIAL_REPOSITORY_URL_BASE = 'https://plugins.qgis.org/'¶
- OFFICIAL_REPOSITORY_XML = 'https://plugins.qgis.org/plugins/plugins.xml'¶
- __init__(name: str, folder_name: str = None, location: QgisPluginLocation = 'remote', official_repository: bool = None, plugin_id: int = None, qgis_maximum_version: str = None, qgis_minimum_version: str = None, repository_url_xml: str = None, url: str = None, version: str = 'latest') None ¶
- property download_url: str¶
Try to guess download URL if it’s not set during the object init.
- Returns:
download URL
- Return type:
- classmethod from_dict(input_dict: dict) QgisPlugin ¶
Create object from a dictionary.
- Parameters:
input_dict (dict) – input dictionary
- Returns:
instanciated object
- Return type:
- classmethod from_plugin_folder(input_plugin_folder: Path) QgisPlugin ¶
Create object from a QGIS plugin folder. Must contain a metadata.txt file.
- Parameters:
input_plugin_folder (Path) – path to the folder containgin a QGIS plugin
- Returns:
instanciated object
- Return type:
- classmethod from_zip(input_zip_path: Path) QgisPlugin ¶
Create object from a ZIP file.
- Parameters:
input_zip_path (Path) – filepath of the input zip
- Returns:
instanciated object
- Return type:
- property id_with_version: str¶
Unique identifier using plugin_id (if set) and name + version slugified.
- Returns:
plugin identifier meant to be unique per version
- Return type:
- property installation_folder_name: str¶
Name of the folder when the plugin is installed into QGIS/profile/python/plugins/. If not clearly specified intot the profile.json, it tries to extract it from the download URL. As final fallback, it returns the slufigied plugin name.
- Returns:
plugin folder name
- Return type:
- is_older_than(version_to_compare: str | QgisPlugin) bool ¶
Determine if the actual object version is older than the given version to compare.
- Parameters:
version_to_compare (Union[str, QgisPlugin]) – given version to compare with object version
- Returns:
True if the given version is newer (more recent)
- Return type:
- location: QgisPluginLocation = 'remote'¶