-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__init__.py
54 lines (46 loc) · 2.27 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Loop_plugin
A QGIS plugin
This plugin preprocess shapefile inputs to generate python script and json file that are used as input for map2loop
Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
-------------------
begin : 2022-10-13
copyright : (C) 2022 by Michel M. Nzikou / CET - UWA
email : [email protected]
git sha : $Format:%H$
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
This script initializes the plugin, making it known to QGIS.
"""
import os
# from pathlib import Path
# noinspection PyPep8Naming
def classFactory(iface): # pylint: disable=invalid-name
"""Load Loop_plugin class from file Loop_plugin.
:param iface: A QGIS interface instance.
:type iface: QgsInterface
"""
# Import and check dependencies
from .install_deps import create_requirement_list, install_module
# find list of required modules
required_modules = create_requirement_list()
# Check if each required module is installed, and install it if necessary
for module in required_modules:
try:
__import__(module)
print(f"{module} has been successfully imported")
except ImportError:
print(f"{module} is not installed. Installing...")
# subprocess.run("pip install" + str(module))
install_module(module)
from .loop_plugin import Loop_plugin
return Loop_plugin(iface)