Python pyqtgraph.Qt.QtGui.QLabel() Examples

The following are 12 code examples of pyqtgraph.Qt.QtGui.QLabel(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pyqtgraph.Qt.QtGui , or try the search function .
Example #1
Source File: widgets.py    From pyFlightAnalysis with MIT License 6 votes vote down vote up
def __init__(self, info_data, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.resize(QtCore.QSize(500,500))
        self.info_table = QtGui.QTableWidget()
        self.setCentralWidget(self.info_table)
        self.info_table.setSortingEnabled(False)
        self.info_table.horizontalHeader().setStretchLastSection(True)
        self.info_table.resizeColumnsToContents()
        self.info_table.setColumnCount(2)
        self.info_table.setColumnWidth(0, 120)
        self.info_table.setColumnWidth(1, 50)
        self.info_table.setHorizontalHeaderLabels(['Name', 'value'])
        index = 0
        for name, value in info_data.items():
            self.info_table.insertRow(index)
            self.info_table.setCellWidget(index, 0, QtGui.QLabel(name))
            self.info_table.setCellWidget(index, 1, QtGui.QLabel(str(value)))
            index += 1
#             self.info_table.setCellWidget(index, 0, QtGui.QLabel(des)) 
Example #2
Source File: widgets.py    From pyFlightAnalysis with MIT License 6 votes vote down vote up
def update_table(self):
        self.params_table.setRowCount(0)
        index = 0
        for name, value in self.params_data.items():
            if name in self.params_data_show:
                self.params_table.insertRow(index)
                if name in self.changed_params_data:
                    name_str = "<font color='red'>%s</font>"%(name)
                    value_str = "<font color='red'>%s</font>"%(str(value))
                else:
                    name_str = name
                    value_str = str(value)
                name_lbl = QtGui.QLabel(name_str)
                value_lbl = QtGui.QLabel(value_str)
                self.params_table.setCellWidget(index, 0, name_lbl)
                self.params_table.setCellWidget(index, 1, value_lbl)
                index += 1 
Example #3
Source File: gccNMFInterface.py    From gcc-nmf with MIT License 6 votes vote down vote up
def initMaskFunctionControls(self):
        self.maskFunctionControlslayout = QtGui.QHBoxLayout()
        labelsLayout = QtGui.QVBoxLayout()
        slidersLayout = QtGui.QVBoxLayout()
        self.maskFunctionControlslayout.addLayout(labelsLayout)
        self.maskFunctionControlslayout.addLayout(slidersLayout)
        def addSlider(label, changedFunction, minimum, maximum, value):
            labelWidget = QtGui.QLabel(label)
            labelsLayout.addWidget(labelWidget)
            slider = QtGui.QSlider(QtCore.Qt.Horizontal)
            slider.setMinimum(minimum)
            slider.setMaximum(maximum)
            slider.setValue(value)
            slider.sliderReleased.connect(changedFunction)
            slidersLayout.addWidget(slider)
            return slider, labelWidget
        
        self.targetModeWindowTDOASlider, self.targetModeWindowTDOALabel = addSlider('Center:', self.tdoaRegionChanged, 0, 100, 50)
        self.targetModeWindowWidthSlider, _ = addSlider('Width:', self.tdoaRegionChanged, 1, 101, 50)
        self.targetModeWindowBetaSlider, _ = addSlider('Shape:', self.tdoaRegionChanged, 0, 100, 50)
        self.targetModeWindowNoiseFloorSlider, _ = addSlider('Floor:', self.tdoaRegionChanged, 0, 100, 0) 
Example #4
Source File: gccNMFInterface.py    From gcc-nmf with MIT License 6 votes vote down vote up
def initNMFControls(self):
        self.nmfControlsLayout = QtGui.QHBoxLayout()
        self.nmfControlsLayout.addStretch(1)
        self.nmfControlsLayout.addWidget(QtGui.QLabel('Dictionary Size:'))
        self.dictionarySizeDropDown = QtGui.QComboBox()
        for dictionarySize in self.dictionarySizes:
            self.dictionarySizeDropDown.addItem( str(dictionarySize) )
        self.dictionarySizeDropDown.setMaximumWidth(75)
        self.dictionarySizeDropDown.setCurrentIndex(self.dictionarySizes.index(self.dictionarySize))
        self.dictionarySizeDropDown.currentIndexChanged.connect(self.dictionarySizeChanged)
        self.nmfControlsLayout.addWidget(self.dictionarySizeDropDown)
        self.nmfControlsLayout.addStretch(1)
        
        self.nmfControlsLayout.addWidget(QtGui.QLabel('Num Updates:'))
        self.numHUpdatesSpinBox = QtGui.QSpinBox()
        self.nmfControlsLayout.addWidget(self.numHUpdatesSpinBox)
        self.nmfControlsLayout.addStretch(1) 
Example #5
Source File: gccNMFInterface.py    From gcc-nmf with MIT License 6 votes vote down vote up
def initLocalizationControls(self):
        self.localizationControlsLayout = QtGui.QHBoxLayout()
        self.localizationControlsLayout.addStretch(3)
        self.localizationCheckBox = QtGui.QCheckBox('Enable Localization')
        self.localizationCheckBox.setChecked(self.localizationEnabled)
        self.localizationCheckBox.stateChanged.connect(self.localizationStateChanged)
        self.localizationControlsLayout.addWidget(self.localizationCheckBox)

        self.localizationControlsLayout.addStretch(1)
        self.localizationWindowSizeLabel = QtGui.QLabel('Sliding Window Size:')
        self.localizationControlsLayout.addWidget(self.localizationWindowSizeLabel)
        self.localziaitonWindowSizeSpinBox = QtGui.QSpinBox()
        self.localziaitonWindowSizeSpinBox.setMinimum(1)
        self.localziaitonWindowSizeSpinBox.setMaximum(128)
        self.localziaitonWindowSizeSpinBox.setValue(self.localizationWindowSize)
        self.localziaitonWindowSizeSpinBox.valueChanged.connect(self.localizationParamsChanged)
        self.localizationControlsLayout.addWidget(self.localziaitonWindowSizeSpinBox)
        self.localizationControlsLayout.addStretch(3) 
Example #6
Source File: widgets.py    From pyFlightAnalysis with MIT License 5 votes vote down vote up
def run(self):
        self.dialog.setText('Loading...')
        self.dialog.setStyleSheet('QLabel{min-width: 100px;}')
        self.dialog.show() 
Example #7
Source File: UIWidgets.py    From Astibot with MIT License 5 votes vote down vote up
def __init__(self, parent):
        QtGui.QLabel.__init__(self, parent)
        self.UIsAreSet = False 
Example #8
Source File: plotly_test.py    From VNect-tensorflow with Apache License 2.0 5 votes vote down vote up
def __init__(self, parent=None):
        super(App, self).__init__(parent)

        #### Create Gui Elements ###########
        self.mainbox = QtGui.QWidget()
        self.setCentralWidget(self.mainbox)
        self.mainbox.setLayout(QtGui.QVBoxLayout())

        self.canvas = pg.GraphicsLayoutWidget()
        self.mainbox.layout().addWidget(self.canvas)

        self.label = QtGui.QLabel()
        self.mainbox.layout().addWidget(self.label)

        self.view = self.canvas.addViewBox()
        self.view.setAspectLocked(True)
        self.view.setRange(QtCore.QRectF(0,0, 100, 100))

        #  image plot
        self.img = pg.ImageItem(border='w')
        self.view.addItem(self.img)

        self.canvas.nextRow()
        #  line plot
        self.otherplot = self.canvas.addPlot()
        self.h2 = self.otherplot.plot(pen='y')


        #### Set Data  #####################

        self.x = np.linspace(0,50., num=100)
        self.X,self.Y = np.meshgrid(self.x,self.x)

        self.counter = 0
        self.fps = 0.
        self.lastupdate = time.time()

        #### Start  #####################
        self._update() 
Example #9
Source File: gccNMFInterface.py    From gcc-nmf with MIT License 5 votes vote down vote up
def initWindowLayout(self):
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(1)
        
        self.infoLabelWidgets = []
        def addWidgetWithLabel(widget, label, fromRow, fromColumn, rowSpan=1, columnSpan=1):
            labeledWidget = QtGui.QWidget()
            widgetLayout = QtGui.QVBoxLayout()
            widgetLayout.setContentsMargins(0, 0, 0, 0)
            widgetLayout.setSpacing(1)
            labeledWidget.setLayout(widgetLayout)
            
            labelWidget = QtGui.QLabel(label)
            labelWidget.setContentsMargins(0, 3, 0, 1)
            labelWidget.setAutoFillBackground(True)
            labelWidget.setAlignment(QtCore.Qt.AlignCenter)
            #labelWidget.setStyleSheet('QLabel { border-top-width: 10px }')       
            self.infoLabelWidgets.append(labelWidget)
            
            widgetLayout.addWidget(labelWidget)
            widgetLayout.addWidget(widget)
            labeledWidget.setSizePolicy(sizePolicy)
            self.mainLayout.addWidget(labeledWidget, fromRow, fromColumn, rowSpan, columnSpan)
        
        addWidgetWithLabel(self.inputSpectrogramWidget, 'Input Spectrogram', 0, 1)
        addWidgetWithLabel(self.outputSpectrogramWidget, 'Output Spectrogram', 1, 1)
        addWidgetWithLabel(self.controlsWidget, 'GCC-NMF Masking Function', 0, 2)
        addWidgetWithLabel(self.gccPHATHistoryWidget, 'GCC PHAT Angular Spectrogram', 0, 3)
        addWidgetWithLabel(self.dictionaryWidget, 'NMF Dictionary', 1, 2)
        addWidgetWithLabel(self.coefficientMaskWidget, 'NMF Dictionary Mask', 1, 3)
        #for widget in self.infoLabelWidgets:
        #    widget.hide()
        #map(lambda widget: widget.hide(), self.infoLabelWidgets) 
Example #10
Source File: widgets.py    From pyFlightAnalysis with MIT License 4 votes vote down vote up
def __init__(self, item_id, mainwindow, *args, **kargs):
        self.id = item_id
        self.mainwindow = mainwindow
        super().__init__(*args, **kargs)
        self.resize(QtCore.QSize(300, 200))
        self.properties_table = QtGui.QTableWidget()
#         self.setCentralWidget(self.properties_table)
        self.properties_table.setSortingEnabled(False)
        self.properties_table.horizontalHeader().setStretchLastSection(True)
        self.properties_table.resizeColumnsToContents()
        self.properties_table.setColumnCount(2)
        self.properties_table.setColumnWidth(0, 120)
        self.properties_table.setColumnWidth(1, 50)
        self.properties_table.setHorizontalHeaderLabels(['Property', 'value'])
        # first row --- color
        self.properties_table.insertRow(0)
        self.properties_table.setCellWidget(0, 0, QtGui.QLabel('Color'))
        self.curve = mainwindow.data_plotting[self.id][2]
        self.btn = ColorPushButton(self.id, self.properties_table, self.curve.opts['pen'])
        self.properties_table.setCellWidget(0, 1, self.btn)
        # second row --- symbol
        self.properties_table.insertRow(1)
        self.properties_table.setCellWidget(1, 0, QtGui.QLabel('Marker'))
        self.mkr = Marker(self.curve.opts['symbol'])
        self.properties_table.setCellWidget(1, 1, self.mkr)
        # third row --- symbol size
        self.properties_table.insertRow(2)
        self.properties_table.setCellWidget(2, 0, QtGui.QLabel('Marker Size'))
        print('symbolSize:', str(self.curve.opts['symbolSize']))
        self.ln = LineEdit(str(self.curve.opts['symbolSize']))
        self.properties_table.setCellWidget(2, 1, self.ln)
        w = QtGui.QWidget()
        self.vlayout = QtGui.QVBoxLayout()
        self.hlayout = QtGui.QHBoxLayout()
        self.setCentralWidget(w)
        self.centralWidget().setLayout(self.vlayout)
        self.vlayout.addWidget(self.properties_table)
        self.vlayout.addLayout(self.hlayout)
        self.cancel_btn = QtGui.QPushButton('Cancel')
        self.ok_btn = QtGui.QPushButton('OK')
        self.cancel_btn.clicked.connect(self.callback_cancel_clicked)
        self.ok_btn.clicked.connect(self.callback_properties_changed)
        self.hlayout.addWidget(self.cancel_btn)
        self.hlayout.addWidget(self.ok_btn) 
Example #11
Source File: widgets.py    From pyFlightAnalysis with MIT License 4 votes vote down vote up
def __init__(self, mainwindow, *args, **kwargs):
        self.mainwindow = mainwindow
        # gui
        self.graph_predefined_list = ['XY_Estimation',
                                       'Altitude Estimate',
                                       'Roll Angle',
                                       'Pitch Angle',
                                       'Yaw Angle',
                                       'Roll Angle Rate',
                                       'Pitch Angle Rate',
                                       'Yaw Angle Rate',
                                       'Local Position X',
                                       'Local Position Y',
                                       'Local Position Z',
                                       'Velocity',
                                       'Manual Control Input',
                                       'Actuator Controls 0',
                                       'Actuation Outputs(Main)',
                                       'Actuation Outputs(Aux)',
                                       'Magnetic field strength',
                                       'Distance Sensor',
                                       'GPS Uncertainty',
                                       'GPS noise and jamming',
                                       'CPU & RAM',
                                       'Power']
        super().__init__(*args,**kwargs)
        self.setFixedSize(QtCore.QSize(300, 660))
        self.graph_table = QtGui.QTableWidget(self)
        self.graph_table.setColumnCount(2)
        self.graph_table.setColumnWidth(0, 200)
        self.graph_table.setColumnWidth(1, 40)
        for index, item in enumerate(self.graph_predefined_list):
            self.graph_table.insertRow(index)
            lbl = QtGui.QLabel(item)
            lbl.mouseDoubleClickEvent = self.callback_double_clicked(item)
            self.graph_table.setCellWidget(index, 0, lbl)
            chk = Checkbox(item)
            if item in self.mainwindow.analysis_graph_list:
                chk.setChecked(True)
            chk.sigStateChanged.connect(self.callback_check_state_changed)
            self.graph_table.setCellWidget(index, 1, chk)
        self.clear_btn = QtGui.QPushButton('Clear all')
        self.clear_btn.clicked.connect(self.callback_clear)
        #
        w = QtGui.QWidget()
        self.vlayout = QtGui.QVBoxLayout(w)
        self.setCentralWidget(w)
        self.centralWidget().setLayout(self.vlayout)
        self.vlayout.addWidget(self.graph_table)
        self.vlayout.addWidget(self.clear_btn) 
Example #12
Source File: analysis.py    From pyFlightAnalysis with MIT License 4 votes vote down vote up
def update_graph(self):
        # update tableView
        # clear 
        self.plotting_data_tableView.setRowCount(0)
        # add
        for ind, (item_id, item) in enumerate(self.data_plotting.items()):
            self.plotting_data_tableView.insertRow(ind)
            self.plotting_data_tableView.setCellWidget(ind, 0, QtGui.QLabel(item[0]))
            chkbox = Checkbox(item_id, '')
            chkbox.setChecked(item[1])
            chkbox.sigStateChanged.connect(self.callback_visible_changed)
            self.plotting_data_tableView.setCellWidget(ind, 1, chkbox)
            curve = item[2]
            color = curve.opts['pen']
            if isinstance(color, QtGui.QColor):
                color = color.red(), color.green(), color.blue()
            marker = curve.opts['symbol']
            marker_dict = OrderedDict([(None,'None'), ('s','☐'), ('t','▽'), ('o','○'), ('+','+')])
            color_text = '#{0[0]:02x}{0[1]:02x}{0[2]:02x}'.format(color)
            lbl_txt = "<font color='{0}'>{1}</font> {2}".format(color_text,'▇▇',str(marker_dict[marker]))
            lbl = PropertyLabel(item_id, self, lbl_txt)
            lbl.sigPropertyChanged.connect(self.callback_property_changed)
            self.plotting_data_tableView.setCellWidget(ind, 2, lbl)
        
        # update curve
        # remove curves in graph
        items_to_be_removed = []
        for item in self.main_graph_t.items:
            if isinstance(item, pg.PlotDataItem):
                items_to_be_removed.append(item)
        for item in items_to_be_removed:
            self.main_graph_t.removeItem(item)

        self.main_graph_t.legend.scene().removeItem(self.main_graph_t.legend)
        self.main_graph_t.addLegend()
        # redraw curves
        for ind, (item_id, item) in enumerate(self.data_plotting.items()):
            label, showed, curve = item
            color = curve.opts['pen']
            if isinstance(color, QtGui.QColor):
                color = color.red(), color.green(), color.blue()
            data = curve.xData, curve.yData
            marker = curve.opts['symbol']
            symbolSize = curve.opts['symbolSize']
            if showed:
                curve = self.main_graph_t.plot(data[0], data[1], symbol=marker, pen=color, name=label, symbolSize=symbolSize)
                self.data_plotting[item_id][2] = curve 
        self.update_ROI_graph()