Exemplo n.º 1
0
    def _set_color(self, c):
        if c == 'red':
            color = pyHAttributeColor(141, 38, 38, 255)
            fill = pyHAttributeFillColor(232, 61, 61, 255)
        elif c == 'blue':
            color = pyHAttributeColor(0, 76, 153, 255)
            fill = pyHAttributeFillColor(0, 128, 255, 255)
        elif c == 'gray':
            color = pyHAttributeColor(170, 170, 170, 255)
            fill = pyHAttributeFillColor(220, 220, 220, 255)
        else:
            raise ValueError('bad color selected')

        self.handle_figure.setAttribute('COLOR', color)
        self.handle_figure.setAttribute('FILL', fill)
Exemplo n.º 2
0
 def _normal(figure, attribs_dict):
     width = attribs_dict.get('WIDTH')
     color = attribs_dict.get('COLOR')
     fill = attribs_dict.get('FILL')
     if width: figure.setAttribute('WIDTH', pyHAttributeWidth(width))
     if color: figure.setAttribute('COLOR', pyHAttributeColor(*color))
     if fill: figure.setAttribute('FILL', pyHAttributeFillColor(*fill))
Exemplo n.º 3
0
    def getHandles(self):
        r = self.getDecoratedFigure().getDisplayBox()
        x = r.getX()
        y = r.getY()
        w = r.getWidth()
        h = r.getHeight()

        h0 = pyHBackwardHandle(self, pyHPoint(x + w, y - 20))
        h0.handle_figure.setAttribute('FILL', pyHAttributeFillColor(255, 0, 0, 200))

        h1 = pyHForwardHandle(self, pyHPoint(x + w, y + h))
        h1.handle_figure.setAttribute('FILL', pyHAttributeFillColor(0, 0, 255, 200))

        handles = [h0, h1]

        return handles
Exemplo n.º 4
0
 def set_info_figure(self, figure):
     drawing = self.view.getDrawing()
     if self.info_figure:
         drawing.removeFigure(self.info_figure)
     self.info_figure = figure
     figure.setAttribute('FILL', pyHAttributeFillColor(255, 255, 255, 255))
     drawing.addFigure(figure)
     self.view.update()
Exemplo n.º 5
0
 def onMouseDown(self,e):
     self.getView().clearSelectedFigures()
     self.r=pyHRectangleFigure(e.getX(),e.getY(),0,0)
     # javi edit:
     self.r.setAttribute('FILL', pyHAttributeFillColor(185, 237, 255, 100))
     self.r.setAttribute('COLOR', pyHAttributeColor(51, 139, 171, 255))
     # end
     self.getView().getDrawing().addFigure(self.r)
Exemplo n.º 6
0
 def __init__(self, owner, point):
     '''
     Constructor
     '''
     self.handle_figure = pyHRectangleFigure(point.getX() - 1,
                                             point.getY() - 1, 20, 20)
     self.handle_figure.setAttribute('COLOR',
                                     pyHAttributeColor(232, 61, 61, 255))
     self.handle_figure.setAttribute(
         'FILL', pyHAttributeFillColor(141, 38, 38, 255))
     self.point = point
     self.owner = owner
Exemplo n.º 7
0
 def _semitransparent(self, figure, attribs_dict):
     self._normal(figure, attribs_dict)
     width = attribs_dict.get('WIDTH') - 1
     color = attribs_dict.get('COLOR')
     fill = attribs_dict.get('FILL')
     if width:
         figure.setAttribute('WIDTH', pyHAttributeWidth(width))
     if color:
         r, g, b, _ = color
         figure.setAttribute('COLOR', pyHAttributeColor(r, g, b, 100))
     if fill:
         r, g, b, _ = fill
         figure.setAttribute('FILL', pyHAttributeFillColor(r, g, b, 100))
Exemplo n.º 8
0
 def setFillColor(self,c,g=None,b=None,a=255):
     if g==None and b==None:
         self.setAttribute("FILL",c)
     else:
         r=c
         self.setAttribute("FILL",pyHAttributeFillColor(r,g,b,a))
Exemplo n.º 9
0
 def setFillColor(self, r, g, b, a):
     self.setAttribute('FILL', pyHAttributeFillColor(r, g, b, a))