Ejemplo n.º 1
0
    def draw(self, cr, hover=(None, None)):
        if self._active:
            cr.set_source_rgb(*accent)

            radius = 5
            y1, y2, x1, x2 = self._y, self.y_bottom, self._x, self._x_right
            cr.arc(x1 + radius, y1 + radius, radius, 2 * (pi / 2),
                   3 * (pi / 2))
            cr.arc(x2 - radius, y1 + radius, radius, 3 * (pi / 2),
                   4 * (pi / 2))
            cr.arc(x2 - radius, y2 - radius, radius, 0 * (pi / 2),
                   1 * (pi / 2))
            cr.arc(x1 + radius, y2 - radius, radius, 1 * (pi / 2),
                   2 * (pi / 2))
            cr.close_path()

            cr.fill()

            cr.set_source_rgb(1, 1, 1)

        elif hover[1]:
            cr.set_source_rgb(*accent)

        else:
            cr.set_source_rgb(0, 0, 0)
        show_text(cr, self._label)
Ejemplo n.º 2
0
    def draw(self, cr, hover=(None, None)):
        for i, (x, label) in enumerate(self._buttons):
            if i == self._active:
                cr.set_source_rgb(*accent)

                radius = 5
                y1, y2, x1, x2 = self._y, self.y_bottom, x, x + int(
                    round(self._button_width))
                cr.arc(x1 + radius, y1 + radius, radius, 2 * (pi / 2),
                       3 * (pi / 2))
                cr.arc(x2 - radius, y1 + radius, radius, 3 * (pi / 2),
                       4 * (pi / 2))
                cr.arc(x2 - radius, y2 - radius, radius, 0 * (pi / 2),
                       1 * (pi / 2))
                cr.arc(x1 + radius, y2 - radius, radius, 1 * (pi / 2),
                       2 * (pi / 2))
                cr.close_path()

                cr.fill()

                cr.set_source_rgb(1, 1, 1)

            elif i == hover[1]:
                cr.set_source_rgb(*accent)

            else:
                cr.set_source_rgb(0, 0, 0)
            show_text(cr, label)
Ejemplo n.º 3
0
 def draw(self, cr, hover):
     for i, link in enumerate(self.recent_links):
         if i == hover:
             cr.set_source_rgba(*splash_accent)
         else:
             cr.set_source_rgba(0, 0, 0)
         show_text(cr, link)
Ejemplo n.º 4
0
 def draw(self, cr, hover):
     for i, link in enumerate(self.recent_links):
         if i == hover:
             cr.set_source_rgba( * splash_accent )
         else:
             cr.set_source_rgba(0, 0, 0)
         show_text(cr, link)
Ejemplo n.º 5
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)
Ejemplo n.º 6
0
 def draw(self, cr, hover=None):
     if hover is None:
         cr.set_source_rgba(0, 0, 0, 0.6)
     else:
         cr.set_source_rgb(0, 0, 0)
     
     show_text(cr, self._label)
     
     if self._state:
         cr.arc(10, self.k - 16, 6, 0, 2*pi)
         cr.fill()
     else:
         cr.set_line_width(1.5)
         cr.arc(10, self.k - 16, 5.25, 0, 2*pi)
         cr.stroke()
