Exemplo n.º 1
0
    def __init__(self, plot_widget):
        super(SelectChannelWidget, self).__init__()

        self.plot_widget = plot_widget

        self.layout = QtGui.QGridLayout()

        self.adc_checkbox = []
        for i in range(2):
            self.adc_checkbox.append(QtGui.QCheckBox('ADC ' + str(i + 1),
                                                     self))
            self.adc_checkbox[i].setCheckState(QtCore.Qt.Checked)
            self.layout.addWidget(self.adc_checkbox[i], 0, i,
                                  QtCore.Qt.AlignCenter)

        self.dac_checkbox = []
        for i in range(2):
            self.dac_checkbox.append(QtGui.QCheckBox('DAC ' + str(i + 1),
                                                     self))
            self.dac_checkbox[i].setCheckState(QtCore.Qt.Unchecked)
            self.layout.addWidget(self.dac_checkbox[i], 1, i,
                                  QtCore.Qt.AlignCenter)

        # Connections
        self.adc_checkbox[0].stateChanged.connect(lambda: self.show_adc(0))
        self.adc_checkbox[1].stateChanged.connect(lambda: self.show_adc(1))
        self.dac_checkbox[0].stateChanged.connect(lambda: self.show_dac(0))
        self.dac_checkbox[1].stateChanged.connect(lambda: self.show_dac(1))
    def __init__(self, app, amaps, smaps, kin, simulation):

        super(Plotter, self).__init__()
        self.amaps = amaps
        self.smaps = smaps
        self.kin = kin

        screen_resolution = app.desktop().screenGeometry()
        _, height = screen_resolution.width(), screen_resolution.height()

        self.LEFT = height * (2 / 20.)
        self.TOP = height * (2 / 20.)
        self.WIDTH = height * (6 / 20.)
        self.HEIGHT = height * (6 / 20.)

        self.setGeometry(self.LEFT, self.TOP, self.WIDTH, self.HEIGHT)
        self.setWindowTitle("MainBoard")

        self.amapsButton = QtGui.QCheckBox('Abstraction Maps', self)
        self.amapsButton.clicked.connect(self.onAMapsButton)
        self.amapsButton.move(20, 20)
        self.amaps_toggle = False

        self.smapsButton = QtGui.QCheckBox('Selection Maps', self)
        self.smapsButton.clicked.connect(self.onSMapsButton)
        self.smapsButton.move(20, 50)
        self.smaps_toggle = False

        self.kinButton = QtGui.QCheckBox('Kinematics', self)
        self.kinButton.clicked.connect(self.onKinButton)
        self.kinButton.move(20, 80)
        self.kin_toggle = False

        self.simButton = QtGui.QPushButton('Run', self)
        self.simButton.clicked.connect(self.onSimButton)
        self.simButton.setAutoDefault(False)
        self.simButton.setFlat(False)
        self.simButton.move(20, 110)
        self.sim_toggle = False

        self.slider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
        self.slider.setFocusPolicy(QtCore.Qt.NoFocus)
        self.slider.setGeometry(20, 160, 120, 10)
        self.slider.valueChanged[int].connect(self.changeValue)
        self.label = QtGui.QLabel(self)
        self.label.setGeometry(150, 160, 60, 10)
        self.label.setText("speed")

        self.simulation = simulation

        self.max_duration = 1000
        self.min_duration = 0.0001
        self.interval = (self.max_duration - self.min_duration) / 100.0
        self.ts_duration = 1
        self.slider.setValue(
            int((self.ts_duration - self.max_duration) / self.interval))
        self.show()
