Created
October 6, 2012 01:37
-
-
Save libricoleur/3843402 to your computer and use it in GitHub Desktop.
Patch for sonata-1.6.2.1 doing the same thing than https://github.com/libricoleur/sonata/commit/c94f4b9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -x '*.pyc' -ur a/sonata/artwork.py b/sonata/artwork.py | |
--- a/sonata/artwork.py 2009-09-21 23:02:16.000000000 +0200 | |
+++ b/sonata/artwork.py 2012-10-06 02:57:02.019888727 +0200 | |
@@ -44,10 +44,7 @@ | |
self.albumimage = ui.image() | |
self.albumimage.set_from_file(self.sonatacd) | |
- self.trayalbumimage1 = ui.image(w=51, h=77, x=1) | |
- self.trayalbumeventbox = ui.eventbox(w=59, h=90, add=self.trayalbumimage1, state=gtk.STATE_SELECTED, visible=True) | |
- | |
- self.trayalbumimage2 = ui.image(w=26, h=77) | |
+ self.trayalbumimage = ui.image(w=51*consts.NOTIFICATION_COVER_RATIO, h=77*consts.NOTIFICATION_COVER_RATIO) | |
self.fullscreenalbumimage = ui.image(w=consts.FULLSCREEN_COVER_SIZE, h=consts.FULLSCREEN_COVER_SIZE, x=1) | |
self.fullscreenalbumlabel = ui.label(x=0.5) | |
@@ -85,7 +82,7 @@ | |
return self.info_image | |
def get_trayalbum(self): | |
- return self.trayalbumeventbox, self.trayalbumimage2 | |
+ return self.trayalbumimage | |
def get_fullscreenalbumimage(self): | |
return self.fullscreenalbumimage | |
@@ -114,15 +111,11 @@ | |
def artwork_set_tooltip_art(self, pix): | |
# Set artwork | |
if not self.is_lang_rtl: | |
- pix1 = pix.subpixbuf(0, 0, 51, 77) | |
- pix2 = pix.subpixbuf(51, 0, 26, 77) | |
+ pix1 = pix.subpixbuf(0, 0, 76*consts.NOTIFICATION_COVER_RATIO, 77*consts.NOTIFICATION_COVER_RATIO) | |
else: | |
- pix1 = pix.subpixbuf(26, 0, 51, 77) | |
- pix2 = pix.subpixbuf(0, 0, 26, 77) | |
- self.trayalbumimage1.set_from_pixbuf(pix1) | |
- self.trayalbumimage2.set_from_pixbuf(pix2) | |
+ pix1 = pix.subpixbuf(26, 0, 76*consts.NOTIFICATION_COVER_RATIO, 77*consts.NOTIFICATION_COVER_RATIO) | |
+ self.trayalbumimage.set_from_pixbuf(pix) | |
del pix1 | |
- del pix2 | |
def artwork_stop_update(self): | |
self.stop_art_update = True | |
@@ -463,8 +456,13 @@ | |
pix1 = img.pixbuf_add_border(pix1) | |
pix1 = img.pixbuf_pad(pix1, 77, 77) | |
self.albumimage.set_from_pixbuf(pix1) | |
- self.artwork_set_tooltip_art(pix1) | |
del pix1 | |
+ (pix2, w, h) = img.get_pixbuf_of_size(pix, 75*consts.NOTIFICATION_COVER_RATIO) | |
+ pix2 = self.artwork_apply_composite_case(pix2, w, h) | |
+ pix2 = img.pixbuf_add_border(pix2) | |
+ pix2 = img.pixbuf_pad(pix2, 77*consts.NOTIFICATION_COVER_RATIO, 77*consts.NOTIFICATION_COVER_RATIO) | |
+ self.artwork_set_tooltip_art(pix2) | |
+ del pix2 | |
# Artwork for library, if current song matches: | |
self.library_set_image_for_current_song(cache_key) | |
Seulement dans b/sonata: artwork.py.orig | |
diff -x '*.pyc' -ur a/sonata/config.py b/sonata/config.py | |
--- a/sonata/config.py 2009-09-21 23:02:16.000000000 +0200 | |
+++ b/sonata/config.py 2012-10-06 02:57:02.019888727 +0200 | |
@@ -70,6 +70,8 @@ | |
self.titleformat = "[Sonata] %A - %T" | |
self.currsongformat1 = "%T" | |
self.currsongformat2 = currsongformat2 | |
+ self.currsongformat3 = "par %A" | |
+ self.currsongformat4 = "de %B" | |
# this mirrors Main.columns widths | |
self.columnwidths = [325,10] | |
self.autoconnect = True | |
Seulement dans b/sonata: config.py.orig | |
diff -x '*.pyc' -ur a/sonata/consts.py b/sonata/consts.py | |
--- a/sonata/consts.py 2009-09-21 23:02:16.000000000 +0200 | |
+++ b/sonata/consts.py 2012-10-06 02:57:02.019888727 +0200 | |
@@ -27,8 +27,9 @@ | |
self.VIEW_GENRE = 2 | |
self.VIEW_ALBUM = 3 | |
self.LYRIC_TIMEOUT = 10 | |
- self.NOTIFICATION_WIDTH_MAX = 500 | |
- self.NOTIFICATION_WIDTH_MIN = 350 | |
+ self.NOTIFICATION_COVER_RATIO = 3 | |
+ self.NOTIFICATION_WIDTH_MAX = 100+75*self.NOTIFICATION_COVER_RATIO | |
+ self.NOTIFICATION_WIDTH_MIN = 50+75*self.NOTIFICATION_COVER_RATIO | |
self.FULLSCREEN_COVER_SIZE = 500 | |
self.ART_LOCATION_HOMECOVERS = 0 # ~/.covers/[artist]-[album].jpg | |
self.ART_LOCATION_COVER = 1 # file_dir/cover.jpg | |
Seulement dans b/sonata: consts.py.orig | |
diff -x '*.pyc' -ur a/sonata/main.py b/sonata/main.py | |
--- a/sonata/main.py 2009-09-21 23:02:16.000000000 +0200 | |
+++ b/sonata/main.py 2012-10-06 03:06:34.249896491 +0200 | |
@@ -584,34 +584,28 @@ | |
# Song notification window: | |
outtertipbox = gtk.VBox() | |
- tipbox = gtk.HBox() | |
+ tipbox = gtk.VBox() | |
- self.trayalbumeventbox, self.trayalbumimage2 = self.artwork.get_trayalbum() | |
+ self.trayalbumimage = self.artwork.get_trayalbum() | |
hiddenlbl = ui.label(w=2, h=-1) | |
tipbox.pack_start(hiddenlbl, False, False, 0) | |
- tipbox.pack_start(self.trayalbumeventbox, False, False, 0) | |
- tipbox.pack_start(self.trayalbumimage2, False, False, 0) | |
+ tipbox.pack_start(self.trayalbumimage, False, False, 0) | |
if not self.config.show_covers: | |
- ui.hide(self.trayalbumeventbox) | |
- ui.hide(self.trayalbumimage2) | |
- innerbox = gtk.VBox() | |
- self.traycursonglabel1 = ui.label(markup=_("Playlist"), y=1) | |
- self.traycursonglabel2 = ui.label(markup=_("Playlist"), y=0) | |
- label1 = ui.label(markup='<span size="10"> </span>') | |
- innerbox.pack_start(label1) | |
- innerbox.pack_start(self.traycursonglabel1, True, True, 0) | |
- innerbox.pack_start(self.traycursonglabel2, True, True, 0) | |
- self.trayprogressbar = ui.progressbar(orient=gtk.PROGRESS_LEFT_TO_RIGHT, frac=0, step=0.05, ellipsize=pango.ELLIPSIZE_NONE) | |
- label2 = ui.label(markup='<span size="10"> </span>') | |
- innerbox.pack_start(label2) | |
- innerbox.pack_start(self.trayprogressbar, False, False, 0) | |
- if not self.config.show_progress: | |
- ui.hide(self.trayprogressbar) | |
- label3 = ui.label(markup='<span size="10"> </span>') | |
- innerbox.pack_start(label3) | |
- tipbox.pack_start(innerbox, True, True, 6) | |
+ ui.hide(self.trayalbumimage) | |
+ self.traycursonglabel1 = ui.label(markup=_("Playlist"), x=0.5) | |
+ self.traycursonglabel2 = ui.label(markup=_("Playlist"), x=0.5) | |
+ self.traycursonglabel3 = ui.label(markup=_("Playlist"), x=0.5) | |
+ label1 = ui.label(markup='<span size="5"> </span>') | |
+ tipbox.pack_start(label1) | |
+ tipbox.pack_start(self.traycursonglabel1, False, False, 0) | |
+ tipbox.pack_start(self.traycursonglabel2, False, False, 0) | |
+ tipbox.pack_start(self.traycursonglabel3, False, False, 0) | |
+ label2 = ui.label(markup='<span size="5"> </span>') | |
+ tipbox.pack_start(label2) | |
+ label3 = ui.label(markup='<span size="5"> </span>') | |
+ tipbox.pack_start(label3) | |
outtertipbox.pack_start(tipbox, False, False, 2) | |
outtertipbox.show_all() | |
self.traytips.add_widget(outtertipbox) | |
@@ -1793,14 +1787,13 @@ | |
# self.on_currsong_notify()) in order to ensure that the notification | |
# popup will have the correct height when being displayed for | |
# the first time after a stopped state. | |
- if self.config.show_progress: | |
- self.trayprogressbar.show() | |
self.traycursonglabel2.show() | |
if self.config.show_covers: | |
- self.trayalbumeventbox.show() | |
- self.trayalbumimage2.show() | |
+ self.trayalbumimage.show() | |
- for label in (self.cursonglabel1, self.cursonglabel2, self.traycursonglabel1, self.traycursonglabel2): | |
+ for label in (self.cursonglabel1, self.cursonglabel2, | |
+ self.traycursonglabel1, self.traycursonglabel2, | |
+ self.traycursonglabel3): | |
label.set_ellipsize(pango.ELLIPSIZE_END) | |
self.expander_ellipse_workaround() | |
@@ -1813,14 +1806,31 @@ | |
newlabel2 = '<small>' + self.parse_formatting(self.config.currsongformat2, self.songinfo, True) + ' </small>' | |
else: | |
newlabel2 = '<small> </small>' | |
+ if len(self.config.currsongformat3) > 0: | |
+ newlabel3 = ('<small>%s </small>' % | |
+ self.parse_formatting( | |
+ self.config.currsongformat3, | |
+ self.songinfo, True)) | |
+ else: | |
+ newlabel3 = '<small> </small>' | |
+ if len(self.config.currsongformat4) > 0: | |
+ newlabel4 = ('<small>%s </small>' % | |
+ self.parse_formatting( | |
+ self.config.currsongformat4, | |
+ self.songinfo, True)) | |
+ else: | |
+ newlabel4 = '<small> </small>' | |
+ | |
if newlabel1 != self.cursonglabel1.get_label(): | |
self.cursonglabel1.set_markup(newlabel1) | |
if newlabel2 != self.cursonglabel2.get_label(): | |
self.cursonglabel2.set_markup(newlabel2) | |
if newlabel1 != self.traycursonglabel1.get_label(): | |
self.traycursonglabel1.set_markup(newlabel1) | |
- if newlabel2 != self.traycursonglabel2.get_label(): | |
- self.traycursonglabel2.set_markup(newlabel2) | |
+ if newlabel3 != self.traycursonglabel2.get_label(): | |
+ self.traycursonglabel2.set_markup(newlabel3) | |
+ if newlabel4 != self.traycursonglabel3.get_label(): | |
+ self.traycursonglabel3.set_markup(newlabel4) | |
self.expander.set_tooltip_text(self.cursonglabel1.get_text() + "\n" + self.cursonglabel2.get_text()) | |
else: | |
for label in (self.cursonglabel1, self.cursonglabel2, self.traycursonglabel1, self.cursonglabel2): | |
@@ -1838,9 +1848,7 @@ | |
self.traycursonglabel1.set_label(_('No Read Permission')) | |
else: | |
self.traycursonglabel1.set_label(_('Stopped')) | |
- self.trayprogressbar.hide() | |
- self.trayalbumeventbox.hide() | |
- self.trayalbumimage2.hide() | |
+ self.trayalbumimage.hide() | |
self.traycursonglabel2.hide() | |
self.update_infofile() | |
@@ -1924,10 +1932,10 @@ | |
pass | |
def on_progressbar_notify_fraction(self, *_args): | |
- self.trayprogressbar.set_fraction(self.progressbar.get_fraction()) | |
+ return | |
def on_progressbar_notify_text(self, *_args): | |
- self.trayprogressbar.set_text(self.progressbar.get_text()) | |
+ return | |
def update_infofile(self): | |
if self.config.use_infofile is True: | |
@@ -3015,9 +3023,9 @@ | |
if button_active: | |
self.traytips.set_size_request(self.notification_width, -1) | |
self.artwork.artwork_set_default_icon() | |
- for widget in [self.imageeventbox, self.info_imagebox, self.trayalbumeventbox, self.trayalbumimage2]: | |
+ for widget in [self.imageeventbox, self.info_imagebox, self.trayalbumimage]: | |
widget.set_no_show_all(False) | |
- if widget in [self.trayalbumeventbox, self.trayalbumimage2]: | |
+ if widget is self.trayalbumimage: | |
if self.conn and self.status and self.status['state'] in ['play', 'pause']: | |
widget.show_all() | |
else: | |
@@ -3027,7 +3035,7 @@ | |
self.artwork.artwork_update() | |
else: | |
self.traytips.set_size_request(self.notification_width-100, -1) | |
- for widget in [self.imageeventbox, self.info_imagebox, self.trayalbumeventbox, self.trayalbumimage2]: | |
+ for widget in [self.imageeventbox, self.info_imagebox, self.trayalbumimage]: | |
ui.hide(widget) | |
self.config.show_covers = False | |
self.update_cursong() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment