Skip to content


[processing] harmonize order of result panel (latest first) and add t…
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Feb 12, 2018
1 parent f10758e commit e5d7733
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 4 additions & 3 deletions python/plugins/processing/core/
Expand Up @@ -34,8 +34,8 @@ class ProcessingResults(QObject):

results = []

def addResult(self, icon, name, result):
self.results.append(Result(icon, name, result))
def addResult(self, icon, name, timestamp, result):
self.results.append(Result(icon, name, timestamp, result))

def getResults(self):
Expand All @@ -44,9 +44,10 @@ def getResults(self):

class Result:

def __init__(self, icon, name, filename):
def __init__(self, icon, name, timestamp, filename):
self.icon = icon = name
self.timestamp = timestamp
self.filename = filename

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/gui/
Expand Up @@ -286,7 +286,7 @@ def finish(self, successful, result, context, feedback):
# add html results to results dock
for out in self.algorithm().outputDefinitions():
if isinstance(out, QgsProcessingOutputHtml) and in result and result[]:
resultsList.addResult(icon=self.algorithm().icon(), name=out.description(),
resultsList.addResult(icon=self.algorithm().icon(), name=out.description(), timestamp=time.localtime(),

if not handleAlgorithmResults(self.algorithm(), context, feedback, not keepOpen):
Expand Down
8 changes: 5 additions & 3 deletions python/plugins/processing/gui/
Expand Up @@ -26,6 +26,7 @@
__revision__ = '$Format:%H$'

import os
import time

from qgis.PyQt import uic
from qgis.PyQt.QtCore import QUrl
Expand Down Expand Up @@ -56,12 +57,12 @@ def fillTree(self):
elements = resultsList.getResults()
for element in elements:
item = TreeResultItem(element)
self.treeResults.insertTopLevelItem(0, item)

def updateDescription(self, current, previous):
if isinstance(current, TreeResultItem):
html = '<b>Algorithm</b>: {}<br><b>File path</b>: {}'.format(current.text(0), current.filename)
html = '<b>Algorithm</b>: {}<br><b>File path</b>: {}'.format(current.algorithm, current.filename)

def openResult(self, item, column):
Expand All @@ -73,5 +74,6 @@ class TreeResultItem(QTreeWidgetItem):
def __init__(self, result):
self.setIcon(0, result.icon)
self.setText(0, '{0} [{1}]'.format(, time.strftime('%I:%M:%S%p', result.timestamp)))
self.algorithm =
self.filename = result.filename

0 comments on commit e5d7733

Please sign in to comment.