Merge lp:~jconti/exaile/lyrics_font into lp:exaile/0.3.3

Proposed by Jason Conti
Status: Merged
Merged at revision: 3957
Proposed branch: lp:~jconti/exaile/lyrics_font
Merge into: lp:exaile/0.3.3
Diff against target: 135 lines (+89/-2)
3 files modified
plugins/lyricsviewer/__init__.py (+14/-2)
plugins/lyricsviewer/lyricsviewer_prefs.ui (+49/-0)
plugins/lyricsviewer/lyricsviewerprefs.py (+26/-0)
To merge this branch: bzr merge lp:~jconti/exaile/lyrics_font
Reviewer Review Type Date Requested Status
Adam Olsen Approve
Review via email: mp+99442@code.launchpad.net

Description of the change

I was in the process of patching the ubuntu package to have a larger font in the lyrics viewer (it is very difficult to read Japanese fonts at 9pt, for me anyway), but decided to add a preference instead.

Adds a single preference to the lyrics viewer plugin: 'plugin/lyricsviewer/lyrics_font'.

To post a comment you must log in.
Revision history for this message
Adam Olsen (arolsen) wrote :

Looks good to me

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/lyricsviewer/__init__.py'
2--- plugins/lyricsviewer/__init__.py 2011-12-19 04:30:33 +0000
3+++ plugins/lyricsviewer/__init__.py 2012-03-26 22:35:31 +0000
4@@ -28,9 +28,11 @@
5 import os
6 import webbrowser
7 from xl.nls import gettext as _
8-from xl import common, event, player
9+from xl import common, event, player, settings
10 from xl.lyrics import LyricsNotFoundException
11
12+import lyricsviewerprefs
13+
14 LYRICSPANEL = None
15 CURPATH = os.path.realpath(__file__)
16 BASEDIR = os.path.dirname(CURPATH)+os.path.sep
17@@ -51,6 +53,7 @@
18 #I set the style of the text view containing the lyrics here cause
19 #the style of the top level is not really available until the panel is added.
20 LYRICSVIEWER.set_lyrics_text_style()
21+ event.add_callback(on_option_set, 'plugin_lyricsviewer_option_set')
22
23 def disable(exaile):
24 global LYRICSPANEL
25@@ -60,6 +63,14 @@
26 LYRICSVIEWER = None
27 LYRICSPANEL = None
28
29+def get_preferences_pane():
30+ return lyricsviewerprefs
31+
32+def on_option_set(event, settings, option):
33+ if option == 'plugin/lyricsviewer/lyrics_font':
34+ value = settings.get_option(option, LYRICSVIEWER.lyrics_font)
35+ LYRICSVIEWER.lyrics_text.modify_font(pango.FontDescription(value))
36+
37 class LyricsViewer(object):
38
39 track_title_font='sans bold 10'
40@@ -120,8 +131,9 @@
41 #trackname end
42
43 #the textview which cointains the lyrics
44+ user_lyrics_font = settings.get_option('plugin/lyricsviewer/lyrics_font', self.lyrics_font)
45 self.lyrics_text=builder.get_object('LyricsText')
46- self.lyrics_text.modify_font(pango.FontDescription(self.lyrics_font))
47+ self.lyrics_text.modify_font(pango.FontDescription(user_lyrics_font))
48 self.lyrics_text_buffer = builder.get_object('LyricsTextBuffer')
49 #end lyrictextview
50
51
52=== added file 'plugins/lyricsviewer/lyricsviewer_prefs.ui'
53--- plugins/lyricsviewer/lyricsviewer_prefs.ui 1970-01-01 00:00:00 +0000
54+++ plugins/lyricsviewer/lyricsviewer_prefs.ui 2012-03-26 22:35:31 +0000
55@@ -0,0 +1,49 @@
56+<?xml version="1.0" encoding="UTF-8"?>
57+<interface>
58+ <requires lib="gtk+" version="2.16"/>
59+ <!-- interface-naming-policy project-wide -->
60+ <object class="GtkWindow" id="prefs_window">
61+ <property name="can_focus">False</property>
62+ <child>
63+ <object class="GtkVBox" id="preferences_pane">
64+ <property name="visible">True</property>
65+ <property name="can_focus">False</property>
66+ <child>
67+ <object class="GtkHBox" id="hbox1">
68+ <property name="visible">True</property>
69+ <property name="can_focus">False</property>
70+ <property name="spacing">6</property>
71+ <child>
72+ <object class="GtkLabel" id="label1">
73+ <property name="visible">True</property>
74+ <property name="can_focus">False</property>
75+ <property name="xalign">0</property>
76+ <property name="label" translatable="yes">Lyrics font:</property>
77+ </object>
78+ <packing>
79+ <property name="expand">False</property>
80+ <property name="position">0</property>
81+ </packing>
82+ </child>
83+ <child>
84+ <object class="GtkFontButton" id="plugin/lyricsviewer/lyrics_font">
85+ <property name="use_action_appearance">False</property>
86+ <property name="visible">True</property>
87+ <property name="can_focus">True</property>
88+ <property name="receives_default">True</property>
89+ </object>
90+ <packing>
91+ <property name="expand">False</property>
92+ <property name="position">1</property>
93+ </packing>
94+ </child>
95+ </object>
96+ <packing>
97+ <property name="expand">False</property>
98+ <property name="position">0</property>
99+ </packing>
100+ </child>
101+ </object>
102+ </child>
103+ </object>
104+</interface>
105
106=== added file 'plugins/lyricsviewer/lyricsviewerprefs.py'
107--- plugins/lyricsviewer/lyricsviewerprefs.py 1970-01-01 00:00:00 +0000
108+++ plugins/lyricsviewer/lyricsviewerprefs.py 2012-03-26 22:35:31 +0000
109@@ -0,0 +1,26 @@
110+# This program is free software; you can redistribute it and/or modify
111+# it under the terms of the GNU General Public License as published by
112+# the Free Software Foundation; either version 1, or (at your option)
113+# any later version.
114+#
115+# This program is distributed in the hope that it will be useful,
116+# but WITHOUT ANY WARRANTY; without even the implied warranty of
117+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
118+# GNU General Public License for more details.
119+#
120+# You should have received a copy of the GNU General Public License
121+# along with this program; if not, write to the Free Software
122+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
123+
124+from xlgui.preferences import widgets
125+from xl import xdg
126+from xl.nls import gettext as _
127+import os
128+
129+name = _('Lyrics Viewer')
130+basedir = os.path.dirname(os.path.realpath(__file__))
131+ui = os.path.join(basedir, 'lyricsviewer_prefs.ui')
132+
133+class LyricsFontPreference(widgets.FontButtonPreference):
134+ default = 'Sans 9'
135+ name = 'plugin/lyricsviewer/lyrics_font'