Beispiel #1
0
    def draw(self):
        s = float(self.size)  #abbreviate as we will use this a lot
        g = Group()

        # new algorithm from markers.StarFive
        R = float(self.size) / 2
        r = R * sin(18 * (pi / 180.0)) / cos(36 * (pi / 180.0))
        P = []
        angle = 90
        for i in xrange(5):
            for radius in R, r:
                theta = angle * (pi / 180.0)
                P.append(radius * cos(theta))
                P.append(radius * sin(theta))
                angle = angle + 36
        # star specific bits
        star = Polygon(P,
                       fillColor=self.fillColor,
                       strokeColor=self.strokeColor,
                       strokeWidth=s / 50)
        g.rotate(self.angle)
        g.shift(self.x + self.dx, self.y + self.dy)
        g.add(star)

        return g
Beispiel #2
0
def makeCircularString(x, y, radius, angle, text, fontName, fontSize, inside=0, G=None,textAnchor='start'):
    '''make a group with circular text in it'''
    if not G: G = Group()

    angle %= 360
    pi180 = pi/180
    phi = angle*pi180
    width = stringWidth(text, fontName, fontSize)
    sig = inside and -1 or 1
    hsig = sig*0.5
    sig90 = sig*90

    if textAnchor!='start':
        if textAnchor=='middle':
            phi += sig*(0.5*width)/radius
        elif textAnchor=='end':
            phi += sig*float(width)/radius
        elif textAnchor=='numeric':
            phi += sig*float(numericXShift(textAnchor,text,width,fontName,fontSize,None))/radius

    for letter in text:
        width = stringWidth(letter, fontName, fontSize)
        beta = float(width)/radius
        h = Group()
        h.add(String(0, 0, letter, fontName=fontName,fontSize=fontSize,textAnchor="start"))
        h.translate(x+cos(phi)*radius,y+sin(phi)*radius)    #translate to radius and angle
        h.rotate((phi-hsig*beta)/pi180-sig90)               # rotate as needed
        G.add(h)                                            #add to main group
        phi -= sig*beta                                     #increment

    return G
        def _rawDraw(self):
            _text = self._text
            self._text = _text or ''
            self.computeSize()
            self._text = _text
            g = Group()
            g.translate(self.x + self.dx, self.y + self.dy)
            g.rotate(self.angle)

            x = self._left

            # paint box behind text just in case they
            # fill it
            if self.boxFillColor or (self.boxStrokeColor and self.boxStrokeWidth):
                g.add(Rect( self._left-self.leftPadding,
                            self._bottom-self.bottomPadding,
                            self._width,
                            self._height,
                            strokeColor=self.boxStrokeColor,
                            strokeWidth=self.boxStrokeWidth,
                            fillColor=self.boxFillColor)
                            )
            g1 = Group()
            g1.translate(x,self._top-self._eheight)
            g1.add(self._ddf(self._obj))
            g.add(g1)
            return g
    def draw(self):
        fillColor = self.fillColor
        strokeColor = self.strokeColor
        g = Group()
        bg = self.background
        bd = self.border
        bdw = self.borderWidth
        shadow = self.shadow
        x, y = self.x, self.y
        if bg:
            if shadow is not None and 0<=shadow<1:
                shadow = Color(bg.red*shadow,bg.green*shadow,bg.blue*shadow)
            self._paintLogo(g,dy=-2.5, dx=2,fillColor=shadow)
        self._paintLogo(g,fillColor=fillColor,strokeColor=strokeColor)
        g.skew(kx=self.skewX, ky=self.skewY)
        g.shift(self._dx,self._dy)
        G = Group()
        G.add(g)
        _w, _h = 130, 86
        w, h = self.width, self.height
        if bg or (bd and bdw):
            G.insert(0,Rect(0,0,_w,_h,fillColor=bg,strokeColor=bd,strokeWidth=bdw))
        if w!=_w or h!=_h: G.scale(w/float(_w),h/float(_h))

        angle = self.angle
        if self.angle:
            w, h = w/2., h/2.
            G.shift(-w,-h)
            G.rotate(angle)
            G.shift(w,h)
        G.shift(x,y)
        return G
