Skip to content
Permalink
Browse files

[processing] save and restore geometry of the algorithm dialog

  • Loading branch information
alexbruy committed Jun 6, 2017
1 parent dec9ecf commit 77fa17781e5319947d0c0cff37e8b8bde38325eb
@@ -157,7 +157,7 @@ def checkExtentCRS(self):
return hasExtent and unmatchingCRS

def accept(self):
self.settings.setValue("/Processing/dialogBase", self.saveGeometry())
super(AlgorithmDialog, self)._saveGeometry()

context = dataobjects.createContext()

@@ -273,7 +273,7 @@ def finish(self, result, context):
self.tr('HTML output has been generated by this algorithm.'
'\nOpen the results dialog to check it.'))

def closeEvent(self, evt):
def closeEvent(self, event):
QgsProject.instance().layerWasAdded.disconnect(self.mainWidget.layerRegistryChanged)
QgsProject.instance().layersWillBeRemoved.disconnect(self.mainWidget.layerRegistryChanged)
super(AlgorithmDialog, self).closeEvent(evt)
super(AlgorithmDialog, self).closeEvent(event)
@@ -87,8 +87,11 @@ def __init__(self, alg):
self.buttonCancel.clicked.connect(self.feedback.cancel)

self.settings = QgsSettings()
self.splitter.restoreState(self.settings.value("/Processing/dialogBaseSplitter", QByteArray()))
self.restoreGeometry(self.settings.value("/Processing/dialogBase", QByteArray()))

self.setWindowTitle(self.alg.displayName())

self.executed = False
self.mainWidget = None
self.alg = alg
@@ -101,15 +104,16 @@ def __init__(self, alg):

self.btnClose = self.buttonBox.button(QDialogButtonBox.Close)

self.setWindowTitle(self.alg.displayName())
# don't collapse parameters panel
self.splitter.setCollapsible(0, False)

# desktop = QDesktopWidget()
# if desktop.physicalDpiX() > 96:
# self.txtHelp.setZoomFactor(desktop.physicalDpiX() / 96)

algHelp = self.formatHelp(self.alg)
if algHelp is None:
self.textShortHelp.setVisible(False)
self.textShortHelp.hide()
else:
self.textShortHelp.document().setDefaultStyleSheet('''.summary { margin-left: 10px; margin-right: 10px; }
h2 { color: #555555; padding-bottom: 15px; }
@@ -119,8 +123,6 @@ def __init__(self, alg):
dl dd { margin-bottom: 5px; }''')
self.textShortHelp.setHtml(algHelp)

self.textShortHelp.setOpenLinks(False)

def linkClicked(url):
webbrowser.open(url.toString())

@@ -162,9 +164,9 @@ def requestFinished(self):
reply.deleteLater()
self.txtHelp.setHtml(html)

def closeEvent(self, evt):
self.settings.setValue("/Processing/dialogBase", self.saveGeometry())
super(AlgorithmDialogBase, self).closeEvent(evt)
def closeEvent(self, event):
self._saveGeometry()
super(AlgorithmDialogBase, self).closeEvent(event)

def setMainWidget(self, widget):
if self.mainWidget is not None:
@@ -228,9 +230,17 @@ def getParamValues(self):
def accept(self):
pass

def reject(self):
self._saveGeometry()
super(AlgorithmDialogBase, self).reject()

def finish(self, context):
pass

def _saveGeometry(self):
self.settings.setValue("/Processing/dialogBaseSplitter", self.splitter.saveState())
self.settings.setValue("/Processing/dialogBase", self.saveGeometry())

class InvalidParameterValue(Exception):

def __init__(self, param, widget):
@@ -26,6 +26,12 @@
<enum>Qt::Horizontal</enum>
</property>
<widget class="QTabWidget" name="tabWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
</property>
@@ -99,7 +105,17 @@
</layout>
</widget>
</widget>
<widget class="QTextBrowser" name="textShortHelp"/>
<widget class="QTextBrowser" name="textShortHelp">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="openLinks">
<bool>false</bool>
</property>
</widget>
</widget>
</item>
<item>

0 comments on commit 77fa177

Please sign in to comment.
You can’t perform that action at this time.