Skip to content
Permalink
Browse files

Merge pull request #3686 from arnaud-morvan/processing_reset_menus

[processing] Add button to reset processing menus in config dialog
  • Loading branch information
volaya committed Nov 8, 2016
2 parents dc9ebe2 + e78fc62 commit 846eef2057c5d9e32829c293831abbc926cd2c1d
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 846eef2

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