Python pyqtgraph.Qt.QtGui.QPushButton() Examples

The following are 14 code examples of pyqtgraph.Qt.QtGui.QPushButton(). 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: midicontrol.py    From OpenNFB with GNU General Public License v3.0 6 votes vote down vote up
def config_dialog(self):
        self.config = True
        win = QtGui.QDialog()

        layout = QtGui.QVBoxLayout()

        keys = self.cc.keys()
        keys.sort()

        for cc in keys:
            label = "CC " + str(cc)
            button = QtGui.QPushButton(label)
            func = lambda cc=cc: self.midi.send_cc(0, cc, random.randint(0, 127))
            button.pressed.connect(func)
            layout.addWidget(button)

        finishButton = QtGui.QPushButton('Finished')
        layout.addWidget(finishButton)
        finishButton.clicked.connect(win.accept)

        win.setLayout(layout)

        win.exec_()
        self.config = False 
Example #2
Source File: gccNMFInterface.py    From gcc-nmf with MIT License 6 votes vote down vote up
def initUIControls(self):
        self.uiConrolsWidget = QtGui.QWidget()
        buttonBarWidgetLayout = QtGui.QHBoxLayout(spacing=0)
        buttonBarWidgetLayout.setContentsMargins(0, 0, 0, 0)
        buttonBarWidgetLayout.setSpacing(0)
        self.uiConrolsWidget.setLayout(buttonBarWidgetLayout)
        
        def addButton(label, widget=None, function=None):
            button = QtGui.QPushButton(label)
            if function is None:
                button.clicked.connect(lambda: widget.setVisible(widget.isHidden()))
            else:
                button.clicked.connect(function)
            button.setStyleSheet('QPushButton {'
                                 'border-color: black;'
                                 'border-width: 5px;}')
            buttonBarWidgetLayout.addWidget(button)
            return button

        addButton('Info', function=self.toggleInfoViews)
        self.toggleSeparationButton = addButton(self.separationOnIconString, function=self.toggleSeparation)
        self.playPauseButton = addButton(self.playIconString, function=self.togglePlay) 
Example #3
Source File: __main__.py    From tf-pose with Apache License 2.0 5 votes vote down vote up
def __init__(self):
        QtGui.QMainWindow.__init__(self)
        self.ui = Ui_Form()
        self.cw = QtGui.QWidget()
        self.setCentralWidget(self.cw)
        self.ui.setupUi(self.cw)

        self.codeBtn = QtGui.QPushButton('Run Edited Code')
        self.codeLayout = QtGui.QGridLayout()
        self.ui.codeView.setLayout(self.codeLayout)
        self.codeLayout.addItem(QtGui.QSpacerItem(100,100,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding), 0, 0)
        self.codeLayout.addWidget(self.codeBtn, 1, 1)
        self.codeBtn.hide()

        global examples
        self.itemCache = []
        self.populateTree(self.ui.exampleTree.invisibleRootItem(), examples)
        self.ui.exampleTree.expandAll()

        self.resize(1000,500)
        self.show()
        self.ui.splitter.setSizes([250,750])
        self.ui.loadBtn.clicked.connect(self.loadFile)
        self.ui.exampleTree.currentItemChanged.connect(self.showFile)
        self.ui.exampleTree.itemDoubleClicked.connect(self.loadFile)
        self.ui.codeView.textChanged.connect(self.codeEdited)
        self.codeBtn.clicked.connect(self.runEditedCode) 
Example #4
Source File: widgets.py    From pyFlightAnalysis with MIT License 5 votes vote down vote up
def callback_properties_changed(self, *args, **kwargs):
        self.curve.opts['symbol'] = self.mkr.marker
        self.curve.opts['pen'] = self.btn.color()
        try:
            self.curve.opts['symbolSize'] = int(self.ln.text())
            print('set size finished to ', self.curve.opts['symbolSize'])
        except:
            d = QtGui.QDialog('Input Error')
            b1 = QtGui.QPushButton("ok",d)
            d.setWindowModality(QtCore.Qt.ApplicationModal)
            d.exec_()
        # update graph and items in plot list pane
        self.sigCurveChanged.emit(True) 
