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)
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)
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)
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()
def _new(self): pen = mkPen(10, len(self.paths)+2) name = typ = self.pType.value() self._add(typ,name, {'pen':pen})
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'])
def new(self): pen = mkPen(10, len(self.paths) + 2) name = typ = self.pType.value() return self._add(typ, name, {'pen': pen})
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'])