Exemplo n.º 3
0
    def __init__(self, workingdirectory=None, filename=None, parent=None):
        #super().__init__()
        QtGui.QDialog.__init__(self)
        self.pathToSecondaryImage = None  #path to secondary image if chosen
        self.workingdirectory = workingdirectory

        self.filename = filename
        layout = QtGui.QGridLayout()

        self.loadtimeseriesCheckBox = QtGui.QCheckBox('Load Time Series')
        self.loadtimeseriesCheckBox.setChecked(False)
        layout.addWidget(self.loadtimeseriesCheckBox, 0, 0, 1, 3)

        explainlabel = QtGui.QLabel(
            'Select Channels to place image (green is plotted)')
        layout.addWidget(explainlabel, 1, 0, 1, 3)

        self.r = QtGui.QCheckBox('red')
        self.r.setChecked(True)
        layout.addWidget(self.r, 2, 0, 1, 1)

        self.g = QtGui.QCheckBox('green')
        self.g.setChecked(True)
        layout.addWidget(self.g, 2, 1, 1, 1)

        self.b = QtGui.QCheckBox('blue')
        self.b.setChecked(True)
        layout.addWidget(self.b, 2, 2, 1, 1)

        self.image2btn = QtGui.QPushButton("Select Image for other channels")
        layout.addWidget(self.image2btn, 3, 0, 1, 3)
        self.image2btn.clicked.connect(self.Load2ndImage)

        #search directory for npy files; will load if it iexists or save if does not exist
        file, index = osDB.getFileContString(self.workingdirectory, '.npy')
        if len(file) != 0:
            label1 = 'Load this numpy file?'
            self.pathToMaskFile = os.path.join(self.workingdirectory,
                                               file.values[0])
        else:
            label1 = 'Save mask in numpy file?'
            self.pathToMaskFile = os.path.join(self.workingdirectory,
                                               filename[:-4] + 'MaskNumpy.npy')
        explainlabel2 = QtGui.QLabel(label1)
        layout.addWidget(explainlabel2, 4, 0, 1, 3)

        self.textBoxMaskFile = QtGui.QLineEdit(self.pathToMaskFile)
        layout.addWidget(self.textBoxMaskFile, 5, 0, 1, 3)
        self.textBoxMaskFile.textChanged.connect(self.textMaskChanged)

        self.continueBtn = QtGui.QPushButton("Settings Picked, Continue")
        layout.addWidget(self.continueBtn, 6, 0, 1, 3)
        self.continueBtn.clicked.connect(self.finished)

        self.setLayout(layout)
        self.setGeometry(300, 200, 460, 350)
 def __init__(self, init_var_dict, label, varname):
     self.varname = varname
     self.label = QtGui.QLabel(label)
     self.label.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
     self.checkbox = QtGui.QCheckBox()
     self.checkbox.setChecked(eval(init_var_dict[varname]))
     self.checkbox.clicked.connect(self.set)
Exemplo n.º 5
0
    def update_labels(self):
        _current_size = UwbNetwork.nodes[self.serial].cdp_pkts_count[self.type] - self.previous_count
        if _current_size > 1000: _current_size = 1000
        self.previous_count = UwbNetwork.nodes[self.serial].cdp_pkts_count[self.type]
        for idx in range(_current_size):
            _target_id = UwbNetwork.nodes[self.serial].cdp_pkts[self.type][idx - _current_size].serial_number.as_int
            if not (_target_id in self.from_ids):
                self.from_id_id_labels.update([(self.id_total, QtGui.QLabel())])
                self.from_id_count_labels.update([(self.id_total, QtGui.QLabel())])
                self.from_id_freq_labels.update([(self.id_total, QtGui.QLabel())])
                self.from_id_enable_checks.update([(self.id_total, QtGui.QCheckBox())])
                self.from_id_times.update([(_target_id, deque([], TRAIL_LENGTH))])
                self.from_id_frequency_deques.update([(_target_id, deque([], FREQUENCY_CALCULATION_DEQUE_LENGTH))])
                self.from_id_count.update([(_target_id, 0)])
                self.from_id_temp_data.update([(_target_id, deque([], TRAIL_LENGTH))])
                self.from_ids = np.sort(np.append(self.from_ids, _target_id))

                _row = self.id_total
                _column = 0
                self.grid_layout.addWidget(self.from_id_id_labels[self.id_total], _row + 1, _column + 0)
                self.grid_layout.addWidget(self.from_id_count_labels[self.id_total], _row + 1, _column + 1)
                self.grid_layout.addWidget(self.from_id_freq_labels[self.id_total], _row + 1, _column + 2)
                self.grid_layout.addWidget(self.from_id_enable_checks[self.id_total], _row + 1, _column + 3)

                if _column > 0:
                    _row = 2
                    self.grid_layout.addWidget(QtGui.QLabel("Serial#"), _row, _column + 0)
                    self.grid_layout.addWidget(QtGui.QLabel("Packet Count"), _row, _column + 1)
                    self.grid_layout.addWidget(QtGui.QLabel("Frequency"), _row, _column + 2)
                    self.grid_layout.addWidget(QtGui.QLabel("Enable"), _row, _column + 3)
                self.id_total += 1

            self.from_id_times[_target_id].append(UwbNetwork.nodes[self.serial].cdp_pkts_time[self.type][idx - _current_size])
            self.from_id_count[_target_id] += 1

            _scale = UwbNetwork.nodes[self.serial].cdp_pkts[self.type][idx - _current_size].scale / 32767.0
            self.from_id_temp_data[_target_id].append(UwbNetwork.nodes[self.serial].cdp_pkts[self.type][idx - _current_size].temperature * _scale)

        for _target_id in self.from_ids:
            self.from_id_frequency_deques[_target_id].append((self.from_id_count[_target_id], time.time()))

        for _row in range(self.id_total):
            _target_id = int(self.from_ids[_row])
            if self.from_id_id_labels[_row].text() != '0x{:08X}'.format(_target_id):
                self.from_id_id_labels[_row].setText('0x{:08X}'.format(_target_id))

            if len(self.from_id_times[_target_id]) == 0: continue

            _freq = UwbNetwork.nodes[self.serial].calculate_frequency(self.from_id_frequency_deques[_target_id])
            self.from_id_count_labels[_row].setText('{:5d}'.format(self.from_id_count[_target_id]))
            self.from_id_freq_labels[_row].setText('{:5.1f}Hz'.format(_freq))

            if self.from_id_enable_checks[_row].isChecked():
                self.sub_window.update_data('temperature', '0x{:08X}'.format(_target_id),
                                            np.array(self.from_id_temp_data[_target_id]),
                                            np.array(self.from_id_times[_target_id]))
            else:
                self.sub_window.update_data('temperature', '0x{:08X}'.format(_target_id),
                                            np.array([]),
                                            np.array([]))
