Skip to content
Permalink
Browse files

Add button to reset processing menus in config dialog

  • Loading branch information
arnaud-morvan committed Aug 21, 2016
1 parent 1df8474 commit 09671197e7529398f823e399e4094e1200fd54ee
Showing with 21 additions and 1 deletion.
  1. +21 −1 python/plugins/processing/gui/ConfigDialog.py
@@ -42,6 +42,7 @@
QHBoxLayout,
QComboBox)
from qgis.PyQt.QtGui import (QIcon,
QPushButton,
QStandardItemModel,
QStandardItem)

@@ -55,7 +56,7 @@
Setting)
from processing.core.Processing import Processing
from processing.gui.DirectorySelectorDialog import DirectorySelectorDialog
from processing.gui.menus import updateMenus
from processing.gui.menus import defaultMenuEntries, updateMenus
from processing.gui.menus import menusSettingsGroup


@@ -198,6 +199,16 @@ def fillTreeUsingProviders(self):

rootItem.insertRow(0, [menusItem, emptyItem])

button = QPushButton(self.tr('Reset to defaults'))
button.clicked.connect(self.resetMenusToDefaults)
layout = QHBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(button)
layout.addStretch()
widget = QWidget()
widget.setLayout(layout)
self.tree.setIndexWidget(emptyItem.index(), widget)

providers = Processing.providers
for provider in providers:
providerDescription = provider.getDescription()
@@ -240,6 +251,15 @@ def fillTreeUsingProviders(self):
self.tree.sortByColumn(0, Qt.AscendingOrder)
self.adjustColumns()

def resetMenusToDefaults(self):
providers = Processing.providers
for provider in providers:
for alg in provider.algs:
d = defaultMenuEntries.get(alg.commandLineName(), "")
setting = ProcessingConfig.settings["MENU_" + alg.commandLineName()]
item = self.items[setting]
item.setData(d, Qt.EditRole)

def accept(self):
for setting in self.items.keys():
if isinstance(setting.value, bool):

0 comments on commit 0967119

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