Ejemplo n.º 7
0
    def draw(self, cr):
        cr.translate(self.x0, self.y0)
        
        cr.push_group()
        
        #cr.rectangle(-2, 2, self.h, self.k)
        #cr.set_source_rgba(0, 0, 0, 0.6)
        #cr.fill()
        
        cr.set_operator(cairo.OPERATOR_SOURCE)
        
        #cr.rectangle(0, 0, self.h, self.k)
        #cr.set_source_rgba(1, 1, 1, 0.9)
        #cr.fill()

        for rectangle in self.rectangles:
            cr.rectangle( * rectangle )
        for snowflake in self.snow:
            cr.arc( * snowflake )
            cr.close_path()
        
        cr.set_source_rgba(0, 0, 0, 0.7)
        
        cr.fill_preserve()
        cr.pop_group_to_source()
        cr.set_operator(cairo.OPERATOR_OVER)
        cr.paint()
        
        cr.set_source_rgba( * splash_accent )
        cr.set_operator(cairo.OPERATOR_ADD)
        cr.fill()
        cr.set_operator(cairo.OPERATOR_OVER)
        
        cr.set_source_rgba(1, 1, 1)
        show_text(cr, self.sorts)
        
        cr.save()
        cr.translate(self.x_center, self._recent_y)
        if self.HOV[0] == 1:
            rh = self.HOV[1]
        else:
            rh = None
        self.recent.draw(cr, rh)
        cr.restore()
Ejemplo n.º 8
0
    def draw(self, cr):
        cr.translate(self.x0, self.y0)

        cr.push_group()

        #cr.rectangle(-2, 2, self.h, self.k)
        #cr.set_source_rgba(0, 0, 0, 0.6)
        #cr.fill()

        cr.set_operator(cairo.OPERATOR_SOURCE)

        #cr.rectangle(0, 0, self.h, self.k)
        #cr.set_source_rgba(1, 1, 1, 0.9)
        #cr.fill()

        for rectangle in self.rectangles:
            cr.rectangle(*rectangle)
        for snowflake in self.snow:
            cr.arc(*snowflake)
            cr.close_path()

        cr.set_source_rgba(0, 0, 0, 0.7)

        cr.fill_preserve()
        cr.pop_group_to_source()
        cr.set_operator(cairo.OPERATOR_OVER)
        cr.paint()

        cr.set_source_rgba(*splash_accent)
        cr.set_operator(cairo.OPERATOR_ADD)
        cr.fill()
        cr.set_operator(cairo.OPERATOR_OVER)

        cr.set_source_rgba(1, 1, 1)
        show_text(cr, self.sorts)

        cr.save()
        cr.translate(self.x_center, self._recent_y)
        if self.HOV[0] == 1:
            rh = self.HOV[1]
        else:
            rh = None
        self.recent.draw(cr, rh)
        cr.restore()
Ejemplo n.º 9
0
    def draw(self, cr, hover=(None, None)):
        for i, (x, label) in enumerate(self._buttons):

            if i == hover[1] or i == self._active:
                ink = accent
            else:
                ink = (0, 0, 0)

            cr.set_source_rgba(*ink)

            radius = self._height / 2
            cx, cy = x + int(round(
                self._button_width / 2)), (self._y + self.y_bottom) // 2
            cr.arc(cx, cy, radius, 0, 2 * pi)
            cr.close_path()
            cr.fill()

            cr.set_source_rgb(1, 1, 1)
            if i != self._active:
                cr.arc(cx, cy, radius - 1.5, 0, 2 * pi)
                cr.close_path()
                cr.fill()

                cr.set_source_rgba(*ink)

            show_text(cr, label)

        cr.set_source_rgb(1, 1, 1)
        radius = 10
        state_label = self._state_labels[self._active]
        width = state_label[2][-1][1] - state_label[2][0][1] + 20
        y1, y2, x1, x2 = self.y_bottom + 5, self.y_bottom + 25, self._x - width // 2, self._x + width // 2
        cr.arc(x1 + radius, y1 + radius, radius, 2 * (pi / 2), 3 * (pi / 2))
        cr.arc(x2 - radius, y1 + radius, radius, 3 * (pi / 2), 4 * (pi / 2))
        cr.arc(x2 - radius, y2 - radius, radius, 0 * (pi / 2), 1 * (pi / 2))
        cr.arc(x1 + radius, y2 - radius, radius, 1 * (pi / 2), 2 * (pi / 2))
        cr.close_path()
        cr.fill()

        cr.set_source_rgb(0, 0, 0)
        show_text(cr, state_label)