Exemplo n.º 6
0
    def __init__(self, *args, **kwargs):
        log.info('')

        super().__init__(*args, **kwargs)

        # Filter input Description
        self._filter_description = QtGui.QLabel()
        self._filter_description.setText(
            '<b>Fingerprint Filter</b>: e.g., "s_ra > 0.1" or "πnematode > 0.1 and s_ra > 0.1"'
        )

        # Filter text input
        self._filter_input = QtGui.QLineEdit()
        self._filter_input.textChanged.connect(self._text_changed)
        self._filter_input.editingFinished.connect(self._enter_pressed)
        self._filter_text = ''

        # Filter text result
        self._filter_results = QtGui.QLabel()

        # Filter overlapping bounding boxes
        self._filter_overlapping_bb = QtGui.QCheckBox(
            'Overlapping Bounding Boxes')
        self._filter_overlapping_bb.setCheckState(True)
        self._filter_overlapping_bb.setTristate(False)
        self._filter_overlapping_bb.stateChanged.connect(
            self._filter_overlapping_bb_state_change)

        # Add both to this widget
        self.layout = QtGui.QGridLayout(self)
        self.layout.addWidget(self._filter_description, 0, 0, 1, 3)
        self.layout.addWidget(self._filter_input, 1, 0, 1, 2)
        self.layout.addWidget(self._filter_overlapping_bb, 1, 2)
        self.layout.addWidget(self._filter_results, 2, 0, 1, 3)
Exemplo n.º 7
0
    def __init__(self, port, name, parent=None,):
        QtGui.QWidget.__init__(self, parent)
        self.resize(800, 600)
        self.setWindowTitle("GraphName:{0} Port:{1}".format(name, port))

        ## Create some widgets to be placed inside
        self.runCheck = QtGui.QCheckBox('Running')
        #self.exportButton = QtGui.QPushButton("Export to CSV")
        #self.exportButton.clicked.connect(self.ExportCSV)
        # Plot objects
        pg.setConfigOptions(antialias=False)
        pg.setConfigOption('background', (255, 255, 255))
        self.plt = pg.PlotWidget()
        self.plt.showGrid(x=True, y=True)

        ## Create a grid layout to manage the widgets size and position
        layout = QtGui.QGridLayout()
        self.setLayout(layout)

        ## Add widgets to the layout in their proper positions
        layout.addWidget(self.runCheck, 0, 0)
        #layout.addWidget(self.exportButton, 0, 2)
        layout.addWidget(self.plt, 1, 0, 1, 3)

        ## zmq worker
        self.thread = QtCore.QThread()
        self.zeromqListener = ZeroMQListener(port, name)
        self.zeromqListener.moveToThread(self.thread)

        self.thread.started.connect(self.zeromqListener.Loop)
        self.zeromqListener.sigGetData.connect(self.UpdatePlot)

        QtCore.QTimer.singleShot(0, self.thread.start)
Exemplo n.º 8
0
    def __init__(self, parent=None):
        super(ActuatorFeedbackWidget, self).__init__(parent)
        self._pressure_widgets = [
            LineEdit(
                title="Pressure {} [Pa]".format(i + 1),
                parent=parent,
                initial_value="0",
            ) for i in range(2)
        ]

        self._analog_input_widgets = [
            LineEdit(
                title="Analog {} [V]".format(i + 1),
                parent=parent,
                initial_value="0.0",
            ) for i in range(2)
        ]

        self._digital_input_widget = QtGui.QCheckBox("Digital in", parent=self)
        self._digital_input_widget.setEnabled(False)

        for w in self._pressure_widgets + self._analog_input_widgets:
            w.line.setReadOnly(True)

        self.setLayout(
            vstack([
                hstack(self._pressure_widgets),
                hstack(self._analog_input_widgets),
                self._digital_input_widget,
            ]))

        self.show()
