Skip to content

Commit 1f1bbba

Browse files
committedDec 5, 2018
[console] Fix saving scripts sometimes defaults to QGIS bin folder
1 parent 9d1aaa8 commit 1f1bbba

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎python/console/console_editor.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
***************************************************************************/
1919
Some portions of code were taken from https://code.google.com/p/pydee/
2020
"""
21-
from qgis.PyQt.QtCore import Qt, QObject, QEvent, QCoreApplication, QFileInfo, QSize
21+
from qgis.PyQt.QtCore import Qt, QObject, QEvent, QCoreApplication, QFileInfo, QSize, QDir
2222
from qgis.PyQt.QtGui import QFont, QFontMetrics, QColor, QKeySequence, QCursor, QFontDatabase
2323
from qgis.PyQt.QtWidgets import QShortcut, QMenu, QApplication, QWidget, QGridLayout, QSpacerItem, QSizePolicy, QFileDialog, QTabWidget, QTreeWidgetItem, QFrame, QLabel, QToolButton, QMessageBox
2424
from qgis.PyQt.Qsci import QsciScintilla, QsciLexerPython, QsciAPIs, QsciStyle
@@ -831,9 +831,10 @@ def save(self, fileName=None):
831831
if self.path is None:
832832
saveTr = QCoreApplication.translate('PythonConsole',
833833
'Python Console: Save file')
834+
folder = self.pc.settings.value("pythonConsole/lastDirPath", QDir.homePath())
834835
self.path, filter = QFileDialog().getSaveFileName(self,
835836
saveTr,
836-
self.tw.tabText(index) + '.py',
837+
os.path.join(folder, self.tw.tabText(index) + '.py'),
837838
"Script file (*.py)")
838839
# If the user didn't select a file, abort the save operation
839840
if len(self.path) == 0:

0 commit comments

Comments
 (0)
Please sign in to comment.