예제 #1
0
    def __init__(self, handle, **kwds):
        kwds.pop('viewRect', None)

        self.data = handle.read()
        self.groupitem = pg.ItemGroup()

        self.pipettes = {}
        for dev in self.data.devices():
            arrow = pg.ArrowItem()
            self.pipettes[dev] = arrow
            arrow.setParentItem(self.groupitem)

        opts = {'movable': False, 'rotatable': False, 'handle': handle}
        opts.update(kwds)
        if opts.get('name') is None:
            opts['name'] = handle.shortName()
        CanvasItem.__init__(self, self.groupitem, **opts)

        self._timeSliderResolution = 10.  # 10 ticks per second on the time slider
        self._mpCtrlWidget = MultiPatchLogCtrlWidget()
        self.layout.addWidget(self._mpCtrlWidget, self.layout.rowCount(), 0, 1,
                              2)
        self._mpCtrlWidget.timeSlider.setMaximum(
            self._timeSliderResolution *
            (self.data.lastTime() - self.data.firstTime()))
        self._mpCtrlWidget.timeSlider.valueChanged.connect(
            self.timeSliderChanged)
        self._mpCtrlWidget.createMarkersBtn.clicked.connect(
            self.createMarkersClicked)

        self.timeSliderChanged(0)
예제 #2
0
    def __init__(self, dev, mod):
        CameraModuleInterface.__init__(self, dev, mod)
        self._haveTarget = False

        self.ui = CamModTemplate()
        self.ctrl = QtGui.QWidget()
        self.ui.setupUi(self.ctrl)

        cal = dev._stageOrientation
        self.calibrateAxis = Axis([0, 0], 0, inverty=cal['inverty'])
        self.calibrateAxis.setZValue(5000)
        mod.addItem(self.calibrateAxis)
        self.calibrateAxis.setVisible(False)

        self.centerArrow = pg.ArrowItem()
        self.centerArrow.setZValue(5000)
        mod.addItem(self.centerArrow)

        self.target = Target()
        self.target.setZValue(5000)
        mod.addItem(self.target)
        self.target.setVisible(False)

        # decide how / whether to add a label for the target
        basename = dev.name().rstrip('0123456789')
        showLabel = False
        if basename != dev.name():
            # If this device looks like "Name00" and another device has the same
            # prefix, then we will label all targets with their device numbers.
            for devname in getManager().listDevices():
                if devname.startswith(basename):
                    showLabel = True
                    break
        if showLabel:
            num = dev.name()[len(basename):]
            self.target.setLabel(num)
            self.target.setLabelAngle(dev.getYawAngle())

        self.depthTarget = Target(movable=False)
        mod.getDepthView().addItem(self.depthTarget)
        self.depthTarget.setVisible(False)

        self.depthArrow = pg.ArrowItem(angle=-dev.pitch * 180 / np.pi)
        mod.getDepthView().addItem(self.depthArrow)

        self.ui.setOrientationBtn.toggled.connect(self.setOrientationToggled)
        mod.window().getView().scene().sigMouseClicked.connect(
            self.sceneMouseClicked)
        dev.sigGlobalTransformChanged.connect(self.transformChanged)
        dev.scopeDevice().sigGlobalTransformChanged.connect(self.focusChanged)
        dev.sigTargetChanged.connect(self.targetChanged)
        self.calibrateAxis.sigRegionChangeFinished.connect(
            self.calibrateAxisChanged)
        self.calibrateAxis.sigRegionChanged.connect(self.calibrateAxisChanging)
        self.ui.homeBtn.clicked.connect(self.homeClicked)
        self.ui.searchBtn.clicked.connect(self.searchClicked)
        self.ui.idleBtn.clicked.connect(self.idleClicked)
        self.ui.setTargetBtn.toggled.connect(self.setTargetToggled)
        self.ui.targetBtn.clicked.connect(self.targetClicked)
        self.ui.approachBtn.clicked.connect(self.approachClicked)
        self.ui.autoCalibrateBtn.clicked.connect(self.autoCalibrateClicked)
        self.ui.getRefBtn.clicked.connect(self.getRefFramesClicked)
        self.ui.aboveTargetBtn.clicked.connect(self.aboveTargetClicked)
        self.target.sigDragged.connect(self.targetDragged)

        self.transformChanged()