Exemplo n.º 9
0
 def createChanSelection(self):
     self.chanSelect = []
     for i in range(self._numChan):
         chB = QtGui.QCheckBox()
         chB.setChecked(self._Channel[i])
         chB.stateChanged.connect(self.updateChanSelection)
         self.chanSelect.append(chB)
Exemplo n.º 10
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.setFrameStyle(QtGui.QFrame.Panel | QtGui.QFrame.Raised)

        # Widgets
        self.graph = MoleculesGraph(self)
        self.enableBox = QtGui.QCheckBox('Enable')
        self.enableBox.setEnabled(False)
        self.enableBox.stateChanged.connect(self.graph.getTime)
        self.lockButton = QtGui.QPushButton('Lock (no anda)')
        self.lockButton.setCheckable(True)
        self.lockButton.clicked.connect(self.toggleLock)
        self.lockButton.setSizePolicy(QtGui.QSizePolicy.Preferred,
                                      QtGui.QSizePolicy.Expanding)
        self.alphaLabel = QtGui.QLabel('Alpha')
        self.alphaLabel.setAlignment(
            (QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter))
        self.alphaEdit = QtGui.QLineEdit('5')
        self.alphaEdit.setFixedWidth(40)

        # GUI layout
        grid = QtGui.QGridLayout()
        self.setLayout(grid)
        grid.addWidget(self.graph, 0, 0, 1, 5)
        grid.addWidget(self.enableBox, 1, 0)
        grid.addWidget(self.alphaLabel, 1, 1)
        grid.addWidget(self.alphaEdit, 1, 2)
        grid.addWidget(self.lockButton, 1, 3, 1, 2)

        grid.setColumnMinimumWidth(0, 200)
        grid.setColumnMinimumWidth(4, 170)
Exemplo n.º 11
0
    def generate_col_box(self):
        col_box = QtWidgets.QGroupBox()
        col_vboxlay = QtWidgets.QVBoxLayout()
        col_box.setLayout(col_vboxlay)
        self.text_box = QtGui.QTextItem()
        # col_vboxlay.addWidget(self.text_box)
        self.col_option_box = QtGui.QComboBox()
        cols = colors.COLOR_SCHEMES
        self.col_option_box.addItems(cols)
        rev_cols = [f'{col}-rev' for col in cols]
        self.col_option_box.addItems(rev_cols)
        self.col_option_box.currentIndexChanged.connect(self.col_box_selection_changed)
        col_vboxlay.addWidget(self.col_option_box)
        self.bal_box = QtGui.QCheckBox("Balanced?")
        col_vboxlay.addWidget(self.bal_box)
        self.bal_box.stateChanged.connect(self.clicked_bal_box)
        self.cmin = QtGui.QLineEdit()
        col_vboxlay.addWidget(self.cmin)
        self.cmax = QtGui.QLineEdit()
        col_vboxlay.addWidget(self.cmax)
        self.crange_but = QtGui.QPushButton("Update range")
        self.crange_but.clicked.connect(self.change_crange)
        col_vboxlay.addWidget(self.crange_but)


        self.col_box = col_box
Exemplo n.º 12
0
    def __init__(self, *args, **kwargs):
        super(DirectorySelectionWidget, self).__init__(*args, **kwargs)

        #construct file selection widget
        self.checkbox = QtGui.QCheckBox()
        self.lineedit = QtGui.QLineEdit()
        self.button = QtGui.QPushButton()
        ic = QtGui.QFileIconProvider().icon(5)
        #btn.setFixedSize(ic.actualSize(ic.availableSizes()[0]));
        ics = QtCore.QSize(20, 20)
        self.button.setFixedSize(ic.actualSize(ics))
        self.button.setText("")
        self.button.setIcon(ic)
        self.button.setIconSize(ic.actualSize(ics))
        self.button.clicked.connect(self.getDirectory)

        layout = QtGui.QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)
        layout.addWidget(self.checkbox)
        layout.addWidget(self.lineedit)
        layout.addWidget(self.button)
        self.setLayout(layout)

        self.lineedit.textChanged.connect(self.sigChanged.emit)
        self.checkbox.stateChanged.connect(self.sigChanged.emit)
Exemplo n.º 13
0
 def __init__(self, parent=None):
     super(QtGui.QWidget, self).__init__(parent)
     self.checkbox = QtGui.QCheckBox(parent=parent)
     self.layout = QtGui.QHBoxLayout(self)
     self.layout.addWidget(self.checkbox)
     self.layout.setAlignment(QtCore.Qt.AlignCenter)
     self.layout.setContentsMargins(0, 0, 0, 0)
