Philipp Hörist pushed to branch mainwindow at gajim / gajim

Commits:

1 changed file:

Changes:

  • gajim/gtk/avatar.py
    ... ... @@ -148,6 +148,36 @@ def add_status_to_avatar(surface, show):
    148 148
         return context.get_target()
    
    149 149
     
    
    150 150
     
    
    151
    +@lru_cache(maxsize=8)
    
    152
    +def get_show_circle(show, size, scale):
    
    153
    +    size = size * scale
    
    154
    +    center = size / 2
    
    155
    +    radius = size / 3
    
    156
    +
    
    157
    +    surface = cairo.ImageSurface(cairo.Format.ARGB32, size, size)
    
    158
    +    context = cairo.Context(surface)
    
    159
    +
    
    160
    +    css_color = get_css_show_class(show.value)
    
    161
    +    color = convert_rgb_string_to_float(
    
    162
    +        app.css_config.get_value(css_color, StyleAttr.COLOR))
    
    163
    +
    
    164
    +    context.set_source_rgb(*color)
    
    165
    +    context.set_operator(cairo.Operator.OVER)
    
    166
    +    context.arc(center, center, radius, 0, 2 * pi)
    
    167
    +    context.fill()
    
    168
    +
    
    169
    +    if show.value == 'dnd':
    
    170
    +        line_length = radius * 0.65
    
    171
    +        context.move_to(center - line_length, center)
    
    172
    +        context.line_to(center + line_length, center)
    
    173
    +
    
    174
    +        context.set_source_rgb(255, 255, 255)
    
    175
    +        context.set_line_width(size / 10)
    
    176
    +        context.stroke()
    
    177
    +
    
    178
    +    return context.get_target()
    
    179
    +
    
    180
    +
    
    151 181
     def square(surface, size):
    
    152 182
         width = surface.get_width()
    
    153 183
         height = surface.get_height()