Skip to content
Permalink
Browse files

Correctly reject algorithm dialog

Algorithm dialog was not being rejected when close button was
called (only hidden), leading to old dialogs and widgets
hanging around forever...
  • Loading branch information
nyalldawson committed Jun 11, 2017
1 parent aa544a1 commit 1d6d4be55657dc53e8857253cdfb8d81578c3cf1
@@ -274,8 +274,3 @@ def finish(self, result, context, feedback):
self.setInfo(
self.tr('HTML output has been generated by this algorithm.'
'\nOpen the results dialog to check it.'))

def closeEvent(self, event):
QgsProject.instance().layerWasAdded.disconnect(self.mainWidget.layerRegistryChanged)
QgsProject.instance().layersWillBeRemoved.disconnect(self.mainWidget.layerRegistryChanged)
super(AlgorithmDialog, self).closeEvent(event)
@@ -107,13 +107,17 @@ def __init__(self, alg):

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

self.buttonBox.rejected.connect(self.reject)
self.buttonBox.accepted.connect(self.accept)

# Rename OK button to Run
self.btnRun = self.buttonBox.button(QDialogButtonBox.Ok)
self.btnRun.setText(self.tr('Run'))

self.buttonCancel.setEnabled(False)

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

self.buttonBox.helpRequested.connect(self.openHelp)

self.btnCollapse.clicked.connect(self.toggleCollapsed)
@@ -267,6 +267,7 @@ def executeAlgorithm(self):

if alg.countVisibleParameters() > 0:
dlg = alg.createCustomParametersWidget(self)

if not dlg:
dlg = AlgorithmDialog(alg)
canvas = iface.mapCanvas()
@@ -46,16 +46,16 @@
<property name="spacing">
<number>2</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
@@ -68,16 +68,7 @@
<property name="spacing">
<number>2</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
@@ -86,16 +77,7 @@
<property name="rightMargin">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@@ -165,38 +147,5 @@
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
<connections/>
</ui>

0 comments on commit 1d6d4be

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