Exemplo n.º 14
0
        def __init__(self, name):
            super().__init__(
                name=name, add_gradient_widgtet=True, channel_selector=True
            )

            self.asRgb = QtGui.QCheckBox()
            self.asRgb.setToolTip("Show As RGB")
            self._layout.addWidget(self.asRgb, 3, 0)
Exemplo n.º 15
0
 def addcheckbox(text: str) -> QtGui.QCheckBox:
     nonlocal row
     chk = QtGui.QCheckBox()
     chk.setTristate(False)
     layout.addWidget(makelabel(text), row, 0)
     layout.addWidget(chk, row, 1)
     row += 1
     return chk
Exemplo n.º 16
0
    def update_labels(self):
        current_size = UwbNetwork.nodes[self.serial].cdp_pkts_count[AnchorPositionStatusV4.type] - self.previous_count
        if current_size > 1000:
            current_size = 1000
        self.previous_count = UwbNetwork.nodes[self.serial].cdp_pkts_count[AnchorPositionStatusV4.type]
        for idx in range(current_size):
            target_id = UwbNetwork.nodes[self.serial].cdp_pkts[AnchorPositionStatusV4.type][idx - current_size].tag_serial_number.as_int
            if not (target_id in self.from_ids):
                self.from_id_id_labels.update([(self.id_total, QtGui.QLabel())])
                self.from_id_count_labels.update([(self.id_total, QtGui.QLabel())])
                self.from_id_freq_labels.update([(self.id_total, QtGui.QLabel())])
                self.from_id_enable_checks.update([(self.id_total, QtGui.QCheckBox())])
                self.from_id_count.update([(target_id, 0)])
                self.from_id_frequency_deques.update([(target_id, deque([], FREQUENCY_CALCULATION_DEQUE_LENGTH))])
                self.from_ids = np.sort(np.append(self.from_ids, target_id))

                row = self.id_total
                column = 0

                row = self.id_total
                column = 0
                self.grid_layout.addWidget(self.from_id_id_labels[self.id_total], row + 1, column + 0)
                self.grid_layout.addWidget(self.from_id_count_labels[self.id_total], row + 1, column + 1)
                self.grid_layout.addWidget(self.from_id_freq_labels[self.id_total], row + 1, column + 2)
                self.grid_layout.addWidget(self.from_id_enable_checks[self.id_total], row + 1, column + 3)

                if column > 0:
                    row = 2
                    self.grid_layout.addWidget(QtGui.QLabel("Serial#"), row, column + 0)
                    self.grid_layout.addWidget(QtGui.QLabel("Packet Count"), row, column + 1)
                    self.grid_layout.addWidget(QtGui.QLabel("Frequency"), row, column + 2)
                    self.grid_layout.addWidget(QtGui.QLabel("Print"), row, column + 3)
                self.id_total += 1

            self.from_id_count[target_id] += 1

            if target_id in self.from_ids:
                row = np.where(self.from_ids==target_id)[0][0]
                if self.from_id_enable_checks[row].isChecked():
                    print(UwbNetwork.nodes[self.serial].cdp_pkts[self.type][idx - current_size])

            if target_id in self.sub_windows:
                packet = UwbNetwork.nodes[self.serial].cdp_pkts[self.type][idx - current_size]
                self.sub_windows[target_id].update_data(packet)

        for target_id in self.from_ids:
            self.from_id_frequency_deques[target_id].append((self.from_id_count[target_id], time.time()))

        for row in range(self.id_total):
            target_id = int(self.from_ids[row])
            if self.from_id_id_labels[row].text() != '0x{:08X}'.format(target_id):
                self.from_id_id_labels[row].setText('0x{:08X}'.format(target_id))
                self.from_id_id_labels[row].setStyleSheet('color:blue')
                self.from_id_id_labels[row].mouseReleaseEvent = partial(self.labelClickEvent, target_id)

            freq = UwbNetwork.nodes[self.serial].calculate_frequency(self.from_id_frequency_deques[target_id])
            self.from_id_count_labels[row].setText('{:5d}'.format(self.from_id_count[target_id]))
            self.from_id_freq_labels[row].setText('{:5.1f}Hz'.format(freq))
Exemplo n.º 17
0
 def _make_widget(self):
     """
     Sets the widget (here a QCheckbox)
     :return:
     """
     self.widget = QtGui.QCheckBox()
     self.widget.setTristate(True)
     self.widget.stateChanged.connect(self.write_widget_value_to_attribute)
     self.setToolTip("Checked:\t    on\nUnchecked: off\nGrey:\t    ignore")