Beispiel #5
0
    def draw(self):
        s = float(self.size)  #abbreviate as we will use this a lot
        g = Group()

        # new algorithm from markers.StarFive
        R = float(self.size)/2
        r = R*sin(18*(pi/180.0))/cos(36*(pi/180.0))
        P = []
        angle = 90
        for i in xrange(5):
            for radius in R, r:
                theta = angle*(pi/180.0)
                P.append(radius*cos(theta))
                P.append(radius*sin(theta))
                angle = angle + 36
        # star specific bits
        star = Polygon(P,
                    fillColor = self.fillColor,
                    strokeColor = self.strokeColor,
                    strokeWidth=s/50)
        g.rotate(self.angle)
        g.shift(self.x+self.dx,self.y+self.dy)
        g.add(star)

        return g
Beispiel #6
0
    def _rawDraw(self):
        _text = self._text
        self._text = _text or ""
        self.computeSize()
        self._text = _text
        g = Group()
        g.translate(self.x + self.dx, self.y + self.dy)
        g.rotate(self.angle)

        y = self._top - self._leading * self._baselineRatio
        textAnchor = self._getTextAnchor()
        if textAnchor == "start":
            x = self._left
        elif textAnchor == "middle":
            x = self._left + self._ewidth * 0.5
        else:
            x = self._right

        # paint box behind text just in case they
        # fill it
        if self.boxFillColor or (self.boxStrokeColor and self.boxStrokeWidth):
            g.add(
                Rect(
                    self._left - self.leftPadding,
                    self._bottom - self.bottomPadding,
                    self._width,
                    self._height,
                    strokeColor=self.boxStrokeColor,
                    strokeWidth=self.boxStrokeWidth,
                    fillColor=self.boxFillColor,
                )
            )

        fillColor, fontName, fontSize = self.fillColor, self.fontName, self.fontSize
        strokeColor, strokeWidth, leading = self.strokeColor, self.strokeWidth, self._leading
        svgAttrs = getattr(self, "_svgAttrs", {})
        if strokeColor:
            for line in self._lines:
                s = _text2Path(line, x, y, fontName, fontSize, textAnchor)
                s.fillColor = fillColor
                s.strokeColor = strokeColor
                s.strokeWidth = strokeWidth
                g.add(s)
                y -= leading
        else:
            for line in self._lines:
                s = String(x, y, line, _svgAttrs=svgAttrs)
                s.textAnchor = textAnchor
                s.fontName = fontName
                s.fontSize = fontSize
                s.fillColor = fillColor
                g.add(s)
                y -= leading

        return g
Beispiel #7
0
    def draw(self):
        _text = self._text
        self._text = _text or ''
        self.computeSize()
        self._text = _text
        g = Group()
        g.translate(self.x + self.dx, self.y + self.dy)
        g.rotate(self.angle)

        y = self._top - self.fontSize
        textAnchor = self._getTextAnchor()
        if textAnchor == 'start':
            x = self._left
        elif textAnchor == 'middle':
            x = self._left + self._ewidth * 0.5
        else:
            x = self._right

        # paint box behind text just in case they
        # fill it
        if self.boxFillColor or (self.boxStrokeColor and self.boxStrokeWidth):
            g.add(
                Rect(
                    self._left - self.leftPadding,
                    self._bottom - self.bottomPadding,
                    self._width,
                    self._height,
                    strokeColor=self.boxStrokeColor,
                    strokeWidth=self.boxStrokeWidth,
                    fillColor=self.boxFillColor))

        fillColor, fontName, fontSize = self.fillColor, self.fontName, self.fontSize
        strokeColor, strokeWidth, leading = self.strokeColor, self.strokeWidth, (
            self.leading or 1.2 * fontSize)
        if strokeColor:
            for line in self._lines:
                s = _text2Path(line, x, y, fontName, fontSize, textAnchor)
                s.fillColor = fillColor
                s.strokeColor = strokeColor
                s.strokeWidth = strokeWidth
                g.add(s)
                y = y - leading
        else:
            for line in self._lines:
                s = String(x, y, line)
                s.textAnchor = textAnchor
                s.fontName = fontName
                s.fontSize = fontSize
                s.fillColor = fillColor
                g.add(s)
                y = y - leading

        return g
