Skip to content

Commit 9e848e0

Browse files
committed
Adds routine "clearGuiValues" for the Inversion perspective
1 parent 9b5668b commit 9e848e0

2 files changed

Lines changed: 29 additions & 6 deletions

File tree

src/sas/qtgui/Perspectives/Inversion/InversionWidget.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,10 @@ def handleRemove(self):
156156
# If there's no results left, we need an empty one.
157157
if len(self.results) == 0:
158158
self.results.append(self.initResult())
159+
self.clearGuiValues()
159160
self.enableButtons()
160161
self.updateGuiValues()
161-
162+
162163
def handleCurrentDataChanged(self):
163164
# This event might get called before there is anything in the results list. But we can't update the GUI without
164165
# errors.
@@ -290,6 +291,29 @@ def updateGuiValues(self):
290291
self.posFractionValue.setText(format_float(out.pos_frac))
291292
self.sigmaPosFractionValue.setText(format_float(out.pos_err))
292293

294+
def clearGuiValues(self):
295+
#self.noOfTermsSuggestionButton.setText("")
296+
#self.regConstantSuggestionButton.setText("")
297+
298+
self.noOfTermsInput.setText("")
299+
self.regularizationConstantInput.setText("")
300+
self.maxDistanceInput.setText("")
301+
302+
self.minQInput.setText("")
303+
self.maxQInput.setText("")
304+
self.slitHeightInput.setText("")
305+
self.slitWidthInput.setText("")
306+
307+
self.rgValue.setText("")
308+
self.iQ0Value.setText("")
309+
self.backgroundValue.setText("")
310+
self.backgroundInput.setText("")
311+
self.computationTimeValue.setText("")
312+
self.chiDofValue.setText("")
313+
self.oscillationValue.setText("")
314+
self.posFractionValue.setText("")
315+
self.sigmaPosFractionValue.setText("")
316+
293317
def setupValidators(self):
294318
"""Apply validators to editable line edits"""
295319
self.noOfTermsInput.setValidator(QIntValidator())

src/sas/qtgui/Perspectives/ParticleEditor/util.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
def format_time_estimate(est_time_seconds):
2-
""" Get easily understandable string for a computational time estimate"""
2+
"""Get easily understandable string for a computational time estimate"""
33
# This is some silly code, but eh, why not
44
#
55
# I'm not even sure this is bad code, it's quite readable,
@@ -72,11 +72,10 @@ def format_time_estimate(est_time_seconds):
7272
unit = time_units
7373
else:
7474
unit = time_units + "s"
75+
elif rounded == 1:
76+
unit = time_units[0]
7577
else:
76-
if rounded == 1:
77-
unit = time_units[0]
78-
else:
79-
unit = time_units[1]
78+
unit = time_units[1]
8079

8180
return f"{rounded} {unit}"
8281

0 commit comments

Comments
 (0)