def __init__(self, *args): PluginBase.__init__(self, BrickletTilt, *args) self.tilt = self.device self.cbe_tilt_state = CallbackEmulator(self.tilt.get_tilt_state, self.cb_tilt_state, self.increase_error_count) self.label = QLabel("Closed") self.closed_pixmap = load_masked_pixmap('plugin_system/plugins/tilt/tilt_closed.bmp') self.open_pixmap = load_masked_pixmap('plugin_system/plugins/tilt/tilt_open.bmp') self.closed_vibrationg_pixmap = load_masked_pixmap('plugin_system/plugins/tilt/tilt_closed_vibrating.bmp') self.image_label = QLabel("") self.image_label.setPixmap(self.closed_pixmap) layout = QVBoxLayout(self) layout.addStretch() h_layout1 = QHBoxLayout() h_layout1.addStretch() h_layout1.addWidget(self.label) h_layout1.addStretch() h_layout2 = QHBoxLayout() h_layout2.addStretch() h_layout2.addWidget(self.image_label) h_layout2.addStretch() layout.addLayout(h_layout1) layout.addLayout(h_layout2) layout.addStretch()
def __init__(self, *args): PluginBase.__init__(self, BrickletDualRelay, *args) self.setupUi(self) self.dr = self.device self.state1_combobox.setItemData(0, True) self.state1_combobox.setItemData(1, False) self.state2_combobox.setItemData(0, True) self.state2_combobox.setItemData(1, False) self.monoflop = Monoflop(self.dr, [1, 2], [self.state1_combobox, self.state2_combobox], self.cb_state_change_by_monoflop, [self.time1_spinbox, self.time2_spinbox], None, self) self.dr1_button.clicked.connect(self.dr1_clicked) self.dr2_button.clicked.connect(self.dr2_clicked) self.go1_button.clicked.connect(self.go1_clicked) self.go2_button.clicked.connect(self.go2_clicked) self.a1_pixmap = load_masked_pixmap( 'plugin_system/plugins/dual_relay/relay_a1.bmp') self.a2_pixmap = load_masked_pixmap( 'plugin_system/plugins/dual_relay/relay_a2.bmp') self.b1_pixmap = load_masked_pixmap( 'plugin_system/plugins/dual_relay/relay_b1.bmp') self.b2_pixmap = load_masked_pixmap( 'plugin_system/plugins/dual_relay/relay_b2.bmp')
def __init__(self, *args): PluginBase.__init__(self, BrickletSolidStateRelay, *args) self.setupUi(self) self.ssr = self.device self.qtcb_monoflop.connect(self.cb_monoflop) self.ssr.register_callback(self.ssr.CALLBACK_MONOFLOP_DONE, self.qtcb_monoflop.emit) self.ssr_button.clicked.connect(self.ssr_clicked) self.go_button.clicked.connect(self.go_clicked) self.monoflop = False self.timebefore = 500 self.a_pixmap = load_masked_pixmap( 'plugin_system/plugins/solid_state_relay/relay_a.bmp') self.b_pixmap = load_masked_pixmap( 'plugin_system/plugins/solid_state_relay/relay_b.bmp') self.update_timer = QTimer() self.update_timer.timeout.connect(self.update) self.update_timer.setInterval(50)
def __init__(self, *args): COMCUPluginBase.__init__(self, BrickletIndustrialDualRelay, *args) self.setupUi(self) self.idr = self.device self.value0_combobox.setItemData(0, True) self.value0_combobox.setItemData(1, False) self.value1_combobox.setItemData(0, True) self.value1_combobox.setItemData(1, False) self.monoflop = Monoflop(self.idr, [0, 1], [self.value0_combobox, self.value1_combobox], self.cb_value_change_by_monoflop, [self.time0_spinbox, self.time1_spinbox], None, self) self.ch0_button.clicked.connect(self.ch0_clicked) self.ch1_button.clicked.connect(self.ch1_clicked) self.go0_button.clicked.connect(self.go0_clicked) self.go1_button.clicked.connect(self.go1_clicked) self.a0_pixmap = load_masked_pixmap('plugin_system/plugins/industrial_dual_relay/channel0_a.bmp') self.a1_pixmap = load_masked_pixmap('plugin_system/plugins/industrial_dual_relay/channel1_a.bmp') self.b0_pixmap = load_masked_pixmap('plugin_system/plugins/industrial_dual_relay/channel0_b.bmp') self.b1_pixmap = load_masked_pixmap('plugin_system/plugins/industrial_dual_relay/channel1_b.bmp')
def __init__(self, *args): COMCUPluginBase.__init__(self, BrickletIndustrialDigitalIn4V2, *args) self.setupUi(self) self.idi4 = self.device self.gnd_pixmap = load_masked_pixmap( 'plugin_system/plugins/industrial_digital_in_4/dio_gnd.bmp') self.vcc_pixmap = load_masked_pixmap( 'plugin_system/plugins/industrial_digital_in_4/dio_vcc.bmp') self.lbl_stat_i_ch = [ self.lbl_stat_i_ch0, self.lbl_stat_i_ch1, self.lbl_stat_i_ch2, self.lbl_stat_i_ch3 ] self.lbl_stat_v_ch = [ self.lbl_stat_v_ch0, self.lbl_stat_v_ch1, self.lbl_stat_v_ch2, self.lbl_stat_v_ch3 ] self.cbe_get_value = CallbackEmulator(self, self.idi4.get_value, None, self.cb_value, self.increase_error_count) self.cbox_cs0_cfg.currentIndexChanged.connect( self.cbox_cs0_cfg_changed) self.cbox_cs1_cfg.currentIndexChanged.connect( self.cbox_cs1_cfg_changed) self.cbox_cs2_cfg.currentIndexChanged.connect( self.cbox_cs2_cfg_changed) self.cbox_cs3_cfg.currentIndexChanged.connect( self.cbox_cs3_cfg_changed)
def __init__(self, *args): PluginBase.__init__(self, BrickletHeartRate, *args) self.hr = self.device self.cbe_heart_rate = CallbackEmulator(self.hr.get_heart_rate, self.cb_heart_rate, self.increase_error_count) # FIXME: add beat state getter to Heart Rate Bricklet API self.qtcb_beat_state_changed.connect(self.cb_beat_state_changed) self.hr.register_callback(self.hr.CALLBACK_BEAT_STATE_CHANGED, self.qtcb_beat_state_changed.emit) self.heart_rate_label = HeartRateLabel() self.heart_white_bitmap = load_masked_pixmap('plugin_system/plugins/heart_rate/heart_white_small.bmp') self.heart_red_bitmap = load_masked_pixmap('plugin_system/plugins/heart_rate/heart_red_small.bmp') self.heart_icon = QLabel() self.heart_icon.setPixmap(self.heart_white_bitmap) self.current_value = None plot_list = [['', Qt.red, self.get_current_value]] self.plot_widget = PlotWidget('Heart Rate [BPM]', plot_list) layout_h = QHBoxLayout() layout_h.addStretch() layout_h.addWidget(self.heart_rate_label) layout_h.addWidget(self.heart_icon) layout_h.addStretch() layout = QVBoxLayout(self) layout.addLayout(layout_h) layout.addWidget(self.plot_widget)
def __init__(self, *args): PluginBase.__init__(self, BrickletDualRelay, *args) self.setupUi(self) self.dr = self.device self.state1_combobox.setItemData(0, True) self.state1_combobox.setItemData(1, False) self.state2_combobox.setItemData(0, True) self.state2_combobox.setItemData(1, False) self.monoflop = Monoflop(self.dr, [1, 2], [self.state1_combobox, self.state2_combobox], self.cb_state_change_by_monoflop, [self.time1_spinbox, self.time2_spinbox], None, self) self.dr1_button.clicked.connect(self.dr1_clicked) self.dr2_button.clicked.connect(self.dr2_clicked) self.go1_button.clicked.connect(self.go1_clicked) self.go2_button.clicked.connect(self.go2_clicked) self.a1_pixmap = load_masked_pixmap('plugin_system/plugins/dual_relay/relay_a1.bmp') self.a2_pixmap = load_masked_pixmap('plugin_system/plugins/dual_relay/relay_a2.bmp') self.b1_pixmap = load_masked_pixmap('plugin_system/plugins/dual_relay/relay_b1.bmp') self.b2_pixmap = load_masked_pixmap('plugin_system/plugins/dual_relay/relay_b2.bmp')
def __init__(self, *args): super().__init__(BrickletTilt, *args) self.tilt = self.device self.cbe_tilt_state = CallbackEmulator(self.tilt.get_tilt_state, None, self.cb_tilt_state, self.increase_error_count) self.label = QLabel("Closed") self.closed_pixmap = load_masked_pixmap('plugin_system/plugins/tilt/tilt_closed.bmp') self.open_pixmap = load_masked_pixmap('plugin_system/plugins/tilt/tilt_open.bmp') self.closed_vibrationg_pixmap = load_masked_pixmap('plugin_system/plugins/tilt/tilt_closed_vibrating.bmp') self.image_label = QLabel("") self.image_label.setPixmap(self.closed_pixmap) layout = QVBoxLayout(self) layout.addStretch() h_layout1 = QHBoxLayout() h_layout1.addStretch() h_layout1.addWidget(self.label) h_layout1.addStretch() h_layout2 = QHBoxLayout() h_layout2.addStretch() h_layout2.addWidget(self.image_label) h_layout2.addStretch() layout.addLayout(h_layout1) layout.addLayout(h_layout2) layout.addStretch()
def __init__(self, *args): PluginBase.__init__(self, BrickletIndustrialDigitalIn4, *args) self.setupUi(self) self.idi4 = self.device self.gnd_pixmap = load_masked_pixmap('plugin_system/plugins/industrial_digital_in_4/dio_gnd.bmp') self.vcc_pixmap = load_masked_pixmap('plugin_system/plugins/industrial_digital_in_4/dio_vcc.bmp') self.pin_buttons = [self.b0, self.b1, self.b2, self.b3, self.b4, self.b5, self.b6, self.b7, self.b8, self.b9, self.b10, self.b11, self.b12, self.b13, self.b14, self.b15] self.pin_button_icons = [self.b0_icon, self.b1_icon, self.b2_icon, self.b3_icon, self.b4_icon, self.b5_icon, self.b6_icon, self.b7_icon, self.b8_icon, self.b9_icon, self.b10_icon, self.b11_icon, self.b12_icon, self.b13_icon, self.b14_icon, self.b15_icon] self.pin_button_labels = [self.b0_label, self.b1_label, self.b2_label, self.b3_label, self.b4_label, self.b5_label, self.b6_label, self.b7_label, self.b8_label, self.b9_label, self.b10_label, self.b11_label, self.b12_label, self.b13_label, self.b14_label, self.b15_label] self.groups = [self.group0, self.group1, self.group2, self.group3] self.lines = [[self.line0, self.line0a, self.line0b, self.line0c], [self.line1, self.line1a, self.line1b, self.line1c], [self.line2, self.line2a, self.line2b, self.line2c], [self.line3, self.line3a, self.line3b, self.line3c]] for lines in self.lines: for line in lines: line.setVisible(False) self.available_ports = 0 async_call(self.idi4.get_available_for_group, None, self.get_available_for_group_aysnc, self.increase_error_count) self.cbe_value = CallbackEmulator(self.idi4.get_value, self.cb_value, self.increase_error_count) self.set_group.clicked.connect(self.set_group_clicked) self.debounce_go.clicked.connect(self.debounce_go_clicked) self.reconfigure_everything()
def __init__(self, *args): super().__init__(BrickletHeartRate, *args) self.hr = self.device self.cbe_heart_rate = CallbackEmulator(self.hr.get_heart_rate, None, self.cb_heart_rate, self.increase_error_count) # FIXME: add beat state getter to Heart Rate Bricklet API self.qtcb_beat_state_changed.connect(self.cb_beat_state_changed) self.hr.register_callback(self.hr.CALLBACK_BEAT_STATE_CHANGED, self.qtcb_beat_state_changed.emit) self.heart_white_bitmap = load_masked_pixmap('plugin_system/plugins/heart_rate/heart_white_small.bmp') self.heart_red_bitmap = load_masked_pixmap('plugin_system/plugins/heart_rate/heart_red_small.bmp') self.heart_icon = QLabel() self.heart_icon.setPixmap(self.heart_white_bitmap) self.current_heart_rate = CurveValueWrapper() plots = [('Heart Rate', Qt.red, self.current_heart_rate, '{} BPM'.format)] self.plot_widget = PlotWidget('Heart Rate [BPM]', plots, extra_key_widgets=[self.heart_icon], y_resolution=1.0) layout = QVBoxLayout(self) layout.addWidget(self.plot_widget)
def __init__(self, *args): PluginBase.__init__(self, BrickletHeartRate, *args) self.hr = self.device self.cbe_heart_rate = CallbackEmulator(self.hr.get_heart_rate, self.cb_heart_rate, self.increase_error_count) # FIXME: add beat state getter to Heart Rate Bricklet API self.qtcb_beat_state_changed.connect(self.cb_beat_state_changed) self.hr.register_callback(self.hr.CALLBACK_BEAT_STATE_CHANGED, self.qtcb_beat_state_changed.emit) self.heart_white_bitmap = load_masked_pixmap('plugin_system/plugins/heart_rate/heart_white_small.bmp') self.heart_red_bitmap = load_masked_pixmap('plugin_system/plugins/heart_rate/heart_red_small.bmp') self.heart_icon = QLabel() self.heart_icon.setPixmap(self.heart_white_bitmap) self.current_heart_rate = None plots = [('Heart Rate', Qt.red, lambda: self.current_heart_rate, '{} BPM'.format)] self.plot_widget = PlotWidget('Heart Rate [BPM]', plots, extra_key_widgets=[self.heart_icon]) layout = QVBoxLayout(self) layout.addWidget(self.plot_widget)
def __init__(self, *args): COMCUPluginBase.__init__(self, BrickletIndustrialQuadRelayV2, *args) self.setupUi(self) self.iqr = self.device self.open_pixmap = load_masked_pixmap('plugin_system/plugins/industrial_quad_relay/relay_open.bmp') self.close_pixmap = load_masked_pixmap('plugin_system/plugins/industrial_quad_relay/relay_close.bmp') self.relay_buttons = [self.b0, self.b1, self.b2, self.b3] self.relay_button_icons = [self.b0_icon, self.b1_icon, self.b2_icon, self.b3_icon] self.relay_button_labels = [self.b0_label, self.b1_label, self.b2_label, self.b3_label] for icon in self.relay_button_icons: icon.setPixmap(self.open_pixmap) icon.show() for i in range(len(self.relay_buttons)): self.relay_buttons[i].clicked.connect(functools.partial(self.relay_button_clicked, i)) self.monoflop_values = [] self.monoflop_times = [] for i in range(4): self.monoflop_channel.setItemData(i, i) monoflop_value = QComboBox() monoflop_value.addItem('On', True) monoflop_value.addItem('Off', False) self.monoflop_values.append(monoflop_value) self.monoflop_value_stack.addWidget(monoflop_value) monoflop_time = QSpinBox() monoflop_time.setRange(1, (1 << 31) - 1) monoflop_time.setValue(1000) self.monoflop_times.append(monoflop_time) self.monoflop_time_stack.addWidget(monoflop_time) self.monoflop = Monoflop(self.iqr, [0, 1, 2, 3], self.monoflop_values, self.cb_value_change_by_monoflop, self.monoflop_times, None, self) self.monoflop_channel.currentIndexChanged.connect(self.monoflop_channel_changed) self.monoflop_go.clicked.connect(self.monoflop_go_clicked) self.cbox_cs0_cfg.currentIndexChanged.connect(self.cbox_cs0_cfg_changed) self.cbox_cs1_cfg.currentIndexChanged.connect(self.cbox_cs1_cfg_changed) self.cbox_cs2_cfg.currentIndexChanged.connect(self.cbox_cs2_cfg_changed) self.cbox_cs3_cfg.currentIndexChanged.connect(self.cbox_cs3_cfg_changed)
def __init__(self, *args): PluginBase.__init__(self, BrickletIndustrialDigitalIn4, *args) self.setupUi(self) self.idi4 = self.device self.gnd_pixmap = load_masked_pixmap( 'plugin_system/plugins/industrial_digital_in_4/dio_gnd.bmp') self.vcc_pixmap = load_masked_pixmap( 'plugin_system/plugins/industrial_digital_in_4/dio_vcc.bmp') self.pin_buttons = [ self.b0, self.b1, self.b2, self.b3, self.b4, self.b5, self.b6, self.b7, self.b8, self.b9, self.b10, self.b11, self.b12, self.b13, self.b14, self.b15 ] self.pin_button_icons = [ self.b0_icon, self.b1_icon, self.b2_icon, self.b3_icon, self.b4_icon, self.b5_icon, self.b6_icon, self.b7_icon, self.b8_icon, self.b9_icon, self.b10_icon, self.b11_icon, self.b12_icon, self.b13_icon, self.b14_icon, self.b15_icon ] self.pin_button_labels = [ self.b0_label, self.b1_label, self.b2_label, self.b3_label, self.b4_label, self.b5_label, self.b6_label, self.b7_label, self.b8_label, self.b9_label, self.b10_label, self.b11_label, self.b12_label, self.b13_label, self.b14_label, self.b15_label ] self.groups = [self.group0, self.group1, self.group2, self.group3] self.lines = [[self.line0, self.line0a, self.line0b, self.line0c], [self.line1, self.line1a, self.line1b, self.line1c], [self.line2, self.line2a, self.line2b, self.line2c], [self.line3, self.line3a, self.line3b, self.line3c]] for lines in self.lines: for line in lines: line.setVisible(False) self.available_ports = 0 async_call(self.idi4.get_available_for_group, None, self.get_available_for_group_aysnc, self.increase_error_count) self.cbe_value = CallbackEmulator(self, self.idi4.get_value, None, self.cb_value, self.increase_error_count) self.set_group.clicked.connect(self.set_group_clicked) self.debounce_go.clicked.connect(self.debounce_go_clicked) self.reconfigure_everything()
def __init__(self, *args): COMCUPluginBase.__init__(self, BrickletIndustrialQuadRelayV2, *args) self.setupUi(self) self.iqr = self.device self.open_pixmap = load_masked_pixmap( 'plugin_system/plugins/industrial_quad_relay/relay_open.bmp') self.close_pixmap = load_masked_pixmap( 'plugin_system/plugins/industrial_quad_relay/relay_close.bmp') self.relay_buttons = [self.b0, self.b1, self.b2, self.b3] self.relay_button_icons = [ self.b0_icon, self.b1_icon, self.b2_icon, self.b3_icon ] self.relay_button_labels = [ self.b0_label, self.b1_label, self.b2_label, self.b3_label ] for icon in self.relay_button_icons: icon.setPixmap(self.open_pixmap) icon.show() def get_button_lambda(button): return lambda: self.relay_button_clicked(button) for i in range(len(self.relay_buttons)): self.relay_buttons[i].clicked.connect(get_button_lambda(i)) self.qtcb_monoflop.connect(self.cb_monoflop) self.iqr.register_callback(self.iqr.CALLBACK_MONOFLOP_DONE, self.qtcb_monoflop.emit) self.monoflop_pin.currentIndexChanged.connect( self.monoflop_pin_changed) self.monoflop_go.clicked.connect(self.monoflop_go_clicked) self.monoflop_time_before = [1000] * 4 self.monoflop_pending = [False] * 4 self.update_timer = QTimer() self.update_timer.timeout.connect(self.update) self.update_timer.setInterval(50) self.cbox_cs0_cfg.currentIndexChanged.connect( self.cbox_cs0_cfg_changed) self.cbox_cs1_cfg.currentIndexChanged.connect( self.cbox_cs1_cfg_changed) self.cbox_cs2_cfg.currentIndexChanged.connect( self.cbox_cs2_cfg_changed) self.cbox_cs3_cfg.currentIndexChanged.connect( self.cbox_cs3_cfg_changed)
def __init__(self, *args): PluginBase.__init__(self, BrickletIndustrialQuadRelay, *args) self.setupUi(self) self.iqr = self.device self.open_pixmap = load_masked_pixmap('plugin_system/plugins/industrial_quad_relay/relay_open.bmp') self.close_pixmap = load_masked_pixmap('plugin_system/plugins/industrial_quad_relay/relay_close.bmp') self.relay_buttons = [self.b0, self.b1, self.b2, self.b3, self.b4, self.b5, self.b6, self.b7, self.b8, self.b9, self.b10, self.b11, self.b12, self.b13, self.b14, self.b15] self.relay_button_icons = [self.b0_icon, self.b1_icon, self.b2_icon, self.b3_icon, self.b4_icon, self.b5_icon, self.b6_icon, self.b7_icon, self.b8_icon, self.b9_icon, self.b10_icon, self.b11_icon, self.b12_icon, self.b13_icon, self.b14_icon, self.b15_icon] self.relay_button_labels = [self.b0_label, self.b1_label, self.b2_label, self.b3_label, self.b4_label, self.b5_label, self.b6_label, self.b7_label, self.b8_label, self.b9_label, self.b10_label, self.b11_label, self.b12_label, self.b13_label, self.b14_label, self.b15_label] self.groups = [self.group0, self.group1, self.group2, self.group3] for icon in self.relay_button_icons: icon.setPixmap(self.open_pixmap) icon.show() self.lines = [[self.line0, self.line0a, self.line0b, self.line0c], [self.line1, self.line1a, self.line1b, self.line1c], [self.line2, self.line2a, self.line2b, self.line2c], [self.line3, self.line3a, self.line3b, self.line3c]] for lines in self.lines: for line in lines: line.setVisible(False) self.available_ports = 0 async_call(self.iqr.get_available_for_group, None, self.get_available_for_group_aysnc, self.increase_error_count) def get_button_lambda(button): return lambda: self.relay_button_clicked(button) for i in range(len(self.relay_buttons)): self.relay_buttons[i].clicked.connect(get_button_lambda(i)) self.qtcb_monoflop.connect(self.cb_monoflop) self.iqr.register_callback(self.iqr.CALLBACK_MONOFLOP_DONE, self.qtcb_monoflop.emit) self.set_group.clicked.connect(self.set_group_clicked) self.monoflop_pin.currentIndexChanged.connect(self.monoflop_pin_changed) self.monoflop_go.clicked.connect(self.monoflop_go_clicked) self.monoflop_time_before = [1000] * 16 self.monoflop_pending = [False] * 16 self.update_timer = QTimer() self.update_timer.timeout.connect(self.update) self.update_timer.setInterval(50) self.reconfigure_everything()
def __init__(self, *args): PluginBase.__init__(self, BrickletIndustrialDigitalOut4, *args) self.setupUi(self) self.ido4 = self.device self.gnd_pixmap = load_masked_pixmap('plugin_system/plugins/industrial_digital_out_4/dio_gnd.bmp') self.vcc_pixmap = load_masked_pixmap('plugin_system/plugins/industrial_digital_out_4/dio_vcc.bmp') self.pin_buttons = [self.b0, self.b1, self.b2, self.b3, self.b4, self.b5, self.b6, self.b7, self.b8, self.b9, self.b10, self.b11, self.b12, self.b13, self.b14, self.b15] self.pin_button_icons = [self.b0_icon, self.b1_icon, self.b2_icon, self.b3_icon, self.b4_icon, self.b5_icon, self.b6_icon, self.b7_icon, self.b8_icon, self.b9_icon, self.b10_icon, self.b11_icon, self.b12_icon, self.b13_icon, self.b14_icon, self.b15_icon] self.pin_button_labels = [self.b0_label, self.b1_label, self.b2_label, self.b3_label, self.b4_label, self.b5_label, self.b6_label, self.b7_label, self.b8_label, self.b9_label, self.b10_label, self.b11_label, self.b12_label, self.b13_label, self.b14_label, self.b15_label] self.groups = [self.group0, self.group1, self.group2, self.group3] for icon in self.pin_button_icons: icon.setPixmap(self.gnd_pixmap) icon.show() self.lines = [[self.line0, self.line0a, self.line0b, self.line0c], [self.line1, self.line1a, self.line1b, self.line1c], [self.line2, self.line2a, self.line2b, self.line2c], [self.line3, self.line3a, self.line3b, self.line3c]] for lines in self.lines: for line in lines: line.setVisible(False) self.available_ports = 0 async_call(self.ido4.get_available_for_group, None, self.get_available_for_group_aysnc, self.increase_error_count) def get_button_lambda(button): return lambda: self.pin_button_clicked(button) for i in range(len(self.pin_buttons)): self.pin_buttons[i].clicked.connect(get_button_lambda(i)) self.qtcb_monoflop.connect(self.cb_monoflop) self.ido4.register_callback(self.ido4.CALLBACK_MONOFLOP_DONE, self.qtcb_monoflop.emit) self.set_group.clicked.connect(self.set_group_clicked) self.monoflop_pin.currentIndexChanged.connect(self.monoflop_pin_changed) self.monoflop_go.clicked.connect(self.monoflop_go_clicked) self.monoflop_time_before = [1000] * 16 self.monoflop_pending = [False] * 16 self.update_timer = QTimer() self.update_timer.timeout.connect(self.update) self.update_timer.setInterval(50) self.reconfigure_everything()
def __init__(self, *args): PluginBase.__init__(self, BrickletDualRelay, *args) self.setupUi(self) self.dr = self.device self.has_monoflop = self.firmware_version >= (1, 1, 1) self.qtcb_monoflop.connect(self.cb_monoflop) self.dr.register_callback(self.dr.CALLBACK_MONOFLOP_DONE, self.qtcb_monoflop.emit) self.dr1_button.clicked.connect(self.dr1_clicked) self.dr2_button.clicked.connect(self.dr2_clicked) self.go1_button.clicked.connect(self.go1_clicked) self.go2_button.clicked.connect(self.go2_clicked) self.r1_monoflop = False self.r2_monoflop = False self.r1_timebefore = 500 self.r2_timebefore = 500 self.a1_pixmap = load_masked_pixmap( 'plugin_system/plugins/dual_relay/relay_a1.bmp') self.a2_pixmap = load_masked_pixmap( 'plugin_system/plugins/dual_relay/relay_a2.bmp') self.b1_pixmap = load_masked_pixmap( 'plugin_system/plugins/dual_relay/relay_b1.bmp') self.b2_pixmap = load_masked_pixmap( 'plugin_system/plugins/dual_relay/relay_b2.bmp') self.update_timer = QTimer() self.update_timer.timeout.connect(self.update) self.update_timer.setInterval(50) if not self.has_monoflop: self.go1_button.setText("Go (FW Versiom >= 1.1.1 required)") self.go2_button.setText("Go (FW Versiom >= 1.1.1 required)") self.go1_button.setEnabled(False) self.go2_button.setEnabled(False)
def __init__(self, *args): COMCUPluginBase.__init__(self, BrickletSolidStateRelayV2, *args) self.setupUi(self) self.ssr = self.device self.state_combobox.setItemData(0, True) self.state_combobox.setItemData(1, False) self.monoflop = Monoflop(self.ssr, None, self.state_combobox, self.cb_state_change_by_monoflop, self.time_spinbox, None, self) self.ssr_button.clicked.connect(self.ssr_clicked) self.go_button.clicked.connect(self.go_clicked) self.a_pixmap = load_masked_pixmap( 'plugin_system/plugins/solid_state_relay/relay_a.bmp') self.b_pixmap = load_masked_pixmap( 'plugin_system/plugins/solid_state_relay/relay_b.bmp')
def __init__(self, *args): PluginBase.__init__(self, BrickletDualRelay, *args) self.setupUi(self) self.dr = self.device self.has_monoflop = self.firmware_version >= (1, 1, 1) self.qtcb_monoflop.connect(self.cb_monoflop) self.dr.register_callback(self.dr.CALLBACK_MONOFLOP_DONE, self.qtcb_monoflop.emit) self.dr1_button.clicked.connect(self.dr1_clicked) self.dr2_button.clicked.connect(self.dr2_clicked) self.go1_button.clicked.connect(self.go1_clicked) self.go2_button.clicked.connect(self.go2_clicked) self.r1_monoflop = False self.r2_monoflop = False self.r1_timebefore = 500 self.r2_timebefore = 500 self.a1_pixmap = load_masked_pixmap('plugin_system/plugins/dual_relay/relay_a1.bmp') self.a2_pixmap = load_masked_pixmap('plugin_system/plugins/dual_relay/relay_a2.bmp') self.b1_pixmap = load_masked_pixmap('plugin_system/plugins/dual_relay/relay_b1.bmp') self.b2_pixmap = load_masked_pixmap('plugin_system/plugins/dual_relay/relay_b2.bmp') self.update_timer = QTimer() self.update_timer.timeout.connect(self.update) self.update_timer.setInterval(50) if not self.has_monoflop: self.go1_button.setText("Go (FW Versiom >= 1.1.1 required)") self.go2_button.setText("Go (FW Versiom >= 1.1.1 required)") self.go1_button.setEnabled(False) self.go2_button.setEnabled(False)
def __init__(self, *args): COMCUPluginBase.__init__(self, BrickletIndustrialDigitalIn4V2, *args) self.setupUi(self) self.idi4 = self.device self.gnd_pixmap = load_masked_pixmap('plugin_system/plugins/industrial_digital_in_4/dio_gnd.bmp') self.vcc_pixmap = load_masked_pixmap('plugin_system/plugins/industrial_digital_in_4/dio_vcc.bmp') self.lbl_stat_i_ch = [self.lbl_stat_i_ch0, self.lbl_stat_i_ch1, self.lbl_stat_i_ch2, self.lbl_stat_i_ch3] self.lbl_stat_v_ch = [self.lbl_stat_v_ch0, self.lbl_stat_v_ch1, self.lbl_stat_v_ch2, self.lbl_stat_v_ch3] self.cbe_get_value = CallbackEmulator(self.idi4.get_value, None, self.cb_value, self.increase_error_count) self.cbox_cs0_cfg.currentIndexChanged.connect(self.cbox_cs0_cfg_changed) self.cbox_cs1_cfg.currentIndexChanged.connect(self.cbox_cs1_cfg_changed) self.cbox_cs2_cfg.currentIndexChanged.connect(self.cbox_cs2_cfg_changed) self.cbox_cs3_cfg.currentIndexChanged.connect(self.cbox_cs3_cfg_changed)
def __init__(self, *args): COMCUPluginBase.__init__(self, BrickletSolidStateRelayV2, *args) self.setupUi(self) self.ssr = self.device self.state_combobox.setItemData(0, True) self.state_combobox.setItemData(1, False) self.monoflop = Monoflop(self.ssr, None, self.state_combobox, self.cb_state_change_by_monoflop, self.time_spinbox, None, self) self.ssr_button.clicked.connect(self.ssr_clicked) self.go_button.clicked.connect(self.go_clicked) self.a_pixmap = load_masked_pixmap('plugin_system/plugins/solid_state_relay/relay_a.bmp') self.b_pixmap = load_masked_pixmap('plugin_system/plugins/solid_state_relay/relay_b.bmp')
def __init__(self, *args): PluginBase.__init__(self, BrickletSolidStateRelay, *args) self.setupUi(self) self.ssr = self.device self.qtcb_monoflop.connect(self.cb_monoflop) self.ssr.register_callback(self.ssr.CALLBACK_MONOFLOP_DONE, self.qtcb_monoflop.emit) self.ssr_button.clicked.connect(self.ssr_clicked) self.go_button.clicked.connect(self.go_clicked) self.monoflop = False self.timebefore = 500 self.a_pixmap = load_masked_pixmap('plugin_system/plugins/solid_state_relay/relay_a.bmp') self.b_pixmap = load_masked_pixmap('plugin_system/plugins/solid_state_relay/relay_b.bmp') self.update_timer = QTimer() self.update_timer.timeout.connect(self.update) self.update_timer.setInterval(50)
def __init__(self, *args): PluginBase.__init__(self, BrickletHeartRate, *args) self.hr = self.device self.cbe_heart_rate = CallbackEmulator(self.hr.get_heart_rate, self.cb_heart_rate, self.increase_error_count) # FIXME: add beat state getter to Heart Rate Bricklet API self.qtcb_beat_state_changed.connect(self.cb_beat_state_changed) self.hr.register_callback(self.hr.CALLBACK_BEAT_STATE_CHANGED, self.qtcb_beat_state_changed.emit) self.heart_rate_label = HeartRateLabel() self.heart_white_bitmap = load_masked_pixmap( 'plugin_system/plugins/heart_rate/heart_white_small.bmp') self.heart_red_bitmap = load_masked_pixmap( 'plugin_system/plugins/heart_rate/heart_red_small.bmp') self.heart_icon = QLabel() self.heart_icon.setPixmap(self.heart_white_bitmap) self.current_value = None plot_list = [['', Qt.red, self.get_current_value]] self.plot_widget = PlotWidget('Heart Rate [BPM]', plot_list) layout_h = QHBoxLayout() layout_h.addStretch() layout_h.addWidget(self.heart_rate_label) layout_h.addWidget(self.heart_icon) layout_h.addStretch() layout = QVBoxLayout(self) layout.addLayout(layout_h) layout.addWidget(self.plot_widget)
def __init__(self, *args): COMCUPluginBase.__init__(self, BrickletIndustrialDigitalOut4V2, *args) self.setupUi(self) self.ido4 = self.device self.has_monoflop_abort = None self.pixmap_low = load_masked_pixmap('plugin_system/plugins/industrial_digital_out_4_v2/ido4_low.bmp') self.pixmap_high = load_masked_pixmap('plugin_system/plugins/industrial_digital_out_4_v2/ido4_high.bmp') self.btn_v_c = [self.btn_v_c0, self.btn_v_c1, self.btn_v_c2, self.btn_v_c3] self.lbl_s_i_c = [self.lbl_s_i_c0, self.lbl_s_i_c1, self.lbl_s_i_c2, self.lbl_s_i_c3] self.cbox_clc_c = [self.cbox_clc_c0, self.cbox_clc_c1, self.cbox_clc_c2, self.cbox_clc_c3] # Set initial channel status icon for lbl in self.lbl_s_i_c: lbl.setPixmap(self.pixmap_low) # Register value toggle button slots for c, b in enumerate(self.btn_v_c): b.clicked.connect(functools.partial(self.btn_v_c_clicked, c)) # Monoflop self.cbox_m_c.currentIndexChanged.connect(self.cbox_m_c_changed) self.btn_m_go.clicked.connect(self.btn_m_go_clicked) self.monoflop_values = [] self.monoflop_times = [] for i in range(4): self.cbox_m_c.setItemData(i, i) monoflop_value = QComboBox() monoflop_value.addItem('High', True) monoflop_value.addItem('Low', False) self.monoflop_values.append(monoflop_value) self.monoflop_value_stack.addWidget(monoflop_value) monoflop_time = QSpinBox() monoflop_time.setRange(1, (1 << 31) - 1) monoflop_time.setValue(1000) self.monoflop_times.append(monoflop_time) self.monoflop_time_stack.addWidget(monoflop_time) self.monoflop = Monoflop(self.ido4, [0, 1, 2, 3], self.monoflop_values, self.cb_value_change_by_monoflop, self.monoflop_times, None, self) # Channel status LED config self.cbox_clc_c0.currentIndexChanged.connect(self.cbox_clc_c0_changed) self.cbox_clc_c1.currentIndexChanged.connect(self.cbox_clc_c1_changed) self.cbox_clc_c2.currentIndexChanged.connect(self.cbox_clc_c2_changed) self.cbox_clc_c3.currentIndexChanged.connect(self.cbox_clc_c3_changed)
def __init__(self, *args): COMCUPluginBase.__init__(self, BrickletIndustrialDigitalOut4V2, *args) self.setupUi(self) self.ido4 = self.device self.pixmap_low = load_masked_pixmap( 'plugin_system/plugins/industrial_digital_out_4_v2/ido4_low.bmp') self.pixmap_high = load_masked_pixmap( 'plugin_system/plugins/industrial_digital_out_4_v2/ido4_high.bmp') self.btn_v_c = [{ 'btn': self.btn_v_c0, 'state': False }, { 'btn': self.btn_v_c1, 'state': False }, { 'btn': self.btn_v_c2, 'state': False }, { 'btn': self.btn_v_c3, 'state': False }] self.lbl_s_i_c = [ self.lbl_s_i_c0, self.lbl_s_i_c1, self.lbl_s_i_c2, self.lbl_s_i_c3 ] self.cbox_clc_c = [ self.cbox_clc_c0, self.cbox_clc_c1, self.cbox_clc_c2, self.cbox_clc_c3 ] # Set initial channel status icon for lbl in self.lbl_s_i_c: lbl.setPixmap(self.pixmap_low) def get_button_lambda(channel): return lambda: self.btn_v_c_clicked(channel) # Register value toggle button slots for c, b in enumerate(self.btn_v_c): b['btn'].clicked.connect(get_button_lambda(c)) # Monoflop self.qtcb_monoflop.connect(self.cb_monoflop_done) self.ido4.register_callback(self.ido4.CALLBACK_MONOFLOP_DONE, self.qtcb_monoflop.emit) self.cbox_m_c.currentIndexChanged.connect(self.cbox_m_c_changed) self.btn_m_go.clicked.connect(self.btn_m_go_clicked) self.monoflop_time_before = [1000] * 4 self.monoflop_pending = [False] * 4 self.update_timer = QTimer() self.update_timer.timeout.connect(self.update) self.update_timer.setInterval(50) # Channel status LED config self.cbox_clc_c0.currentIndexChanged.connect(self.cbox_clc_c0_changed) self.cbox_clc_c1.currentIndexChanged.connect(self.cbox_clc_c1_changed) self.cbox_clc_c2.currentIndexChanged.connect(self.cbox_clc_c2_changed) self.cbox_clc_c3.currentIndexChanged.connect(self.cbox_clc_c3_changed)
def __init__(self, *args): COMCUPluginBase.__init__(self, BrickletIndustrialQuadRelayV2, *args) self.setupUi(self) self.iqr = self.device self.open_pixmap = load_masked_pixmap( 'plugin_system/plugins/industrial_quad_relay/relay_open.bmp') self.close_pixmap = load_masked_pixmap( 'plugin_system/plugins/industrial_quad_relay/relay_close.bmp') self.relay_buttons = [self.b0, self.b1, self.b2, self.b3] self.relay_button_icons = [ self.b0_icon, self.b1_icon, self.b2_icon, self.b3_icon ] self.relay_button_labels = [ self.b0_label, self.b1_label, self.b2_label, self.b3_label ] for icon in self.relay_button_icons: icon.setPixmap(self.open_pixmap) icon.show() for i in range(len(self.relay_buttons)): self.relay_buttons[i].clicked.connect( functools.partial(self.relay_button_clicked, i)) self.monoflop_values = [] self.monoflop_times = [] for i in range(4): self.monoflop_channel.setItemData(i, i) monoflop_value = QComboBox() monoflop_value.addItem('On', True) monoflop_value.addItem('Off', False) self.monoflop_values.append(monoflop_value) self.monoflop_value_stack.addWidget(monoflop_value) monoflop_time = QSpinBox() monoflop_time.setRange(1, (1 << 31) - 1) monoflop_time.setValue(1000) self.monoflop_times.append(monoflop_time) self.monoflop_time_stack.addWidget(monoflop_time) self.monoflop = Monoflop(self.iqr, [0, 1, 2, 3], self.monoflop_values, self.cb_value_change_by_monoflop, self.monoflop_times, None, self) self.monoflop_channel.currentIndexChanged.connect( self.monoflop_channel_changed) self.monoflop_go.clicked.connect(self.monoflop_go_clicked) self.cbox_cs0_cfg.currentIndexChanged.connect( self.cbox_cs0_cfg_changed) self.cbox_cs1_cfg.currentIndexChanged.connect( self.cbox_cs1_cfg_changed) self.cbox_cs2_cfg.currentIndexChanged.connect( self.cbox_cs2_cfg_changed) self.cbox_cs3_cfg.currentIndexChanged.connect( self.cbox_cs3_cfg_changed)
def __init__(self, *args): PluginBase.__init__(self, BrickletIndustrialQuadRelay, *args) self.setupUi(self) self.iqr = self.device self.open_pixmap = load_masked_pixmap( 'plugin_system/plugins/industrial_quad_relay/relay_open.bmp') self.close_pixmap = load_masked_pixmap( 'plugin_system/plugins/industrial_quad_relay/relay_close.bmp') self.relay_buttons = [ self.b0, self.b1, self.b2, self.b3, self.b4, self.b5, self.b6, self.b7, self.b8, self.b9, self.b10, self.b11, self.b12, self.b13, self.b14, self.b15 ] self.relay_button_icons = [ self.b0_icon, self.b1_icon, self.b2_icon, self.b3_icon, self.b4_icon, self.b5_icon, self.b6_icon, self.b7_icon, self.b8_icon, self.b9_icon, self.b10_icon, self.b11_icon, self.b12_icon, self.b13_icon, self.b14_icon, self.b15_icon ] self.relay_button_labels = [ self.b0_label, self.b1_label, self.b2_label, self.b3_label, self.b4_label, self.b5_label, self.b6_label, self.b7_label, self.b8_label, self.b9_label, self.b10_label, self.b11_label, self.b12_label, self.b13_label, self.b14_label, self.b15_label ] self.groups = [self.group0, self.group1, self.group2, self.group3] for icon in self.relay_button_icons: icon.setPixmap(self.open_pixmap) icon.show() self.lines = [[self.line0, self.line0a, self.line0b, self.line0c], [self.line1, self.line1a, self.line1b, self.line1c], [self.line2, self.line2a, self.line2b, self.line2c], [self.line3, self.line3a, self.line3b, self.line3c]] for lines in self.lines: for line in lines: line.setVisible(False) self.available_ports = 0 for i in range(16): self.relay_buttons[i].clicked.connect( functools.partial(self.relay_button_clicked, i)) self.monoflop_values = [] self.monoflop_times = [] for i in range(16): monoflop_value = QComboBox() monoflop_value.addItem('On', 1) monoflop_value.addItem('Off', 0) self.monoflop_values.append(monoflop_value) self.monoflop_value_stack.addWidget(monoflop_value) monoflop_time = QDoubleSpinBox() self.monoflop_times.append(monoflop_time) self.monoflop_time_stack.addWidget(monoflop_time) self.monoflop = Monoflop( self.iqr, list(range(16)), self.monoflop_values, self.cb_value_change_by_monoflop, self.monoflop_times, None, self, setter_uses_bitmasks=True, callback_uses_bitmasks=True, handle_get_monoflop_invalid_parameter_as_abort=True) self.set_group.clicked.connect(self.set_group_clicked) self.monoflop_pin.currentIndexChanged.connect( self.monoflop_pin_changed) self.monoflop_go.clicked.connect(self.monoflop_go_clicked)
def __init__(self, *args): PluginBase.__init__(self, BrickletIndustrialDigitalOut4, *args) self.setupUi(self) self.ido4 = self.device self.gnd_pixmap = load_masked_pixmap('plugin_system/plugins/industrial_digital_out_4/dio_gnd.bmp') self.vcc_pixmap = load_masked_pixmap('plugin_system/plugins/industrial_digital_out_4/dio_vcc.bmp') self.pin_buttons = [self.b0, self.b1, self.b2, self.b3, self.b4, self.b5, self.b6, self.b7, self.b8, self.b9, self.b10, self.b11, self.b12, self.b13, self.b14, self.b15] self.pin_button_icons = [self.b0_icon, self.b1_icon, self.b2_icon, self.b3_icon, self.b4_icon, self.b5_icon, self.b6_icon, self.b7_icon, self.b8_icon, self.b9_icon, self.b10_icon, self.b11_icon, self.b12_icon, self.b13_icon, self.b14_icon, self.b15_icon] self.pin_button_labels = [self.b0_label, self.b1_label, self.b2_label, self.b3_label, self.b4_label, self.b5_label, self.b6_label, self.b7_label, self.b8_label, self.b9_label, self.b10_label, self.b11_label, self.b12_label, self.b13_label, self.b14_label, self.b15_label] self.groups = [self.group0, self.group1, self.group2, self.group3] for icon in self.pin_button_icons: icon.setPixmap(self.gnd_pixmap) icon.show() self.lines = [[self.line0, self.line0a, self.line0b, self.line0c], [self.line1, self.line1a, self.line1b, self.line1c], [self.line2, self.line2a, self.line2b, self.line2c], [self.line3, self.line3a, self.line3b, self.line3c]] for lines in self.lines: for line in lines: line.setVisible(False) self.available_ports = 0 for i in range(len(self.pin_buttons)): self.pin_buttons[i].clicked.connect(functools.partial(self.pin_button_clicked, i)) self.monoflop_states = [] self.monoflop_times = [] for i in range(16): monoflop_state = QComboBox() monoflop_state.addItem('High', 1) monoflop_state.addItem('Low', 0) self.monoflop_states.append(monoflop_state) self.monoflop_state_stack.addWidget(monoflop_state) monoflop_time = QSpinBox() monoflop_time.setRange(1, (1 << 31) - 1) monoflop_time.setValue(1000) self.monoflop_times.append(monoflop_time) self.monoflop_time_stack.addWidget(monoflop_time) self.monoflop = Monoflop(self.ido4, list(range(16)), self.monoflop_states, self.cb_state_change_by_monoflop, self.monoflop_times, None, self, setter_uses_bitmasks=True, callback_uses_bitmasks=True, handle_get_monoflop_invalid_parameter_as_abort=True) self.set_group.clicked.connect(self.set_group_clicked) self.monoflop_pin.currentIndexChanged.connect(self.monoflop_pin_changed) self.monoflop_go.clicked.connect(self.monoflop_go_clicked)
def __init__(self, *args): COMCUPluginBase.__init__(self, BrickletIndustrialDigitalOut4V2, *args) self.setupUi(self) self.ido4 = self.device self.has_monoflop_abort = None self.pixmap_low = load_masked_pixmap( 'plugin_system/plugins/industrial_digital_out_4_v2/ido4_low.bmp') self.pixmap_high = load_masked_pixmap( 'plugin_system/plugins/industrial_digital_out_4_v2/ido4_high.bmp') self.btn_v_c = [ self.btn_v_c0, self.btn_v_c1, self.btn_v_c2, self.btn_v_c3 ] self.lbl_s_i_c = [ self.lbl_s_i_c0, self.lbl_s_i_c1, self.lbl_s_i_c2, self.lbl_s_i_c3 ] self.cbox_clc_c = [ self.cbox_clc_c0, self.cbox_clc_c1, self.cbox_clc_c2, self.cbox_clc_c3 ] # Set initial channel status icon for lbl in self.lbl_s_i_c: lbl.setPixmap(self.pixmap_low) # Register value toggle button slots for c, b in enumerate(self.btn_v_c): b.clicked.connect(functools.partial(self.btn_v_c_clicked, c)) # Monoflop self.cbox_m_c.currentIndexChanged.connect(self.cbox_m_c_changed) self.btn_m_go.clicked.connect(self.btn_m_go_clicked) self.monoflop_values = [] self.monoflop_times = [] for i in range(4): self.cbox_m_c.setItemData(i, i) monoflop_value = QComboBox() monoflop_value.addItem('High', True) monoflop_value.addItem('Low', False) self.monoflop_values.append(monoflop_value) self.monoflop_value_stack.addWidget(monoflop_value) monoflop_time = QDoubleSpinBox() self.monoflop_times.append(monoflop_time) self.monoflop_time_stack.addWidget(monoflop_time) self.monoflop = Monoflop(self.ido4, [0, 1, 2, 3], self.monoflop_values, self.cb_value_change_by_monoflop, self.monoflop_times, None, self) # Channel status LED config self.cbox_clc_c0.currentIndexChanged.connect(self.cbox_clc_c0_changed) self.cbox_clc_c1.currentIndexChanged.connect(self.cbox_clc_c1_changed) self.cbox_clc_c2.currentIndexChanged.connect(self.cbox_clc_c2_changed) self.cbox_clc_c3.currentIndexChanged.connect(self.cbox_clc_c3_changed)