Exemplo n.º 18
0
 def addCheckbox(self, i, st):
     step = 16
     x0 = 5
     y0 = 25
     self.grid.append(
         QtGui.QCheckBox(parent=self,
                         text=QtCore.QString.fromUtf8(st),
                         geometry=QtCore.QRect(x0, y0 + i * step, 350, 20)))
     self.grid[i].clicked.connect(self._emitState)
Exemplo n.º 19
0
	def checkbox(self):
		self.alphline = QtGui.QCheckBox('\u03B1 line')
		self.alphline.stateChanged.connect(self.alphstate)
		self.alproxy=QtGui.QGraphicsProxyWidget()
		self.alproxy.setWidget(self.alphline)

		self.p3_w = self.win.addLayout(row=2,col=0)

		self.p3_w.addItem(self.alproxy,row=0,col=1)
 def add_checkbox(self,
                  checkbox,
                  y_pos,
                  text,
                  check_state=QtCore.Qt.Unchecked):
     for i in range(2):
         checkbox.append(QtGui.QCheckBox(text + ' ' + str(i + 1), self))
         checkbox[i].setCheckState(check_state)
         self.layout.addWidget(checkbox[i], y_pos, i, QtCore.Qt.AlignCenter)
Exemplo n.º 21
0
    def setup_layout(self):
        self.index_edit = QtGui.QLineEdit()
        self.index_edit.setValidator(QtGui.QIntValidator())
        self.index_edit.returnPressed.connect(self.change_index)
        index_edit_label = QtGui.QLabel()
        index_edit_label.setText('Index: ')

        self.directory_edit = QtGui.QLineEdit()
        self.directory_edit.returnPressed.connect(self.change_directory)
        directory_edit_label = QtGui.QLabel()
        directory_edit_label.setText('Directory: ')

        autolevel_label = QtGui.QLabel()
        autolevel_label.setText('Autolevel: ')
        self.autolevel_checkbox = QtGui.QCheckBox()
        self.autolevel_checkbox.setChecked(True)
        self.absolute_level_checkbox = QtGui.QCheckBox()
        self.absolute_level_checkbox.setChecked(False)
        absolute_level_label = QtGui.QLabel()
        absolute_level_label.setText('Absolute level: ')
        autorange_label = QtGui.QLabel()
        autorange_label.setText('Autorange: ')
        self.autorange_checkbox = QtGui.QCheckBox()
        self.autorange_checkbox.setChecked(True)

        # self.autolevel_checkbox.stateChanged.connect(
        #    lambda: self.guiwrapper.autolevel_button_state(self.autolevel_checkbox))
        # Alternate way to do this.

        basic_tab_layout = QtGui.QGridLayout()
        self.my_widget.setLayout(basic_tab_layout)

        basic_tab_layout.addWidget(directory_edit_label, 0, 0)
        basic_tab_layout.addWidget(self.directory_edit, 0, 1)

        basic_tab_layout.addWidget(index_edit_label, 1, 0)
        basic_tab_layout.addWidget(self.index_edit, 1, 1)

        basic_tab_layout.addWidget(autorange_label, 0, 2)
        basic_tab_layout.addWidget(self.autorange_checkbox, 0, 3)
        basic_tab_layout.addWidget(autolevel_label, 1, 2)
        basic_tab_layout.addWidget(self.autolevel_checkbox, 1, 3)
        basic_tab_layout.addWidget(absolute_level_label, 1, 5)
        basic_tab_layout.addWidget(self.absolute_level_checkbox, 1, 6)
