Skip to content

Commit

Permalink
Remember window geometry in multi input dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 5, 2017
1 parent a1f487d commit 572dada
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions python/plugins/processing/gui/MultipleFileInputDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

from qgis.core import QgsSettings
from qgis.PyQt import uic
from qgis.PyQt.QtCore import QByteArray
from qgis.PyQt.QtWidgets import QDialog, QAbstractItemView, QPushButton, QDialogButtonBox, QFileDialog
from qgis.PyQt.QtGui import QStandardItemModel, QStandardItem

Expand Down Expand Up @@ -65,7 +66,14 @@ def __init__(self, options):
self.btnRemove.clicked.connect(lambda: self.removeRows())
self.btnRemoveAll.clicked.connect(lambda: self.removeRows(True))

self.settings = QgsSettings()
self.restoreGeometry(self.settings.value("/Processing/multipleFileInputDialogGeometry", QByteArray()))

self.populateList()
self.finished.connect(self.saveWindowGeometry)

def saveWindowGeometry(self):
self.settings.setValue("/Processing/multipleInputDialogGeometry", self.saveGeometry())

def populateList(self):
model = QStandardItemModel()
Expand Down
9 changes: 9 additions & 0 deletions python/plugins/processing/gui/MultipleInputDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@

import os

from qgis.core import QgsSettings
from qgis.PyQt import uic
from qgis.PyQt.QtCore import Qt
from qgis.PyQt.QtCore import QByteArray
from qgis.PyQt.QtWidgets import QDialog, QAbstractItemView, QPushButton, QDialogButtonBox
from qgis.PyQt.QtGui import QStandardItemModel, QStandardItem

Expand Down Expand Up @@ -71,7 +73,14 @@ def __init__(self, options, selectedoptions=None):
self.btnClearSelection.clicked.connect(lambda: self.selectAll(False))
self.btnToggleSelection.clicked.connect(self.toggleSelection)

self.settings = QgsSettings()
self.restoreGeometry(self.settings.value("/Processing/multipleInputDialogGeometry", QByteArray()))

self.populateList()
self.finished.connect(self.saveWindowGeometry)

def saveWindowGeometry(self):
self.settings.setValue("/Processing/multipleInputDialogGeometry", self.saveGeometry())

def populateList(self):
model = QStandardItemModel()
Expand Down

0 comments on commit 572dada

Please sign in to comment.