How to use the pyqtgraph.Qt.QtCore function in pyqtgraph

To help you get started, we’ve selected a few pyqtgraph examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fedebarabas / tormenta / tormenta / control / control.py View on Github external
self.recFormat = QtGui.QComboBox(self)
        self.recFormat.addItem('tiff')
        self.recFormat.addItem('hdf5')
        self.recFormat.setFixedWidth(50)

        # Number of frames and measurement timing
        self.currentFrame = QtGui.QLabel('0 /')
        self.currentFrame.setAlignment((QtCore.Qt.AlignRight |
                                        QtCore.Qt.AlignVCenter))
        self.currentFrame.setFixedWidth(45)
        self.numExpositionsEdit = QtGui.QLineEdit('100')
        self.numExpositionsEdit.setFixedWidth(45)
        self.tRemaining = QtGui.QLabel()
        self.tRemaining.setStyleSheet("font-size:14px")
        self.tRemaining.setAlignment((QtCore.Qt.AlignCenter |
                                      QtCore.Qt.AlignVCenter))
        self.numExpositionsEdit.textChanged.connect(self.nChanged)
        self.updateRemaining()

        self.progressBar = QtGui.QProgressBar()
        self.progressBar.setTextVisible(False)
        self.progressBar.setSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Expanding)
        self.fileSizeLabel = QtGui.QLabel()
        self.nChanged()

        # Recording buttons layout
        buttonWidget = QtGui.QWidget()
        buttonGrid = QtGui.QGridLayout(buttonWidget)
        buttonGrid.addWidget(self.snapButton, 0, 0)
        buttonWidget.setSizePolicy(QtGui.QSizePolicy.Preferred,
                                   QtGui.QSizePolicy.Expanding)
github SainsburyWellcomeCentre / lasagna / lasagna / io_libs / exported_goggle_tree_to_lasagna_lines.py View on Github external
# view 3
view.nextRow()
w3 = view.addPlot()
path_item = []
for path in paths:
    path_item.append(pg.PlotDataItem(size=10, pen='w', symbol='o', symbolSize=2, brush=pg.mkBrush(255, 255, 255, 120)))
    data = dataFromPath(data_tree, path)
    path_item[-1].setData(x=data[1], y=data[2])
    w3.addItem(path_item[-1])


# Start Qt event loop unless running in interactive mode.
if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()
github Ulm-IQO / qudi / gui / optimizer / optimgui.py View on Github external
#        print("Save logic is", self._save_logic)

        # Use the inherited class 'Ui_OptimizerGuiTemplate' to create now the
        # GUI element:
        self._mw = OptimizerMainWindow()
        self._sw = OptimizerSettingDialog()

        # Get the image for the display from the logic:
        arr01 = self._optimizer_logic.xy_refocus_image[:,:,3].transpose()
        arr02 = self._optimizer_logic.z_refocus_line


        # Load the image in the display:
        self.xy_refocus_image = pg.ImageItem(arr01)
        self.xy_refocus_image.setRect(
            QtCore.QRectF(
                self._optimizer_logic._trackpoint_x - 0.5 * self._optimizer_logic.refocus_XY_size,
                self._optimizer_logic._trackpoint_y - 0.5 * self._optimizer_logic.refocus_XY_size,
                self._optimizer_logic.refocus_XY_size, self._optimizer_logic.refocus_XY_size
            ))
        self.xz_refocus_image = pg.ScatterPlotItem(self._optimizer_logic._zimage_Z_values,
                                                arr02,
                                                symbol='o')
        self.xz_refocus_fit_image = pg.PlotDataItem(self._optimizer_logic._fit_zimage_Z_values,
                                                    self._optimizer_logic.z_fit_data,
                                                    pen=QtGui.QPen(QtGui.QColor(255,0,255,255)))

        # Add the display item to the xy and xz VieWidget defined in
        # the UI file.
        self._mw.xy_refocus_ViewWidget.addItem(self.xy_refocus_image)
        self._mw.xz_refocus_ViewWidget.addItem(self.xz_refocus_image)
        self._mw.xz_refocus_ViewWidget.addItem(self.xz_refocus_fit_image)