Exemplo n.º 22
0
def affichage(name, shareddic):
    """ Ploting and Display """
    pg.mkQApp()
    pg.setConfigOptions(antialias=True)  ## this will be expensive for the local plot
    force = pg.SpinBox(value=0, int=True, minStep=1, step=10, bounds=(-128, 128))#QtGui.QLineEdit()
    phase = pg.SpinBox(value=1, minStep=0.1, step=0.1, bounds=(0, 2))#QtGui.QLineEdit()
    freq = pg.SpinBox(value=55, minStep=1, step=1, dec=True, bounds=(0, 900))#QtGui.QLineEdit()
    label = QtGui.QLabel()
    #self.data = data
    #self.fps = fps
    labelf = QtGui.QLabel()
    labelf.setText('Force')
    labelp = QtGui.QLabel()
    labelp.setText('Phase')
    labelfr = QtGui.QLabel()
    labelfr.setText('Frequence')
    lcheck = QtGui.QCheckBox('plot local')
    lcheck.setChecked(True)
    lplt = pg.PlotWidget()
    lplt.setYRange(-45, 45)
    lplt.setTitle('Position')
    fplt = pg.PlotWidget()
    fplt.setYRange(-150, 150)
    fplt.setTitle('Forces')
    fplt.getAxis('bottom').setScale(1.0/RESANG)
    layout = pg.LayoutWidget()
    layout.addWidget(labelf)
    layout.addWidget(labelp)
    layout.addWidget(labelfr)
    layout.addWidget(force, row=2, col=0)
    layout.addWidget(phase, row=2, col=1)
    layout.addWidget(freq, row=2, col=2)
    layout.addWidget(lcheck, row=3, col=0)
    layout.addWidget(label, row=3, col=1)
    layout.addWidget(lplt, row=4, col=0, colspan=3)
    layout.addWidget(fplt, row=5, col=0, colspan=3)
    layout.resize(800, 800)
    layout.setWindowTitle('Timon 12: Demo')
    layout.show()
    def update(shareddic):
        """ Every refresh of the display """
        localdata = [0]*1000
        taille = shareddic['taille']
        localdata = shareddic['data']
        lplt.plot(localdata, clear=True)
        fps = shareddic['fps']
        label.setText("Communication %0.2f Hz Taille buffer: %0.2f" % (fps, taille/3.0))
        force = shareddic['force']
        degre = shareddic['degre']
        forcenow = shareddic['forcenow']
        fplt.plot(range(-ANGLEMAX*RESANG, ANGLEMAX*RESANG), force, clear=True)
        fplt.plot([degre*RESANG], [forcenow], pen=(0, 0, 255), symbolBrush=(255, 0, 0), symbolPen='r')
    timer = QtCore.QTimer()
    timer.timeout.connect(lambda: update(shareddic))
    timer.start(50)
    QtGui.QApplication.instance().exec_()
Exemplo n.º 23
0
 def setupOptionsBox(self):
     self.subtractMeanLayout = QtGui.QHBoxLayout()
     self.subtractMeanLabel = QtGui.QLabel()
     self.subtractMeanLabel.setText('Subtract Means')
     self.subtractMeanLabel.setAlignment(QtCore.Qt.AlignCenter)
     self.subtractMeanCheckbox = QtGui.QCheckBox()
     self.subtractMeanCheckbox.setChecked(False)
     self.subtractMeanCheckbox.stateChanged.connect(self.setSubtractMeans)
     self.subtractMeanLayout.addWidget(self.subtractMeanLabel)
     self.subtractMeanLayout.addWidget(self.subtractMeanCheckbox)
     self.normaliseLayout = QtGui.QHBoxLayout()
     self.normaliseLabel = QtGui.QLabel()
     self.normaliseLabel.setText('Normalise')
     self.normaliseLabel.setAlignment(QtCore.Qt.AlignCenter)
     self.normaliseCheckbox = QtGui.QCheckBox()
     self.normaliseCheckbox.setChecked(False)
     self.normaliseCheckbox.stateChanged.connect(self.setNormalise)
     self.normaliseLayout.addWidget(self.normaliseLabel)
     self.normaliseLayout.addWidget(self.normaliseCheckbox)
 def heaveyWeightsChanged(self):
     self.heavyWeightsList.clear()
     heavyWightsWdg = self.grpBox.children()
     for chld in heavyWightsWdg:
         if str(type(QtGui.QCheckBox())) == str(type(chld)):
             if chld.isChecked():
                 self.heavyWeightsList.append(chld.text())
     
     self.heaveyWeightsChdSgnl.emit(self.heavyWeightsList)
     log.log("Heavy weights changed : " + str(self.heavyWeightsList))
Exemplo n.º 25
0
    def setUpUI(self):
        self.uiLayout = QtGui.QGridLayout()
        self.rawButton = QtGui.QRadioButton("Raw")
        self.rawButton.setChecked(True)
        self.logButton = QtGui.QRadioButton("log")
        self.cButton = QtGui.QRadioButton("C period")
        self.rawButton.clicked.connect(self.plotData)
        self.logButton.clicked.connect(self.plotData)
        self.threshButton = QtGui.QCheckBox("Thresh line")
        self.fitButton = QtGui.QCheckBox("Fits")

        self.cButton.clicked.connect(self.plotData)
        self.threshButton.clicked.connect(self.plotData)
        self.fitButton.clicked.connect(self.plotData)
        self.uiLayout.addWidget(self.rawButton, 0, 0, 1, 1)
        self.uiLayout.addWidget(self.logButton, 1, 0, 1, 1)
        self.uiLayout.addWidget(self.threshButton, 2, 0, 1, 1)
        self.uiLayout.addWidget(self.fitButton, 3, 0, 1, 1)
        self.uiLayout.addWidget(self.cButton, 4, 0, 1, 1)
