Skip to content
Permalink
Browse files

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

(cherry picked from commit 3dcf487)
  • Loading branch information
nirvn authored and alexbruy committed Jan 24, 2017
1 parent 4923e46 commit 787fecb7a286b5d5a831d82b43698d85c98ff4b9
@@ -293,16 +293,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 = unicode(value).lower() == unicode(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 + '=' + unicode(self.value)
@@ -28,8 +28,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,
@@ -264,6 +263,7 @@ def resetMenusToDefaults(self):

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

0 comments on commit 787fecb

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