Skip to content
Permalink
Browse files

[sextante] Made configuration of algorithm classification available i…

…n toolbox
  • Loading branch information
volaya committed Apr 19, 2013
1 parent 9675af0 commit 7feb1af62f691331f1b59c924beabb03be3eb996
@@ -28,8 +28,7 @@
from PyQt4 import QtGui

class SextanteConfig():

USE_CATEGORIES = "USE_CATEGORIES"

TABLE_LIKE_PARAM_PANEL = "TABLE_LIKE_PARAM_PANEL"
OUTPUT_FOLDER = "OUTPUT_FOLDER"
RASTER_STYLE = "RASTER_STYLE"
@@ -61,8 +60,7 @@ def initialize():
SextanteConfig.addSetting(Setting("General", SextanteConfig.USE_SELECTED, "Use only selected features", 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))
SextanteConfig.addSetting(Setting("General", SextanteConfig.SHOW_RECENT_ALGORITHMS, "Show recently executed algorithms", True))
SextanteConfig.addSetting(Setting("General", SextanteConfig.USE_CATEGORIES, "Use categories to classify algorithms, instead of providers", True))
SextanteConfig.addSetting(Setting("General", SextanteConfig.SHOW_RECENT_ALGORITHMS, "Show recently executed algorithms", True))
SextanteConfig.addSetting(Setting("General", SextanteConfig.OUTPUT_FOLDER, "Output folder", SextanteUtils.tempFolder()))
SextanteConfig.addSetting(Setting("General", SextanteConfig.SHOW_CRS_DEF, "Show layer CRS definition in selection boxes", True))
SextanteConfig.addSetting(Setting("General", SextanteConfig.WARN_UNMATCHING_CRS, "Warn before executing if layer CRS's do not match", True))
@@ -17,6 +17,7 @@
***************************************************************************
"""


__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
@@ -46,12 +47,28 @@
_fromUtf8 = lambda s: s

class SextanteToolbox(QDockWidget, Ui_SextanteToolbox):

USE_CATEGORIES = "/SextanteQGIS/UseCategories"


def __init__(self, iface):
QDockWidget.__init__(self, None)
self.setupUi(self)
self.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)

self.iface=iface

self.modeComboBox.clear()
self.modeComboBox.addItems(['Simplified interface', 'Advanced interface'])
settings = QSettings()
if not settings.contains(self.USE_CATEGORIES):
settings.setValue(self.USE_CATEGORIES, True)
useCategories = settings.value(self.USE_CATEGORIES).toBool()
if useCategories:
self.modeComboBox.setCurrentIndex(0)
else:
self.modeComboBox.setCurrentIndex(1)
self.modeComboBox.currentIndexChanged.connect(self.modeHasChanged)

self.externalAppsButton.clicked.connect(self.configureProviders)
self.searchBox.textChanged.connect(self.fillTree)
@@ -62,6 +79,16 @@ def __init__(self, iface):
self.searchBox.setPlaceholderText(self.tr("Search..."))

self.fillTree()

def modeHasChanged(self):
idx = self.modeComboBox.currentIndex()
settings = QSettings()
if idx == 0: #simplified
settings.setValue(self.USE_CATEGORIES, True)
else:
settings.setValue(self.USE_CATEGORIES, False)

self.fillTree()

def algsListHasChanged(self):
self.fillTree()
@@ -145,7 +172,8 @@ def executeAlgorithm(self):
action.execute()

def fillTree(self):
useCategories = SextanteConfig.getSetting(SextanteConfig.USE_CATEGORIES)
settings = QSettings()
useCategories = settings.value(self.USE_CATEGORIES).toBool()
if useCategories:
self.fillTreeUsingCategories()
else:
@@ -334,7 +362,8 @@ def fillTreeUsingProviders(self):
class TreeAlgorithmItem(QTreeWidgetItem):

def __init__(self, alg):
useCategories = SextanteConfig.getSetting(SextanteConfig.USE_CATEGORIES)
settings = QSettings()
useCategories = settings.value(SextanteToolbox.USE_CATEGORIES)
QTreeWidgetItem.__init__(self)
self.alg = alg
icon = alg.getIcon()
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>225</width>
<height>444</height>
<width>289</width>
<height>438</height>
</rect>
</property>
<property name="windowTitle">
@@ -24,8 +24,8 @@
<item>
<widget class="QPushButton" name="externalAppsButton">
<property name="text">
<string>Click here to configure
additional algorithm providers</string>
<string>Click here to learn more
about SEXTANTE</string>
</property>
</widget>
</item>
@@ -51,6 +51,9 @@ additional algorithm providers</string>
</column>
</widget>
</item>
<item>
<widget class="QComboBox" name="modeComboBox"/>
</item>
</layout>
</widget>
</widget>

0 comments on commit 7feb1af

Please sign in to comment.
You can’t perform that action at this time.