Beispiel #8
0
    def draw(self):
        fillColor = self.fillColor
        strokeColor = self.strokeColor
        g = Group()
        bg = self.background
        bd = self.border
        bdw = self.borderWidth
        shadow = self.shadow
        x, y = self.x, self.y
        if bg:
            if shadow is not None and 0 <= shadow < 1:
                shadow = Color(bg.red * shadow, bg.green * shadow,
                               bg.blue * shadow)
            self._paintLogo(g, dy=-2.5, dx=2, fillColor=shadow)
        self._paintLogo(g,
                        fillColor=fillColor,
                        strokeColor=strokeColor,
                        _ocolors=getattr(self, '_ocolors', None),
                        _pagecolors=getattr(self, '_pagecolors', None))
        g.skew(kx=self.skewX, ky=self.skewY)
        g.shift(self._dx, self._dy)
        G = Group()
        G.add(g)
        _w, _h = 130, 86
        w, h = self.width, self.height
        if bg or (bd and bdw):
            G.insert(
                0,
                Rect(0,
                     0,
                     _w,
                     _h,
                     fillColor=bg,
                     strokeColor=bd,
                     strokeWidth=bdw))
        if w != _w or h != _h: G.scale(w / float(_w), h / float(_h))

        angle = self.angle
        if self.angle:
            w, h = w / 2., h / 2.
            G.shift(-w, -h)
            G.rotate(angle)
            G.shift(w, h)
        xFlip = getattr(self, 'xFlip', 0) and -1 or 0
        yFlip = getattr(self, 'yFlip', 0) and -1 or 0
        if xFlip or yFlip:
            sx = xFlip or 1
            sy = yFlip or 1
            G.shift(sx * x + w * xFlip, sy * y + yFlip * h)
            G = Group(G, transform=(sx, 0, 0, sy, 0, 0))
        else:
            G.shift(x, y)
        return G
Beispiel #9
0
    def _rawDraw(self):
        _text = self._text
        self._text = _text or ''
        self.computeSize()
        self._text = _text
        g = Group()
        g.translate(self.x + self.dx, self.y + self.dy)
        g.rotate(self.angle)

        y = self._top - self._leading * self._baselineRatio
        textAnchor = self._getTextAnchor()
        if textAnchor == 'start':
            x = self._left
        elif textAnchor == 'middle':
            x = self._left + self._ewidth * 0.5
        else:
            x = self._right

        # paint box behind text just in case they
        # fill it
        if self.boxFillColor or (self.boxStrokeColor and self.boxStrokeWidth):
            g.add(
                Rect(self._left - self.leftPadding,
                     self._bottom - self.bottomPadding,
                     self._width,
                     self._height,
                     strokeColor=self.boxStrokeColor,
                     strokeWidth=self.boxStrokeWidth,
                     fillColor=self.boxFillColor))

        fillColor, fontName, fontSize = self.fillColor, self.fontName, self.fontSize
        strokeColor, strokeWidth, leading = self.strokeColor, self.strokeWidth, self._leading
        svgAttrs = getattr(self, '_svgAttrs', {})
        if strokeColor:
            for line in self._lines:
                s = _text2Path(line, x, y, fontName, fontSize, textAnchor)
                s.fillColor = fillColor
                s.strokeColor = strokeColor
                s.strokeWidth = strokeWidth
                g.add(s)
                y -= leading
        else:
            for line in self._lines:
                s = String(x, y, line, _svgAttrs=svgAttrs)
                s.textAnchor = textAnchor
                s.fontName = fontName
                s.fontSize = fontSize
                s.fillColor = fillColor
                g.add(s)
                y -= leading

        return g
def group_demo():
    drawing = Drawing(width=400, height=200)
    radius = 25
    circles = Group(Circle(50, 40, radius, fillColor=colors.blue),
                    Circle(75, 40, radius, fillColor=colors.red),
                    Circle(100, 40, radius, fillColor=colors.green),
                    Circle(125, 40, radius, fillColor=colors.yellow),
                    String(75, 5, 'Circles'))
    drawing.add(circles)

    more_circles = Group(circles)
    more_circles.translate(75, 55)
    more_circles.rotate(35)
    drawing.add(more_circles)

    drawing.save(formats=['pdf'], outDir='.', fnRoot='group_demo')
