Exemplo n.º 1
0
 def draw(self, cr, hover=None):
     cr.set_line_width(2)
     if self._dropdown_active or hover == 1:
         cr.set_source_rgba( * accent )
     else:
         cr.set_source_rgba(0, 0, 0, 0.7)
     
     # v
     downchevron(cr, 3, 1)
     cr.stroke()
     
     show_text(cr, self._current)
     show_text(cr, self._label)
Exemplo n.º 2
0
 def draw(self, cr, hover=None):
     cr.set_line_width(2)
     if self._dropdown_active or hover == 1:
         colors = [accent] + [(0, 0, 0, 0.7)] * 3
     else:
         colors = [(0, 0, 0, 0.7)] * 4
     
     if hover is not None:
         colors[hover - 1] = accent
     
     # v
     cr.set_source_rgba( * colors[0] )
     downchevron(cr, 3, 1)
     cr.stroke()
     
     if self._O is None:
         # +
         cr.set_source_rgba( * colors[2] )
         show_text(cr, self._nonelabel)
         plus_sign(cr, self._d3, 1)
         cr.fill()
     else:
         cr.save()
         cr.translate(self._d1, 0)
         self._NAMEWIDGET.draw(cr, hover)
         cr.restore()
         
         # +
         cr.set_source_rgba( * colors[2] )
         plus_sign(cr, self._d2, 1)
         cr.fill()
         
         # x
         cr.set_source_rgba( * colors[3] )
         cross(cr, self._d3, 1)
         cr.stroke()
Exemplo n.º 3
0
    def draw(self, cr, hover=(None, None)):
        cr.set_line_width(2)
        
        y1 = self._y
        for i, (value, textlines) in enumerate(zip(self._fullcontent, self._labels)):
            if value is self._active:
                radius = 5
                halfpi = pi*0.5
                y2 = y1 + self._itemheight
                cr.move_to(self._x           , y1 + radius)
                cr.arc(self._x       + radius, y1 + radius, radius, pi      , 3*halfpi)
                cr.arc(self._x_right - radius, y1 + radius, radius, 3*halfpi, 2*pi    )
                cr.arc(self._x_right - radius, y2 - radius, radius, 0       , halfpi  )
                cr.arc(self._x       + radius, y2 - radius, radius, halfpi  , pi      )
                cr.close_path()
                
                if self._colored(value):
                    cr.set_source_rgb( * accent )
                else:
                    cr.set_source_rgb(0.7, 0.7, 0.7)
                cr.fill()

                cr.set_source_rgb(1, 1, 1)
                upchevron(cr, self._subdivisions[0], y1)
                downchevron(cr, self._subdivisions[1], y1)
                cross(cr, self._subdivisions[2], y1)
                cr.stroke()

            elif hover[1] is not None and hover[1][0] == i:
                colors = [(0.3, 0.3, 0.3)] * 3
                if hover[1][1] > 1:
                    colors[hover[1][1] - 2] = accent
                
                cr.set_source_rgba( * colors[0] )
                upchevron(cr, self._subdivisions[0], y1)
                cr.stroke()

                cr.set_source_rgba( * colors[1] )
                downchevron(cr, self._subdivisions[1], y1)
                cr.stroke()

                cr.set_source_rgba( * colors[2] )
                cross(cr, self._subdivisions[2], y1)
                cr.stroke()
                
                if self._colored(value):
                    cr.set_source_rgba( * accent )
                else:
                    cr.set_source_rgb(0.6, 0.6, 0.6)

            elif self._colored(value):
                cr.set_source_rgb(0.3, 0.3, 0.3)

            else:
                cr.set_source_rgb(0.6, 0.6, 0.6)
            
            for textline in textlines:
                show_text(cr, textline)
            y1 += self._itemheight

        if hover[1] is not None and hover[1][0] == self._LMAX:
            cr.set_source_rgb( * accent )
        else:
            cr.set_source_rgb(0.3, 0.3, 0.3)
        plus_sign(cr, self._x, y1)
        cr.fill()
Exemplo n.º 4
0
    def draw(self, cr, hover=(None, None)):
        cr.set_line_width(2)

        y1 = self._y
        for i, (value,
                textlines) in enumerate(zip(self._fullcontent, self._labels)):
            if value is self._active:
                radius = 5
                halfpi = pi * 0.5
                y2 = y1 + self._itemheight
                cr.move_to(self._x, y1 + radius)
                cr.arc(self._x + radius, y1 + radius, radius, pi, 3 * halfpi)
                cr.arc(self._x_right - radius, y1 + radius, radius, 3 * halfpi,
                       2 * pi)
                cr.arc(self._x_right - radius, y2 - radius, radius, 0, halfpi)
                cr.arc(self._x + radius, y2 - radius, radius, halfpi, pi)
                cr.close_path()

                if self._colored(value):
                    cr.set_source_rgb(*accent)
                else:
                    cr.set_source_rgb(0.7, 0.7, 0.7)
                cr.fill()

                cr.set_source_rgb(1, 1, 1)
                upchevron(cr, self._subdivisions[0], y1)
                downchevron(cr, self._subdivisions[1], y1)
                cross(cr, self._subdivisions[2], y1)
                cr.stroke()

            elif hover[1] is not None and hover[1][0] == i:
                colors = [(0.3, 0.3, 0.3)] * 3
                if hover[1][1] > 1:
                    colors[hover[1][1] - 2] = accent

                cr.set_source_rgba(*colors[0])
                upchevron(cr, self._subdivisions[0], y1)
                cr.stroke()

                cr.set_source_rgba(*colors[1])
                downchevron(cr, self._subdivisions[1], y1)
                cr.stroke()

                cr.set_source_rgba(*colors[2])
                cross(cr, self._subdivisions[2], y1)
                cr.stroke()

                if self._colored(value):
                    cr.set_source_rgba(*accent)
                else:
                    cr.set_source_rgb(0.6, 0.6, 0.6)

            elif self._colored(value):
                cr.set_source_rgb(0.3, 0.3, 0.3)

            else:
                cr.set_source_rgb(0.6, 0.6, 0.6)

            for textline in textlines:
                show_text(cr, textline)
            y1 += self._itemheight

        if hover[1] is not None and hover[1][0] == self._LMAX:
            cr.set_source_rgb(*accent)
        else:
            cr.set_source_rgb(0.3, 0.3, 0.3)
        plus_sign(cr, self._x, y1)
        cr.fill()