Skip to content

Commit

Permalink
[processing] fix app freeze when closing options dialog (fixes #15550)
Browse files Browse the repository at this point in the history
(cherry picked from commit 3dcf487)
  • Loading branch information
nirvn authored and alexbruy committed Jan 24, 2017
1 parent da3eb06 commit e648e21
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 3 additions & 4 deletions python/plugins/processing/core/ProcessingConfig.py
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions python/plugins/processing/gui/ConfigDialog.py
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit e648e21

Please sign in to comment.