diff options
author | Anton Khirnov <wyskas@gmail.com> | 2009-08-19 09:49:15 +0200 |
---|---|---|
committer | Anton Khirnov <wyskas@gmail.com> | 2009-08-19 09:49:15 +0200 |
commit | 34cc07dee5c909e0262386edf578ced4d646d784 (patch) | |
tree | 3762b6c23328031253197fe54561fc97bad4912b /nephilim/plugins/AlbumCover.py | |
parent | ae94ee8e4baefa34ab47e73280c7198ca55a39c5 (diff) |
plugin: make settings a var, not a function.
Diffstat (limited to 'nephilim/plugins/AlbumCover.py')
-rw-r--r-- | nephilim/plugins/AlbumCover.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/nephilim/plugins/AlbumCover.py b/nephilim/plugins/AlbumCover.py index 2a80fc0..8321944 100644 --- a/nephilim/plugins/AlbumCover.py +++ b/nephilim/plugins/AlbumCover.py @@ -103,7 +103,7 @@ class wgAlbumCover(QtGui.QLabel): self.plugin.emit(QtCore.SIGNAL('cover_changed'), self.cover) self.logger.info('Cover set.') - if (write and self.plugin.settings().value(self.plugin.name + '/store').toBool() + if (write and self.plugin.settings.value(self.plugin.name + '/store').toBool() and self._cover_filepath): if self.cover.save(self._cover_filepath, 'png'): self.logger.info('Cover saved.') @@ -134,13 +134,13 @@ class wgAlbumCover(QtGui.QLabel): self.logger.info("autorefreshing cover") # generate filenames - (self._cover_dirname, self._cover_filepath) = generate_metadata_path(song, self.plugin.settings().value(self.plugin.name + '/coverdir').toString(), - self.plugin.settings().value(self.plugin.name + '/covername').toString()) + (self._cover_dirname, self._cover_filepath) = generate_metadata_path(song, self.plugin.settings.value(self.plugin.name + '/coverdir').toString(), + self.plugin.settings.value(self.plugin.name + '/covername').toString()) write = False if not QtCore.QFile.exists(self._cover_filepath): for i in (0, 1): - src = self.plugin.settings().value(self.plugin.name + '/method%i'%i).toInt()[0] + src = self.plugin.settings.value(self.plugin.name + '/method%i'%i).toInt()[0] if src == AC_FETCH_LOCAL_DIR and self._cover_dirname: cover = self._fetch_local(song) elif src == AC_FETCH_AMAZON: @@ -274,7 +274,7 @@ class AlbumCover(Plugin): def __init__(self, plugin): Plugin.SettingsWidget.__init__(self, plugin) - self.settings().beginGroup(self.plugin.name) + self.settings.beginGroup(self.plugin.name) # fetching methods comboboxes self.methods = [QtGui.QComboBox(), QtGui.QComboBox()] @@ -282,23 +282,23 @@ class AlbumCover(Plugin): method.addItem('No method.') method.addItem('Local dir') method.addItem('Amazon') - method.setCurrentIndex(self.settings().value('method' + str(i)).toInt()[0]) + method.setCurrentIndex(self.settings.value('method' + str(i)).toInt()[0]) # store covers groupbox self.store = QtGui.QGroupBox('Store covers.') self.store.setToolTip('Should %s store its own copy of covers?'%APPNAME) self.store.setCheckable(True) - self.store.setChecked(self.settings().value('store').toBool()) + self.store.setChecked(self.settings.value('store').toBool()) self.store.setLayout(QtGui.QGridLayout()) # paths to covers - self.coverdir = QtGui.QLineEdit(self.settings().value('coverdir').toString()) + self.coverdir = QtGui.QLineEdit(self.settings.value('coverdir').toString()) self.coverdir.setToolTip('Where should %s store covers.\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 covername' %APPNAME) - self.covername = QtGui.QLineEdit(self.settings().value('covername').toString()) + self.covername = QtGui.QLineEdit(self.settings.value('covername').toString()) self.covername.setToolTip('Filename for %s cover files.\n' 'All tags supported by MPD will be expanded to their\n' 'values for current song, e.g. $title, $track, $artist,\n' @@ -313,16 +313,16 @@ class AlbumCover(Plugin): self._add_widget(self.methods[1], 'Method 1', 'Method to try if the first one fails.') self.layout().addWidget(self.store) - self.settings().endGroup() + self.settings.endGroup() def save_settings(self): - self.settings().beginGroup(self.plugin.name) - self.settings().setValue('method0', QVariant(self.methods[0].currentIndex())) - self.settings().setValue('method1', QVariant(self.methods[1].currentIndex())) - self.settings().setValue('coverdir', QVariant(self.coverdir.text())) - self.settings().setValue('covername', QVariant(self.covername.text())) - self.settings().setValue('store', QVariant(self.store.isChecked())) - self.settings().endGroup() + self.settings.beginGroup(self.plugin.name) + self.settings.setValue('method0', QVariant(self.methods[0].currentIndex())) + self.settings.setValue('method1', QVariant(self.methods[1].currentIndex())) + self.settings.setValue('coverdir', QVariant(self.coverdir.text())) + self.settings.setValue('covername', QVariant(self.covername.text())) + self.settings.setValue('store', QVariant(self.store.isChecked())) + self.settings.endGroup() self.plugin.o.refresh() def get_settings_widget(self): |