Repository navigation
Expand file tree
/
Copy pathprovider.py
More file actions
127 lines (98 loc) · 3.64 KB
/
Copy pathprovider.py
File metadata and controls
127 lines (98 loc) · 3.64 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#! python3
"""Processing provider for LoopStructural plugin."""
# PyQGIS
from qgis.core import QgsProcessingProvider
from qgis.PyQt.QtCore import QCoreApplication
from qgis.PyQt.QtGui import QIcon
# project
from loopstructural.__about__ import (
__icon_path__,
__title__,
__version__,
)
from .algorithms import (
BasalContactsAlgorithm,
SamplerAlgorithm,
StratigraphySorterAlgorithm,
ThicknessCalculatorAlgorithm,
UserDefinedStratigraphyAlgorithm,
)
# ############################################################################
# ########## Classes ###############
# ##################################
class LoopstructuralProvider(QgsProcessingProvider):
"""Processing provider class."""
def loadAlgorithms(self):
"""Load all algorithms belonging to this provider."""
def id(self) -> str:
"""Return unique provider id.
Returns
-------
str
Provider ID string used for identifying the provider (must be short and
non-localised).
"""
return "loopstructural"
def name(self) -> str:
"""Return provider name used in the GUI.
Returns
-------
str
Short, localised provider name.
"""
return __title__
class Map2LoopProvider(QgsProcessingProvider):
"""Processing provider class."""
def loadAlgorithms(self):
"""Loads all algorithms belonging to this provider."""
self.addAlgorithm(BasalContactsAlgorithm())
self.addAlgorithm(StratigraphySorterAlgorithm())
self.addAlgorithm(UserDefinedStratigraphyAlgorithm())
self.addAlgorithm(ThicknessCalculatorAlgorithm())
self.addAlgorithm(SamplerAlgorithm())
def id(self) -> str:
"""Unique provider id, used for identifying it. This string should be unique, \
short, character only string, eg "qgis" or "gdal". \
This string should not be localised.
:return: provider ID
:rtype: str
"""
return "plugin_map2loop"
def name(self) -> str:
"""Returns the provider name, which is used to describe the provider
within the GUI. This string should be short (e.g. "Lastools") and localised.
:return: provider name
:rtype: str
"""
return __title__
def longName(self) -> str:
"""Longer version of the provider name, which can include
extra details such as version numbers. E.g. "Lastools LIDAR tools". This string should be localised. The default
implementation returns the same string as name().
:return: provider long name
:rtype: str
"""
return self.tr(f"{__title__} - Tools")
def icon(self) -> QIcon:
"""QIcon used for your provider inside the Processing toolbox menu.
:return: provider icon
:rtype: QIcon
"""
return QIcon(str(__icon_path__))
def tr(self, message: str) -> str:
"""Get the translation for a string using Qt translation API.
:param message: String for translation.
:type message: str, QString
:returns: Translated version of message.
:rtype: str
"""
# noinspection PyTypeChecker,PyArgumentList,PyCallByClass
return QCoreApplication.translate(self.__class__.__name__, message)
def versionInfo(self) -> str:
"""Version information for the provider, or an empty string if this is not \
applicable (e.g. for inbuilt Processing providers). For plugin based providers, \
this should return the plugin’s version identifier.
:return: version
:rtype: str
"""
return __version__