コード例 #1
0
ファイル: ArrowItem.py プロジェクト: fivejjs/pyqtgraph
 def setStyle(self, **opts):
     self.opts = opts
     
     opt = dict([(k,self.opts[k]) for k in ['headLen', 'tipAngle', 'baseAngle', 'tailLen', 'tailWidth']])
     self.path = fn.makeArrowPath(**opt)
     self.setPath(self.path)
     
     if opts['pxMode']:
         self.setFlags(self.flags() | self.ItemIgnoresTransformations)
     else:
         self.setFlags(self.flags() & ~self.ItemIgnoresTransformations)
コード例 #2
0
ファイル: arrow.py プロジェクト: garretstuber/neurodemo
    def setStyle(self, **opts):
        """
        Changes the appearance of the arrow.
        All arguments are optional:
        
        ======================  =================================================
        **Keyword Arguments:**
        angle                   Orientation of the arrow in degrees. Default is
                                0; arrow pointing to the left.
        headLen                 Length of the arrow head, from tip to base.
                                default=20
        headWidth               Width of the arrow head at its base.
        tipAngle                Angle of the tip of the arrow in degrees. Smaller
                                values make a 'sharper' arrow. If tipAngle is
                                specified, ot overrides headWidth. default=25
        baseAngle               Angle of the base of the arrow head. Default is
                                0, which means that the base of the arrow head
                                is perpendicular to the arrow tail.
        tailLen                 Length of the arrow tail, measured from the base
                                of the arrow head to the end of the tail. If
                                this value is None, no tail will be drawn.
                                default=None
        tailWidth               Width of the tail. default=3
        pen                     The pen used to draw the outline of the arrow.
        brush                   The brush used to fill the arrow.
        ======================  =================================================
        """
        self.opts.update(opts)
        
        opt = dict([(k,self.opts[k]) for k in ['headLen', 'tipAngle', 'baseAngle', 'tailLen', 'tailWidth']])
        tr = QtGui.QTransform()
        tr.rotate(self.opts['angle'])
        self.path = tr.map(fn.makeArrowPath(**opt))

        self.setPath(self.path)
        
        self.setPen(fn.mkPen(self.opts['pen']))
        self.setBrush(fn.mkBrush(self.opts['brush']))
        
        if self.opts['pxMode']:
            self.setFlags(self.flags() | self.ItemIgnoresTransformations)
        else:
            self.setFlags(self.flags() & ~self.ItemIgnoresTransformations)
コード例 #3
0
    def setStyle(self, **opts):
        # http://www.pyqtgraph.org/documentation/_modules/pyqtgraph/graphicsItems/ArrowItem.html#ArrowItem.setStyle
        self.opts.update(opts)

        opt = dict([(k,self.opts[k]) for k in ['headLen', 'tipAngle', 'baseAngle', 'tailLen', 'tailWidth']])
        tr = QtGui.QTransform()
        path = fn.makeArrowPath(**opt)
        tr.rotate(self.opts['angle'])
        p = -path.boundingRect().center()
        tr.translate(p.x(), p.y())
        self.path = tr.map(path)
        self.setPath(self.path)

        self.setPen(fn.mkPen(self.opts['pen']))
        self.setBrush(fn.mkBrush(self.opts['brush']))

        if self.opts['pxMode']:
            self.setFlags(self.flags() | self.ItemIgnoresTransformations)
        else:
            self.setFlags(self.flags() & ~self.ItemIgnoresTransformations)
コード例 #4
0
    def setStyle(self, **opts):
        """
        Changes the appearance of the arrow.
        All arguments are optional:
        
        ================= =================================================
        Keyword Arguments
        angle             Orientation of the arrow in degrees. Default is
                          0; arrow pointing to the left.
        headLen           Length of the arrow head, from tip to base.
                          default=20
        headWidth         Width of the arrow head at its base.
        tipAngle          Angle of the tip of the arrow in degrees. Smaller
                          values make a 'sharper' arrow. If tipAngle is 
                          specified, ot overrides headWidth. default=25
        baseAngle         Angle of the base of the arrow head. Default is
                          0, which means that the base of the arrow head
                          is perpendicular to the arrow shaft.
        tailLen           Length of the arrow tail, measured from the base
                          of the arrow head to the tip of the tail. If
                          this value is None, no tail will be drawn.
                          default=None
        tailWidth         Width of the tail. default=3
        pen               The pen used to draw the outline of the arrow.
        brush             The brush used to fill the arrow.
        ================= =================================================
        """
        self.opts = opts

        opt = dict([
            (k, self.opts[k]) for k in
            ['headLen', 'tipAngle', 'baseAngle', 'tailLen', 'tailWidth']
        ])
        self.path = fn.makeArrowPath(**opt)
        self.setPath(self.path)

        if opts['pxMode']:
            self.setFlags(self.flags() | self.ItemIgnoresTransformations)
        else:
            self.setFlags(self.flags() & ~self.ItemIgnoresTransformations)