Skip to content

Commit 27c5f78

Browse files
committed
Merge branch 'processing_shortHelp'
2 parents 3d95712 + 8592a7e commit 27c5f78

File tree

3 files changed

+55
-12
lines changed

3 files changed

+55
-12
lines changed

python/plugins/processing/algs/r/RAlgorithm.py

+25-6
Original file line numberDiff line numberDiff line change
@@ -434,15 +434,34 @@ def help(self):
434434
else:
435435
return False, None
436436

437+
def shortHelp(self):
438+
if self.descriptionFile is None:
439+
return None
440+
helpFile = unicode(self.descriptionFile) + '.help'
441+
if os.path.exists(helpFile):
442+
with open(helpFile) as f:
443+
try:
444+
descriptions = json.load(f)
445+
if 'ALG_DESC' in descriptions:
446+
return self._formatHelp(unicode(descriptions['ALG_DESC']))
447+
except:
448+
return None
449+
return None
450+
437451
def getParameterDescriptions(self):
438452
descs = {}
439-
helpfile = unicode(self.descriptionFile) + '.help'
440-
if os.path.exists(helpfile):
453+
if self.descriptionFile is None:
454+
return descs
455+
helpFile = unicode(self.descriptionFile) + '.help'
456+
if os.path.exists(helpFile):
441457
with open(helpFile) as f:
442-
descriptions = json.load(f)
443-
for param in self.parameters:
444-
if param.name in descriptions:
445-
descs[param.name] = unicode(descriptions[param.name])
458+
try:
459+
descriptions = json.load(f)
460+
for param in self.parameters:
461+
if param.name in descriptions:
462+
descs[param.name] = unicode(descriptions[param.name])
463+
except:
464+
return None
446465
return descs
447466

448467
def checkBeforeOpeningParametersDialog(self):

python/plugins/processing/modeler/ModelerAlgorithm.py

+5
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,11 @@ def help(self):
544544
except:
545545
return False, None
546546

547+
def shortHelp(self):
548+
if 'ALG_DESC' in self.helpContent:
549+
return self._formatHelp(unicode(self.helpContent['ALG_DESC']))
550+
return None
551+
547552
def getParameterDescriptions(self):
548553
descs = {}
549554
descriptions = self.helpContent

python/plugins/processing/script/ScriptAlgorithm.py

+25-6
Original file line numberDiff line numberDiff line change
@@ -351,13 +351,32 @@ def help(self):
351351
else:
352352
return False, None
353353

354+
def shortHelp(self):
355+
if self.descriptionFile is None:
356+
return None
357+
helpFile = unicode(self.descriptionFile) + '.help'
358+
if os.path.exists(helpFile):
359+
with open(helpFile) as f:
360+
try:
361+
descriptions = json.load(f)
362+
if 'ALG_DESC' in descriptions:
363+
return self._formatHelp(unicode(descriptions['ALG_DESC']))
364+
except:
365+
return None
366+
return None
367+
354368
def getParameterDescriptions(self):
355369
descs = {}
356-
helpfile = unicode(self.descriptionFile) + '.help'
357-
if os.path.exists(helpfile):
370+
if self.descriptionFile is None:
371+
return descs
372+
helpFile = unicode(self.descriptionFile) + '.help'
373+
if os.path.exists(helpFile):
358374
with open(helpFile) as f:
359-
descriptions = json.load(f)
360-
for param in self.parameters:
361-
if param.name in descriptions:
362-
descs[param.name] = unicode(descriptions[param.name])
375+
try:
376+
descriptions = json.load(f)
377+
for param in self.parameters:
378+
if param.name in descriptions:
379+
descs[param.name] = unicode(descriptions[param.name])
380+
except:
381+
return None
363382
return descs

0 commit comments

Comments
 (0)