Ejemplo n.º 1
0
    def __init__(self, dev, win):
        StageInterface.__init__(self, dev, win)

        # Insert Scientifica-specific controls into GUI
        self.zeroBtn = Qt.QPushButton('Zero position')
        self.layout.addWidget(self.zeroBtn, self.nextRow, 0, 1, 2)
        self.nextRow += 1

        self.psGroup = Qt.QGroupBox('Rotary Controller')
        self.layout.addWidget(self.psGroup, self.nextRow, 0, 1, 2)
        self.nextRow += 1

        self.psLayout = Qt.QGridLayout()
        self.psGroup.setLayout(self.psLayout)
        self.speedLabel = Qt.QLabel('Speed')
        self.speedSpin = SpinBox(value=self.dev.userSpeed,
                                 suffix='m/turn',
                                 siPrefix=True,
                                 dec=True,
                                 bounds=[1e-6, 10e-3])
        self.psLayout.addWidget(self.speedLabel, 0, 0)
        self.psLayout.addWidget(self.speedSpin, 0, 1)

        self.zeroBtn.clicked.connect(self.dev.dev.zeroPosition)
        self.speedSpin.valueChanged.connect(
            lambda v: self.dev.setDefaultSpeed(v))
Ejemplo n.º 2
0
    def start(self, canvas, plot):
        """Add graphics items to *view* showing the path of the scanner.
        """
        self.clear()

        self.path = pg.PlotCurveItem()
        self.spot = Qt.QGraphicsEllipseItem(Qt.QRectF(-1, -1, 2, 2))
        self.spot.scale(1e-6, 1e-6)
        self.spot.setPen(pg.mkPen('y'))

        self.data = self.program.generatePositionArray()
        self.laserMask = self.program.generateLaserMask()
        self.lastTime = pg.ptime.time()
        self.index = 0
        self.sampleRate = self.program.sampleRate

        self.timeline = pg.InfiniteLine(angle=90)
        self.timeline.setZValue(100)

        if canvas is not None:
            canvas.addItem(self.path)
            canvas.addItem(self.spot)
        if plot is not None:
            self.plot = plot
            self.plotTimeline(plot)
            plot.addItem(self.timeline)

        self.timer.start(16)
Ejemplo n.º 3
0
    def __init__(self, dm, config, name):
        Device.__init__(self, dm, config, name)
        OptomechDevice.__init__(self, dm, config, name)

        # total device transform will be composed of a base transform (defined in the config)
        # and a dynamic translation provided by the hardware.
        self._baseTransform = Qt.QMatrix4x4(self.deviceTransform())
        self._stageTransform = Qt.QMatrix4x4()
        self._invStageTransform = Qt.QMatrix4x4()

        self.config = config
        self.lock = Mutex(Qt.QMutex.Recursive)
        self.pos = [0] * 3
        self._defaultSpeed = 'fast'
        self.pitch = config.get('pitch', 27)
        self.setFastSpeed(config.get('fastSpeed', 1e-3))
        self.setSlowSpeed(config.get('slowSpeed', 10e-6))

        # used to emit signal when position passes a threshold
        self.switches = {}
        self.switchThresholds = {}
        for name, spec in config.get('switches', {}).items():
            self.switches[name] = None
            self.switchThresholds[name] = spec

        self._limits = [(None, None), (None, None), (None, None)]

        self._progressDialog = None
        self._progressTimer = Qt.QTimer()
        self._progressTimer.timeout.connect(self.updateProgressDialog)

        dm.declareInterface(name, ['stage'], self)
