Python pyqtgraph.Qt.QtGui.QWidget() Examples

The following are 26 code examples of pyqtgraph.Qt.QtGui.QWidget(). 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: 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 #2
Source File: gccNMFInterface.py    From gcc-nmf with MIT License 6 votes vote down vote up
def initControlWidgets(self):
        self.initMaskFunctionControls()
        self.initMaskFunctionPlot()
        self.initNMFControls()
        self.initLocalizationControls()
        self.initUIControls()
         
        controlWidgetsLayout = QtGui.QVBoxLayout()
        controlWidgetsLayout.addWidget(self.gccPHATPlotWidget)
        controlWidgetsLayout.addLayout(self.maskFunctionControlslayout)
        self.addSeparator(controlWidgetsLayout)
        controlWidgetsLayout.addLayout(self.nmfControlsLayout)
        controlWidgetsLayout.addLayout(self.localizationControlsLayout)
        self.addSeparator(controlWidgetsLayout)
        controlWidgetsLayout.addWidget(self.uiConrolsWidget)
        
        self.controlsWidget = QtGui.QWidget()
        self.controlsWidget.setLayout(controlWidgetsLayout)
        self.controlsWidget.setAutoFillBackground(True) 
Example #3
Source File: Qt.py    From pymeasure with MIT License 6 votes vote down vote up
def fromUi(*args, **kwargs):
    """ Returns a Qt object constructed using loadUiType
    based on its arguments. All QWidget objects in the
    form class are set in the returned object for easy
    accessability.
    """
    form_class, base_class = loadUiType(*args, **kwargs)
    widget = base_class()
    form = form_class()
    form.setupUi(widget)
    form.retranslateUi(widget)
    for name in dir(form):
        element = getattr(form, name)
        if isinstance(element, QtGui.QWidget):
            setattr(widget, name, element)
    return widget 
Example #4
Source File: gccNMFInterface.py    From gcc-nmf with MIT License 6 votes vote down vote up
def initWindow(self):
        self.setWindowTitle('Real-time GCC-NMF')
        
        self.mainWidget = QtGui.QWidget()
        self.setCentralWidget(self.mainWidget)
        self.backgroundColor = self.mainWidget.palette().color(QtGui.QPalette.Background)
        self.borderColor = 'k'
        self.mainWidget.setStyleSheet('QSplitter::handle {image: url(images/notExists.png); background-color: #D8D8D8}')
        
        self.mainLayout = QtGui.QGridLayout()
        self.mainWidget.setLayout(self.mainLayout)
        self.mainWidget.setAutoFillBackground(True)
        p = QtGui.QPalette(self.mainWidget.palette())
        p.setColor(self.mainWidget.backgroundRole(), QtCore.Qt.black)
        self.mainWidget.setPalette(p)
        
        self.mainLayout.setContentsMargins(0, 0, 0, 0)
        self.mainLayout.setSpacing(1) 
Example #5
Source File: widgets.py    From pyFlightAnalysis with MIT License 6 votes vote down vote up
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.setFixedSize(QtCore.QSize(600, 400))
        w = QtGui.QWidget()
        self.setCentralWidget(w)
        vlayout = QtGui.QVBoxLayout()
        w.setLayout(vlayout)
        self.htmlView = QtWidgets.QTextBrowser(self)
        font = QtGui.QFont()
        font.setFamily('Arial')
        self.htmlView.setReadOnly(True)
        self.htmlView.setFont(font)
        self.htmlView.setOpenExternalLinks(True)
        self.htmlView.setObjectName('Help information')
        html_help_path = get_source_name('docs/help.html')
        ret = self.htmlView.setSource(QtCore.QUrl(html_help_path))
        print('load result:', ret)
#         self.htmlView.append(ret)
        vlayout.addWidget(self.htmlView) 
Example #6
Source File: widgets.py    From pyFlightAnalysis with MIT License 6 votes vote down vote up
def __init__(self,*args,**kwargs):
        super(QuadrotorWin,self).__init__(*args,**kwargs)
        self.toolBar = self.addToolBar('showSetting')
        self.trace_show = QtGui.QAction(QtGui.QIcon(get_source_name('icons/trace.gif')),
                                        'show trace',
                                        self)
        self.trace_show.triggered.connect(self.callback_show_trace)
        self.trace_showed = False
        self.vector_show = QtGui.QAction(QtGui.QIcon(get_source_name('icons/rotor_vector.gif')),
                                         'show rotation speed vector',self)
        self.vector_show.triggered.connect(self.callback_show_vector)
        self.vector_showed = False
        self.toolBar.addAction(self.trace_show)
        self.toolBar.addAction(self.vector_show)
        self.quadrotor_win_main_widget = QtGui.QWidget(self)
        self.quadrotor_win_main_layout = QtGui.QHBoxLayout() 
        self.quadrotor_win_main_widget.setLayout(self.quadrotor_win_main_layout)
        self.quadrotor_widget = QuadrotorWidget(self.quadrotor_win_main_widget)
        self.quadrotor_win_main_layout.addWidget(self.quadrotor_widget)
        self.setCentralWidget(self.quadrotor_win_main_widget)
        self.setWindowTitle("pyFlightAnalysis  Trace plot") 
Example #7
Source File: UIInfo.py    From Astibot with MIT License 6 votes vote down vote up
def __init__(self):
        # Here, you should call the inherited class' init, which is QDialog
        QtGui.QWidget.__init__(self)
        
        print("UIFO - UI Info constructor")
        
        # Window settings
        #self.setWindowModality(QtCore.Qt.ApplicationModal)
        self.setWindowTitle('Astibot Information')
        self.setStyleSheet("background-color:#203044;")
        self.setWindowIcon(QtGui.QIcon("AstibotIcon.png"))
        self.setAutoFillBackground(True);
        self.setFixedSize(1060, 750)
        
        # Build layout
        self.BuildWindowLayout() 
Example #8
Source File: batchviewer.py    From BatchViewer with Apache License 2.0 5 votes vote down vote up
def __init__(self, parent=None, width=300, height=300):
        QtGui.QWidget.__init__(self, parent)
        self.batch = None
        self.width = width
        self.height = height
        self.slicingWidgets = {}
        self._init_gui() 
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: relativity.py    From qgisSpaceSyntaxToolkit with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        QtGui.QWidget.__init__(self)
        
        self.animations = []
        self.animTimer = QtCore.QTimer()
        self.animTimer.timeout.connect(self.stepAnimation)
        self.animTime = 0
        self.animDt = .016
        self.lastAnimTime = 0
        
        self.setupGUI()
        
        self.objectGroup = ObjectGroupParam()
        
        self.params = Parameter.create(name='params', type='group', children=[
            dict(name='Load Preset..', type='list', values=[]),
            #dict(name='Unit System', type='list', values=['', 'MKS']),
            dict(name='Duration', type='float', value=10.0, step=0.1, limits=[0.1, None]),
            dict(name='Reference Frame', type='list', values=[]),
            dict(name='Animate', type='bool', value=True),
            dict(name='Animation Speed', type='float', value=1.0, dec=True, step=0.1, limits=[0.0001, None]),
            dict(name='Recalculate Worldlines', type='action'),
            dict(name='Save', type='action'),
            dict(name='Load', type='action'),
            self.objectGroup,
            ])
        self.tree.setParameters(self.params, showTop=False)
        self.params.param('Recalculate Worldlines').sigActivated.connect(self.recalculate)
        self.params.param('Save').sigActivated.connect(self.save)
        self.params.param('Load').sigActivated.connect(self.load)
        self.params.param('Load Preset..').sigValueChanged.connect(self.loadPreset)
        self.params.sigTreeStateChanged.connect(self.treeChanged)
        
        ## read list of preset configs
        presetDir = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), 'presets')
        if os.path.exists(presetDir):
            presets = [os.path.splitext(p)[0] for p in os.listdir(presetDir)]
            self.params.param('Load Preset..').setLimits(['']+presets) 
Example #11
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 #12
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 #13
Source File: clear-windshield.py    From OpenNFB with GNU General Public License v3.0 5 votes vote down vote up
def widget(self):
        w = QtGui.QWidget()
        layout = QtGui.QGridLayout()
        w.setLayout(layout)

        layout.addWidget(self.OSC1.widget(), 0, 0)
        layout.addWidget(self.OSC2.widget(), 1, 0)
        layout.addWidget(self.OSC3.widget(), 2, 0)

        layout.addWidget(self.Spec.widget(), 0, 1, 3, 3)
        layout.addWidget(self.Lthr.widget(), 4, 1, 1, 1)
        layout.addWidget(self.Tthr.widget(), 4, 2, 1, 1)
        layout.addWidget(self.Hthr.widget(), 4, 3, 1, 1)

        return w 
Example #14
Source File: ekg-drum.py    From OpenNFB with GNU General Public License v3.0 5 votes vote down vote up
def widget(self):
        w = QtGui.QWidget()
        layout = QtGui.QGridLayout()
        w.setLayout(layout)

        layout.addWidget(self.RAWOSC1.widget(), 0, 0)
        layout.addWidget(self.fftFilt.widget(), 2, 0)

        return w 
Example #15
Source File: smr.py    From OpenNFB with GNU General Public License v3.0 5 votes vote down vote up
def widget(self):
        w = QtGui.QWidget()
        layout = QtGui.QGridLayout()
        w.setLayout(layout)

        layout.addWidget(self.OSC1.widget(), 0, 0)
        layout.addWidget(self.OSC2.widget(), 1, 0)
        layout.addWidget(self.OSC3.widget(), 2, 0)
        layout.addWidget(self.OSC4.widget(), 3, 0)

        layout.addWidget(self.Spec.widget(), 0, 1, 4, 1)

        return w 
Example #16
Source File: multiband.py    From OpenNFB with GNU General Public License v3.0 5 votes vote down vote up
def widget(self):
        w = QtGui.QWidget()
        layout = QtGui.QGridLayout()
        w.setLayout(layout)

        layout.addWidget(self.OSC1.widget(), 0, 0)
        layout.addWidget(self.OSC2.widget(), 1, 0)
        layout.addWidget(self.OSC3.widget(), 2, 0)
        layout.addWidget(self.OSC4.widget(), 3, 0)

        layout.addWidget(self.Spec.widget(), 0, 1, 3, 1)
        layout.addWidget(self.DCOSC.widget(), 3, 1)

        return w 
Example #17
Source File: emg.py    From OpenNFB with GNU General Public License v3.0 5 votes vote down vote up
def widget(self):
        w = QtGui.QWidget()
        layout = QtGui.QGridLayout()
        w.setLayout(layout)

        layout.addWidget(self.OSC1.widget(), 0, 0)
        layout.addWidget(self.OSC2.widget(), 1, 0)
        layout.addWidget(self.OSC3.widget(), 2, 0)

        layout.addWidget(self.Spec.widget(), 0, 1, 3, 1)

        return w 
Example #18
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 #19
Source File: batchviewer.py    From BatchViewer with Apache License 2.0 5 votes vote down vote up
def __init__(self, width=300, height=300):
        QtGui.QWidget.__init__(self)
        self.image = None
        self.lut=None
        self.init(width, height) 
Example #20
Source File: UIDonation.py    From Astibot with MIT License 5 votes vote down vote up
def __init__(self, settings):
        # Here, you should call the inherited class' init, which is QDialog
        QtGui.QWidget.__init__(self)
        
        print("UIDO - UI Donating constructor")
        
        # Application settings data instance
        self.theSettings = settings
        
        # Functional
        self.BTCBalance = -1.0
        self.windowIsShown = False
        self.timerRefreshBTCBalance = QtCore.QTimer()
        self.timerRefreshBTCBalance.timeout.connect(self.TimerRaisedRefreshBTCBalance)
        self.timerRefreshBTCBalance.start(200)
        self.withdrawHasBeenPerformed = False
    
        # Window settings
        self.setWindowModality(QtCore.Qt.ApplicationModal)
        self.setWindowTitle('Astibot')
        self.setStyleSheet("background-color:#203044;")
        self.setWindowIcon(QtGui.QIcon("AstibotIcon.png"))
        self.setAutoFillBackground(True);
        self.setFixedSize(450, 350)
        
        # Build layout
        self.BuildWindowLayout() 
