Commit de4b9d7d authored by Cédric Bellegarde's avatar Cédric Bellegarde

Use Cellarea to check if drawing allowed

parent 0c3ea743
......@@ -78,7 +78,6 @@ class CellRendererArtist(Gtk.CellRendererText):
Gtk.CellRendererText.__init__(self)
self.__is_artists = False
self.__surfaces = {}
self.__draw_artwork = False
self.__scale_factor = None
def set_is_artists(self, is_artists):
......@@ -88,9 +87,10 @@ class CellRendererArtist(Gtk.CellRendererText):
if self.__scale_factor != widget.get_scale_factor():
self.__scale_factor = widget.get_scale_factor()
self.__surfaces = {}
size = ArtSize.ARTIST_SMALL * self.__scale_factor
if self.__draw_artwork:
draw_artwork = cell_area.height >\
Gtk.CellRendererText.get_preferred_height(self, widget)[1]
if draw_artwork:
if Gtk.Widget.get_default_direction() == Gtk.TextDirection.LTR:
cell_area.x = ArtSize.ARTIST_SMALL + self.xshift * 2
cell_area.width -= ArtSize.ARTIST_SMALL
......@@ -99,7 +99,7 @@ class CellRendererArtist(Gtk.CellRendererText):
cell_area.width -= ArtSize.ARTIST_SMALL + self.xshift
Gtk.CellRendererText.do_render(self, ctx, widget,
cell_area, cell_area, flags)
if self.__draw_artwork:
if draw_artwork:
if Gtk.Widget.get_default_direction() == Gtk.TextDirection.LTR:
cell_area.x = self.xshift
else:
......@@ -144,10 +144,10 @@ class CellRendererArtist(Gtk.CellRendererText):
ctx.paint()
def do_get_preferred_height_for_width(self, widget, width):
self.__draw_artwork = self.__is_artists and\
draw_artwork = self.__is_artists and\
self.rowid >= 0 and\
App().settings.get_value("artist-artwork")
if self.__draw_artwork:
if draw_artwork:
return (ArtSize.ARTIST_SMALL, ArtSize.ARTIST_SMALL)
else:
return Gtk.CellRendererText.do_get_preferred_height_for_width(
......
ninja -C build install
echo "Running lollypop"
lollypop
lollypop -e
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment