Skip to content
Permalink
Browse files

[console] Correctly save settings when exiting app

The closeEvent approach which was previously used is not reliable
on application exit, so manually force a settings save in this case too.

Avoids loss of command history when closing QGIS

Also remove the manual "Save" history action, as it's redundant

(cherry picked from commit cce5c4e)
  • Loading branch information
nyalldawson committed Dec 5, 2018
1 parent fc03f40 commit 6d619382946a2d55888aebd5c6024c23d79da6e5
Showing with 4 additions and 5 deletions.
  1. +4 −0 python/console/console.py
  2. +0 −5 python/console/console_sci.py
@@ -87,6 +87,10 @@ def __init__(self, parent=None):
if iface and not iface.mainWindow().restoreDockWidget(self):
iface.mainWindow().addDockWidget(Qt.BottomDockWidgetArea, self)

# closeEvent is not always called for this widget -- so we also trigger a settings
# save on application exit
QgsApplication.instance().aboutToQuit.connect(self.console.saveSettingsConsole)

def activate(self):
self.activateWindow()
self.raise_()
@@ -509,11 +509,6 @@ def contextMenuEvent(self, e):
subMenu.addAction(
QCoreApplication.translate("PythonConsole", "Show"),
self.showHistory, 'Ctrl+Shift+SPACE')
subMenu.addSeparator()
subMenu.addAction(
QCoreApplication.translate("PythonConsole", "Save"),
self.writeHistoryFile)
subMenu.addSeparator()
subMenu.addAction(
QCoreApplication.translate("PythonConsole", "Clear File"),
self.clearHistory)

0 comments on commit 6d61938

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