Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[processing] Use algorithm icon and friendly display names in the his…
- Loading branch information
Showing
with
22 additions
and
4 deletions.
-
+22
−4
python/plugins/processing/gui/HistoryDialog.py
|
@@ -23,6 +23,7 @@ |
|
|
|
|
|
import os |
|
|
import warnings |
|
|
import re |
|
|
|
|
|
from qgis.core import QgsApplication |
|
|
from qgis.gui import QgsGui, QgsHelp |
|
@@ -114,12 +115,29 @@ def openHelp(self): |
|
|
def fillTree(self): |
|
|
self.tree.clear() |
|
|
entries = ProcessingLog.getLogEntries() |
|
|
names = {} |
|
|
icons = {} |
|
|
groupItem = QTreeWidgetItem() |
|
|
groupItem.setText(0, 'ALGORITHM') |
|
|
groupItem.setIcon(0, self.groupIcon) |
|
|
for entry in entries: |
|
|
item = TreeLogEntryItem(entry, True) |
|
|
item.setIcon(0, self.keyIcon) |
|
|
icon = self.keyIcon |
|
|
name = '' |
|
|
match = re.search('processing.run\\("(.*?)"', entry.text) |
|
|
if match.group: |
|
|
algorithm_id = match.group(1) |
|
|
if algorithm_id not in names: |
|
|
algorithm = QgsApplication.processingRegistry().algorithmById(algorithm_id) |
|
|
if algorithm: |
|
|
names[algorithm_id] = algorithm.displayName() |
|
|
icons[algorithm_id] = QgsApplication.processingRegistry().algorithmById(algorithm_id).icon() |
|
|
else: |
|
|
names[algorithm_id] = '' |
|
|
icons[algorithm_id] = self.keyIcon |
|
|
name = names[algorithm_id] |
|
|
icon = icons[algorithm_id] |
|
|
item = TreeLogEntryItem(entry, True, name) |
|
|
item.setIcon(0, icon) |
|
|
groupItem.insertChild(0, item) |
|
|
self.tree.addTopLevelItem(groupItem) |
|
|
groupItem.setExpanded(True) |
|
@@ -161,8 +179,8 @@ def showPopupMenu(self, point): |
|
|
|
|
|
class TreeLogEntryItem(QTreeWidgetItem): |
|
|
|
|
|
def __init__(self, entry, isAlg): |
|
|
def __init__(self, entry, isAlg, algName): |
|
|
QTreeWidgetItem.__init__(self) |
|
|
self.entry = entry |
|
|
self.isAlg = isAlg |
|
|
self.setText(0, '[' + entry.date + '] ' + entry.text.split(LOG_SEPARATOR)[0]) |
|
|
self.setText(0, '[' + entry.date + '] ' + algName + ' - ' + entry.text.split(LOG_SEPARATOR)[0]) |