Skip to content

Commit

Permalink
Make html output in basic stats algorithm optional
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 11, 2017
1 parent cb41ef1 commit e49cc78
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions python/plugins/processing/algs/qgis/BasicStatistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def __init__(self):
self.tr('Field to calculate statistics on'),
None, self.INPUT_LAYER, QgsProcessingParameterTableField.Any))

self.addParameter(QgsProcessingParameterFileOutput(self.OUTPUT_HTML_FILE, self.tr('Statistics'), self.tr('HTML files (*.html)')))
self.addParameter(QgsProcessingParameterFileOutput(self.OUTPUT_HTML_FILE, self.tr('Statistics'), self.tr('HTML files (*.html)'), None, True))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT_HTML_FILE, self.tr('Statistics')))

self.addOutput(QgsProcessingOutputNumber(self.COUNT, self.tr('Count')))
Expand Down Expand Up @@ -149,9 +149,10 @@ def processAlgorithm(self, parameters, context, feedback):
d, results = self.calcStringStats(features, feedback, field, count)
data.extend(d)

self.createHTML(output_file, data)
if output_file:
self.createHTML(output_file, data)
results[self.OUTPUT_HTML_FILE] = output_file

results[self.OUTPUT_HTML_FILE] = output_file
return results

def calcNumericStats(self, features, feedback, field, count):
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/gui/DestinationSelectionPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def textChanged(self):

def skipOutput(self):
self.leText.setPlaceholderText(self.SKIP_OUTPUT)
self.leText.setText('')
self.use_temporary = False

def selectOutput(self):
Expand All @@ -99,8 +100,7 @@ def selectOutput(self):
else:
popupMenu = QMenu()

if isinstance(self.parameter, QgsProcessingParameterFeatureSink) \
and self.parameter.flags() & QgsProcessingParameterDefinition.FlagOptional:
if self.parameter.flags() & QgsProcessingParameterDefinition.FlagOptional:
actionSkipOutput = QAction(
self.tr('Skip output'), self.btnSelect)
actionSkipOutput.triggered.connect(self.skipOutput)
Expand Down

0 comments on commit e49cc78

Please sign in to comment.