github pyqtgraph / pyqtgraph / pyqtgraph / graphicsItems / GraphicsItem.py View on Github external
## check local cache
        if direction is None and dt == self._pixelVectorCache[0]:
            return tuple(map(Point, self._pixelVectorCache[1]))  ## return a *copy*
        
        ## check global cache
        #key = (dt.m11(), dt.m21(), dt.m31(), dt.m12(), dt.m22(), dt.m32(), dt.m31(), dt.m32())
        key = (dt.m11(), dt.m21(), dt.m12(), dt.m22())
        pv = self._pixelVectorGlobalCache.get(key, None)
        if direction is None and pv is not None:
            self._pixelVectorCache = [dt, pv]
            return tuple(map(Point,pv))  ## return a *copy*
        
        
        if direction is None:
            direction = QtCore.QPointF(1, 0)  
        if direction.manhattanLength() == 0:
            raise Exception("Cannot compute pixel length for 0-length vector.")
            
        ## attempt to re-scale direction vector to fit within the precision of the coordinate system
        ## Here's the problem: we need to map the vector 'direction' from the item to the device, via transform 'dt'.
        ## In some extreme cases, this mapping can fail unless the length of 'direction' is cleverly chosen.
        ## Example:
        ##   dt = [ 1, 0,    2 
        ##          0, 2, 1e20
        ##          0, 0,    1 ]
        ## Then we map the origin (0,0) and direction (0,1) and get:
        ##    o' = 2,1e20
        ##    d' = 2,1e20  <-- should be 1e20+2, but this can't be represented with a 32-bit float
        ##    
        ##    |o' - d'|  == 0    <-- this is the problem.
github lneuhaus / pyrpl / pyrpl / gui / redpitaya_gui.py View on Github external
def add_dock_widget(self, widget, name):
        dock_widget = QtGui.QDockWidget(name)
        dock_widget.setObjectName(name)
        dock_widget.setFeatures(
            QtGui.QDockWidget.DockWidgetFloatable |
            QtGui.QDockWidget.DockWidgetMovable |
            QtGui.QDockWidget.DockWidgetVerticalTitleBar)
        self.dock_widgets[name] = dock_widget
        dock_widget.setWidget(widget)
        self.main_window.addDockWidget(QtCore.Qt.TopDockWidgetArea,
                                       dock_widget)
        if self.last_docked is not None:
            self.main_window.tabifyDockWidget(self.last_docked, dock_widget)
        self.last_docked = dock_widget
github pyqtgraph / pyqtgraph / pyqtgraph / exporters / SVGExporter.py View on Github external
tr = QtGui.QTransform()
    if isinstance(item, QtGui.QGraphicsScene):
        xmlStr = "\n"
        doc = xml.parseString(xmlStr)
        childs = [i for i in item.items() if i.parentItem() is None]
    elif item.__class__.paint == QtGui.QGraphicsItem.paint:
        xmlStr = "\n"
        doc = xml.parseString(xmlStr)
        childs = item.childItems()
    else:
        childs = item.childItems()
        tr = itemTransform(item, item.scene())
        
        ## offset to corner of root item
        if isinstance(root, QtGui.QGraphicsScene):
            rootPos = QtCore.QPoint(0,0)
        else:
            rootPos = root.scenePos()
        tr2 = QtGui.QTransform()
        tr2.translate(-rootPos.x(), -rootPos.y())
        tr = tr * tr2

        arr = QtCore.QByteArray()
        buf = QtCore.QBuffer(arr)
        svg = QtSvg.QSvgGenerator()
        svg.setOutputDevice(buf)
        dpi = QtGui.QDesktopWidget().physicalDpiX()
        svg.setResolution(dpi)

        p = QtGui.QPainter()
        p.begin(svg)
        if hasattr(item, 'setExportMode'):
