def __init__(self, ipcon, uid, version):
        PluginBase.__init__(self, ipcon, uid, 'Industrial Digital In 4 Bricklet', version)
        
        self.setupUi(self)
        
        self.idi4 = BrickletIndustrialDigitalIn4(uid, ipcon)
        
        self.gnd_pixmap = bmp_to_pixmap('plugin_system/plugins/industrial_digital_in_4/dio_gnd.bmp')
        self.vcc_pixmap = bmp_to_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.qtcb_interrupt.connect(self.cb_interrupt)
        self.idi4.register_callback(self.idi4.CALLBACK_INTERRUPT,
                                    self.qtcb_interrupt.emit)
        
        self.set_group.pressed.connect(self.set_group_pressed)
        
        self.debounce_go.pressed.connect(self.debounce_go_pressed)
        
        self.reconfigure_everything()
Beispiel #2
0
    def __init__(self, ipcon, uid, version):
        PluginBase.__init__(self, ipcon, uid, 'Heart Rate Bricklet', version)
        
        self.hr = BrickletHeartRate(uid, ipcon)
        
        self.qtcb_heart_rate.connect(self.cb_heart_rate)
        self.hr.register_callback(self.hr.CALLBACK_HEART_RATE,
                                  self.qtcb_heart_rate.emit) 
        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 = bmp_to_pixmap('plugin_system/plugins/heart_rate/heart_white_small.bmp')
        self.heart_red_bitmap = bmp_to_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)
Beispiel #3
0
    def __init__(self, ipcon, uid, version):
        PluginBase.__init__(self, ipcon, uid, 'Tilt Bricklet', version)

        self.tilt = BrickletTilt(uid, ipcon)
        
        self.qtcb_tilt_state.connect(self.cb_tilt_state)
        self.tilt.register_callback(self.tilt.CALLBACK_TILT_STATE,
                                    self.qtcb_tilt_state.emit)
        
        self.label = QLabel("Closed")
        self.closed_pixmap = bmp_to_pixmap('plugin_system/plugins/tilt/tilt_closed.bmp')
        self.open_pixmap = bmp_to_pixmap('plugin_system/plugins/tilt/tilt_open.bmp')
        self.closed_vibrationg_pixmap = bmp_to_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, ipcon, uid, version):
        PluginBase.__init__(self, ipcon, uid, 'Industrial Quad Relay Bricklet', version)
        
        self.setupUi(self)
        
        self.iqr = BrickletIndustrialQuadRelay(uid, ipcon)
        
        self.open_pixmap = bmp_to_pixmap('plugin_system/plugins/industrial_quad_relay/relay_open.bmp')
        self.close_pixmap = bmp_to_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_pressed(button)
        
        for i in range(len(self.relay_buttons)):
            self.relay_buttons[i].pressed.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.pressed.connect(self.set_group_pressed)

        self.monoflop_pin.currentIndexChanged.connect(self.monoflop_pin_changed)
        self.monoflop_go.pressed.connect(self.monoflop_go_pressed)
        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()
Beispiel #5
0
    def __init__(self, ipcon, uid, version):
        PluginBase.__init__(self, ipcon, uid, "Dual Relay Bricklet", version)

        self.setupUi(self)

        self.dr = BrickletDualRelay(uid, ipcon)

        self.has_monoflop = 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.pressed.connect(self.dr1_pressed)
        self.dr2_button.pressed.connect(self.dr2_pressed)

        self.go1_button.pressed.connect(self.go1_pressed)
        self.go2_button.pressed.connect(self.go2_pressed)

        self.r1_monoflop = False
        self.r2_monoflop = False

        self.r1_timebefore = 500
        self.r2_timebefore = 500

        self.a1_pixmap = bmp_to_pixmap("plugin_system/plugins/dual_relay/relay_a1.bmp")
        self.a2_pixmap = bmp_to_pixmap("plugin_system/plugins/dual_relay/relay_a2.bmp")
        self.b1_pixmap = bmp_to_pixmap("plugin_system/plugins/dual_relay/relay_b1.bmp")
        self.b2_pixmap = bmp_to_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 (Firmware > 1.1.0 needed)")
            self.go2_button.setText("Go (Firmware > 1.1.0 needed)")
            self.go1_button.setEnabled(False)
            self.go2_button.setEnabled(False)