Skip to content

Commit

Permalink
Stop hardcoding activation setting name in Grass7AlgorithmProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
pmav99 committed Jun 18, 2019
1 parent bff757a commit cfbd91d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions python/plugins/processing/algs/grass7/Grass7AlgorithmProvider.py
Expand Up @@ -44,13 +44,15 @@ class Grass7AlgorithmProvider(QgsProcessingProvider):
# and set its value to their own description folder.
descriptionFolder = Grass7Utils.grassDescriptionPath()

activateSetting = "ACTIVATE_GRASS7"

def __init__(self):
super().__init__()
self.algs = []

def load(self):
ProcessingConfig.settingIcons[self.name()] = self.icon()
ProcessingConfig.addSetting(Setting(self.name(), 'ACTIVATE_GRASS7',
ProcessingConfig.addSetting(Setting(self.name(), self.activateSetting,
self.tr('Activate'), True))
if isMac():
ProcessingConfig.addSetting(Setting(
Expand Down Expand Up @@ -83,7 +85,7 @@ def load(self):
return True

def unload(self):
ProcessingConfig.removeSetting('ACTIVATE_GRASS7')
ProcessingConfig.removeSetting(self.activateSetting)
if isMac():
ProcessingConfig.removeSetting(Grass7Utils.GRASS_FOLDER)
ProcessingConfig.removeSetting(Grass7Utils.GRASS_LOG_COMMANDS)
Expand All @@ -92,10 +94,10 @@ def unload(self):
ProcessingConfig.removeSetting(Grass7Utils.GRASS_USE_VEXTERNAL)

def isActive(self):
return ProcessingConfig.getSetting('ACTIVATE_GRASS7')
return ProcessingConfig.getSetting(self.activateSetting)

def setActive(self, active):
ProcessingConfig.setSettingValue('ACTIVATE_GRASS7', active)
ProcessingConfig.setSettingValue(self.activateSetting, active)

def createAlgsList(self):
algs = []
Expand Down

0 comments on commit cfbd91d

Please sign in to comment.