Skip to content

Commit cce5c4e

Browse files
committedDec 5, 2018
[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
1 parent 1f1bbba commit cce5c4e

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed
 

‎python/console/console.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ def __init__(self, parent=None):
8787
if iface and not iface.mainWindow().restoreDockWidget(self):
8888
iface.mainWindow().addDockWidget(Qt.BottomDockWidgetArea, self)
8989

90+
# closeEvent is not always called for this widget -- so we also trigger a settings
91+
# save on application exit
92+
QgsApplication.instance().aboutToQuit.connect(self.console.saveSettingsConsole)
93+
9094
def activate(self):
9195
self.activateWindow()
9296
self.raise_()

‎python/console/console_sci.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -509,11 +509,6 @@ def contextMenuEvent(self, e):
509509
subMenu.addAction(
510510
QCoreApplication.translate("PythonConsole", "Show"),
511511
self.showHistory, 'Ctrl+Shift+SPACE')
512-
subMenu.addSeparator()
513-
subMenu.addAction(
514-
QCoreApplication.translate("PythonConsole", "Save"),
515-
self.writeHistoryFile)
516-
subMenu.addSeparator()
517512
subMenu.addAction(
518513
QCoreApplication.translate("PythonConsole", "Clear File"),
519514
self.clearHistory)

0 commit comments

Comments
 (0)
Please sign in to comment.