Beispiel #11
0
    def draw(self):
        fillColor = self.fillColor
        strokeColor = self.strokeColor
        g = Group()
        bg = self.background
        bd = self.border
        bdw = self.borderWidth
        shadow = self.shadow
        x, y = self.x, self.y
        if bg:
            if shadow is not None and 0 <= shadow < 1:
                shadow = Color(bg.red * shadow, bg.green * shadow, bg.blue * shadow)
            self._paintLogo(g, dy=-2.5, dx=2, fillColor=shadow)
        self._paintLogo(
            g,
            fillColor=fillColor,
            strokeColor=strokeColor,
            _ocolors=getattr(self, "_ocolors", None),
            _pagecolors=getattr(self, "_pagecolors", None),
        )
        g.skew(kx=self.skewX, ky=self.skewY)
        g.shift(self._dx, self._dy)
        G = Group()
        G.add(g)
        _w, _h = 130, 86
        w, h = self.width, self.height
        if bg or (bd and bdw):
            G.insert(0, Rect(0, 0, _w, _h, fillColor=bg, strokeColor=bd, strokeWidth=bdw))
        if w != _w or h != _h:
            G.scale(w / float(_w), h / float(_h))

        angle = self.angle
        if self.angle:
            w, h = w / 2.0, h / 2.0
            G.shift(-w, -h)
            G.rotate(angle)
            G.shift(w, h)
        xFlip = getattr(self, "xFlip", 0) and -1 or 0
        yFlip = getattr(self, "yFlip", 0) and -1 or 0
        if xFlip or yFlip:
            sx = xFlip or 1
            sy = yFlip or 1
            G.shift(sx * x + w * xFlip, sy * y + yFlip * h)
            G = Group(G, transform=(sx, 0, 0, sy, 0, 0))
        else:
            G.shift(x, y)
        return G
Beispiel #12
0
 def add_vert_line(self, x, y, color, label):
     i = self.x_to_i(x)
     j = self.y_to_j(y)
     self.flowable.add(
         Line(
             i, self.j_plot_offset,
             i, j,
             strokeColor=color,
             strokeWidth=0.75))
     if not label:
         return
     group = Group(
         String(
             0, 0,
             label,
             fontSize=self.font_size,
             fontName='Helvetica',
             textAnchor='start',
             fillColor=color))
     group.translate(i + 1, j + 2)
     group.rotate(90)
     self.flowable.add(group)
 def process(O, grid_ij, xy_max, label, data, label_font_size=12):
   if (reportlab is None): return
   from reportlab.graphics.shapes import Group, String
   lp = O.line_plot(xy_max, data=data, label_font_size=label_font_size)
   gr = Group(lp)
   i,j = grid_ij
   assert 0 <= i < O.grid[0]
   assert 0 <= j < O.grid[1]
   i = O.grid[0] - 1 - i
   tx, ty = O.margin + j * (O.page_size[0] - 2 * O.margin) / O.grid[1] \
                     - j * O.more_narrow_shift, \
            O.margin + i * (O.page_size[1] - 2 * O.margin
                                           - O.top_label_space) / O.grid[0]
   gr.translate(tx, ty)
   O.top_group.add(gr)
   O.top_group.add(String(
     tx+lp.x+lp.width*0.5,
     ty+lp.y+lp.height*1.05,
     label,
     fontSize=label_font_size,
     textAnchor="middle"))
   if (i == 0 and j == 0):
     O.top_group.add(String(
       tx+lp.x+lp.width*0.5,
       ty+lp.y-lp.height*0.3,
       u"RMSD start (\u00C5)",
       fontSize=label_font_size,
       textAnchor="middle"))
     gr = Group(String(
       0,
       0,
       u"RMSD final (\u00C5)",
       fontSize=label_font_size,
       textAnchor="middle"))
     gr.rotate(90)
     gr.translate(
       ty+lp.y+lp.height*0.5,
       -(tx+lp.x-lp.width*0.15))
     O.top_group.add(gr)
