Skip to content

Commit

Permalink
Merge pull request #1583 from brunob/animosd
Browse files Browse the repository at this point in the history
Fix #1049 : allow to configure cover size in animosd plugin
  • Loading branch information
lazka committed Apr 19, 2015
2 parents 660372a + 6451f6c commit 704bebd
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion quodlibet/quodlibet/ext/events/animosd.py
Expand Up @@ -73,7 +73,7 @@ def __init__(self, conf, song):

# now calculate size of window
mgeo = screen.get_monitor_geometry(conf.monitor)
coverwidth = min(120, mgeo.width // 8)
coverwidth = min(conf.coversize, mgeo.width // 8)
textwidth = mgeo.width - 2 * (conf.border + conf.margin)
if cover is not None:
textwidth -= coverwidth + conf.border
Expand Down Expand Up @@ -403,6 +403,12 @@ def change_rounded(button):
self.config_set("corners", str(self.Conf.corners))
show_preview()

def change_coversize(button):
value = int(button.get_value())
self.config_set("coversize", str(value))
self.Conf.coversize = value
show_preview()

def edit_pattern(button):
w = PatternEdit(button, AnimOsd.ConfDef.string)
w.set_default_size(520, 260)
Expand Down Expand Up @@ -450,6 +456,18 @@ def build_display_widget():
hb.pack_start(lbl, False, True, 0)
hb.pack_start(cb, False, True, 0)
vb2.pack_start(hb, False, True, 0)

hb = Gtk.HBox(spacing=6)
coversize = Gtk.SpinButton(
adjustment=Gtk.Adjustment.new(
self.Conf.coversize, 120, 600, 1, 10, 0),
climb_rate=1, digits=0)
coversize.set_numeric(True)
coversize.connect('value-changed', change_coversize)
l1 = ConfigLabel(_("_Cover Size:"), coversize)
hb.pack_start(l1, False, True, 0)
hb.pack_start(coversize, False, True, 0)
vb2.pack_start(hb, False, True, 0)
return vb2

frame = qltk.Frame(label=_("Display"), child=build_display_widget())
Expand Down Expand Up @@ -580,6 +598,8 @@ class ConfDef(object):
align = 1
# rounded corner radius, 0 for angled corners
corners = 0
# cover size, min and default to 120, max to 600
coversize = 120
# color,alpha or (-1.0,0.0,0.0,0.0) - surrounds text and cover
outline = (-1.0, 0.0, 0.0, 0.2)
# color,alpha or (-1.0,0.0,0.0) - shadows outline for text and cover
Expand Down Expand Up @@ -613,6 +633,7 @@ def str_to_tuple(s):
('outline', str_to_tuple),
('bcolor', str_to_tuple),
('corners', float),
('coversize', int),
('font', None),
('align', int),
('delay', int),
Expand Down

0 comments on commit 704bebd

Please sign in to comment.