Skip to content

Commit

Permalink
[processing] remember last path for batch processes
Browse files Browse the repository at this point in the history
Fixes #16310
  • Loading branch information
volaya committed Aug 23, 2017
1 parent 3ef008c commit 64f3e67
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions python/plugins/processing/gui/BatchPanel.py
Expand Up @@ -31,6 +31,7 @@
from qgis.PyQt import uic
from qgis.PyQt.QtGui import QIcon
from qgis.PyQt.QtWidgets import QTableWidgetItem, QComboBox, QLineEdit, QHeaderView, QFileDialog, QMessageBox
from qgis.PyQt.QtCore import QSettings

from qgis.core import QgsApplication

Expand Down Expand Up @@ -178,9 +179,15 @@ def getWidgetFromParameter(self, param, row, col):

return item

def getLastFolder():
settings = QSettings()
if settings.contains('/Processing/LastBatchInputPath'):
return settings.value('/Processing/LastBatchInputPath')

def load(self):
filename = unicode(QFileDialog.getOpenFileName(self,
self.tr('Open batch'), None,
self.tr('Open batch'),
self.getLastFolder(),
self.tr('JSON files (*.json)')))
if filename:
with open(filename) as f:
Expand Down Expand Up @@ -287,7 +294,7 @@ def save(self):

filename = unicode(QFileDialog.getSaveFileName(self,
self.tr('Save batch'),
None,
self.getLastFolder(),
self.tr('JSON files (*.json)')))
if filename:
if not filename.endswith('.json'):
Expand Down

0 comments on commit 64f3e67

Please sign in to comment.