Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 639 → Rev 640

/VibrationTest/trunk/VibrationTest/VibrationTestGui.py
672,24 → 672,33
def onStartMeasure(self, event): # wxGlade: MainFrame.<event_handler>
# Collect measure parameters
mp = MeasureParameters()
mp.descr = self.descrCtrl.GetValue()
mp.motors = map(int,self.motorsCtrl.GetValue().split(','))
mp.channels = []
if self.accTopCb.IsChecked(): mp.channels.append(5)
if self.accRollCb.IsChecked(): mp.channels.append(6)
if self.accNickCb.IsChecked(): mp.channels.append(7)
s = self.speedCtrl.GetValue()
if s=="test":
mp.speeds = (100,100,100,100,100, 150,150,150,150,150, 200,200,200,200,200, 100,150,200, 100,150,200, 100,150,200, 100,150,200)
elif s.count("-") == 1:
# assume from-to:step format
s = s.split("-")
if len(s) != 2: raise Exception("Invalid format")
s[1] = s[1].split(":")
if len(s[1]) != 2: raise Exception("Invalid format")
mp.speeds = range(int(s[0]),int(s[1][0])+int(s[1][1]),int(s[1][1]))
else:
mp.speeds = map(int,s.split(','))
try:
mp.descr = self.descrCtrl.GetValue()
mp.motors = map(int,self.motorsCtrl.GetValue().split(','))
mp.channels = []
if self.accTopCb.IsChecked(): mp.channels.append(5)
if self.accRollCb.IsChecked(): mp.channels.append(6)
if self.accNickCb.IsChecked(): mp.channels.append(7)
s = self.speedCtrl.GetValue()
if s=="test":
mp.speeds = (100,100,100,100,100, 150,150,150,150,150, 200,200,200,200,200, 100,150,200, 100,150,200, 100,150,200, 100,150,200)
elif s.count("-") == 1:
# assume from-to:step format
s = s.split("-")
if len(s) != 2: raise Exception("Invalid format")
s[1] = s[1].split(":")
if len(s[1]) != 2: raise Exception("Invalid format")
mp.speeds = range(int(s[0]),int(s[1][0])+int(s[1][1]),int(s[1][1]))
else:
mp.speeds = map(int,s.split(','))
except Exception,e:
dial = wx.MessageDialog(None, 'Invalid paramters', 'Error', wx.OK |
wx.ICON_ERROR)
dial.ShowModal()
raise e
 
print mp.descr
print mp.motors