Skip to content

Commit

Permalink
Merge pull request #359 from genodeftest/icons-remove-dead-code
Browse files Browse the repository at this point in the history
Remove unused broken function
  • Loading branch information
sjohannes committed May 2, 2017
2 parents cf3c696 + ed02d97 commit 8514bcd
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 58 deletions.
1 change: 0 additions & 1 deletion doc/xlgui/icons.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Icon management
pixbuf_from_stock,
pixbuf_from_icon_name,
pixbuf_from_data,
pixbuf_from_text,
pixbuf_from_rating

Utilities
Expand Down
57 changes: 0 additions & 57 deletions xlgui/icons.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,63 +765,6 @@ def on_size_prepared(loader, width, height):

return pixbuf

def pixbuf_from_text(self, text, size, background_color='#456eac',
border_color='#000', text_color='#fff'):
"""
Generates a pixbuf based on a text, width and height
:param size: A tuple describing width and height
:type size: tuple of int
:param background_color: The color of the background as
hexadecimal value
:type background_color: string
:param border_color: The color of the border as
hexadecimal value
:type border_color: string
:param text_color: The color of the text as
hexadecimal value
:type text_color: string
"""
pixmap_width, pixmap_height = size
key = '%s - %sx%s - %s' % (text, pixmap_width, pixmap_height,
background_color)

if key in self._cache:
return self._cache[key]

# TODO: GI: No pixmap
'''pixmap = Gdk.Pixmap(None, pixmap_width, pixmap_height,
self.system_visual.depth)
context = pixmap.cairo_create()
context.set_source_color(Gdk.Color(background_color))
context.set_line_width(1)
context.rectangle(1, 1, pixmap_width - 2, pixmap_height - 2)
context.fill()
context.set_source_color(Gdk.Color(text_color))
context.select_font_face('sans-serif 10')
x_bearing, y_bearing, width, height = context.text_extents(text)[:4]
x = pixmap_width / 2 - width / 2 - x_bearing
y = pixmap_height / 2 - height / 2 - y_bearing
context.move_to(x, y)
context.show_text(text)
context.set_source_color(Gdk.Color(border_color))
context.set_antialias(cairo.ANTIALIAS_NONE)
context.rectangle(0, 0, pixmap_width - 1, pixmap_height - 1)
context.stroke()'''

pixbuf = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, False, 8,
pixmap_width, pixmap_height)
# TODO: GI: No pixmap
#pixbuf = pixbuf.get_from_drawable(pixmap, self.system_colormap,
# 0, 0, 0, 0, pixmap_width, pixmap_height)

self._cache[key] = pixbuf

return pixbuf

@common.cached(limit=settings.get_option('rating/maximum', 5)*3)
def pixbuf_from_rating(self, rating, size_ratio=1):
"""
Expand Down

0 comments on commit 8514bcd

Please sign in to comment.