Beispiel #14
0
 def process(O, grid_ij, xy_max, label, data, label_font_size=12):
     if (reportlab is None): return
     from reportlab.graphics.shapes import Group, String
     lp = O.line_plot(xy_max, data=data, label_font_size=label_font_size)
     gr = Group(lp)
     i, j = grid_ij
     assert 0 <= i < O.grid[0]
     assert 0 <= j < O.grid[1]
     i = O.grid[0] - 1 - i
     tx, ty = O.margin + j * (O.page_size[0] - 2 * O.margin) / O.grid[1] \
                       - j * O.more_narrow_shift, \
              O.margin + i * (O.page_size[1] - 2 * O.margin
                                             - O.top_label_space) / O.grid[0]
     gr.translate(tx, ty)
     O.top_group.add(gr)
     O.top_group.add(
         String(tx + lp.x + lp.width * 0.5,
                ty + lp.y + lp.height * 1.05,
                label,
                fontSize=label_font_size,
                textAnchor="middle"))
     if (i == 0 and j == 0):
         O.top_group.add(
             String(tx + lp.x + lp.width * 0.5,
                    ty + lp.y - lp.height * 0.3,
                    u"RMSD start (\u00C5)",
                    fontSize=label_font_size,
                    textAnchor="middle"))
         gr = Group(
             String(0,
                    0,
                    u"RMSD final (\u00C5)",
                    fontSize=label_font_size,
                    textAnchor="middle"))
         gr.rotate(90)
         gr.translate(ty + lp.y + lp.height * 0.5,
                      -(tx + lp.x - lp.width * 0.15))
         O.top_group.add(gr)
Beispiel #15
0
    def _Flag_Brazil(self):
        s = _size  # abbreviate as we will use this a lot
        g = Group()

        m = s / 14
        self._width = w = (m * 20)

        def addStar(x, y, size, g=g, w=w, s=s, m=m):
            st = Star()
            st.fillColor = colors.mintcream
            st.size = size * m
            st.x = (w / 2) + (x * (0.35 * m))
            st.y = (s / 2) + (y * (0.35 * m))
            g.add(st)

        g.add(
            Rect(0,
                 0,
                 w,
                 s,
                 fillColor=colors.green,
                 strokeColor=None,
                 strokeWidth=0))
        g.add(
            Polygon(points=[
                1.7 * m, (s / 2), (w / 2), s - (1.7 * m), w - (1.7 * m),
                (s / 2), (w / 2), 1.7 * m
            ],
                    fillColor=colors.yellow,
                    strokeColor=None,
                    strokeWidth=0))
        g.add(
            Circle(cx=w / 2,
                   cy=s / 2,
                   r=3.5 * m,
                   fillColor=colors.blue,
                   strokeColor=None,
                   strokeWidth=0))
        g.add(
            Wedge((w / 2) - (2 * m),
                  0,
                  8.5 * m,
                  50,
                  98.1,
                  8.5 * m,
                  fillColor=colors.mintcream,
                  strokeColor=None,
                  strokeWidth=0))
        g.add(
            Wedge((w / 2), (s / 2),
                  3.501 * m,
                  156,
                  352,
                  3.501 * m,
                  fillColor=colors.mintcream,
                  strokeColor=None,
                  strokeWidth=0))
        g.add(
            Wedge((w / 2) - (2 * m),
                  0,
                  8 * m,
                  48.1,
                  100,
                  8 * m,
                  fillColor=colors.blue,
                  strokeColor=None,
                  strokeWidth=0))
        g.add(
            Rect(0,
                 0,
                 w, (s / 4) + 1.7 * m,
                 fillColor=colors.green,
                 strokeColor=None,
                 strokeWidth=0))
        g.add(
            Polygon(points=[
                1.7 * m, (s / 2), (w / 2), s / 2 - 2 * m, w - (1.7 * m),
                (s / 2), (w / 2), 1.7 * m
            ],
                    fillColor=colors.yellow,
                    strokeColor=None,
                    strokeWidth=0))
        g.add(
            Wedge(w / 2,
                  s / 2,
                  3.502 * m,
                  166,
                  342.1,
                  3.502 * m,
                  fillColor=colors.blue,
                  strokeColor=None,
                  strokeWidth=0))

        addStar(3.2, 3.5, 0.3)
        addStar(-8.5, 1.5, 0.3)
        addStar(-7.5, -3, 0.3)
        addStar(-4, -5.5, 0.3)
        addStar(0, -4.5, 0.3)
        addStar(7, -3.5, 0.3)
        addStar(-3.5, -0.5, 0.25)
        addStar(0, -1.5, 0.25)
        addStar(1, -2.5, 0.25)
        addStar(3, -7, 0.25)
        addStar(5, -6.5, 0.25)
        addStar(6.5, -5, 0.25)
        addStar(7, -4.5, 0.25)
        addStar(-5.5, -3.2, 0.25)
        addStar(-6, -4.2, 0.25)
        addStar(-1, -2.75, 0.2)
        addStar(2, -5.5, 0.2)
        addStar(4, -5.5, 0.2)
        addStar(5, -7.5, 0.2)
        addStar(5, -5.5, 0.2)
        addStar(6, -5.5, 0.2)
        addStar(-8.8, -3.2, 0.2)
        addStar(2.5, 0.5, 0.2)
        addStar(-0.2, -3.2, 0.14)
        addStar(-7.2, -2, 0.14)
        addStar(0, -8, 0.1)

        sTmp = "ORDEM E PROGRESSO"
        nTmp = len(sTmp)
        delta = 0.850848010347 / nTmp
        radius = 7.9 * m
        centerx = (w / 2) - (2 * m)
        centery = 0
        for i in range(nTmp):
            rad = 2 * pi - i * delta - 4.60766922527
            x = cos(rad) * radius + centerx
            y = sin(rad) * radius + centery
            if i == 6:
                z = 0.35 * m
            else:
                z = 0.45 * m
            g2 = Group(
                String(x,
                       y,
                       sTmp[i],
                       fontName='Helvetica-Bold',
                       fontSize=z,
                       strokeColor=None,
                       fillColor=colors.green))
            g2.rotate(rad)
            g.add(g2)
        return g