Exemplo n.º 26
0
    def __init__(self, parent=None):
        super(Slider, self).__init__(parent=parent)

        self.verticalLayout = QtGui.QVBoxLayout(self)
        self.label = QtGui.QLabel(self)
        self.verticalLayout.addWidget(self.label)
        self.slider = QtGui.QSlider(self)
        self.slider.setValue(0)
        self.verticalLayout.addWidget(self.slider)
        self.check_box = QtGui.QCheckBox('large than', self)
        self.verticalLayout.addWidget(self.check_box)
Exemplo n.º 27
0
 def __init__(self, name, color, checked, slot):
     QtGui.QWidget.__init__(self)
     layout = QtGui.QHBoxLayout(self)
     layout.setContentsMargins(0, 0, 0, 0)
     self._cbx = QtGui.QCheckBox(self)
     self._cbx.setChecked(checked)
     self._cbx.setFixedWidth(50)
     self._cbx.setStyleSheet("background-color: {};".format(color.name()))
     self._cbx.stateChanged.connect(slot)
     layout.addWidget(self._cbx)
     layout.addWidget(QtGui.QLabel(name, self))
Exemplo n.º 28
0
    def _initControls(self, layout):
        """Initialize Control units

        Args:
            layout (QLayout): layout to put controls in
        """        
        self._alpha_slider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
        layout.addRow(QtGui.QLabel("mask alpha"), self._alpha_slider)
        self._alpha_slider.valueChanged.connect(self.change_alpha)
        self._alpha_slider.setValue(self._mask_alpha)

        self._mask_checkbox = QtGui.QCheckBox()
        layout.addRow(QtGui.QLabel("display mask"), self._mask_checkbox)
        self._mask_checkbox.stateChanged.connect(self.switch_mask)
        self._mask_checkbox.setChecked(True)

        self._boundary_checkbox = QtGui.QCheckBox()
        layout.addRow(QtGui.QLabel("display boundary"), self._boundary_checkbox)
        self._boundary_checkbox.stateChanged.connect(self.switch_boundary)
        self._boundary_checkbox.setChecked(True)
Exemplo n.º 29
0
 def __init__(self, owner, name):
     super(tickMC, self).__init__()
     self._label = QtGui.QLabel()
     self._name = name
     self._label.setText(self._name.capitalize() + ": ")
     self._box = QtGui.QCheckBox("Nu only")
     self._box.setChecked(False)
     self._box.stateChanged.connect(self.emitSignal)
     # This is the widget itself, so set it up
     self._layout = QtGui.QVBoxLayout()
     self._layout.addWidget(self._label)
     self._layout.addWidget(self._box)
     self.setLayout(self._layout)
Exemplo n.º 30
0
    def __init__(self, parent=None, rownum=0):
        global window

        # Sets up window
        super(RecordSettings, self).__init__(parent)

        # Sets main window bar title and size
        self.setWindowTitle('Myo Data Recorder Settings')
        self.resize(400, 240)

        self.cw = QtGui.QWidget()
        self.setCentralWidget(self.cw)
        self.l = QtGui.QGridLayout()
        self.cw.setLayout(self.l)

        seconds = QtGui.QLabel('Seconds\n(Set to 0 for manual toggling)')
        self.l.addWidget(seconds, 0, 0, 1, 1)

        self.numentry = QtGui.QLineEdit()
        self.numentry.setText(str(window.record_time))
        self.l.addWidget(self.numentry, 0, 1, 1, 1)

        seconds = QtGui.QLabel('Device Sample Rate (Hz)')
        self.l.addWidget(seconds, 1, 0, 1, 1)

        self.samplerate = QtGui.QLineEdit()
        self.samplerate.setText(str(window.sample_rate))
        self.l.addWidget(self.samplerate, 1, 1, 1, 1)

        snipping_toggle = QtGui.QCheckBox('Toggle Snipping Window')
        snipping_toggle.setChecked(window.toggle_snipping)
        snipping_toggle.toggled.connect(window.toggle_snipping_window)
        self.l.addWidget(snipping_toggle, 2, 1, 1, 1)

        ssnl = QtGui.QLabel(
            'Record CSV naming scheme (enter %s for iterative naming)')
        self.l.addWidget(ssnl, 3, 0, 1, 1)

        self.name_scheme = QtGui.QLineEdit()
        self.name_scheme.setText(str(window.config_data['save_scheme']))
        self.l.addWidget(self.name_scheme, 4, 0, 1, 2)

        save_plot_data = QtGui.QPushButton('Save')
        save_plot_data.setToolTip('Save MYO Settings')
        save_plot_data.clicked.connect(self.saveEvent)
        self.save_plot_data = save_plot_data
        self.l.addWidget(save_plot_data, 5, 0, 1, 1)

        save_plot_data = QtGui.QPushButton('Exit')
        save_plot_data.clicked.connect(self.closeEvent)
        self.l.addWidget(save_plot_data, 5, 1, 1, 1)