diff options
author | Anton Khirnov <wyskas@gmail.com> | 2009-05-12 21:43:06 +0200 |
---|---|---|
committer | Anton Khirnov <wyskas@gmail.com> | 2009-05-12 21:43:06 +0200 |
commit | 42143bfe8153ddd565d0601e08e623cb515ddb3d (patch) | |
tree | e806dc31668dff10b1355131623f02846518fbd0 /nephilim/plugins/Lyrics.py | |
parent | 420386f8b7a209b717e64bd85718268efa88d99c (diff) |
Lyrics: add a settings widget.
shamelessly copypasted from AlbumCover
Diffstat (limited to 'nephilim/plugins/Lyrics.py')
-rw-r--r-- | nephilim/plugins/Lyrics.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/nephilim/plugins/Lyrics.py b/nephilim/plugins/Lyrics.py index e4f053b..7eae646 100644 --- a/nephilim/plugins/Lyrics.py +++ b/nephilim/plugins/Lyrics.py @@ -149,3 +149,53 @@ class Lyrics(Plugin): return None return result if result != 'Not found' else None + + class SettingsWidgetLyrics(Plugin.SettingsWidget): + lyricdir = None + lyricname = None + store = None + + def __init__(self, plugin): + Plugin.SettingsWidget.__init__(self, plugin) + self.settings().beginGroup(self.plugin.name()) + + + # store lyrics groupbox + self.store = QtGui.QGroupBox('Store lyrics.') + self.store.setToolTip('Should %s store its own copy of lyrics?'%misc.APPNAME) + self.store.setCheckable(True) + self.store.setChecked(self.settings().value('store').toBool()) + self.store.setLayout(QtGui.QGridLayout()) + + # paths to lyrics + self.lyricdir = QtGui.QLineEdit(self.settings().value('lyricdir').toString()) + self.lyricdir.setToolTip('Where should %s store lyrics.\n' + '$musicdir will be expanded to path to MPD music library (as set by user)\n' + '$songdir will be expanded to path to the song (relative to $musicdir\n' + 'other tags same as in lyricname' + %misc.APPNAME) + self.lyricname = QtGui.QLineEdit(self.settings().value('lyricname').toString()) + self.lyricname.setToolTip('Filename for %s lyricsfiles.\n' + 'All tags supported by MPD will be expanded to their\n' + 'values for current song, e.g. $title, $track, $artist,\n' + '$album, $genre etc.'%misc.APPNAME) + self.store.layout().addWidget(QtGui.QLabel('Lyrics directory'), 0, 0) + self.store.layout().addWidget(self.lyricdir, 0, 1) + self.store.layout().addWidget(QtGui.QLabel('Lyrics filename'), 1, 0) + self.store.layout().addWidget(self.lyricname, 1, 1) + + self.setLayout(QtGui.QVBoxLayout()) + self.layout().addWidget(self.store) + + self.settings().endGroup() + + def save_settings(self): + self.settings().beginGroup(self.plugin.name()) + self.settings().setValue('lyricdir', QVariant(self.lyricdir.text())) + self.settings().setValue('lyricname', QVariant(self.lyricname.text())) + self.settings().setValue('store', QVariant(self.store.isChecked())) + self.settings().endGroup() + self.plugin.o.refresh() + + def get_settings_widget(self): + return self.SettingsWidgetLyrics(self) |