Skip to content

Commit a245f91

Browse files
author
stephanie
committed
add message if multiple groups selected for linear drift #290
1 parent 0561ceb commit a245f91

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

odmtools/controller/frmLinearDrift.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ def OnBtnOKButton(self, event):
1313
Perform Drift Correction based on given input. Catch errors if the user enters something invalid
1414
"""
1515
try:
16-
self._record_service.drift_correction(float(self.txtFinalGapValue.GetValue()))
16+
result = self._record_service.drift_correction(float(self.txtFinalGapValue.GetValue()))
17+
if not result:
18+
dial = wx.MessageDialog( None, "Linear drift can only be performed on one continuous data selection. \nPlease modify your selection and try again.", "Bad Input", wx.OK)
19+
dial.ShowModal()
1720
except Exception as e:
1821
dial = wx.MessageDialog(None, "Unable to convert value to float %s" % e, "Bad Input",
1922
wx.OK | wx.ICON_ERROR)

odmtools/controller/logicEditTools.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,11 @@ def interpolate(self):
184184

185185
def drift_correction(self, gap_width):
186186
ret = self._edit_service.drift_correction(gap_width)
187-
self.refresh_edit()
188-
if self._record:
189-
self._script("edit_service.drift_correction(%s)\n" % (gap_width), 'black')
190-
Publisher.sendMessage("scroll")
187+
if ret:
188+
self.refresh_edit()
189+
if self._record:
190+
self._script("edit_service.drift_correction(%s)\n" % (gap_width), 'black')
191+
Publisher.sendMessage("scroll")
191192
return ret
192193

193194
def reset_filter(self):

odmtools/odmservices/edit_service.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,8 @@ def interpolate(self):
353353

354354

355355
def drift_correction(self, gap_width):
356+
357+
356358
if self.isOneGroup():
357359
tmp_filter_list =self.get_filtered_points()
358360
startdate =tmp_filter_list.index[0]

0 commit comments

Comments
 (0)