Skip to content

Commit cdef051

Browse files
pmav99nyalldawson
authored andcommitted
Stop hardcoding activation setting name in Grass7AlgorithmProvider
1 parent 80907f6 commit cdef051

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

python/plugins/processing/algs/grass7/Grass7AlgorithmProvider.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,15 @@ class Grass7AlgorithmProvider(QgsProcessingProvider):
4444
# and set its value to their own description folder.
4545
descriptionFolder = Grass7Utils.grassDescriptionPath()
4646

47+
activateSetting = "ACTIVATE_GRASS7"
48+
4749
def __init__(self):
4850
super().__init__()
4951
self.algs = []
5052

5153
def load(self):
5254
ProcessingConfig.settingIcons[self.name()] = self.icon()
53-
ProcessingConfig.addSetting(Setting(self.name(), 'ACTIVATE_GRASS7',
55+
ProcessingConfig.addSetting(Setting(self.name(), self.activateSetting,
5456
self.tr('Activate'), True))
5557
if isMac():
5658
ProcessingConfig.addSetting(Setting(
@@ -83,7 +85,7 @@ def load(self):
8385
return True
8486

8587
def unload(self):
86-
ProcessingConfig.removeSetting('ACTIVATE_GRASS7')
88+
ProcessingConfig.removeSetting(self.activateSetting)
8789
if isMac():
8890
ProcessingConfig.removeSetting(Grass7Utils.GRASS_FOLDER)
8991
ProcessingConfig.removeSetting(Grass7Utils.GRASS_LOG_COMMANDS)
@@ -92,10 +94,10 @@ def unload(self):
9294
ProcessingConfig.removeSetting(Grass7Utils.GRASS_USE_VEXTERNAL)
9395

9496
def isActive(self):
95-
return ProcessingConfig.getSetting('ACTIVATE_GRASS7')
97+
return ProcessingConfig.getSetting(self.activateSetting)
9698

9799
def setActive(self, active):
98-
ProcessingConfig.setSettingValue('ACTIVATE_GRASS7', active)
100+
ProcessingConfig.setSettingValue(self.activateSetting, active)
99101

100102
def createAlgsList(self):
101103
algs = []

0 commit comments

Comments
 (0)