Subversion Repositories Projects

Rev

Rev 639 | Rev 643 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 639 Rev 640
Line 670... Line 670...
670
        self.app.onSettingsChanged()
670
        self.app.onSettingsChanged()
Line 671... Line 671...
671
 
671
 
672
    def onStartMeasure(self, event): # wxGlade: MainFrame.<event_handler>
672
    def onStartMeasure(self, event): # wxGlade: MainFrame.<event_handler>
673
        # Collect measure parameters
673
        # Collect measure parameters
-
 
674
        mp = MeasureParameters()
-
 
675
       
674
        mp = MeasureParameters()
676
        try:
675
        mp.descr = self.descrCtrl.GetValue()
677
          mp.descr = self.descrCtrl.GetValue()
676
        mp.motors = map(int,self.motorsCtrl.GetValue().split(','))
678
          mp.motors = map(int,self.motorsCtrl.GetValue().split(','))
677
        mp.channels = []
679
          mp.channels = []
678
        if self.accTopCb.IsChecked(): mp.channels.append(5)
680
          if self.accTopCb.IsChecked(): mp.channels.append(5)
679
        if self.accRollCb.IsChecked(): mp.channels.append(6)
681
          if self.accRollCb.IsChecked(): mp.channels.append(6)
680
        if self.accNickCb.IsChecked(): mp.channels.append(7)
682
          if self.accNickCb.IsChecked(): mp.channels.append(7)
681
        s = self.speedCtrl.GetValue()
683
          s = self.speedCtrl.GetValue()
682
        if s=="test":
684
          if s=="test":
683
          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)
685
            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)
684
        elif s.count("-") == 1:
686
          elif s.count("-") == 1:
685
            # assume from-to:step format
687
              # assume from-to:step format
686
            s = s.split("-")
688
              s = s.split("-")
687
            if len(s) != 2: raise Exception("Invalid format")
689
              if len(s) != 2: raise Exception("Invalid format")
688
            s[1] = s[1].split(":")
690
              s[1] = s[1].split(":")
689
            if len(s[1]) != 2: raise Exception("Invalid format")
691
              if len(s[1]) != 2: raise Exception("Invalid format")
690
            mp.speeds = range(int(s[0]),int(s[1][0])+int(s[1][1]),int(s[1][1]))
692
              mp.speeds = range(int(s[0]),int(s[1][0])+int(s[1][1]),int(s[1][1]))
691
        else:
693
          else:
-
 
694
              mp.speeds = map(int,s.split(','))
-
 
695
        except Exception,e:
-
 
696
          dial = wx.MessageDialog(None, 'Invalid paramters', 'Error', wx.OK |
-
 
697
            wx.ICON_ERROR)
-
 
698
          dial.ShowModal()
-
 
699
          raise e
-
 
700
 
Line 692... Line 701...
692
            mp.speeds = map(int,s.split(','))
701
         
693
           
702
           
694
        print mp.descr
703
        print mp.descr
695
        print mp.motors
704
        print mp.motors