Example #5
Source File: widgets.py    From pyFlightAnalysis with MIT License 5 votes vote down vote up
def __init__(self, params_data, changed_params_data, *args, **kwargs):
        self.params_data = params_data
        self.params_data_show = list(self.params_data.keys())
        self.changed_params_data = changed_params_data
        super().__init__(*args, **kwargs)
        self.resize(QtCore.QSize(500,500))
        self.params_table = QtGui.QTableWidget()
        self.choose_item_lineEdit = QtGui.QLineEdit(self)
        self.choose_item_lineEdit.setPlaceholderText('filter by data name')
        self.choose_item_lineEdit.textChanged.connect(self.callback_filter)
        self.btn_changed_filter = QtGui.QPushButton('Changed')
        self.btn_changed_filter.clicked.connect(self.btn_changed_filter_clicked) 
        w = QtGui.QWidget()
        self.vlayout = QtGui.QVBoxLayout(w)
        self.hlayout = QtGui.QHBoxLayout(self)
        self.setCentralWidget(w)
        self.centralWidget().setLayout(self.vlayout)
        self.vlayout.addWidget(self.params_table)
        self.vlayout.addLayout(self.hlayout)
        self.hlayout.addWidget(self.btn_changed_filter)
        self.hlayout.addWidget(self.choose_item_lineEdit)
        self.params_table.setEditTriggers(QtGui.QAbstractItemView.DoubleClicked | 
                                                     QtGui.QAbstractItemView.SelectedClicked)
        self.params_table.setSortingEnabled(False)
        self.params_table.horizontalHeader().setStretchLastSection(True)
        self.params_table.resizeColumnsToContents()
        self.params_table.setColumnCount(2)
        self.params_table.setColumnWidth(0, 120)
        self.params_table.setColumnWidth(1, 50)
        self.params_table.setHorizontalHeaderLabels(['Name', 'value'])
        self.show_all_params = True
        self.filtertext = ''
        self.update_table() 
Example #6
Source File: UIWidgets.py    From Astibot with MIT License 5 votes vote down vote up
def __init__(self, inLblToolTip, parent=None):
        super(QtGui.QPushButton, self).__init__(parent)
        self.lblToolTip = inLblToolTip 
Example #7
Source File: UIWidgets.py    From Astibot with MIT License 5 votes vote down vote up
def __init__(self, inLblToolTip, parent=None):
        super(QtGui.QPushButton, self).__init__(parent)
        self.lblToolTip = inLblToolTip 
Example #8
Source File: UIWidgets.py    From Astibot with MIT License 5 votes vote down vote up
def __init__(self, inLblToolTip, parent=None):
        super(QtGui.QPushButton, self).__init__(parent)
        self.lblToolTip = inLblToolTip 
Example #9
Source File: UIWidgets.py    From Astibot with MIT License 5 votes vote down vote up
def __init__(self, inLblToolTip, parent=None):
        super(QtGui.QPushButton, self).__init__(parent)
        self.lblToolTip = inLblToolTip 
Example #10
Source File: UIWidgets.py    From Astibot with MIT License 5 votes vote down vote up
def __init__(self, inLblToolTip, parent=None):
        super(QtGui.QPushButton, self).__init__(parent)
        self.lblToolTip = inLblToolTip 
Example #11
Source File: label_events.py    From ConvNetQuake with MIT License 5 votes vote down vote up
def set_buttons(self):
    self.button_layout = QtGui.QHBoxLayout()
    self.prev_button = QtGui.QPushButton('Previous Event')
    self.next_button = QtGui.QPushButton('Next Event')
    # self.catalog_button = QtGui.QPushButton("Save Catalog")
    self.next_button.clicked.connect(self.next_event)
    self.prev_button.clicked.connect(self.prev_event)
    # self.catalog_button.clicked.connect(self.save_catalog)

    self.button_layout.addWidget(self.prev_button)
    self.button_layout.addWidget(self.next_button)
    # self.button_layout.addWidget(self.catalog_button)

    self.layout.addLayout(self.button_layout) 
Example #12
Source File: __main__.py    From qgisSpaceSyntaxToolkit with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        QtGui.QMainWindow.__init__(self)
        self.ui = Ui_Form()
        self.cw = QtGui.QWidget()
        self.setCentralWidget(self.cw)
        self.ui.setupUi(self.cw)

        self.codeBtn = QtGui.QPushButton('Run Edited Code')
        self.codeLayout = QtGui.QGridLayout()
        self.ui.codeView.setLayout(self.codeLayout)
        self.codeLayout.addItem(QtGui.QSpacerItem(100,100,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding), 0, 0)
        self.codeLayout.addWidget(self.codeBtn, 1, 1)
        self.codeBtn.hide()

        global examples
        self.itemCache = []
        self.populateTree(self.ui.exampleTree.invisibleRootItem(), examples)
        self.ui.exampleTree.expandAll()

        self.resize(1000,500)
        self.show()
        self.ui.splitter.setSizes([250,750])
        self.ui.loadBtn.clicked.connect(self.loadFile)
        self.ui.exampleTree.currentItemChanged.connect(self.showFile)
        self.ui.exampleTree.itemDoubleClicked.connect(self.loadFile)
        self.ui.codeView.textChanged.connect(self.codeEdited)
        self.codeBtn.clicked.connect(self.runEditedCode) 
Example #13
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 #14
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)