Ejemplo n.º 4
0
    def updateWaves(self):
        if self._block_update:
            return

        self.clearCmdPlots()

        ## compute sequence waves
        params = {}
        ps = self.ui.waveGeneratorWidget.listSequences()
        for k in ps:
            params[k] = range(len(ps[k]))
        waves = []
        runSequence(lambda p: waves.append(self.getSingleWave(p)), params,
                    list(params.keys()))

        # Plot all waves but disable auto-range first to improve performance.
        autoRange = self.ui.bottomPlotWidget.getViewBox().autoRangeEnabled()
        self.ui.bottomPlotWidget.enableAutoRange(x=False, y=False)
        try:
            for w in waves:
                if w is not None:
                    self.plotCmdWave(w,
                                     color=Qt.QColor(100, 100, 100),
                                     replot=False)

            ## display single-mode wave in red
            single = self.getSingleWave()
            if single is not None:
                p = self.plotCmdWave(single, color=Qt.QColor(200, 100, 100))
                p.setZValue(1000)

        finally:
            # re-enable auto range if needed
            self.ui.bottomPlotWidget.enableAutoRange(x=autoRange[0],
                                                     y=autoRange[1])
Ejemplo n.º 5
0
    class SignalProxyObject(Qt.QObject):
        # emitted when this device's transform changes
        sigTransformChanged = Qt.Signal(object)  # self
        # emitted when the transform for this device or any of its parents changes
        sigGlobalTransformChanged = Qt.Signal(object,
                                              object)  # self, changed device

        # Emitted when the transform of a subdevice has changed
        sigSubdeviceTransformChanged = Qt.Signal(object,
                                                 object)  ## self, subdev
        # Emitted when the transform of a subdevice or any (grand)parent's subdevice has changed
        sigGlobalSubdeviceTransformChanged = Qt.Signal(
            object, object, object)  # self, dev, subdev

        # Emitted when this device's optics change
        sigOpticsChanged = Qt.Signal(object, object)  # self, port
        # Emitted when the optics for this device or any of its parents changes
        sigGlobalOpticsChanged = Qt.Signal(
            object, object, object)  # self, changed device, port

        # Emitted when this device changes its current subdevice
        sigSubdeviceChanged = Qt.Signal(
            object, object, object)  ## self, new subdev, old subdev
        # Emitted when this device or any (grand)parent changes its current subdevice
        sigGlobalSubdeviceChanged = Qt.Signal(
            object, object, object,
            object)  ## self, dev, new subdev, old subdev

        # Emitted when this device changes its list of available subdevices
        sigSubdeviceListChanged = Qt.Signal(object)  ## self
        # Emitted when this device or any (grand)parent changes its list of available subdevices
        sigGlobalSubdeviceListChanged = Qt.Signal(object, object)  ## self, dev
Ejemplo n.º 6
0
    def __init__(self, parent=None, host=None, dm=None):
        pg.LayoutWidget.__init__(self, parent)
        self.host = host

        self.dbGui = DatabaseGui.DatabaseGui(
            dm=dm,
            tables={
                'Photostim.events': None,
                'Photostim.sites': None,
                'Photostim.maps': None,
                MapAnalyzer.dbIdentity + '.sites': 'map_sites'
            })
        self.addWidget(self.dbGui)

        self.tree = pg.TreeWidget()
        self.tree.setHeaderHidden(True)
        self.addWidget(self.tree, 1, 0)

        self.loadBtn = Qt.QPushButton('Load Map')
        self.addWidget(self.loadBtn, 2, 0)
        self.loadBtn.clicked.connect(self.load)

        self.refreshBtn = Qt.QPushButton('Reload Map List')
        self.addWidget(self.refreshBtn, 3, 0)
        self.refreshBtn.clicked.connect(self.populate)

        self.loadedLabel = Qt.QLabel("Loaded: [none]")
        self.addWidget(self.loadedLabel, 4, 0)

        self.populate()
