Skip to content

Commit

Permalink
Correctly reject algorithm dialog
Browse files Browse the repository at this point in the history
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 1d6d4be
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 69 deletions.
5 changes: 0 additions & 5 deletions python/plugins/processing/gui/AlgorithmDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 4 additions & 0 deletions python/plugins/processing/gui/AlgorithmDialogBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/gui/ProcessingToolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ def executeAlgorithm(self):

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

if not dlg:
dlg = AlgorithmDialog(alg)
canvas = iface.mapCanvas()
Expand Down
77 changes: 13 additions & 64 deletions python/plugins/processing/ui/DlgAlgorithmBase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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">
Expand All @@ -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>
Expand Down Expand Up @@ -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.