Example #21
Source File: UISettings.py    From Astibot with MIT License 5 votes vote down vote up
def __init__(self, settings):
        # Here, you should call the inherited class' init, which is QDialog
        QtGui.QWidget.__init__(self)
        
        print("UIST - UI Settings constructor")
        
        # Application settings data instance
        self.theSettings = settings
        
        # Window settings
        self.setWindowModality(QtCore.Qt.ApplicationModal)
        self.setWindowTitle('Astibot Settings')
        self.setStyleSheet("background-color:#203044;")
        self.setWindowIcon(QtGui.QIcon("AstibotIcon.png"))
        self.setAutoFillBackground(True);
        self.setFixedSize(646, 610)
        
        # Build layout
        self.BuildWindowLayout()
        
        # Timer to make API textboxes blink
        self.timerBlinkStuffs = QtCore.QTimer()
        self.timerBlinkStuffs.timeout.connect(self.TimerRaisedBlinkStuff)    
        self.blinkIsOn = False
        self.blinkCounter = 0
              
        # Apply saved (or default) settings
        self.ApplySettings() 
Example #22
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 #23
Source File: MatplotlibWidget.py    From FAE with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None, size=(5.0, 4.0), dpi=100):
        QtGui.QWidget.__init__(self)
        super(MatplotlibWidget, self).__init__(parent)
        self.fig = Figure(size, dpi=dpi)
        self.canvas = FigureCanvas(self.fig)
        self.canvas.setParent(self)
        # self.toolbar = NavigationToolbar(self.canvas, self)
        
        self.vbox = QtGui.QVBoxLayout()
        # self.vbox.addWidget(self.toolbar)
        self.vbox.addWidget(self.canvas)
        
        self.setLayout(self.vbox) 
Example #24
Source File: relativity.py    From tf-pose with Apache License 2.0 5 votes vote down vote up
def __init__(self):
        QtGui.QWidget.__init__(self)
        
        self.animations = []
        self.animTimer = QtCore.QTimer()
        self.animTimer.timeout.connect(self.stepAnimation)
        self.animTime = 0
        self.animDt = .016
        self.lastAnimTime = 0
        
        self.setupGUI()
        
        self.objectGroup = ObjectGroupParam()
        
        self.params = Parameter.create(name='params', type='group', children=[
            dict(name='Load Preset..', type='list', values=[]),
            #dict(name='Unit System', type='list', values=['', 'MKS']),
            dict(name='Duration', type='float', value=10.0, step=0.1, limits=[0.1, None]),
            dict(name='Reference Frame', type='list', values=[]),
            dict(name='Animate', type='bool', value=True),
            dict(name='Animation Speed', type='float', value=1.0, dec=True, step=0.1, limits=[0.0001, None]),
            dict(name='Recalculate Worldlines', type='action'),
            dict(name='Save', type='action'),
            dict(name='Load', type='action'),
            self.objectGroup,
            ])
        self.tree.setParameters(self.params, showTop=False)
        self.params.param('Recalculate Worldlines').sigActivated.connect(self.recalculate)
        self.params.param('Save').sigActivated.connect(self.save)
        self.params.param('Load').sigActivated.connect(self.load)
        self.params.param('Load Preset..').sigValueChanged.connect(self.loadPreset)
        self.params.sigTreeStateChanged.connect(self.treeChanged)
        
        ## read list of preset configs
        presetDir = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), 'presets')
        if os.path.exists(presetDir):
            presets = [os.path.splitext(p)[0] for p in os.listdir(presetDir)]
            self.params.param('Load Preset..').setLimits(['']+presets) 
Example #25
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 #26
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)