Ejemplo n.º 7
0
    def __init__(self,
                 handle,
                 checkState=None,
                 allowMove=True,
                 allowRename=True):
        Qt.QTreeWidgetItem.__init__(self, [handle.shortName()])
        self.handle = handle
        self.childrenLoaded = False

        if self.handle.isDir():
            self.setExpanded(False)
            self.setChildIndicatorPolicy(Qt.QTreeWidgetItem.ShowIndicator)
            self.setFlags(Qt.Qt.ItemIsSelectable | Qt.Qt.ItemIsDropEnabled
                          | Qt.Qt.ItemIsEnabled)
            self.setForeground(0, Qt.QBrush(Qt.QColor(0, 0, 150)))
        else:
            self.setFlags(Qt.Qt.ItemIsSelectable | Qt.Qt.ItemIsEnabled)

        if allowMove:
            self.setFlag(Qt.Qt.ItemIsDragEnabled)
        if allowRename:
            self.setFlag(Qt.Qt.ItemIsEditable)

        if checkState is not None:
            self.setFlag(Qt.Qt.ItemIsUserCheckable)
            if checkState:
                self.setCheckState(0, Qt.Qt.Checked)
            else:
                self.setCheckState(0, Qt.Qt.Unchecked)
        self.expandState = False
        self.handle.sigChanged.connect(self.handleChanged)
        self.updateBoldState()
Ejemplo n.º 8
0
    def plotCmdWave(self, data, color=Qt.QColor(100, 100, 100), replot=True):
        if data is None:
            return
        plot = self.ui.bottomPlotWidget.plot(data, x=self.timeVals)
        plot.setPen(Qt.QPen(color))

        return plot
Ejemplo n.º 9
0
    def __init__(self, parent=None):
        Qt.QWidget.__init__(self, parent)
        self.layout = Qt.QGridLayout()
        self.setLayout(self.layout)

        self.view = pg.ImageView()
        self.layout.addWidget(self.view, 0, 0)

        self.ctrlWidget = Qt.QWidget()
        self.layout.addWidget(self.ctrlWidget, 0, 1)

        self.maskItem = pg.ImageItem()
        self.maskItem.setZValue(10)
        self.maskItem.setCompositionMode(Qt.QPainter.CompositionMode_Multiply)
        lut = np.zeros((256, 3), dtype='ubyte')
        lut[:, 0:2] = np.arange(256).reshape(256, 1)
        self.maskItem.setLookupTable(lut)

        kern = np.fromfunction(
            lambda x, y: np.clip(((5 - (x - 5)**2 +
                                   (y - 5)**2)**0.5 * 255), 0, 255), (11, 11))
        self.maskItem.setDrawKernel(kern, mask=kern, center=(5, 5), mode='add')

        self.view.addItem(self.maskItem)

        self.view.sigTimeChanged.connect(self.updateMaskImage)
Ejemplo n.º 10
0
    def __init__(self, parent=None, filePath=None):
        Qt.QWidget.__init__(self, parent)
        self._signalBlock = 0
        self.ui = CMTemplate.Ui_Form()
        self.ui.setupUi(self)

        self.ui.tree.setColumnWidth(1, 50)
        self.ui.tree.setColumnWidth(2, 60)
        self.ui.tree.setColumnWidth(3, 60)

        self.addBtn = Qt.QPushButton('Add New')
        item = Qt.QTreeWidgetItem()
        self.ui.tree.addTopLevelItem(item)
        self.ui.tree.setItemWidget(item, 0, self.addBtn)

        self._argList = []
        self.items = []
        self.loadedFile = None
        self.filePath = filePath
        self.deleteState = 0

        self.refreshFileList()

        self.addBtn.clicked.connect(self.addClicked)
        self.ui.saveBtn.clicked.connect(self.saveClicked)
        self.ui.fileCombo.lineEdit().editingFinished.connect(self.editDone)
        self.ui.fileCombo.setEditable(False)
        self.ui.saveAsBtn.clicked.connect(self.saveAs)
        self.ui.deleteBtn.clicked.connect(self.deleteClicked)
        self.ui.fileCombo.currentIndexChanged[int].connect(self.load)
Ejemplo n.º 11
0
 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)