github pyqtgraph / pyqtgraph / pyqtgraph / parametertree / Parameter.py View on Github external
removable                    If True, the user may remove this Parameter.
                                     (default=False)
        expanded                     If True, the Parameter will appear expanded when
                                     displayed in a ParameterTree (its children will be
                                     visible). (default=True)
        title                        (str or None) If specified, then the parameter will be 
                                     displayed to the user using this string as its name. 
                                     However, the parameter will still be referred to 
                                     internally using the *name* specified above. Note that
                                     this option is not compatible with renamable=True.
                                     (default=None; added in version 0.9.9)
        =======================      =========================================================
        """
        
        
        QtCore.QObject.__init__(self)
        
        self.opts = {
            'type': None,
            'readonly': False,
            'visible': True,
            'enabled': True,
            'renamable': False,
            'removable': False,
            'strictNaming': False,  # forces name to be usable as a python variable
            'expanded': True,
            'title': None,
            #'limits': None,  ## This is a bad plan--each parameter type may have a different data type for limits.
        }
        self.opts.update(opts)
        
        self.childs = []
github ColinDuquesnoy / QDarkStyleSheet / example / ui / dw_inputs_no_fields_pyqtgraph_ui.py View on Github external
self.comboBoxDis.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self.comboBoxDis.setObjectName(_fromUtf8("comboBoxDis"))
        self.comboBoxDis.addItem(_fromUtf8(""))
        self.comboBoxDis.addItem(_fromUtf8(""))
        self.comboBoxDis.addItem(_fromUtf8(""))
        self.gridLayout.addWidget(self.comboBoxDis, 1, 2, 1, 1)
        self.horizontalScrollBar = QtGui.QScrollBar(self.dockWidgetContents)
        self.horizontalScrollBar.setMinimumSize(QtCore.QSize(0, 0))
        self.horizontalScrollBar.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self.horizontalScrollBar.setProperty("value", 50)
        self.horizontalScrollBar.setOrientation(QtCore.Qt.Horizontal)
        self.horizontalScrollBar.setObjectName(_fromUtf8("horizontalScrollBar"))
        self.gridLayout.addWidget(self.horizontalScrollBar, 3, 1, 1, 1)
        self.comboBox = QtGui.QComboBox(self.dockWidgetContents)
        self.comboBox.setMinimumSize(QtCore.QSize(0, 0))
        self.comboBox.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self.comboBox.setObjectName(_fromUtf8("comboBox"))
        self.comboBox.addItem(_fromUtf8(""))
        self.comboBox.addItem(_fromUtf8(""))
        self.comboBox.addItem(_fromUtf8(""))
        self.gridLayout.addWidget(self.comboBox, 1, 1, 1, 1)
        self.label_22 = QtGui.QLabel(self.dockWidgetContents)
        self.label_22.setMinimumSize(QtCore.QSize(0, 0))
        self.label_22.setMaximumSize(QtCore.QSize(16777215, 16777215))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label_22.setFont(font)
        self.label_22.setObjectName(_fromUtf8("label_22"))
        self.gridLayout.addWidget(self.label_22, 3, 0, 1, 1)
        self.label = QtGui.QLabel(self.dockWidgetContents)
        font = QtGui.QFont()
github pyqtgraph / pyqtgraph / pyqtgraph / dockarea / Dock.py View on Github external
def dragEnterEvent(self, *args):
        DockDrop.dragEnterEvent(self, *args)

    def dragMoveEvent(self, *args):
        DockDrop.dragMoveEvent(self, *args)

    def dragLeaveEvent(self, *args):
        DockDrop.dragLeaveEvent(self, *args)

    def dropEvent(self, *args):
        DockDrop.dropEvent(self, *args)


class DockLabel(VerticalLabel):
    
    sigClicked = QtCore.Signal(object, object)
    sigCloseClicked = QtCore.Signal()
    
    def __init__(self, text, dock, showCloseButton):
        self.dim = False
        self.fixedWidth = False
        VerticalLabel.__init__(self, text, orientation='horizontal', forceWidth=False)
        self.setAlignment(QtCore.Qt.AlignTop|QtCore.Qt.AlignHCenter)
        self.dock = dock
        self.updateStyle()
        self.setAutoFillBackground(False)
        self.startedDrag = False

        self.closeButton = None
        if showCloseButton:
            self.closeButton = QtGui.QToolButton(self)
            self.closeButton.clicked.connect(self.sigCloseClicked)
github pyacq / pyacq / pyacq / devices / webcam_av.py View on Github external
import numpy as np

from ..core import Node, register_node_type
from pyqtgraph.Qt import QtCore, QtGui
from pyqtgraph.util.mutex import Mutex

try:
    import av
    HAVE_AV = True
except ImportError:
    HAVE_AV = False



class AVThread(QtCore.QThread):
    def __init__(self, out_stream, container, parent=None):
        QtCore.QThread.__init__(self)
        self.out_stream = out_stream
        self.container = container

        self.lock = Mutex()
        self.running = False
        
    def run(self):
        with self.lock:
            self.running = True
        n = 0
        stream = self.container.streams[0]

        for packet in self.container.demux(stream):
            with self.lock: