Esempio n. 1
0
 def update_ybound(self, event):
     try:
         y_max = int(self.max_tc.GetValue())
         y_min = int(self.min_tc.GetValue())
         if y_max < y_min:
             y_min, y_max = y_max, y_min
         self.set_ybound(lower=y_min, upper=y_max)
         Utility.AlertMsg(u"设置成功")
     except ValueError:
         Utility.AlertError(u"输入异常: \"%s\" or \"%s\"" % (self.min_tc.GetValue(), self.max_tc.GetValue()))
Esempio n. 2
0
 def on_start(self, event):
     if self.instrumentation:
         interval = self.interval_spin.GetValue()
         v_cali = self.v_calibration_spin.GetValue()
         a_cali = self.a_calibration_spin.GetValue()
         self.data = ChargeData(interval=interval,
                                instr=self.instrumentation,
                                v_cali=v_cali,
                                a_cali=a_cali)
         self.ampe.start(interval=interval, data=self.data)
         self.volt.start(interval=interval, data=self.data)
         self.EnableCtrl(enable=False)
     else:
         Utility.AlertError(u"请先连接设备")
Esempio n. 3
0
 def on_connect(self, event):
     obj = event.GetEventObject()
     state = obj.GetLabel()
     if state == u"连接":
         port = self.port_choice.GetStringSelection()
         if not port:
             return False
         try:
             self.instrumentation = SerialInstrument(port)
             self.port_choice.Disable()
             obj.SetLabel(u"断开")
         except pyvisa.errors.VisaIOError:
             Utility.AlertError(u"连接失败")
     else:
         if self.instrumentation:
             self.instrumentation.disconnect()
             self.instrumentation = None
         self.port_choice.Enable()
         obj.SetLabel(u"连接")