def __init__(self, mc): self.mc = mc Qt.QTreeWidgetItem.__init__(self) self.paramCombo = pg.ComboBox() self.convolutionCombo = pg.ComboBox( items=["Gaussian convolution", "interpolation"], default="Gaussian convolution") #self.convolutionCombo.addItems(["Gaussian convolution", "interpolation"]) self.sigmaSpin = pg.SpinBox(value=45e-6, siPrefix=True, suffix='m', dec=True, step=0.1) self.modeCombo = pg.ComboBox(items=['nearest', 'linear', 'cubic'], default='nearest') #self.modeCombo.addItems(['nearest', 'linear', 'cubic']) self.modeCombo.setEnabled(False) self.remBtn = Qt.QPushButton('Remove') self.remBtn.clicked.connect(self.delete) self.paramCombo.currentIndexChanged.connect(self.mc.fieldsChanged) self.convolutionCombo.currentIndexChanged.connect(self.methodChanged) self.paramCombo.currentIndexChanged.connect(self.itemChanged) self.sigmaSpin.sigValueChanged.connect(self.itemChanged) self.modeCombo.currentIndexChanged.connect(self.itemChanged)
def __init__(self, dev, win): QtGui.QWidget.__init__(self) self.win = win self.dev = dev self.dev.sigObjectiveChanged.connect(self.objectiveChanged) #self.dev.sigPositionChanged.connect(self.positionChanged) self.ui = Ui_Form() self.ui.setupUi(self) self.objList = self.dev._allObjectives() self.switchN = len(self.objList) self.objWidgets = {} self.blockSpinChange = False row = 1 for i in self.objList: ## For each objective, create a set of widgets for selecting and updating. c = QtGui.QComboBox() r = QtGui.QRadioButton(i) #first = self.objList[i].keys()[0] #first = self.objList[i][first] xs = pg.SpinBox(step=1e-6, suffix='m', siPrefix=True) ys = pg.SpinBox(step=1e-6, suffix='m', siPrefix=True) zs = pg.SpinBox(step=1e-6, suffix='m', siPrefix=True) ss = pg.SpinBox(step=1e-7, bounds=(1e-10, None)) xs.index = ys.index = zs.index = ss.index = i ## used to determine which row has changed widgets = (r, c, xs, ys, zs, ss) for col, w in enumerate(widgets): self.ui.objectiveLayout.addWidget(w, row, col) self.objWidgets[i] = widgets for o in self.objList[i].values(): c.addItem(o.name(), o) o.sigTransformChanged.connect(self.updateSpins) ## objectives are accessed like: ## index = changedWidget.index ## combo = self.objWidgets[index][1] ## obj = combo.currentData() r.clicked.connect(self.objRadioClicked) c.currentIndexChanged.connect(self.objComboChanged) xs.sigValueChanged.connect(self.offsetSpinChanged) ys.sigValueChanged.connect(self.offsetSpinChanged) zs.sigValueChanged.connect(self.offsetSpinChanged) ss.sigValueChanged.connect(self.scaleSpinChanged) row += 1 self.updateSpins()
def __init__(self, cp, parentImage=None): self.cp = cp QtGui.QTreeWidgetItem.__init__(self) self.paramCombo = pg.ComboBox() self.thresholdSpin = pg.SpinBox(value=0.98, dec=True, step=0.1) self.maxCheck = QtGui.QCheckBox() self.colorBtn = ColorButton(color=(255, 255, 255)) self.remBtn = QtGui.QPushButton('Remove') self.curveItem = pg.IsocurveItem() self.curveItem.setParentItem(parentImage) self.paramCombo.currentIndexChanged.connect(self.emitChanged) self.thresholdSpin.valueChanged.connect(self.emitChanged) self.maxCheck.stateChanged.connect(self.emitChanged) self.colorBtn.sigColorChanged.connect(self.setPen) self.remBtn.clicked.connect(self.delete)
def __init__(self, mod): Qt.QWidget.__init__(self) self.mod = weakref.ref(mod) self.view = mod.view # ROI state variables self.lastPlotTime = None self.ROIs = [] self.plotCurves = [] # Set up UI self.roiLayout = Qt.QGridLayout() self.roiLayout.setSpacing(0) self.roiLayout.setContentsMargins(0,0,0,0) self.setLayout(self.roiLayout) # rect rectPath = Qt.QPainterPath() rectPath.addRect(0, 0, 1, 1) self.rectBtn = pg.PathButton(path=rectPath) # ellipse ellPath = Qt.QPainterPath() ellPath.addEllipse(0, 0, 1, 1) self.ellipseBtn = pg.PathButton(path=ellPath) # polygon polyPath = Qt.QPainterPath() polyPath.moveTo(0,0) polyPath.lineTo(2,3) polyPath.lineTo(3,1) polyPath.lineTo(5,0) polyPath.lineTo(2, -2) polyPath.lineTo(0,0) self.polygonBtn = pg.PathButton(path=polyPath) # ruler polyPath = Qt.QPainterPath() polyPath.moveTo(0, 0) polyPath.lineTo(3, -2) polyPath.moveTo(0, 0) polyPath.lineTo(3, 0) polyPath.moveTo(1, 0) polyPath.arcTo(-1, -1, 2, 2, 0, 33.69) for i in range(5): x = i * 3./4. y = x * -2./3. polyPath.moveTo(x, y) polyPath.lineTo(x-0.2, y-0.3) self.rulerBtn = pg.PathButton(path=polyPath) self.roiLayout.addWidget(self.rectBtn, 0, 0) self.roiLayout.addWidget(self.ellipseBtn, 0, 1) self.roiLayout.addWidget(self.polygonBtn, 1, 0) self.roiLayout.addWidget(self.rulerBtn, 1, 1) self.roiTimeSpin = pg.SpinBox(value=5.0, suffix='s', siPrefix=True, dec=True, step=0.5, bounds=(0,None)) self.roiLayout.addWidget(self.roiTimeSpin, 2, 0, 1, 2) self.roiPlotCheck = Qt.QCheckBox('Plot') self.roiLayout.addWidget(self.roiPlotCheck, 3, 0, 1, 2) self.roiPlot = pg.PlotWidget() self.roiLayout.addWidget(self.roiPlot, 0, 2, self.roiLayout.rowCount(), 1) self.rectBtn.clicked.connect(lambda: self.addROI('rect')) self.ellipseBtn.clicked.connect(lambda: self.addROI('ellipse')) self.polygonBtn.clicked.connect(lambda: self.addROI('polygon')) self.rulerBtn.clicked.connect(lambda: self.addROI('ruler'))
def writeParams(self): nodes = self.flowchart.nodes() params = {} #excludes=['Input', 'Output', 'GatherInfo', 'NegativeEventFilter', 'EventListPlotter', 'ColumnJoin', 'ColumnSelect', 'Plot'] includes = ['DenoiseFilter','LowPassBesselFilter','HighPassBesselFilter','DetrendFilter','HistogramDetrend','ExpDeconvolve','ThresholdEvents','CaEventFitter'] ## get previously stored values if os.path.exists(self.paramStorageFile): prev = pg.configfile.readConfigFile(self.paramStorageFile) else: prev = {} for name in includes: node = nodes[name] d = {} if hasattr(node, 'ctrls'): for k, v in node.ctrls.items(): if type(v) == type(Qt.QCheckBox()): d[k] = v.isChecked() elif type(v) == type(Qt.QComboBox()): d[k] = str(v.currentText()) elif type(v) in [type(Qt.QSpinBox()), type(Qt.QDoubleSpinBox()), type(pg.SpinBox())]: d[k] = v.value() else: print("Not saving param %s for node %s because we don't know how to record value of type %s" %(k, name, str(type(v)))) d['bypassed'] = node.isBypassed() params[name] = d item = self.fileLoader.ui.fileTree.currentItem() roi = str(item.text(0)) ## replace or add previously stored values prev[roi] = params pg.configfile.writeConfigFile(prev, self.paramStorageFile)
win.setCentralWidget(layout) cellCombo = Qt.QComboBox() cellCombo.setSizeAdjustPolicy(cellCombo.AdjustToContents) layout.addWidget(cellCombo) reloadBtn = Qt.QPushButton('reload') layout.addWidget(reloadBtn) separateCheck = Qt.QCheckBox("color pre/post") layout.addWidget(separateCheck) colorCheck = Qt.QCheckBox("color y position") layout.addWidget(colorCheck) errLimitSpin = pg.SpinBox(value=0.7, step=0.1) layout.addWidget(errLimitSpin) lengthRatioLimitSpin = pg.SpinBox(value=1.5, step=0.1) layout.addWidget(lengthRatioLimitSpin) postRgnStartSpin = pg.SpinBox(value=0.500, step=0.01, siPrefix=True, suffix='s') layout.addWidget(postRgnStartSpin) postRgnStopSpin = pg.SpinBox(value=0.700, step=0.01, siPrefix=True, suffix='s')