Navigation Menu

Skip to content

Commit

Permalink
[sextante] add separators to context menu
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Apr 24, 2013
1 parent 17613e8 commit 608adb8
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions python/plugins/sextante/gui/SextanteToolbox.py
Expand Up @@ -17,7 +17,6 @@
***************************************************************************
"""


__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
Expand Down Expand Up @@ -47,23 +46,22 @@
_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()
settings.setValue(self.USE_CATEGORIES, True)
useCategories = settings.value(self.USE_CATEGORIES).toBool()
if useCategories:
self.modeComboBox.setCurrentIndex(0)
else:
Expand All @@ -79,15 +77,15 @@ 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)
settings.setValue(self.USE_CATEGORIES, True)
else:
settings.setValue(self.USE_CATEGORIES, False)
settings.setValue(self.USE_CATEGORIES, False)

self.fillTree()

def algsListHasChanged(self):
Expand All @@ -111,12 +109,15 @@ def showPopupMenu(self,point):
executeBatchAction = QAction(self.tr("Execute as batch process"), self.algorithmTree)
executeBatchAction.triggered.connect(self.executeAlgorithmAsBatchProcess)
popupmenu.addAction(executeBatchAction)
popupmenu.addSeparator()
editRenderingStylesAction = QAction(self.tr("Edit rendering styles for outputs"), self.algorithmTree)
editRenderingStylesAction.triggered.connect(self.editRenderingStyles)
popupmenu.addAction(editRenderingStylesAction)
actions = Sextante.contextMenuActions
if len(actions) > 0:
popupmenu.addSeparator()
for action in actions:
action.setData(alg,self)
action.setData(alg, self)
if action.isEnabled():
contextMenuAction = QAction(action.name, self.algorithmTree)
contextMenuAction.triggered.connect(action.execute)
Expand Down Expand Up @@ -173,7 +174,7 @@ def executeAlgorithm(self):

def fillTree(self):
settings = QSettings()
useCategories = settings.value(self.USE_CATEGORIES).toBool()
useCategories = settings.value(self.USE_CATEGORIES).toBool()
if useCategories:
self.fillTreeUsingCategories()
else:
Expand Down Expand Up @@ -307,7 +308,7 @@ def fillTreeUsingCategories(self):
if (text != ""):
self.algorithmTree.expandAll()

def fillTreeUsingProviders(self):
def fillTreeUsingProviders(self):
self.algorithmTree.clear()
text = unicode(self.searchBox.text())
for providerName in Sextante.algs.keys():
Expand Down Expand Up @@ -357,8 +358,6 @@ def fillTreeUsingProviders(self):
for groupItem in groups.values():
groupItem.setExpanded(text != "")



class TreeAlgorithmItem(QTreeWidgetItem):

def __init__(self, alg):
Expand Down

0 comments on commit 608adb8

Please sign in to comment.