Skip to content


[console] Fix saving scripts sometimes defaults to QGIS bin folder
Browse files Browse the repository at this point in the history
(cherry picked from commit 1f1bbba)
  • Loading branch information
nyalldawson committed Dec 6, 2018
1 parent 4b524de commit fc03f40
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python/console/
Expand Up @@ -18,7 +18,7 @@
Some portions of code were taken from
from qgis.PyQt.QtCore import Qt, QObject, QEvent, QCoreApplication, QFileInfo, QSize
from qgis.PyQt.QtCore import Qt, QObject, QEvent, QCoreApplication, QFileInfo, QSize, QDir
from qgis.PyQt.QtGui import QFont, QFontMetrics, QColor, QKeySequence, QCursor, QFontDatabase
from qgis.PyQt.QtWidgets import QShortcut, QMenu, QApplication, QWidget, QGridLayout, QSpacerItem, QSizePolicy, QFileDialog, QTabWidget, QTreeWidgetItem, QFrame, QLabel, QToolButton, QMessageBox
from qgis.PyQt.Qsci import QsciScintilla, QsciLexerPython, QsciAPIs, QsciStyle
Expand Down Expand Up @@ -831,9 +831,10 @@ def save(self, fileName=None):
if self.path is None:
saveTr = QCoreApplication.translate('PythonConsole',
'Python Console: Save file')
folder = self.pc.settings.value("pythonConsole/lastDirPath", QDir.homePath())
self.path, filter = QFileDialog().getSaveFileName(self,
saveTr, + '.py',
os.path.join(folder, + '.py'),
"Script file (*.py)")
# If the user didn't select a file, abort the save operation
if len(self.path) == 0:
Expand Down

0 comments on commit fc03f40

Please sign in to comment.