Ejemplo n.º 12
0
    def __init__(self):
        Qt.QSplitter.__init__(self)
        self.setOrientation(Qt.Qt.Horizontal)
        self.plot = pg.PlotWidget()
        self.addWidget(self.plot)
        self.ctrl = Qt.QWidget()
        self.addWidget(self.ctrl)
        self.layout = Qt.QVBoxLayout()
        self.layout.setSpacing(0)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.ctrl.setLayout(self.layout)

        self.scanList = pg.TreeWidget()
        self.layout.addWidget(self.scanList)

        self.filter = FCEventDetection.EventFilter('eventFilter')
        self.layout.addWidget(self.filter.ctrlWidget())

        self.xCombo = Qt.QComboBox()
        self.yCombo = Qt.QComboBox()
        self.layout.addWidget(self.xCombo)
        self.layout.addWidget(self.yCombo)

        self.columns = []
        self.scans = {}  ## maps scan: (scatterPlotItem, treeItem, valid)

        self.xCombo.currentIndexChanged.connect(self.invalidate)
        self.yCombo.currentIndexChanged.connect(self.invalidate)
        self.filter.sigStateChanged.connect(self.invalidate)
        self.scanList.itemChanged.connect(self.itemChanged)
Ejemplo n.º 13
0
 def getNormalizedRects(self):
     """Return a list of rectangles (each a list of 4 points, in self.parentItem coordinates) for quadrilaterals to be mapped into."""
     quads = self.getQuadrilaterals()
     widths = []
     for i, q in enumerate(quads):
         w = abs(Point((q[0]+(q[3]-q[0])/2.)-(q[1]+(q[2]-q[1])/2.)).length())
         widths.append(w)
         if Qt.QPolygonF(q).containsPoint(Qt.QPointF(0., 0.0002), Qt.Qt.OddEvenFill):
             ind = i
     mids = (quads[ind][0]+(quads[ind][3]-quads[ind][0])/2.),(quads[ind][1]+(quads[ind][2]-quads[ind][1])/2.)
     xPos = -(Point(mids[0]).length()*math.sin(Point(mids[0]).angle(Point(0,1)))*(math.pi/180.))
     rects = []
     for i, q in enumerate(quads):
         rect = []
         if i < ind:
             rect.append([-sum(widths[i:ind])+xPos, 0.])
         elif i == ind:
             rect.append([xPos, 0.])
         elif i > ind:
             rect.append([sum(widths[ind:i])-xPos, 0.])
         rect.append([rect[0][0] + widths[i], 0.])
         rect.append([rect[0][0] + widths[i], 0.001])
         rect.append([rect[0][0], 0.001])
         rects.append(rect)
     return rects     
Ejemplo n.º 14
0
    def updateModList(self):
        # Fill the list of modules.

        # clear tree and create top-level items in default order
        self.ui.moduleList.clear()
        self._modGrpItems = {}
        for n in self.modGroupOrder:
            self._mkModGrpItem(n)

        # load defined configurations first
        confMods = []
        for name, conf in self.manager.listDefinedModules().items():
            cls = modules.getModuleClass(conf['module'])
            confMods.append(cls)
            root = self._mkModGrpItem(cls.moduleCategory)
            item = Qt.QTreeWidgetItem([name])
            font = item.font(0)
            font.setBold(True)
            item.setFont(0, font)
            item.confModName = name
            root.addChild(item)

        # if a module has no defined configurations, then just give it a default entry without configuration.
        for name, cls in modules.getModuleClasses().items():
            if cls is Manager or cls in confMods:
                continue
            root = self._mkModGrpItem(cls.moduleCategory)
            dispName = cls.moduleDisplayName or cls.__name__
            item = Qt.QTreeWidgetItem([dispName])
            item.modName = name
            root.addChild(item)