Ejemplo n.º 10
0
    def draw(self, cr, hover=(None, None)):
        for i, (x, label) in enumerate(self._buttons):

            if i == hover[1] or i == self._active:
                ink = accent
            else:
                ink = (0, 0, 0)
            
            cr.set_source_rgba( * ink )

            radius = self._height/2
            cx, cy = x + int(round(self._button_width/2)), (self._y + self.y_bottom)//2
            cr.arc(cx, cy, radius, 0, 2*pi)
            cr.close_path()
            cr.fill()
            
            cr.set_source_rgb(1, 1, 1)
            if i != self._active:
                cr.arc(cx, cy, radius - 1.5, 0, 2*pi)
                cr.close_path()
                cr.fill()
                
                cr.set_source_rgba( * ink )
            
            show_text(cr, label)

        cr.set_source_rgb(1, 1, 1)
        radius = 10
        state_label = self._state_labels[self._active]
        width = state_label[2][-1][1] - state_label[2][0][1] + 20
        y1, y2, x1, x2 = self.y_bottom + 5, self.y_bottom + 25, self._x - width//2, self._x + width//2
        cr.arc(x1 + radius, y1 + radius, radius, 2*(pi/2), 3*(pi/2))
        cr.arc(x2 - radius, y1 + radius, radius, 3*(pi/2), 4*(pi/2))
        cr.arc(x2 - radius, y2 - radius, radius, 0*(pi/2), 1*(pi/2))
        cr.arc(x1 + radius, y2 - radius, radius, 1*(pi/2), 2*(pi/2))
        cr.close_path()
        cr.fill()
                
        cr.set_source_rgb(0, 0, 0)
        show_text(cr, state_label)
Ejemplo n.º 11
0
    def draw(self, cr, hover=(None, None)):
        if self._active:
            cr.set_source_rgb( * accent)

            radius = 5
            y1, y2, x1, x2 = self._y, self.y_bottom, self._x, self._x_right
            cr.arc(x1 + radius, y1 + radius, radius, 2*(pi/2), 3*(pi/2))
            cr.arc(x2 - radius, y1 + radius, radius, 3*(pi/2), 4*(pi/2))
            cr.arc(x2 - radius, y2 - radius, radius, 0*(pi/2), 1*(pi/2))
            cr.arc(x1 + radius, y2 - radius, radius, 1*(pi/2), 2*(pi/2))
            cr.close_path()

            cr.fill()

            cr.set_source_rgb(1,1,1)
            
        elif hover[1]:
            cr.set_source_rgb( * accent)

        else:
            cr.set_source_rgb(0,0,0)
        show_text(cr, self._label)
Ejemplo n.º 12
0
 def draw(self, cr, hover=None):
     if hover is None:
         ink = (1, 1, 1), (0.4, 0.4, 0.4), (0.4, 0.4, 0.4), negative_accent
     else:
         ink = (1, 1, 1), (0  , 0  , 0  ), (0.2, 0.2, 0.2), negative_accent_dark
     if self._state:
         half_pi = pi*0.5
         radius = 13
         centerline = self._from_top + 13
         cr.arc(self._zero + radius - 6, centerline, radius,  half_pi, -half_pi)
         cr.arc( self._one - radius + 6, centerline, radius, -half_pi,  half_pi)
         cr.close_path()
         ink = ink[2 + (self._state < 0)], ink[0]
         cr.set_source_rgba( * ink[0] )
         cr.fill()
         hover = None
     
     inks = [ink[1]] * 3
     if hover is not None:
         inks[hover - 1] = accent
     
     cr.set_source_rgba( * inks[0] )
     show_text(cr, self._label)
     if self._state < 0:
         cr.fill()
         cr.set_line_width(2)
         cross(cr, self._anchors[0], self._from_top)
         cr.stroke()
     else:
         show_text(cr, self._number)
         cr.fill()
     
     cr.set_source_rgba( * inks[1] )
     minus_sign(cr, self._anchors[2] - 6, self._from_top)
     cr.fill()
     
     cr.set_source_rgba( * inks[2] )
     plus_sign (cr, self._anchors[3] - 6, self._from_top)
     cr.fill()
