示例#1
0
 def _setRainbowColors(self):
     curves = self.display.widget.curves
     for n, c in enumerate(curves):
         pen = c.opts['pen']
         if isinstance(pen, QtGui.QPen):
             pen.setColor(mkColor((n, len(curves) + 1)))
         else:
             pen = mkPen(n, len(curves) + 1)
         c.setPen(pen)
示例#2
0
 def _setRainbowColors(self):
     curves = self.display.widget.curves
     for n, c in enumerate(curves):
         pen = c.opts['pen']
         if isinstance(pen, QtGui.QPen):
             pen.setColor(mkColor((n, len(curves) + 1)))
         else:
             pen = mkPen(n, len(curves) + 1)
         c.setPen(pen)
示例#3
0
    def _newCurve(self):
        w = self.display.widget

        pen = mkPen(10, len(self.paths) + 2)

        self.curIndex = -1

        p = self.pa.addChild({
            'name': str(len(self.paths) + 1),
            'type': 'empty',
            'highlight': True,
            'removable': True,
            'renamable': True,
            'autoIncrementName': True
        })

        path = FreehandItem(w.imageItem, pen)

        pAdd = p.addChild({
            'name': 'Add',
            'type': 'action',
        })
        pAdd.sigActivated.connect(self._appendToPath)
        pAdd.sigActivated.connect(self._menu.hide)

        pMod = p.addChild({
            'name': 'Modify',
            'type': 'action'})
        pMod.sigActivated.connect(self._modifyPath)
        pMod.sigActivated.connect(self._menu.hide)

        self._initDraw()

        self.paths.append(path)

        color = pen.color()
        pLineColor = p.addChild({
            'name': 'Line color',
            'type': 'color',
            'value': color,
            'path': path})
        pLineColor.sigValueChanged.connect(self._changeLineColor)

        br = QtGui.QColor(color)
        br.setAlpha(0)
        path.setBrush(br)

        pFillColor = p.addChild({
            'name': 'Fill color',
            'type': 'color',
            'value': br,
            'path': path})
        pFillColor.sigValueChanged.connect(self._changeFillColor)

        self.setChecked(True)
示例#4
0
    def _newCurve(self):
        w = self.display.widget

        pen = mkPen(10, len(self.paths) + 2)

        self.curIndex = -1

        p = self.pa.addChild({
            'name': str(len(self.paths) + 1),
            'type': 'empty',
            'highlight': True,
            'removable': True,
            'renamable': True,
            'autoIncrementName': True
        })

        path = FreehandItem(w.imageItem, pen)

        pAdd = p.addChild({
            'name': 'Add',
            'type': 'action',
        })
        pAdd.sigActivated.connect(self._appendToPath)
        pAdd.sigActivated.connect(self._menu.hide)

        pMod = p.addChild({'name': 'Modify', 'type': 'action'})
        pMod.sigActivated.connect(self._modifyPath)
        pMod.sigActivated.connect(self._menu.hide)

        self._initDraw()

        self.paths.append(path)

        color = pen.color()
        pLineColor = p.addChild({
            'name': 'Line color',
            'type': 'color',
            'value': color,
            'path': path
        })
        pLineColor.sigValueChanged.connect(self._changeLineColor)

        br = QtGui.QColor(color)
        br.setAlpha(0)
        path.setBrush(br)

        pFillColor = p.addChild({
            'name': 'Fill color',
            'type': 'color',
            'value': br,
            'path': path
        })
        pFillColor.sigValueChanged.connect(self._changeFillColor)

        self.setChecked(True)
示例#5
0
 def setPen(self, *args, **kwargs):
     """Set the pen used to draw the isocurve. Arguments can be any that are valid 
     for :func:`mkPen <pyqtgraph.mkPen>`"""
     self.pen = fn.mkPen(*args, **kwargs)
     self.update()
示例#6
0
 def _new(self):
     pen = mkPen(10, len(self.paths)+2)
     name = typ = self.pType.value()
     self._add(typ,name, {'pen':pen})
示例#7
0
 def restoreState(self, state):
     for typ,name,s in state['paths']:
         s['pen'] = mkPen(state['pen'])
         s['brush'] = mkBrush(state['brush'])
         self._add(typ, name, s)   
     self.setChecked(state['activated'])
示例#8
0
 def new(self):
     pen = mkPen(10, len(self.paths) + 2)
     name = typ = self.pType.value()
     return self._add(typ, name, {'pen': pen})
示例#9
0
 def restoreState(self, state):
     for typ, name, s in state['paths']:
         s['pen'] = mkPen(state['pen'])
         s['brush'] = mkBrush(state['brush'])
         self._add(typ, name, s)
     self.setChecked(state['activated'])
示例#10
0
 def setPen(self, *args, **kwargs):
     """Set the pen used to draw the isocurve. Arguments can be any that are valid 
     for :func:`mkPen <pyqtgraph.mkPen>`"""
     self.pen = fn.mkPen(*args, **kwargs)
     self.update()