本文整理汇总了Python中sextante.core.Sextante.Sextante.getProviderFromName方法的典型用法代码示例。如果您正苦于以下问题:Python Sextante.getProviderFromName方法的具体用法?Python Sextante.getProviderFromName怎么用?Python Sextante.getProviderFromName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sextante.core.Sextante.Sextante
的用法示例。
在下文中一共展示了Sextante.getProviderFromName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fillTreeUsingProviders
# 需要导入模块: from sextante.core.Sextante import Sextante [as 别名]
# 或者: from sextante.core.Sextante.Sextante import getProviderFromName [as 别名]
def fillTreeUsingProviders(self):
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:
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()
+ " ["
+ str(len(provider))
+ " geoalgorithms]",
)
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)
providerItem.setExpanded(text != "")
for groupItem in groups.values():
groupItem.setExpanded(text != "")
示例2: fillTreeUsingCategories
# 需要导入模块: from sextante.core.Sextante import Sextante [as 别名]
# 或者: from sextante.core.Sextante.Sextante import getProviderFromName [as 别名]
def fillTreeUsingCategories(self):
providersToExclude = ["model", "script"]
self.algorithmTree.clear()
text = unicode(self.searchBox.text())
groups = {}
for providerName in Sextante.algs.keys():
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
altgroup, altsubgroup, altname = AlgorithmDecorator.getGroupsAndName(alg)
if altgroup is None:
continue
if text =="" or text.lower() in altname.lower():
if altgroup not in groups:
groups[altgroup] = {}
group = groups[altgroup]
if altsubgroup not in group:
groups[altgroup][altsubgroup] = []
subgroup = groups[altgroup][altsubgroup]
subgroup.append(alg)
if len(groups) > 0:
mainItem = QTreeWidgetItem()
mainItem.setText(0, "Geoalgorithms")
mainItem.setIcon(0, GeoAlgorithm.getDefaultIcon())
mainItem.setToolTip(0, mainItem.text(0))
for groupname, group in groups.items():
groupItem = QTreeWidgetItem()
groupItem.setText(0, groupname)
groupItem.setIcon(0, GeoAlgorithm.getDefaultIcon())
groupItem.setToolTip(0, groupItem.text(0))
mainItem.addChild(groupItem)
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)
subgroupItem.addChild(algItem)
self.algorithmTree.addTopLevelItem(mainItem)
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)
if (text != ""):
self.algorithmTree.expandAll()
示例3: fillTree
# 需要导入模块: from sextante.core.Sextante import Sextante [as 别名]
# 或者: from sextante.core.Sextante.Sextante import getProviderFromName [as 别名]
def fillTree(self):
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:
groupItem = QTreeWidgetItem()
groupItem.setText(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()
+ " [" + str(len(provider)) + " geoalgorithms]")
providerItem.setIcon(0, Sextante.getProviderFromName(providerName).getIcon())
for groupItem in groups.values():
providerItem.addChild(groupItem)
self.algorithmTree.addTopLevelItem(providerItem)
providerItem.setExpanded(text!="")
for groupItem in groups.values():
if text != "":
groupItem.setExpanded(True)
self.algorithmTree.sortItems(0, Qt.AscendingOrder)
showRecent = SextanteConfig.getSetting(SextanteConfig.SHOW_RECENT_ALGORITHMS)
if showRecent:
recent = SextanteLog.getRecentAlgorithms()
if len(recent) != 0:
found = False
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
if found:
self.algorithmTree.insertTopLevelItem(0, recentItem)
recentItem.setExpanded(True)
self.algorithmTree.setWordWrap(True)