コード例 #1
0
    def __init__(self,
                 size,
                 width=5,
                 brush=None,
                 pen=None,
                 suffix='m',
                 offset=None):
        GraphicsObject.__init__(self)
        GraphicsWidgetAnchor.__init__(self)
        self.setFlag(self.ItemHasNoContents)
        self.setAcceptedMouseButtons(QtCore.Qt.NoButton)

        if brush is None:
            brush = getConfigOption('foreground')
        self.brush = fn.mkBrush(brush)
        self.pen = fn.mkPen(pen)
        self._width = width
        self.size = size
        if offset == None:
            offset = (0, 0)
        self.offset = offset

        self.bar = QtGui.QGraphicsRectItem()
        self.bar.setPen(self.pen)
        self.bar.setBrush(self.brush)
        self.bar.setParentItem(self)

        self.text = TextItem(text=fn.siFormat(size, suffix=suffix),
                             anchor=(0.5, 1),
                             angle=90,
                             color=(0, 0, 0))
        self.text.setParentItem(self)
コード例 #2
0
    def __init__(self, image: np.ndarray, channel: Channel, **kargs):
        """
        See :func:`setImage <pyqtgraph.ImageItem.setImage>` for all allowed initialization arguments.
        """
        GraphicsObject.__init__(self)
        self.channel = channel
        self.setPxMode(False)
        self.setAutoDownsample(False)

        self.menu = None
        self.image = None  ## original image data
        self.qimage = None  ## rendered image for display

        self.paintMode = None

        self.levels = channel.settings.levels
        self.lut = None
        self.autoDownsample = False

        self.axisOrder = getConfigOption('imageAxisOrder')

        # In some cases, we use a modified lookup table to handle both rescaling
        # and LUT more efficiently
        self._effectiveLut = None

        self.drawKernel = None
        self.border = None
        self.removable = False

        if image is not None:
            self.setImage(image, **kargs)
        else:
            self.setOpts(**kargs)
コード例 #3
0
ファイル: plotpyqtgraph.py プロジェクト: gesellkammer/sndtrck
 def __init__(self, antialias=True):
     GraphicsObject.__init__(self)
     self.data = []
     self.x0, self.x1, self.y0, self.y1 = inf, -inf, inf, -inf
     self.picture = None
     self._boundingRect = None
     self._numcalls = 0
     self._t1 = 0
     self._t0 = 0
     self._mousex = 0
     self._mousey = 0
     self._antialias = antialias
コード例 #4
0
 def __init__(self, antialias=True):
     GraphicsObject.__init__(self)
     self.data = []
     self.x0, self.x1, self.y0, self.y1 = inf, -inf, inf, -inf
     self.picture = None
     self._boundingRect = None
     self._numcalls = 0
     self._t1 = 0
     self._t0 = 0
     self._mousex = 0
     self._mousey = 0
     self._antialias = antialias
コード例 #5
0
    def __init__(self):
        GraphicsObject.__init__(self)
        # Set menu, create when necessary
        self.menu = None

        # Set size
        self._rect = QtCore.QRectF(0, 0, 0, 0)
        self._boundingRect = QtCore.QRectF(0, 0, 0, 0)

        # Set Formatting
        self.pen = mkPen((255, 255, 100), width=1)
        self.brush = mkBrush(255, 255, 0, 100)
        self.setZValue(1e9)
コード例 #6
0
	def __init__(self, x = 1, y = 1, parent = None, barWidth = 3, 
			brush = None, offset = None):
		'''
		Initialze the geometry parameters for the bars.

		Paramters
		---------
		x: float, optional
			Horizontal bar length. Default is 1 unit on x axis.
		y: float, optional
			Vertical bar length. Default is 1 unit on y axis.
		parent: pyqtgraph.plotItem, optional
			QGraphicsWidget containing these scale bars.
		barWidth: float, optional
			Width of the scale bars. Default is 3 pixels.
		brush: QBrush, optional
			Brush for the bars.
		offset: float, optional
			Specifies the offset position relative to the bars' parent.
			Positive values offset from the left or top; negative values
			offset from the right or bottom. Default is None, will be 
			put somewhere in the corner, could be moved by mouse dragging.
		'''
		GraphicsObject.__init__(self)
		GraphicsWidgetAnchor.__init__(self)
		self.setFlag(self.ItemHasNoContents)
		self.offset = offset
		# if offset == None:
		self.setFlag(self.ItemIgnoresTransformations)
		self.xs, self.ys = x, y
		self.xlen = 0
		self.ylen = 0
		self.xbar = QtGui.QGraphicsRectItem(self)
		self.ybar = QtGui.QGraphicsRectItem(self)
		if brush is None:
			brush = pg.getConfigOption("foreground")
		self.xbar.setBrush(brush)
		self.ybar.setBrush(brush)
		self.barWidth = barWidth
		self.setParentItem(parent)