2012-10-05 23:28:47 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
"""
|
|
|
|
***************************************************************************
|
|
|
|
SextanteToolbox.py
|
|
|
|
---------------------
|
|
|
|
Date : August 2012
|
|
|
|
Copyright : (C) 2012 by Victor Olaya
|
|
|
|
Email : volayaf at gmail dot com
|
|
|
|
***************************************************************************
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
***************************************************************************
|
|
|
|
"""
|
2013-04-12 17:18:51 +02:00
|
|
|
|
2012-10-05 23:28:47 +02:00
|
|
|
__author__ = 'Victor Olaya'
|
|
|
|
__date__ = 'August 2012'
|
|
|
|
__copyright__ = '(C) 2012, Victor Olaya'
|
|
|
|
# This will get replaced with a git SHA1 when you do a git archive
|
|
|
|
__revision__ = '$Format:%H$'
|
|
|
|
|
2012-09-15 18:25:25 +03:00
|
|
|
from PyQt4.QtCore import *
|
|
|
|
from PyQt4.QtGui import *
|
2012-09-18 21:53:25 +03:00
|
|
|
|
2012-12-07 21:11:56 +01:00
|
|
|
import webbrowser
|
2013-04-12 17:18:51 +02:00
|
|
|
from sextante.gui.MissingDependencyDialog import MissingDependencyDialog
|
2012-12-07 21:11:56 +01:00
|
|
|
from sextante.core.GeoAlgorithm import GeoAlgorithm
|
|
|
|
from sextante.modeler.Providers import Providers
|
2013-02-17 23:12:23 +01:00
|
|
|
from sextante.gui.AlgorithmClassification import AlgorithmDecorator
|
2012-09-15 18:25:25 +03:00
|
|
|
from sextante.core.Sextante import Sextante
|
|
|
|
from sextante.core.SextanteLog import SextanteLog
|
|
|
|
from sextante.core.SextanteConfig import SextanteConfig
|
|
|
|
from sextante.core.QGisLayers import QGisLayers
|
2012-09-18 21:53:25 +03:00
|
|
|
from sextante.gui.ParametersDialog import ParametersDialog
|
|
|
|
from sextante.gui.BatchProcessingDialog import BatchProcessingDialog
|
|
|
|
from sextante.gui.EditRenderingStylesDialog import EditRenderingStylesDialog
|
2012-10-30 15:00:07 +02:00
|
|
|
from sextante.ui.ui_SextanteToolbox import Ui_SextanteToolbox
|
|
|
|
|
2012-09-15 18:25:25 +03:00
|
|
|
|
2012-10-30 15:00:07 +02:00
|
|
|
class SextanteToolbox(QDockWidget, Ui_SextanteToolbox):
|
2013-04-24 13:34:34 +04:00
|
|
|
|
2013-04-19 15:41:28 +02:00
|
|
|
USE_CATEGORIES = "/SextanteQGIS/UseCategories"
|
2013-04-24 13:34:34 +04:00
|
|
|
|
2012-09-15 18:25:25 +03:00
|
|
|
def __init__(self, iface):
|
2012-10-30 15:00:07 +02:00
|
|
|
QDockWidget.__init__(self, None)
|
|
|
|
self.setupUi(self)
|
|
|
|
self.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
|
|
|
|
|
2012-09-15 18:25:25 +03:00
|
|
|
self.iface=iface
|
2013-04-24 13:34:34 +04:00
|
|
|
|
2013-04-19 15:41:28 +02:00
|
|
|
self.modeComboBox.clear()
|
|
|
|
self.modeComboBox.addItems(['Simplified interface', 'Advanced interface'])
|
|
|
|
settings = QSettings()
|
|
|
|
if not settings.contains(self.USE_CATEGORIES):
|
2013-04-24 13:34:34 +04:00
|
|
|
settings.setValue(self.USE_CATEGORIES, True)
|
2013-06-03 21:25:22 +02:00
|
|
|
useCategories = settings.value(self.USE_CATEGORIES, type = bool)
|
2013-04-19 15:41:28 +02:00
|
|
|
if useCategories:
|
|
|
|
self.modeComboBox.setCurrentIndex(0)
|
|
|
|
else:
|
|
|
|
self.modeComboBox.setCurrentIndex(1)
|
|
|
|
self.modeComboBox.currentIndexChanged.connect(self.modeHasChanged)
|
2012-10-30 15:00:07 +02:00
|
|
|
|
|
|
|
self.externalAppsButton.clicked.connect(self.configureProviders)
|
|
|
|
self.searchBox.textChanged.connect(self.fillTree)
|
|
|
|
self.algorithmTree.customContextMenuRequested.connect(self.showPopupMenu)
|
|
|
|
self.algorithmTree.doubleClicked.connect(self.executeAlgorithm)
|
|
|
|
|
2012-12-01 20:22:21 +02:00
|
|
|
if hasattr(self.searchBox, 'setPlaceholderText'):
|
|
|
|
self.searchBox.setPlaceholderText(self.tr("Search..."))
|
|
|
|
|
2012-10-30 15:00:07 +02:00
|
|
|
self.fillTree()
|
2013-04-24 13:34:34 +04:00
|
|
|
|
2013-04-19 15:41:28 +02:00
|
|
|
def modeHasChanged(self):
|
|
|
|
idx = self.modeComboBox.currentIndex()
|
|
|
|
settings = QSettings()
|
|
|
|
if idx == 0: #simplified
|
2013-04-24 13:34:34 +04:00
|
|
|
settings.setValue(self.USE_CATEGORIES, True)
|
2013-04-19 15:41:28 +02:00
|
|
|
else:
|
2013-04-24 13:34:34 +04:00
|
|
|
settings.setValue(self.USE_CATEGORIES, False)
|
|
|
|
|
2013-04-19 15:41:28 +02:00
|
|
|
self.fillTree()
|
2012-09-15 18:25:25 +03:00
|
|
|
|
|
|
|
def algsListHasChanged(self):
|
|
|
|
self.fillTree()
|
|
|
|
|
|
|
|
def updateTree(self):
|
|
|
|
Sextante.updateAlgsList()
|
|
|
|
|
|
|
|
def configureProviders(self):
|
2013-02-16 00:20:38 +01:00
|
|
|
webbrowser.open("http://sextantegis.com")
|
2012-09-15 18:25:25 +03:00
|
|
|
|
|
|
|
def showPopupMenu(self,point):
|
|
|
|
item = self.algorithmTree.itemAt(point)
|
|
|
|
if isinstance(item, TreeAlgorithmItem):
|
|
|
|
alg = item.alg
|
|
|
|
popupmenu = QMenu()
|
2012-09-18 21:53:25 +03:00
|
|
|
executeAction = QAction(self.tr("Execute"), self.algorithmTree)
|
2012-09-15 18:25:25 +03:00
|
|
|
executeAction.triggered.connect(self.executeAlgorithm)
|
|
|
|
popupmenu.addAction(executeAction)
|
2013-02-21 22:12:01 +01:00
|
|
|
if alg.canRunInBatchMode:
|
|
|
|
executeBatchAction = QAction(self.tr("Execute as batch process"), self.algorithmTree)
|
|
|
|
executeBatchAction.triggered.connect(self.executeAlgorithmAsBatchProcess)
|
|
|
|
popupmenu.addAction(executeBatchAction)
|
2013-04-24 13:34:34 +04:00
|
|
|
popupmenu.addSeparator()
|
2012-09-18 21:53:25 +03:00
|
|
|
editRenderingStylesAction = QAction(self.tr("Edit rendering styles for outputs"), self.algorithmTree)
|
2012-09-15 18:25:25 +03:00
|
|
|
editRenderingStylesAction.triggered.connect(self.editRenderingStyles)
|
|
|
|
popupmenu.addAction(editRenderingStylesAction)
|
|
|
|
actions = Sextante.contextMenuActions
|
2013-04-24 13:34:34 +04:00
|
|
|
if len(actions) > 0:
|
|
|
|
popupmenu.addSeparator()
|
2012-09-15 18:25:25 +03:00
|
|
|
for action in actions:
|
2013-04-24 13:34:34 +04:00
|
|
|
action.setData(alg, self)
|
2012-09-15 18:25:25 +03:00
|
|
|
if action.isEnabled():
|
2012-09-18 21:53:25 +03:00
|
|
|
contextMenuAction = QAction(action.name, self.algorithmTree)
|
2012-09-15 18:25:25 +03:00
|
|
|
contextMenuAction.triggered.connect(action.execute)
|
|
|
|
popupmenu.addAction(contextMenuAction)
|
|
|
|
|
|
|
|
popupmenu.exec_(self.algorithmTree.mapToGlobal(point))
|
|
|
|
|
|
|
|
def editRenderingStyles(self):
|
|
|
|
item = self.algorithmTree.currentItem()
|
|
|
|
if isinstance(item, TreeAlgorithmItem):
|
|
|
|
alg = Sextante.getAlgorithm(item.alg.commandLineName())
|
|
|
|
dlg = EditRenderingStylesDialog(alg)
|
|
|
|
dlg.exec_()
|
|
|
|
|
|
|
|
def executeAlgorithmAsBatchProcess(self):
|
|
|
|
item = self.algorithmTree.currentItem()
|
|
|
|
if isinstance(item, TreeAlgorithmItem):
|
|
|
|
alg = Sextante.getAlgorithm(item.alg.commandLineName())
|
|
|
|
dlg = BatchProcessingDialog(alg)
|
|
|
|
dlg.exec_()
|
|
|
|
|
|
|
|
def executeAlgorithm(self):
|
|
|
|
item = self.algorithmTree.currentItem()
|
|
|
|
if isinstance(item, TreeAlgorithmItem):
|
|
|
|
alg = Sextante.getAlgorithm(item.alg.commandLineName())
|
|
|
|
message = alg.checkBeforeOpeningParametersDialog()
|
|
|
|
if message:
|
2013-04-12 17:18:51 +02:00
|
|
|
dlg = MissingDependencyDialog(message)
|
|
|
|
dlg.exec_()
|
|
|
|
#QMessageBox.warning(self, self.tr("Warning"), message)
|
2012-09-15 18:25:25 +03:00
|
|
|
return
|
2013-01-26 23:55:14 +01:00
|
|
|
alg = alg.getCopy()
|
2012-09-15 18:25:25 +03:00
|
|
|
dlg = alg.getCustomParametersDialog()
|
|
|
|
if not dlg:
|
|
|
|
dlg = ParametersDialog(alg)
|
|
|
|
canvas = QGisLayers.iface.mapCanvas()
|
|
|
|
prevMapTool = canvas.mapTool()
|
|
|
|
dlg.show()
|
|
|
|
dlg.exec_()
|
|
|
|
if canvas.mapTool()!=prevMapTool:
|
|
|
|
try:
|
|
|
|
canvas.mapTool().reset()
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
canvas.setMapTool(prevMapTool)
|
|
|
|
if dlg.executed:
|
|
|
|
showRecent = SextanteConfig.getSetting(SextanteConfig.SHOW_RECENT_ALGORITHMS)
|
|
|
|
if showRecent:
|
2013-03-15 09:28:56 +01:00
|
|
|
self.addRecentAlgorithms(True)
|
2012-09-15 18:25:25 +03:00
|
|
|
if isinstance(item, TreeActionItem):
|
|
|
|
action = item.action
|
|
|
|
action.setData(self)
|
|
|
|
action.execute()
|
|
|
|
|
|
|
|
def fillTree(self):
|
2013-04-19 15:41:28 +02:00
|
|
|
settings = QSettings()
|
2013-06-03 21:25:22 +02:00
|
|
|
useCategories = settings.value(self.USE_CATEGORIES, type = bool)
|
2012-12-07 21:11:56 +01:00
|
|
|
if useCategories:
|
|
|
|
self.fillTreeUsingCategories()
|
|
|
|
else:
|
|
|
|
self.fillTreeUsingProviders()
|
2013-03-26 14:15:12 +01:00
|
|
|
self.algorithmTree.sortItems(0, Qt.AscendingOrder)
|
2013-03-15 09:28:56 +01:00
|
|
|
self.addRecentAlgorithms(False)
|
2013-03-26 14:15:12 +01:00
|
|
|
|
2013-03-15 09:28:56 +01:00
|
|
|
def addRecentAlgorithms(self, updating):
|
2012-12-07 21:11:56 +01:00
|
|
|
showRecent = SextanteConfig.getSetting(SextanteConfig.SHOW_RECENT_ALGORITHMS)
|
2013-04-02 22:34:21 +02:00
|
|
|
if showRecent:
|
2012-12-07 21:11:56 +01:00
|
|
|
recent = SextanteLog.getRecentAlgorithms()
|
|
|
|
if len(recent) != 0:
|
|
|
|
found = False
|
2013-04-01 00:29:07 +02:00
|
|
|
if updating:
|
|
|
|
recentItem = self.algorithmTree.topLevelItem(0)
|
2013-04-02 22:34:21 +02:00
|
|
|
treeWidget = recentItem.treeWidget()
|
|
|
|
treeWidget.takeTopLevelItem(treeWidget.indexOfTopLevelItem(recentItem))
|
|
|
|
|
2012-12-07 21:11:56 +01:00
|
|
|
recentItem = QTreeWidgetItem()
|
|
|
|
recentItem.setText(0, self.tr("Recently used algorithms"))
|
|
|
|
for algname in recent:
|
|
|
|
alg = Sextante.getAlgorithm(algname)
|
|
|
|
if alg is not None:
|
|
|
|
algItem = TreeAlgorithmItem(alg)
|
|
|
|
recentItem.addChild(algItem)
|
|
|
|
found = True
|
2013-04-02 22:34:21 +02:00
|
|
|
if found:
|
2012-12-07 21:11:56 +01:00
|
|
|
self.algorithmTree.insertTopLevelItem(0, recentItem)
|
|
|
|
recentItem.setExpanded(True)
|
|
|
|
|
|
|
|
self.algorithmTree.setWordWrap(True)
|
2012-12-10 00:12:07 +01:00
|
|
|
|
|
|
|
def fillTreeUsingCategories(self):
|
2012-12-07 21:11:56 +01:00
|
|
|
providersToExclude = ["model", "script"]
|
|
|
|
self.algorithmTree.clear()
|
|
|
|
text = unicode(self.searchBox.text())
|
|
|
|
groups = {}
|
2012-12-10 00:12:07 +01:00
|
|
|
for providerName in Sextante.algs.keys():
|
2012-12-07 21:11:56 +01:00
|
|
|
provider = Sextante.algs[providerName]
|
|
|
|
name = "ACTIVATE_" + providerName.upper().replace(" ", "_")
|
|
|
|
if not SextanteConfig.getSetting(name):
|
|
|
|
continue
|
|
|
|
if providerName in providersToExclude or len(Providers.providers[providerName].actions) != 0:
|
|
|
|
continue
|
|
|
|
algs = provider.values()
|
|
|
|
#add algorithms
|
|
|
|
for alg in algs:
|
|
|
|
if not alg.showInToolbox:
|
|
|
|
continue
|
2013-07-21 21:53:27 +02:00
|
|
|
altgroup, altsubgroup, altname = AlgorithmDecorator.getGroupsAndName(alg)
|
|
|
|
if altgroup is None:
|
2013-02-17 23:12:23 +01:00
|
|
|
continue
|
2012-12-10 00:12:07 +01:00
|
|
|
if text =="" or text.lower() in altname.lower():
|
2012-12-08 22:47:41 +01:00
|
|
|
if altgroup not in groups:
|
|
|
|
groups[altgroup] = {}
|
|
|
|
group = groups[altgroup]
|
|
|
|
if altsubgroup not in group:
|
|
|
|
groups[altgroup][altsubgroup] = []
|
|
|
|
subgroup = groups[altgroup][altsubgroup]
|
2012-12-10 00:12:07 +01:00
|
|
|
subgroup.append(alg)
|
|
|
|
|
2012-12-07 21:11:56 +01:00
|
|
|
if len(groups) > 0:
|
|
|
|
mainItem = QTreeWidgetItem()
|
|
|
|
mainItem.setText(0, "Geoalgorithms")
|
|
|
|
mainItem.setIcon(0, GeoAlgorithm.getDefaultIcon())
|
2013-02-28 22:08:32 +01:00
|
|
|
mainItem.setToolTip(0, mainItem.text(0))
|
2012-12-08 22:47:41 +01:00
|
|
|
for groupname, group in groups.items():
|
|
|
|
groupItem = QTreeWidgetItem()
|
|
|
|
groupItem.setText(0, groupname)
|
|
|
|
groupItem.setIcon(0, GeoAlgorithm.getDefaultIcon())
|
|
|
|
groupItem.setToolTip(0, groupItem.text(0))
|
2012-12-07 21:11:56 +01:00
|
|
|
mainItem.addChild(groupItem)
|
2012-12-08 22:47:41 +01:00
|
|
|
for subgroupname, subgroup in group.items():
|
|
|
|
subgroupItem = QTreeWidgetItem()
|
|
|
|
subgroupItem.setText(0, subgroupname)
|
|
|
|
subgroupItem.setIcon(0, GeoAlgorithm.getDefaultIcon())
|
|
|
|
subgroupItem.setToolTip(0, subgroupItem.text(0))
|
|
|
|
groupItem.addChild(subgroupItem)
|
|
|
|
for alg in subgroup:
|
|
|
|
algItem = TreeAlgorithmItem(alg)
|
2013-02-28 22:08:32 +01:00
|
|
|
subgroupItem.addChild(algItem)
|
|
|
|
|
|
|
|
self.algorithmTree.addTopLevelItem(mainItem)
|
2012-12-10 00:12:07 +01:00
|
|
|
|
2012-12-07 21:11:56 +01:00
|
|
|
for providerName in Sextante.algs.keys():
|
|
|
|
groups = {}
|
|
|
|
provider = Sextante.algs[providerName]
|
|
|
|
name = "ACTIVATE_" + providerName.upper().replace(" ", "_")
|
|
|
|
if not SextanteConfig.getSetting(name):
|
|
|
|
continue
|
|
|
|
if providerName not in providersToExclude:
|
|
|
|
continue
|
|
|
|
algs = provider.values()
|
|
|
|
#add algorithms
|
|
|
|
for alg in algs:
|
|
|
|
if not alg.showInToolbox:
|
|
|
|
continue
|
|
|
|
if text =="" or text.lower() in alg.name.lower():
|
|
|
|
if alg.group in groups:
|
|
|
|
groupItem = groups[alg.group]
|
|
|
|
else:
|
|
|
|
groupItem = QTreeWidgetItem()
|
|
|
|
groupItem.setText(0, alg.group)
|
|
|
|
groupItem.setToolTip(0, alg.group)
|
|
|
|
groups[alg.group] = groupItem
|
|
|
|
algItem = TreeAlgorithmItem(alg)
|
|
|
|
groupItem.addChild(algItem)
|
|
|
|
|
|
|
|
actions = Sextante.actions[providerName]
|
|
|
|
for action in actions:
|
|
|
|
if text =="" or text.lower() in action.name.lower():
|
|
|
|
if action.group in groups:
|
|
|
|
groupItem = groups[action.group]
|
|
|
|
else:
|
|
|
|
groupItem = QTreeWidgetItem()
|
|
|
|
groupItem.setText(0,action.group)
|
|
|
|
groups[action.group] = groupItem
|
|
|
|
algItem = TreeActionItem(action)
|
|
|
|
groupItem.addChild(algItem)
|
|
|
|
|
|
|
|
if len(groups) > 0:
|
|
|
|
providerItem = QTreeWidgetItem()
|
|
|
|
providerItem.setText(0, Sextante.getProviderFromName(providerName).getDescription())
|
|
|
|
providerItem.setIcon(0, Sextante.getProviderFromName(providerName).getIcon())
|
|
|
|
providerItem.setToolTip(0, providerItem.text(0))
|
|
|
|
for groupItem in groups.values():
|
|
|
|
providerItem.addChild(groupItem)
|
|
|
|
self.algorithmTree.addTopLevelItem(providerItem)
|
2013-02-28 22:08:32 +01:00
|
|
|
|
2013-02-21 22:12:01 +01:00
|
|
|
if (text != ""):
|
|
|
|
self.algorithmTree.expandAll()
|
2013-02-28 22:08:32 +01:00
|
|
|
|
2013-04-24 13:34:34 +04:00
|
|
|
def fillTreeUsingProviders(self):
|
2012-09-15 18:25:25 +03:00
|
|
|
self.algorithmTree.clear()
|
|
|
|
text = unicode(self.searchBox.text())
|
|
|
|
for providerName in Sextante.algs.keys():
|
|
|
|
groups = {}
|
|
|
|
provider = Sextante.algs[providerName]
|
|
|
|
name = "ACTIVATE_" + providerName.upper().replace(" ", "_")
|
|
|
|
if not SextanteConfig.getSetting(name):
|
|
|
|
continue
|
|
|
|
algs = provider.values()
|
|
|
|
#add algorithms
|
|
|
|
for alg in algs:
|
|
|
|
if not alg.showInToolbox:
|
|
|
|
continue
|
|
|
|
if text =="" or text.lower() in alg.name.lower():
|
|
|
|
if alg.group in groups:
|
|
|
|
groupItem = groups[alg.group]
|
|
|
|
else:
|
2012-09-18 21:53:25 +03:00
|
|
|
groupItem = QTreeWidgetItem()
|
2012-12-01 20:33:28 +02:00
|
|
|
groupItem.setText(0, alg.group)
|
|
|
|
groupItem.setToolTip(0, alg.group)
|
2012-09-15 18:25:25 +03:00
|
|
|
groups[alg.group] = groupItem
|
|
|
|
algItem = TreeAlgorithmItem(alg)
|
|
|
|
groupItem.addChild(algItem)
|
|
|
|
|
|
|
|
actions = Sextante.actions[providerName]
|
|
|
|
for action in actions:
|
|
|
|
if text =="" or text.lower() in action.name.lower():
|
|
|
|
if action.group in groups:
|
|
|
|
groupItem = groups[action.group]
|
|
|
|
else:
|
2012-09-18 21:53:25 +03:00
|
|
|
groupItem = QTreeWidgetItem()
|
2012-09-15 18:25:25 +03:00
|
|
|
groupItem.setText(0,action.group)
|
|
|
|
groups[action.group] = groupItem
|
|
|
|
algItem = TreeActionItem(action)
|
|
|
|
groupItem.addChild(algItem)
|
|
|
|
|
2012-09-18 21:53:25 +03:00
|
|
|
if len(groups) > 0:
|
|
|
|
providerItem = QTreeWidgetItem()
|
2012-09-15 18:25:25 +03:00
|
|
|
providerItem.setText(0, Sextante.getProviderFromName(providerName).getDescription()
|
|
|
|
+ " [" + str(len(provider)) + " geoalgorithms]")
|
|
|
|
providerItem.setIcon(0, Sextante.getProviderFromName(providerName).getIcon())
|
2012-12-01 20:33:28 +02:00
|
|
|
providerItem.setToolTip(0, providerItem.text(0))
|
2012-09-15 18:25:25 +03:00
|
|
|
for groupItem in groups.values():
|
|
|
|
providerItem.addChild(groupItem)
|
|
|
|
self.algorithmTree.addTopLevelItem(providerItem)
|
|
|
|
providerItem.setExpanded(text!="")
|
2013-02-28 22:08:32 +01:00
|
|
|
for groupItem in groups.values():
|
2013-02-21 22:12:01 +01:00
|
|
|
groupItem.setExpanded(text != "")
|
2012-09-15 18:25:25 +03:00
|
|
|
|
2012-09-18 21:53:25 +03:00
|
|
|
class TreeAlgorithmItem(QTreeWidgetItem):
|
2012-09-15 18:25:25 +03:00
|
|
|
|
|
|
|
def __init__(self, alg):
|
2013-04-19 15:41:28 +02:00
|
|
|
settings = QSettings()
|
2013-06-03 21:25:22 +02:00
|
|
|
useCategories = settings.value(SextanteToolbox.USE_CATEGORIES, type = bool)
|
2012-09-15 18:25:25 +03:00
|
|
|
QTreeWidgetItem.__init__(self)
|
2013-02-28 22:08:32 +01:00
|
|
|
self.alg = alg
|
2012-12-10 00:12:07 +01:00
|
|
|
icon = alg.getIcon()
|
2012-12-07 21:11:56 +01:00
|
|
|
name = alg.name
|
|
|
|
if useCategories:
|
2012-12-10 00:12:07 +01:00
|
|
|
icon = GeoAlgorithm.getDefaultIcon()
|
|
|
|
group, subgroup, name = AlgorithmDecorator.getGroupsAndName(alg)
|
2012-12-07 21:11:56 +01:00
|
|
|
self.setIcon(0, icon)
|
|
|
|
self.setToolTip(0, name)
|
2013-02-21 22:12:01 +01:00
|
|
|
self.setText(0, name)
|
2012-09-15 18:25:25 +03:00
|
|
|
|
2012-09-18 21:53:25 +03:00
|
|
|
class TreeActionItem(QTreeWidgetItem):
|
2012-09-15 18:25:25 +03:00
|
|
|
|
|
|
|
def __init__(self, action):
|
|
|
|
QTreeWidgetItem.__init__(self)
|
|
|
|
self.action = action
|
|
|
|
self.setText(0, action.name)
|
|
|
|
self.setIcon(0, action.getIcon())
|