Exemplo n.º 1
0
 def _viewConnect(self,view) :
     self._graphicSelection = Qub2PointSurfaceDrawingMgr(view.canvas(),
                                                             view.matrix())
     self._graphicSelection.setActionInfo('Mesh grab, select the area')
     drawingobject = qtcanvas.QCanvasRectangle(view.canvas())
     self._graphicSelection.addDrawingObject(drawingobject)
     self._graphicSelection.setEndDrawCallBack(self.__endGrab)
     view.addDrawingMgr(self._graphicSelection)
Exemplo n.º 2
0
    def run(self):
        """
        get view
        """
        view = {}
        self.emit(qt.PYSIGNAL("getView"), (view,))
        self.drawing = view["drawing"]
        self.view = view["view"]

        """
        rectangle drawing initialization
        """
        cvs = self.drawing.canvas()
        matrix = self.drawing.matrix()
        drawingobjectRect = qtcanvas.QCanvasRectangle(cvs)
        color = self.drawing.foregroundColor()

        self.drawingMgrRect = Qub2PointSurfaceDrawingMgr(cvs, matrix)
        self.drawingMgrRect.setDrawingEvent(QubPressedNDrag2Point)
        self.drawingMgrRect.addDrawingObject(drawingobjectRect)
        self.drawingMgrRect.setEndDrawCallBack(self.rectangleSelected)
        self.drawingMgrRect.setColor(color)

        qt.QWidget.connect(self.drawing, qt.PYSIGNAL("ForegroundColorChanged"),
                           self.setColor)

        self.drawing.addDrawingMgr(self.drawingMgrRect)

        """
        values initialization
        """
        self.imageReceived()
        if self.infoDict is not None:
            # change the background color
            qcolor = qt.QColor(CcdBpmBrick.colorState[self.infoDict["live"]])
            self.liveControlToggle.setPaletteBackgroundColor(qcolor)
            # change the background color
            qcolor = qt.QColor(CcdBpmBrick.colorState[self.infoDict["bpmon"]])
            self.bpmControlToggle.setPaletteBackgroundColor(qcolor)

            self.exposureText.setText("%g" % (self.infoDict["time"],))
            self.gainText.setText("%d" % (self.infoDict["gain"],))
            self.thresholdText.setText("%g" % (self.infoDict["threshold"],))

            self.startxText.setText("%d" % (self.infoDict["startx"],))
            self.endxText.setText("%d" % (self.infoDict["endx"],))
            self.startyText.setText("%d" % (self.infoDict["starty"],))
            self.endyText.setText("%d" % (self.infoDict["endy"],))
Exemplo n.º 3
0
    def __init__(self, canvas, parent =None, name ="PrintCanvas", fl =0):
        """
        """
        qtcanvas.QCanvasView.__init__(self, canvas, parent, name, fl)

        self.setAcceptDrops(1)

        self.canvas().setBackgroundColor(qt.QColor(qt.Qt.lightGray))
        self.marginSize = (0, 0)
        self.marginItem = qtcanvas.QCanvasRectangle(0, 0, 0, 0, self.canvas())
        self.marginItem.setBrush(qt.QBrush(qt.Qt.white, qt.Qt.SolidPattern))
        self.marginItem.show()

        self.viewScale = 1

        self.activePen = qt.QPen(qt.Qt.red, 1)

        self.__active_item = None
        self.__moving_start = None
        self.__moving_scale = 0