Ejemplo n.º 13
0
    def draw(self, cr, hover=(None, None)):
        for i, (x, label) in enumerate(self._buttons):
            if i == self._active:
                cr.set_source_rgb( * accent)

                radius = 5
                y1, y2, x1, x2 = self._y, self.y_bottom, x, x + int(round(self._button_width))
                cr.arc(x1 + radius, y1 + radius, radius, 2*(pi/2), 3*(pi/2))
                cr.arc(x2 - radius, y1 + radius, radius, 3*(pi/2), 4*(pi/2))
                cr.arc(x2 - radius, y2 - radius, radius, 0*(pi/2), 1*(pi/2))
                cr.arc(x1 + radius, y2 - radius, radius, 1*(pi/2), 2*(pi/2))
                cr.close_path()

                cr.fill()

                cr.set_source_rgb(1,1,1)
                
            elif i == hover[1]:
                cr.set_source_rgb( * accent)

            else:
                cr.set_source_rgb(0,0,0)
            show_text(cr, label)
Ejemplo n.º 14
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()
Ejemplo n.º 15
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()
Ejemplo n.º 16
0
 def draw(self, cr, hover=(None, None)):
     cr.set_source_rgb(0, 0, 0)
     cr.rectangle(self._x, self.y_bottom - 2, self._width, 2)
     cr.fill()
     show_text(cr, self._heading)
Ejemplo n.º 17
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()
Ejemplo n.º 18
0
 def draw(self, cr, hover=(None, None)):
     cr.set_source_rgb(0,0,0)
     cr.rectangle(self._x, self.y_bottom - 2, self._width, 2)
     cr.fill()
     show_text(cr, self._heading)
Ejemplo n.º 19
0
    def draw(self, cr, hover=None):        
        if hover is None:
            resting_bar_color = self._resting_bar_color
        else:
            resting_bar_color = self._active_bar_color
        active_bar_color = self._active_bar_color
        resting_text_color = self._resting_text_color
        active_text_color = self._active_text_color

        
        fontsize = round(self._contents[1])
        
        if self._active:
            cr.set_source_rgba( * active_text_color )
        else:
            cr.set_source_rgba( * resting_text_color )
        
        cr.save()
        
        cr.rectangle(self._text_left - 1, 0, self._text_width + 2, self.k)
        cr.clip()
        cr.translate(round(self._scroll), 0)
        
        show_text(cr, ( * self._contents[:2], self._contents[2][:-1])) # don't print the cap glyph
        
        if self._active:
            # print cursors
            cr.set_source_rgb( * accent )
            cr.rectangle(round(self._template[self._i][1] - 1), 
                        5, 
                        2, 
                        fontsize)
            cr.rectangle(round(self._template[self._j][1] - 1), 
                        5, 
                        2, 
                        fontsize)
            cr.fill()
            
            # print highlight
            if self._i != self._j:
                cr.set_source_rgba(0, 0, 0, 0.1)
                # find leftmost
                if self._i <= self._j:
                    root = self._template[self._i][1]
                else:
                    root = self._template[self._j][1]
                cr.rectangle(root, 
                        5,
                        abs(self._template[self._i][1] - self._template[self._j][1]),
                        fontsize)
                cr.fill()
        
        cr.restore()
        
        show_text(cr, self._label)
        
        if self._active:
            cr.set_source_rgba( * active_bar_color )
        else:
            cr.set_source_rgba( * resting_bar_color )
        cr.rectangle(self._text_left, fontsize + 10, self._text_width, 1)
        cr.fill()