Skip to content

Commit 7feb1af

Browse files
committed
[sextante] Made configuration of algorithm classification available in toolbox
1 parent 9675af0 commit 7feb1af

3 files changed

Lines changed: 40 additions & 10 deletions

File tree

python/plugins/sextante/core/SextanteConfig.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
from PyQt4 import QtGui
2929

3030
class SextanteConfig():
31-
32-
USE_CATEGORIES = "USE_CATEGORIES"
31+
3332
TABLE_LIKE_PARAM_PANEL = "TABLE_LIKE_PARAM_PANEL"
3433
OUTPUT_FOLDER = "OUTPUT_FOLDER"
3534
RASTER_STYLE = "RASTER_STYLE"
@@ -61,8 +60,7 @@ def initialize():
6160
SextanteConfig.addSetting(Setting("General", SextanteConfig.USE_SELECTED, "Use only selected features", True))
6261
SextanteConfig.addSetting(Setting("General", SextanteConfig.TABLE_LIKE_PARAM_PANEL, "Show table-like parameter panels", False))
6362
SextanteConfig.addSetting(Setting("General", SextanteConfig.USE_FILENAME_AS_LAYER_NAME, "Use filename as layer name", True))
64-
SextanteConfig.addSetting(Setting("General", SextanteConfig.SHOW_RECENT_ALGORITHMS, "Show recently executed algorithms", True))
65-
SextanteConfig.addSetting(Setting("General", SextanteConfig.USE_CATEGORIES, "Use categories to classify algorithms, instead of providers", True))
63+
SextanteConfig.addSetting(Setting("General", SextanteConfig.SHOW_RECENT_ALGORITHMS, "Show recently executed algorithms", True))
6664
SextanteConfig.addSetting(Setting("General", SextanteConfig.OUTPUT_FOLDER, "Output folder", SextanteUtils.tempFolder()))
6765
SextanteConfig.addSetting(Setting("General", SextanteConfig.SHOW_CRS_DEF, "Show layer CRS definition in selection boxes", True))
6866
SextanteConfig.addSetting(Setting("General", SextanteConfig.WARN_UNMATCHING_CRS, "Warn before executing if layer CRS's do not match", True))

python/plugins/sextante/gui/SextanteToolbox.py

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
***************************************************************************
1818
"""
1919

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

4849
class SextanteToolbox(QDockWidget, Ui_SextanteToolbox):
50+
51+
USE_CATEGORIES = "/SextanteQGIS/UseCategories"
52+
53+
4954
def __init__(self, iface):
5055
QDockWidget.__init__(self, None)
5156
self.setupUi(self)
5257
self.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
5358

5459
self.iface=iface
60+
61+
self.modeComboBox.clear()
62+
self.modeComboBox.addItems(['Simplified interface', 'Advanced interface'])
63+
settings = QSettings()
64+
if not settings.contains(self.USE_CATEGORIES):
65+
settings.setValue(self.USE_CATEGORIES, True)
66+
useCategories = settings.value(self.USE_CATEGORIES).toBool()
67+
if useCategories:
68+
self.modeComboBox.setCurrentIndex(0)
69+
else:
70+
self.modeComboBox.setCurrentIndex(1)
71+
self.modeComboBox.currentIndexChanged.connect(self.modeHasChanged)
5572

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

6481
self.fillTree()
82+
83+
def modeHasChanged(self):
84+
idx = self.modeComboBox.currentIndex()
85+
settings = QSettings()
86+
if idx == 0: #simplified
87+
settings.setValue(self.USE_CATEGORIES, True)
88+
else:
89+
settings.setValue(self.USE_CATEGORIES, False)
90+
91+
self.fillTree()
6592

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

147174
def fillTree(self):
148-
useCategories = SextanteConfig.getSetting(SextanteConfig.USE_CATEGORIES)
175+
settings = QSettings()
176+
useCategories = settings.value(self.USE_CATEGORIES).toBool()
149177
if useCategories:
150178
self.fillTreeUsingCategories()
151179
else:
@@ -334,7 +362,8 @@ def fillTreeUsingProviders(self):
334362
class TreeAlgorithmItem(QTreeWidgetItem):
335363

336364
def __init__(self, alg):
337-
useCategories = SextanteConfig.getSetting(SextanteConfig.USE_CATEGORIES)
365+
settings = QSettings()
366+
useCategories = settings.value(SextanteToolbox.USE_CATEGORIES)
338367
QTreeWidgetItem.__init__(self)
339368
self.alg = alg
340369
icon = alg.getIcon()

python/plugins/sextante/ui/SextanteToolbox.ui

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>225</width>
10-
<height>444</height>
9+
<width>289</width>
10+
<height>438</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -24,8 +24,8 @@
2424
<item>
2525
<widget class="QPushButton" name="externalAppsButton">
2626
<property name="text">
27-
<string>Click here to configure
28-
additional algorithm providers</string>
27+
<string>Click here to learn more
28+
about SEXTANTE</string>
2929
</property>
3030
</widget>
3131
</item>
@@ -51,6 +51,9 @@ additional algorithm providers</string>
5151
</column>
5252
</widget>
5353
</item>
54+
<item>
55+
<widget class="QComboBox" name="modeComboBox"/>
56+
</item>
5457
</layout>
5558
</widget>
5659
</widget>

0 commit comments

Comments
 (0)