Skip to content

Commit

Permalink
[processing] add group id to scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Dec 14, 2017
1 parent dca37ab commit 2674022
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/plugins/processing/script/ScriptAlgorithm.py
Expand Up @@ -62,6 +62,7 @@ def __init__(self, descriptionFile, script=None):
self._name = ''
self._display_name = ''
self._group = ''
self._groupId = ''
self._flags = None

self.script = script
Expand Down Expand Up @@ -111,6 +112,7 @@ def defineCharacteristicsFromFile(self):
self._name = filename[:filename.rfind('.')].replace('_', ' ')
self._display_name = self._name
self._group = self.tr('User scripts', 'ScriptAlgorithm')
self._groupId = 'userscripts'
with open(self.descriptionFile) as lines:
line = lines.readline()
while line != '':
Expand All @@ -130,6 +132,7 @@ def defineCharacteristicsFromScript(self):
self._name = '[Unnamed algorithm]'
self._display_name = self.tr('[Unnamed algorithm]', 'ScriptAlgorithm')
self._group = self.tr('User scripts', 'ScriptAlgorithm')
self._groupId = 'userscripts'
for line in lines:
if line.startswith('##'):
try:
Expand Down Expand Up @@ -163,6 +166,8 @@ def processParameterLine(self, line):
desc = self.createDescriptiveName(tokens[0])
if tokens[1].lower().strip() == 'group':
self._group = tokens[0]
validChars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:'
self._groupId = ''.join(c for c in tokens[0].lower() if c in validChars)
return
if tokens[1].lower().strip() == 'name':
self._name = self._display_name = tokens[0]
Expand Down

0 comments on commit 2674022

Please sign in to comment.