def run(self):
        if self.firstTime:
            self.initInterface()
            self.zoomChanged()
            """
            get view
            """
            view = {}
            self.emit(qt.PYSIGNAL("getView"), (view, ))
            try:
                self.drawing = view["drawing"]

                cvs = self.drawing.canvas()
                matrix = self.drawing.matrix()
                drawingobject = QubCanvasTarget(cvs)
                color = self.drawing.foregroundColor()

                self.drawingMgr = QubPointDrawingMgr(cvs, matrix)
                self.drawingMgr.setDrawingEvent(QubMoveNPressed1Point)
                self.drawingMgr.setAutoDisconnectEvent(True)
                self.drawingMgr.addDrawingObject(drawingobject)
                self.drawingMgr.setEndDrawCallBack(self.pointSelected)
                qt.QWidget.connect(self.drawing,
                                   qt.PYSIGNAL("ForegroundColorChanged"),
                                   self.setColor)

                self.drawing.addDrawingMgr(self.drawingMgr)
            except:
                print "No View"

        self.firstTime = False
Esempio n. 2
0
    def setView(self, view):
        self.alignementProcessState.setView(view)
        ####### CENTER DRAWING #######
        self.__centerRotation = QubPointDrawingMgr(view.canvas(),
                                                   view.matrix())
        self.__centerRotation.setCanBeModify(False)
        target = QubCanvasTarget(view.canvas())
        self.__centerRotation.addDrawingObject(target)
        view.addDrawingMgr(self.__centerRotation)
        self.__centerRotation.setColor(qt.QColor("red"))

        ####### Help lines #######
        self.__helpLines = []
        for i in range(3):
            dMgr = QubPointDrawingMgr(view.canvas(), view.matrix())
            view.addDrawingMgr(dMgr)
            if self.alignementProcessState.verticalPhi():
                line = QubCanvasVLine(view.canvas())
            else:
                line = QubCanvasHLine(view.canvas())
            dMgr.addDrawingObject(line)
            if not i:
                dMgr.setCanBeModify(False)
                dMgr.setPen(qt.QPen(qt.Qt.red, 1, qt.Qt.DashLine))
            else:
                dMgr.setPen(qt.QPen(qt.Qt.red, 2))
                dMgr.setEndDrawCallBack(self.__helpLineMoved)
            self.__helpLines.append(dMgr)
Esempio n. 3
0
    def _startDraw(self):
        self._lastDrawing = QubPointDrawingMgr(self._view.canvas(),
                                               self._view.matrix())
        drawingobject = QubCanvasTarget(self._view.canvas())

        self._lastDrawing.setAutoDisconnectEvent(True)
        self._lastDrawing.setEventName("StickAlignement")
        self._lastDrawing.setExceptExclusiveListName(["HelpLine"])
        self._lastDrawing.addDrawingObject(drawingobject)
        self._view.addDrawingMgr(self._lastDrawing)
        self._lastDrawing.startDrawing()
        self._lastDrawing.setEndDrawCallBack(
            self._centeringPlug.endAlignementDraw)