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 da3eb06 commit e648e212212555ba98897b7208719cd106ea8b0f
@@ -268,16 +268,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)
@@ -30,7 +30,7 @@

from PyQt4 import uic
from PyQt4.QtCore import Qt, QEvent, QPyNullVariant
from PyQt4.QtGui import (QFileDialog, QDialog, QIcon, QStyle,
from PyQt4.QtGui import (QFileDialog, QDialog, QIcon, QStyle, QSettings,
QStandardItemModel, QStandardItem, QMessageBox, QStyledItemDelegate,
QLineEdit, QWidget, QToolButton, QHBoxLayout,
QComboBox)
@@ -139,6 +139,7 @@ def fillTree(self):
self.adjustColumns()

def accept(self):
qsettings = QSettings()
for setting in self.items.keys():
if isinstance(setting.value, bool):
setting.setValue(self.items[setting].checkState() == Qt.Checked)
@@ -149,7 +150,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()

QDialog.accept(self)

0 comments on commit e648e21

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