From 79123e7df3329484545dedafc96e44409cb45b95 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Thu, 1 Sep 2011 21:45:36 +0200 Subject: [PATCH] Tidied up some method and variable names. --- openlp/core/lib/mediamanageritem.py | 12 ++++++------ openlp/core/lib/plugin.py | 1 + openlp/plugins/bibles/lib/mediaitem.py | 6 +++--- openlp/plugins/custom/forms/editcustomform.py | 2 +- openlp/plugins/custom/lib/mediaitem.py | 12 ++++++------ openlp/plugins/songs/forms/editsongform.py | 2 +- openlp/plugins/songs/lib/mediaitem.py | 14 +++++++------- 7 files changed, 25 insertions(+), 24 deletions(-) diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index f21d8df50..55cb2faeb 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -111,7 +111,7 @@ class MediaManagerItem(QtGui.QWidget): self.requiredIcons() self.setupUi() self.retranslateUi() - self.auto_select_id = -1 + self.autoSelectId = -1 QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'%s_service_load' % self.plugin.name), self.serviceLoad) @@ -506,7 +506,7 @@ class MediaManagerItem(QtGui.QWidget): if QtCore.QSettings().value(u'advanced/single click preview', QtCore.QVariant(False)).toBool() and self.quickPreviewAllowed \ and self.listView.selectedIndexes() \ - and self.auto_select_id == -1: + and self.autoSelectId == -1: self.onPreviewClick(True) def onPreviewClick(self, keepFocus=False): @@ -626,7 +626,7 @@ class MediaManagerItem(QtGui.QWidget): """ pass - def check_search_result(self): + def checkSearchResult(self): """ Checks if the listView is empty and adds a "No Search Results" item. """ @@ -662,15 +662,15 @@ class MediaManagerItem(QtGui.QWidget): item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] return item_id - def save_auto_select_id(self): + def saveAutoSelectId(self): """ Sorts out, what item to select after loading a list. """ # The item to select has not been set. - if self.auto_select_id == -1: + if self.autoSelectId == -1: item = self.listView.currentItem() if item: - self.auto_select_id = item.data(QtCore.Qt.UserRole).toInt()[0] + self.autoSelectId = item.data(QtCore.Qt.UserRole).toInt()[0] def search(self, string): """ diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index 5b9f2185e..db7d4845b 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -368,3 +368,4 @@ class Plugin(QtCore.QObject): after this has been set. """ self.textStrings[name] = {u'title': title, u'tooltip': tooltip} + diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index ab6fb13d5..95f5402a2 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -67,7 +67,7 @@ class BibleMediaItem(MediaManagerItem): self.hasSearch = True self.search_results = {} self.second_search_results = {} - self.check_search_result() + self.checkSearchReslt() QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'bibles_load_list'), self.reloadBibles) @@ -651,7 +651,7 @@ class BibleMediaItem(MediaManagerItem): elif self.search_results: self.displayResults(bible, second_bible) self.advancedSearchButton.setEnabled(True) - self.check_search_result() + self.checkSearchReslt() Receiver.send_message(u'cursor_normal') Receiver.send_message(u'openlp_process_events') @@ -715,7 +715,7 @@ class BibleMediaItem(MediaManagerItem): elif self.search_results: self.displayResults(bible, second_bible) self.quickSearchButton.setEnabled(True) - self.check_search_result() + self.checkSearchReslt() Receiver.send_message(u'cursor_normal') Receiver.send_message(u'openlp_process_events') diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index a3a80caf9..0eadf6021 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -135,7 +135,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.customSlide.credits = unicode(self.creditEdit.text()) self.customSlide.theme_name = unicode(self.themeComboBox.currentText()) success = self.manager.save_object(self.customSlide) - self.mediaitem.auto_select_id = self.customSlide.id + self.mediaitem.autoSelectId = self.customSlide.id return success def onUpButtonClicked(self): diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 34480b828..c2640234e 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -132,7 +132,7 @@ class CustomMediaItem(MediaManagerItem): def loadList(self, custom_slides): # Sort out what custom we want to select after loading the list. - self.save_auto_select_id() + self.saveAutoSelectId() self.listView.clear() # Sort the customs by its title considering language specific # characters. lower() is needed for windows! @@ -144,9 +144,9 @@ class CustomMediaItem(MediaManagerItem): QtCore.Qt.UserRole, QtCore.QVariant(custom_slide.id)) self.listView.addItem(custom_name) # Auto-select the custom. - if custom_slide.id == self.auto_select_id: + if custom_slide.id == self.autoSelectId: self.listView.setCurrentItem(custom_name) - self.auto_select_id = -1 + self.autoSelectId = -1 # Called to redisplay the custom list screen edith from a search # or from the exit of the Custom edit dialog. If remote editing is # active trigger it and clean up so it will not update again. @@ -180,7 +180,7 @@ class CustomMediaItem(MediaManagerItem): self.remoteTriggered = remote_type self.edit_custom_form.loadCustom(custom_id, (remote_type == u'P')) self.edit_custom_form.exec_() - self.auto_select_id = -1 + self.autoSelectId = -1 self.onSearchTextButtonClick() def onEditClick(self): @@ -192,7 +192,7 @@ class CustomMediaItem(MediaManagerItem): item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] self.edit_custom_form.loadCustom(item_id, False) self.edit_custom_form.exec_() - self.auto_select_id = -1 + self.autoSelectId = -1 self.onSearchTextButtonClick() def onDeleteClick(self): @@ -273,7 +273,7 @@ class CustomMediaItem(MediaManagerItem): CustomSlide.theme_name.like(u'%' + self.whitespace.sub(u' ', search_keywords) + u'%'), order_by_ref=CustomSlide.title) self.loadList(search_results) - self.check_search_result() + self.checkSearchReslt() def onSearchTextEditChanged(self, text): """ diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 792adbdbe..d5522a33f 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -877,7 +877,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): pass clean_song(self.manager, self.song) self.manager.save_object(self.song) - self.mediaitem.auto_select_id = self.song.id + self.mediaitem.autoSelectId = self.song.id def _processLyrics(self): """ diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 78f9948c1..804ff494e 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -229,7 +229,7 @@ class SongMediaItem(MediaManagerItem): search_results = self.plugin.manager.get_all_objects(Song, Song.theme_name.like(u'%' + search_keywords + u'%')) self.displayResultsSong(search_results) - self.check_search_result() + self.checkSearchReslt() def searchEntire(self, search_keywords): return self.plugin.manager.get_all_objects(Song, @@ -263,7 +263,7 @@ class SongMediaItem(MediaManagerItem): def displayResultsSong(self, searchresults): log.debug(u'display results Song') - self.save_auto_select_id() + self.saveAutoSelectId() self.listView.clear() # Sort the songs by its title considering language specific characters. # lower() is needed for windows! @@ -277,9 +277,9 @@ class SongMediaItem(MediaManagerItem): song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id)) self.listView.addItem(song_name) # Auto-select the item if name has been set - if song.id == self.auto_select_id: + if song.id == self.autoSelectId: self.listView.setCurrentItem(song_name) - self.auto_select_id = -1 + self.autoSelectId = -1 def displayResultsAuthor(self, searchresults): log.debug(u'display results Author') @@ -331,7 +331,7 @@ class SongMediaItem(MediaManagerItem): self.edit_song_form.exec_() self.onClearTextButtonClick() self.onSelectionChange() - self.auto_select_id = -1 + self.autoSelectId = -1 def onSongMaintenanceClick(self): self.song_maintenance_form.exec_() @@ -356,7 +356,7 @@ class SongMediaItem(MediaManagerItem): self.remoteTriggered = remote_type self.edit_song_form.loadSong(song_id, remote_type == u'P') self.edit_song_form.exec_() - self.auto_select_id = -1 + self.autoSelectId = -1 self.onSongListLoad() def onEditClick(self): @@ -369,7 +369,7 @@ class SongMediaItem(MediaManagerItem): item_id = (self.editItem.data(QtCore.Qt.UserRole)).toInt()[0] self.edit_song_form.loadSong(item_id, False) self.edit_song_form.exec_() - self.auto_select_id = -1 + self.autoSelectId = -1 self.onSongListLoad() self.editItem = None