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
  • Loading branch information
nirvn committed Jan 3, 2017
1 parent b3fddc7 commit 3dcf487
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 3 additions & 4 deletions python/plugins/processing/core/ProcessingConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/gui/ConfigDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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):
Expand All @@ -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()
Expand Down

0 comments on commit 3dcf487

Please sign in to comment.