Skip to content
Permalink
Browse files

[processing] fix app freeze when closing options dialog (fixes #15550)

  • Loading branch information
nirvn committed Jan 3, 2017
1 parent b3fddc7 commit 3dcf4874859f777050f06c9fde54233e5df73b2c
@@ -289,16 +289,15 @@ def setValue(self, value):
self.validator(value)
self.value = value

def read(self):
qsettings = QSettings()
def read(self, qsettings=QSettings()):
value = qsettings.value(self.qname, None)
if value is not None:
if isinstance(self.value, bool):
value = str(value).lower() == str(True).lower()
self.value = value

def save(self):
QSettings().setValue(self.qname, self.value)
def save(self, qsettings=QSettings()):
qsettings.setValue(self.qname, self.value)

def __str__(self):
return self.name + '=' + str(self.value)
@@ -30,8 +30,7 @@
import os

from qgis.PyQt import uic
from qgis.PyQt.QtCore import (Qt,
QEvent)
from qgis.PyQt.QtCore import Qt, QEvent, QSettings
from qgis.PyQt.QtWidgets import (QFileDialog,
QDialog,
QStyle,
@@ -266,6 +265,7 @@ def resetMenusToDefaults(self):

def accept(self):
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
qsettings = QSettings()
for setting in list(self.items.keys()):
if setting.group != menusSettingsGroup or self.saveMenus:
if isinstance(setting.value, bool):
@@ -277,7 +277,7 @@ def accept(self):
QMessageBox.warning(self, self.tr('Wrong value'),
self.tr('Wrong value for parameter "%s":\n\n%s' % (setting.description, str(e))))
return
setting.save()
setting.save(qsettings)
Processing.updateAlgsList()
settingsWatcher.settingsChanged.emit()
QApplication.restoreOverrideCursor()

0 comments on commit 3dcf487

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