Ejemplo n.º 15
0
    def __init__(self, parent=None, filePath=None, data=None):
        Qt.QWidget.__init__(self, parent)

        self.ui = MapConvolverTemplate.Ui_Form()
        self.ui.setupUi(self)
        self.ui.spacingSpin.setOpts(suffix='m',
                                    value=5e-6,
                                    siPrefix=True,
                                    dec=False,
                                    step=1e-6)

        self.addBtn = Qt.QPushButton('Add New')
        item = Qt.QTreeWidgetItem()
        self.ui.tree.addTopLevelItem(item)
        self.ui.tree.setItemWidget(item, 0, self.addBtn)

        self.items = []
        self.filePath = filePath
        self.data = data
        self.output = None
        self._availableFields = None  ## a list of fieldnames that are available for coloring/contouring

        self.ui.processBtn.hide()
        self.addBtn.clicked.connect(self.addItem)
        self.ui.processBtn.clicked.connect(self.processClicked)
Ejemplo n.º 16
0
    def __init__(self, manager):
        Qt.QMainWindow.__init__(self)
        self.setWindowTitle("Log")
        path = os.path.dirname(__file__)
        self.setWindowIcon(Qt.QIcon(os.path.join(path, 'logIcon.png')))
        self.wid = LogWidget(self, manager)
        self.wid.ui.input = Qt.QLineEdit()
        self.wid.ui.gridLayout.addWidget(self.wid.ui.input, 2, 0, 1, 3)
        self.wid.ui.dirLabel.setText("Current Storage Directory: None")
        self.setCentralWidget(self.wid)
        self.resize(1000, 500)
        self.manager = manager
        #global WIN
        global WIN
        WIN = self
        self.msgCount = 0
        self.logCount = 0
        self.logFile = None
        configfile.writeConfigFile(
            '', self.fileName()
        )  ## start a new temp log file, destroying anything left over from the last session.
        self.buttons = [
        ]  ## weak references to all Log Buttons get added to this list, so it's easy to make them all do things, like flash red.
        self.lock = Mutex()
        self.errorDialog = ErrorDialog()

        self.wid.ui.input.returnPressed.connect(self.textEntered)
        self.sigLogMessage.connect(self.queuedLogMsg, Qt.Qt.QueuedConnection)
Ejemplo n.º 17
0
    def powerCmdChanged(self):
        self.clearRawPlots()
        self.cache = {}
        rate = self.powerWidget.rate

        #### calculate, cache and display sequence waves for shutter/qSwitch/pCell
        params = {}
        ps = self.powerWidget.listSequence()
        for k in ps:
            params[k] = range(len(ps[k]))
        ## get power waveforms
        waves = []
        runSequence(
            lambda p: waves.append(self.powerWidget.getSingleWave(p)), params,
            list(params.keys(
            )))  ## appends waveforms for the entire parameter space to waves

        for w in waves:
            if w is not None:
                ## need to translate w into raw traces, plot them, and cache them (using id(w) as a key)
                rawWaves = self.getChannelCmds(w, rate)
                #rawWaves = self.dev.getChannelCmds({'powerWaveform':w}, rate) ## calculate raw waveforms for shutter/qSwitch/pCell from powerWaveform
                #self.cache[id(w)] = rawWaves ## cache the calculated waveforms
                self.plotRawCurves(
                    rawWaves, color=Qt.QColor(100, 100, 100)
                )  ## plot the raw waveform in it's appropriate plot in grey

        ## calculate (or pull from cache) and display single-mode wave in red
        single = self.powerWidget.getSingleWave()
        if single is not None:
            #rawSingle = self.cache.get(id(single), self.dev.getChannelCmds({'powerWaveform':single}, rate))
            rawSingle = self.getChannelCmds(single, rate)
            self.plotRawCurves(rawSingle, color=Qt.QColor(200, 100, 100))
Ejemplo n.º 18
0
    def __init__(self, dev, taskRunner):
        TaskGui.__init__(self, dev, taskRunner)
        self.layout = Qt.QGridLayout()
        self.setLayout(self.layout)
        self.blankCheck = Qt.QCheckBox("Blank Screen")

        self.layout.addWidget(self.blankCheck)
Ejemplo n.º 19
0
 def __init__(self):
     Qt.QWidget.__init__(self)
     self.layout = Qt.QHBoxLayout()
     self.setLayout(self.layout)
     self.saveLabel = Qt.QLabel()
     self.saveLabel.setScaledContents(True)
     self.lockBtn = Qt.QPushButton()
     self.lockBtn.setFixedWidth(20)
     self.lockBtn.setFixedHeight(20)
     self.saveLabel.setFixedWidth(20)
     self.saveLabel.setFixedHeight(20)
     self.layout.setSpacing(0)
     self.layout.setContentsMargins(0,0,0,0)
     self.layout.addWidget(self.lockBtn)
     self.layout.addWidget(self.saveLabel)
     self.setFixedWidth(40)
     
     path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'icons'))
     images = [os.path.join(path, x) for x in ['locked.png', 'unlocked.png', 'saved.png', 'unsaved.png']]
     self.images = [Qt.QPixmap(img) for img in images]
     self.icons = [Qt.QIcon(img) for img in self.images[:2]]
     if any([img.width() == 0 for img in self.images]):
         raise Exception("Could not load icons:", images)
     self.setSaved(False)
     self.setLocked(False)
     self.lockBtn.clicked.connect(self.lockClicked)
Ejemplo n.º 20
0
    def __init__(self, manager, name, config):
        Module.__init__(self, manager, name, config)
        self.win = Qt.QMainWindow()
        mp = os.path.dirname(__file__)
        self.win.setWindowIcon(Qt.QIcon(os.path.join(mp, 'icon.png')))
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self.win)
        self.stateFile = os.path.join('modules', self.name + '_ui.cfg')
        firstDock = None

        self.modGroupOrder = ['Acquisition', 'Analysis', 'Utilities']

        self.devRackDocks = {}
        for d in self.manager.listDevices():
            try:
                dw = self.manager.getDevice(d).deviceInterface(self)
                if dw is None:
                    continue
                dock = Qt.QDockWidget(d)
                dock.setFeatures(dock.DockWidgetMovable
                                 | dock.DockWidgetFloatable)
                dock.setObjectName(d)
                dock.setWidget(dw)

                self.devRackDocks[d] = dock
                self.win.addDockWidget(Qt.Qt.RightDockWidgetArea, dock)

                # By default, we stack all docks
                if firstDock is None:
                    firstDock = dock
                else:
                    self.win.tabifyDockWidget(firstDock, dock)
            except:
                self.showMessage(
                    "Error creating dock for device '%s', see console for details."
                    % d, 10000)
                printExc("Error while creating dock for device '%s':" % d)

        self.updateModList()
        self.updateConfList()

        self.ui.loadConfigBtn.clicked.connect(self.loadConfig)
        self.ui.loadModuleBtn.clicked.connect(self.loadSelectedModule)
        self.ui.reloadModuleBtn.clicked.connect(self.reloadAll)
        self.ui.configList.itemDoubleClicked.connect(self.loadConfig)
        self.ui.moduleList.itemDoubleClicked.connect(self.loadSelectedModule)
        self.ui.quitBtn.clicked.connect(self.requestQuit)

        state = self.manager.readConfigFile(self.stateFile)
        # restore window position
        if 'geometry' in state:
            geom = Qt.QRect(*state['geometry'])
            self.win.setGeometry(geom)
        # restore dock configuration
        if 'window' in state:
            ws = Qt.QByteArray.fromPercentEncoding(state['window'])
            self.win.restoreState(ws)

        self.win.show()
Ejemplo n.º 21
0
 def updateCurrentDirItem(self):
     """Color the currentDir item, expand, and scroll-to"""
     #print "UpdateCurrentDirItem"
     item = self.item(self.currentDir)
     item.setBackground(0, Qt.QBrush(Qt.QColor(250, 100, 100)))
     item.setExpanded(True)
     self.scrollToItem(item)
     self.selectionChanged()