Beispiel #16
0
    def _Flag_Brazil(self):
        s = _size  # abbreviate as we will use this a lot
        g = Group()

        m = s/14
        self._width = w = (m * 20)

        def addStar(x,y,size, g=g, w=w, s=s, m=m):
            st = Star()
            st.fillColor=colors.mintcream
            st.size = size*m
            st.x = (w/2) + (x * (0.35 * m))
            st.y = (s/2) + (y * (0.35 * m))
            g.add(st)

        g.add(Rect(0, 0, w, s, fillColor = colors.green, strokeColor = None, strokeWidth=0))
        g.add(Polygon(points = [ 1.7*m, (s/2), (w/2), s-(1.7*m), w-(1.7*m),(s/2),(w/2), 1.7*m],
                      fillColor = colors.yellow, strokeColor = None, strokeWidth=0))
        g.add(Circle(cx=w/2, cy=s/2, r=3.5*m,
                     fillColor=colors.blue,strokeColor=None, strokeWidth=0))
        g.add(Wedge((w/2)-(2*m), 0, 8.5*m, 50, 98.1, 8.5*m,
                    fillColor=colors.mintcream,strokeColor=None, strokeWidth=0))
        g.add(Wedge((w/2), (s/2), 3.501*m, 156, 352, 3.501*m,
                    fillColor=colors.mintcream,strokeColor=None, strokeWidth=0))
        g.add(Wedge((w/2)-(2*m), 0, 8*m, 48.1, 100, 8*m,
                    fillColor=colors.blue,strokeColor=None, strokeWidth=0))
        g.add(Rect(0, 0, w, (s/4) + 1.7*m,
                   fillColor = colors.green, strokeColor = None, strokeWidth=0))
        g.add(Polygon(points = [ 1.7*m,(s/2), (w/2),s/2 - 2*m,  w-(1.7*m),(s/2) , (w/2),1.7*m],
                      fillColor = colors.yellow, strokeColor = None, strokeWidth=0))
        g.add(Wedge(w/2, s/2, 3.502*m, 166, 342.1, 3.502*m,
                    fillColor=colors.blue,strokeColor=None, strokeWidth=0))

        addStar(3.2,3.5,0.3)
        addStar(-8.5,1.5,0.3)
        addStar(-7.5,-3,0.3)
        addStar(-4,-5.5,0.3)
        addStar(0,-4.5,0.3)
        addStar(7,-3.5,0.3)
        addStar(-3.5,-0.5,0.25)
        addStar(0,-1.5,0.25)
        addStar(1,-2.5,0.25)
        addStar(3,-7,0.25)
        addStar(5,-6.5,0.25)
        addStar(6.5,-5,0.25)
        addStar(7,-4.5,0.25)
        addStar(-5.5,-3.2,0.25)
        addStar(-6,-4.2,0.25)
        addStar(-1,-2.75,0.2)
        addStar(2,-5.5,0.2)
        addStar(4,-5.5,0.2)
        addStar(5,-7.5,0.2)
        addStar(5,-5.5,0.2)
        addStar(6,-5.5,0.2)
        addStar(-8.8,-3.2,0.2)
        addStar(2.5,0.5,0.2)
        addStar(-0.2,-3.2,0.14)
        addStar(-7.2,-2,0.14)
        addStar(0,-8,0.1)

        sTmp = "ORDEM E PROGRESSO"
        nTmp = len(sTmp)
        delta = 0.850848010347/nTmp
        radius = 7.9 *m
        centerx = (w/2)-(2*m)
        centery = 0
        for i in range(nTmp):
            rad = 2*pi - i*delta -4.60766922527
            x=cos(rad)*radius+centerx
            y=sin(rad)*radius+centery
            if i == 6:
                z = 0.35*m
            else:
                z= 0.45*m
            g2 = Group(String(x, y, sTmp[i], fontName='Helvetica-Bold',
                fontSize = z,strokeColor=None,fillColor=colors.green))
            g2.rotate(rad)
            g.add(g2)
        return g
    def draw(self):
        # general widget bits
        g = Group()

        x = self.x
        y = self.y
        scale = self.scale
        stemThickness = self.stemThickness * scale
        stemLength = self.stemLength * scale
        headProjection = self.headProjection * scale
        headLength = self.headLength * scale
        headSweep = self.headSweep * scale
        w = stemLength + headLength
        h = 2 * headProjection + stemThickness
        # shift to the boxAnchor
        boxAnchor = self.boxAnchor
        if self.right:
            if boxAnchor in ('sw', 'w', 'nw'):
                dy = -h
            elif boxAnchor in ('s', 'c', 'n'):
                dy = -h * 0.5
            else:
                dy = 0
            if boxAnchor in ('w', 'c', 'e'):
                dx = -w * 0.5
            elif boxAnchor in ('nw', 'n', 'ne'):
                dx = -w
            else:
                dx = 0
            points = [
                dx,
                dy + headProjection + stemThickness,
                dx + stemLength,
                dy + headProjection + stemThickness,
                dx + stemLength + headSweep,
                dy + 2 * headProjection + stemThickness,
                dx + stemLength + headLength,
                dy + 0.5 * stemThickness + headProjection,
                dx + stemLength + headSweep,
                dy,
                dx + stemLength,
                dy + headProjection,
                dx,
                dy + headProjection,
            ]
        else:
            w, h = h, w
            if boxAnchor in ('nw', 'n', 'ne'):
                dy = -h
            elif boxAnchor in ('w', 'c', 'e'):
                dy = -h * 0.5
            else:
                dy = 0
            if boxAnchor in ('ne', 'e', 'se'):
                dx = -w
            elif boxAnchor in ('n', 'c', 's'):
                dx = -w * 0.5
            else:
                dx = 0
            points = [
                dx + headProjection,
                dy,  #sw
                dx + headProjection + stemThickness,
                dy,  #se
                dx + headProjection + stemThickness,
                dy + stemLength,
                dx + w,
                dy + stemLength + headSweep,
                dx + headProjection + 0.5 * stemThickness,
                dy + h,
                dx,
                dy + stemLength + headSweep,
                dx + headProjection,
                dy + stemLength,
            ]

        g.add(
            Polygon(
                points=points,
                fillColor=self.fillColor,
                strokeColor=self.strokeColor,
                strokeWidth=self.strokeWidth,
            ))
        g.translate(x, y)
        g.rotate(self.angle)
        return g