コード例 #1
0
 def update_channels(self):
     changed = False
     for j in range(2):
         for a in range(8):
             _safe_dict["j{}a{}".format(j, a)] = self.ui.__getattribute__("verticalSlider_j_{}_a_{}".format(j, a)).value()
             _safe_dict["j{}s{}".format(j, a)] = self.ui.__getattribute__("verticalSlider_j_{}_s_{}".format(j, a)).value()
     for ch in range(8):
         oldVal = self.ui.__getattribute__("verticalSlider_ch_{}".format(ch)).value()
         newVal = self.ui.__getattribute__("verticalSlider_ch_{}".format(ch)).value()
         try:
             newVal = eval(self.ui.__getattribute__("lineEdit_ch_{}".format(ch)).text(), {"__builtins__": None}, _safe_dict)
         except (NameError, SyntaxError, AttributeError):
             pass
         if oldVal != newVal:
             self.ui.__getattribute__("verticalSlider_ch_{}".format(ch)).setValue(newVal)
             changed = True
     if changed:
         ch0 = range_convert(-100, 100, 1000, 2000, self.ui.verticalSlider_ch_0.value())
         ch1 = range_convert(-100, 100, 1000, 2000, self.ui.verticalSlider_ch_1.value())
         ch2 = range_convert(-100, 100, 1000, 2000, self.ui.verticalSlider_ch_2.value())
         ch3 = range_convert(-100, 100, 1000, 2000, self.ui.verticalSlider_ch_3.value())
         ch4 = range_convert(-100, 100, 1000, 2000, self.ui.verticalSlider_ch_4.value())
         ch5 = range_convert(-100, 100, 1000, 2000, self.ui.verticalSlider_ch_5.value())
         ch6 = range_convert(-100, 100, 1000, 2000, self.ui.verticalSlider_ch_6.value())
         ch7 = range_convert(-100, 100, 1000, 2000, self.ui.verticalSlider_ch_7.value())
         self.channels_updated.emit(ch0, ch1, ch2, ch3, ch4, ch5, ch6, ch7)
コード例 #2
0
ファイル: RC_Receiver.py プロジェクト: TimJay/RaspberryPylot
def set_fail_position(controller):
    for i in range(8):
        val = int(remote_config.get("fail", "{}".format(i)))
        controller.set_position(i, int(range_convert(-100, 100, 1000, 2000, val)))
コード例 #3
0
def set_fail_position(controller):
    for i in range(8):
        val = int(remote_config.get("fail", "{}".format(i)))
        controller.set_position(i,
                                int(range_convert(-100, 100, 1000, 2000, val)))