Ejemplo n.º 22
0
 def __init__(self):
     Qt.QMainWindow.__init__(self)
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     self.show()
     self.items = {}
     self.connect(self.ui.setRootBtn, Qt.SIGNAL('clicked()'), self.setRootClicked)
     self.connect(self.ui.loadBtn, Qt.SIGNAL('clicked()'), self.loadClicked)
     self.connect(self.ui.canvas, Qt.SIGNAL('itemTransformChangeFinished'), self.itemMoved)
Ejemplo n.º 23
0
 def boundingRect(self):
     if self._bounds is None:
         w, h = self._pxLen
         if w is None:
             return Qt.QRectF()
         w = w * 100
         h = abs(h * 100)
         self._bounds = Qt.QRectF(-w, -h, w * 2, h * 2)
     return self._bounds
Ejemplo n.º 24
0
 def __init__(self, parent=None):
     super(W, self).__init__(parent=parent)
     self.mies = MIES.getBridge(True)
     self.mies.sigDataReady.connect(self.printit)
     self.b = Qt.QPushButton("stop", parent=self)
     self.b.clicked.connect(self.mies.quit)
     l = Qt.QVBoxLayout()
     l.addWidget(self.b)
     self.setLayout(l)
Ejemplo n.º 25
0
    def handleResult(self, result, params):
        if self.stateGroup.state()['displayCheck']:
            if self.clearBeforeNextPlot:
                self.clearPlots()
                self.clearBeforeNextPlot = False

            plot = self.plot.plot(y=result.view(numpy.ndarray),
                                  x=result.xvals('Time'),
                                  pen=Qt.QPen(Qt.QColor(200, 200, 200)),
                                  params=params)
Ejemplo n.º 26
0
 def addTimes(self, times):
     for x1, x2 in times:
         t = Qt.QGraphicsRectItem(Qt.QRectF(x1, 0, x2 - x1, 1))
         t.setParentItem(self)
         t.setPen(self.pen)
         t.setBrush(self.brush)
         self.xRange[0] = min(self.xRange[0], x1, x2)
         self.xRange[1] = max(self.xRange[1], x1, x2)
         self.prepareGeometryChange()
         self.times.append(t)
Ejemplo n.º 27
0
 def addSpot(self, pos, size):
     """Add a circle to the image"""
     s2 = size/2.0
     s = Qt.QGraphicsEllipseItem(0, 0, 1, 1)
     s.scale(size, size)
     s.setPos(pos[0]-s2, pos[1]-s2)
     s.setPen(Qt.QPen(Qt.QColor(100, 255, 100, 70)))
     self.ui.view.addItem(s)
     s.setZValue(100)
     self.spots.append(s)
Ejemplo n.º 28
0
    def __init__(self, pr):
        Qt.QMainWindow.__init__(self)
        mp = os.path.dirname(__file__)
        self.setWindowIcon(Qt.QIcon(os.path.join(mp, 'icon.png')))
        self.pr = pr

        self.stateFile = os.path.join('modules', self.pr.name + '_ui.cfg')
        uiState = getManager().readConfigFile(self.stateFile)
        if 'geometry' in uiState:
            geom = Qt.QRect(*uiState['geometry'])
            self.setGeometry(geom)
Ejemplo n.º 29
0
 def getBoundary(self, globalCoords=True):
     """Return the boundaries of the camera sensor in global coordinates.
     If globalCoords==False, return in local coordinates.
     """
     size = self.getParam('sensorSize')
     bounds = Qt.QPainterPath()
     bounds.addRect(Qt.QRectF(0, 0, *size))
     if globalCoords:
         return pg.SRTTransform(self.globalTransform()).map(bounds)
     else:
         return bounds
Ejemplo n.º 30
0
    def __init__(self, *args):
        AnalysisModule.__init__(self, *args)
        self.layout = Qt.QGridLayout()
        self.setLayout(self.layout)
        self.rmLabel = Qt.QLabel("Membrane Resistance:")
        self.raLabel = Qt.QLabel("Access Resistance:")
        self.layout.addWidget(self.rmLabel)
        self.layout.addWidget(self.raLabel)

        # Optional: this configures automatic save/restore of widget state
        self.postGuiInit()