@@ -36,8 +36,8 @@ def setup_ui(self):
3636
3737 def _run_and_accept (self ):
3838 """Run the sampler and accept dialog if successful."""
39- self .widget ._run_sampler ()
40- # Dialog stays open so user can see the result
39+ if self .widget ._run_sampler ():
40+ self . accept ()
4141
4242
4343class SorterDialog (QDialog ):
@@ -73,7 +73,8 @@ def setup_ui(self):
7373
7474 def _run_and_accept (self ):
7575 """Run the sorter and accept dialog if successful."""
76- self .widget ._run_sorter ()
76+ if self .widget ._run_sorter ():
77+ self .accept ()
7778
7879
7980class UserDefinedSorterDialog (QDialog ):
@@ -101,16 +102,15 @@ def setup_ui(self):
101102 layout .addWidget (self .widget )
102103
103104 # Replace the run button with dialog buttons
104- # self.widget.runButton.hide()
105-
106- # self.button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self)
107- # self.button_box.accepted.connect(self._run_and_accept)
108- # self.button_box.rejected.connect(self.reject)
109- # layout.addWidget(self.button_box)
105+ self .button_box = QDialogButtonBox (QDialogButtonBox .Ok | QDialogButtonBox .Cancel , self )
106+ self .button_box .accepted .connect (self ._run_and_accept )
107+ self .button_box .rejected .connect (self .reject )
108+ layout .addWidget (self .button_box )
110109
111110 def _run_and_accept (self ):
112111 """Run the sorter and accept dialog if successful."""
113- self .widget ._run_sorter ()
112+ if self .widget ._run_sorter ():
113+ self .accept ()
114114
115115
116116class BasalContactsDialog (QDialog ):
@@ -146,7 +146,8 @@ def setup_ui(self):
146146
147147 def _run_and_accept (self ):
148148 """Run the extractor and accept dialog if successful."""
149- self .widget ._run_extractor ()
149+ if self .widget ._run_extractor ():
150+ self .accept ()
150151
151152
152153class ThicknessCalculatorDialog (QDialog ):
@@ -182,7 +183,8 @@ def setup_ui(self):
182183
183184 def _run_and_accept (self ):
184185 """Run the calculator and accept dialog if successful."""
185- self .widget ._run_calculator ()
186+ if self .widget ._run_calculator ():
187+ self .accept ()
186188
187189
188190class PaintStratigraphicOrderDialog (QDialog ):
@@ -218,5 +220,5 @@ def setup_ui(self):
218220
219221 def _run_and_accept (self ):
220222 """Run the painter and accept dialog if successful."""
221- self .widget ._run_painter ()
222-
223+ if self .widget ._run_painter ():
224+ self . accept ()
0 commit comments