Skip to content

Commit

Permalink
Added feature request #5439
Browse files Browse the repository at this point in the history
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@141 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
volayaf@gmail.com committed Apr 22, 2012
1 parent 757fd0b commit 00ca86d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/sextante/core/AlgorithmProvider.py
Expand Up @@ -35,6 +35,7 @@ def initializeSettings(self):
'''this is the place where you should add config parameters to SEXTANTE using the SextanteConfig class.
this method is called when a provider is added to SEXTANTE.
By default it just adds a setting to activate or deactivate algorithms from the provider'''
SextanteConfig.settingIcons[self.getName()] = self.getIcon()
name = "ACTIVATE_" + self.getName().upper().replace(" ", "_")
SextanteConfig.addSetting(Setting(self.getName(), name, "Activate", True))

Expand Down
15 changes: 15 additions & 0 deletions src/sextante/core/SextanteConfig.py
@@ -1,5 +1,6 @@
from sextante.core.SextanteUtils import SextanteUtils
import os.path
from PyQt4 import QtGui

class SextanteConfig():

Expand All @@ -14,9 +15,12 @@ class SextanteConfig():
USE_FILENAME_AS_LAYER_NAME = "USE_FILENAME_AS_LAYER_NAME"

settings = {}
settingIcons= {}

@staticmethod
def initialize():
icon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/alg.png")
SextanteConfig.settingIcons["General"] = icon
SextanteConfig.addSetting(Setting("General", SextanteConfig.USE_SELECTED, "Use only selected features in external applications", True))
SextanteConfig.addSetting(Setting("General", SextanteConfig.TABLE_LIKE_PARAM_PANEL, "Show table-like parameter panels", False))
SextanteConfig.addSetting(Setting("General", SextanteConfig.USE_FILENAME_AS_LAYER_NAME, "Use filename as layer name", True))
Expand All @@ -28,6 +32,17 @@ def initialize():
SextanteConfig.addSetting(Setting("General", SextanteConfig.VECTOR_LINE_STYLE,"Style for line layers",""))
SextanteConfig.addSetting(Setting("General", SextanteConfig.VECTOR_POLYGON_STYLE,"Style for polygon layers",""))

@staticmethod
def setGroupIcon(group, icon):
SextanteConfig.settingIcons[group] = icon

@staticmethod
def getGroupIcon(group):
if group in SextanteConfig.settingIcons:
return SextanteConfig.settingIcons[group]
else:
return QtGui.QIcon(os.path.dirname(__file__) + "/../images/alg.png")

@staticmethod
def addSetting(setting):
SextanteConfig.settings[setting.name] = setting
Expand Down
6 changes: 4 additions & 2 deletions src/sextante/gui/ConfigDialog.py
Expand Up @@ -50,10 +50,12 @@ def fillTree(self):
for group in settings.keys():
groupItem = QtGui.QTreeWidgetItem()
groupItem.setText(0,group)
groupItem.setIcon(0,self.groupIcon)
icon = SextanteConfig.getGroupIcon(group)
groupItem.setIcon(0, icon)
#groupItem.setIcon(0,self.groupIcon)
for setting in settings[group]:
if text =="" or text.lower() in setting.description.lower():
settingItem = TreeSettingItem(setting, self.keyIcon)
settingItem = TreeSettingItem(setting, icon)
self.items[setting]=settingItem
groupItem.addChild(settingItem)
self.tree.addTopLevelItem(groupItem)
Expand Down

0 comments on commit 00ca86d

Please sign in to comment.