Tidied up some method and variable names.

This commit is contained in:
Raoul Snyman 2011-09-01 21:45:36 +02:00
parent 2a02167646
commit 79123e7df3
7 changed files with 25 additions and 24 deletions

View File

@ -111,7 +111,7 @@ class MediaManagerItem(QtGui.QWidget):
self.requiredIcons() self.requiredIcons()
self.setupUi() self.setupUi()
self.retranslateUi() self.retranslateUi()
self.auto_select_id = -1 self.autoSelectId = -1
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'%s_service_load' % self.plugin.name), QtCore.SIGNAL(u'%s_service_load' % self.plugin.name),
self.serviceLoad) self.serviceLoad)
@ -506,7 +506,7 @@ class MediaManagerItem(QtGui.QWidget):
if QtCore.QSettings().value(u'advanced/single click preview', if QtCore.QSettings().value(u'advanced/single click preview',
QtCore.QVariant(False)).toBool() and self.quickPreviewAllowed \ QtCore.QVariant(False)).toBool() and self.quickPreviewAllowed \
and self.listView.selectedIndexes() \ and self.listView.selectedIndexes() \
and self.auto_select_id == -1: and self.autoSelectId == -1:
self.onPreviewClick(True) self.onPreviewClick(True)
def onPreviewClick(self, keepFocus=False): def onPreviewClick(self, keepFocus=False):
@ -626,7 +626,7 @@ class MediaManagerItem(QtGui.QWidget):
""" """
pass pass
def check_search_result(self): def checkSearchResult(self):
""" """
Checks if the listView is empty and adds a "No Search Results" item. 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] item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
return item_id return item_id
def save_auto_select_id(self): def saveAutoSelectId(self):
""" """
Sorts out, what item to select after loading a list. Sorts out, what item to select after loading a list.
""" """
# The item to select has not been set. # The item to select has not been set.
if self.auto_select_id == -1: if self.autoSelectId == -1:
item = self.listView.currentItem() item = self.listView.currentItem()
if item: 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): def search(self, string):
""" """

View File

@ -368,3 +368,4 @@ class Plugin(QtCore.QObject):
after this has been set. after this has been set.
""" """
self.textStrings[name] = {u'title': title, u'tooltip': tooltip} self.textStrings[name] = {u'title': title, u'tooltip': tooltip}

View File

@ -67,7 +67,7 @@ class BibleMediaItem(MediaManagerItem):
self.hasSearch = True self.hasSearch = True
self.search_results = {} self.search_results = {}
self.second_search_results = {} self.second_search_results = {}
self.check_search_result() self.checkSearchReslt()
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'bibles_load_list'), self.reloadBibles) QtCore.SIGNAL(u'bibles_load_list'), self.reloadBibles)
@ -651,7 +651,7 @@ class BibleMediaItem(MediaManagerItem):
elif self.search_results: elif self.search_results:
self.displayResults(bible, second_bible) self.displayResults(bible, second_bible)
self.advancedSearchButton.setEnabled(True) self.advancedSearchButton.setEnabled(True)
self.check_search_result() self.checkSearchReslt()
Receiver.send_message(u'cursor_normal') Receiver.send_message(u'cursor_normal')
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
@ -715,7 +715,7 @@ class BibleMediaItem(MediaManagerItem):
elif self.search_results: elif self.search_results:
self.displayResults(bible, second_bible) self.displayResults(bible, second_bible)
self.quickSearchButton.setEnabled(True) self.quickSearchButton.setEnabled(True)
self.check_search_result() self.checkSearchReslt()
Receiver.send_message(u'cursor_normal') Receiver.send_message(u'cursor_normal')
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')

View File

@ -135,7 +135,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
self.customSlide.credits = unicode(self.creditEdit.text()) self.customSlide.credits = unicode(self.creditEdit.text())
self.customSlide.theme_name = unicode(self.themeComboBox.currentText()) self.customSlide.theme_name = unicode(self.themeComboBox.currentText())
success = self.manager.save_object(self.customSlide) success = self.manager.save_object(self.customSlide)
self.mediaitem.auto_select_id = self.customSlide.id self.mediaitem.autoSelectId = self.customSlide.id
return success return success
def onUpButtonClicked(self): def onUpButtonClicked(self):

View File

@ -132,7 +132,7 @@ class CustomMediaItem(MediaManagerItem):
def loadList(self, custom_slides): def loadList(self, custom_slides):
# Sort out what custom we want to select after loading the list. # Sort out what custom we want to select after loading the list.
self.save_auto_select_id() self.saveAutoSelectId()
self.listView.clear() self.listView.clear()
# Sort the customs by its title considering language specific # Sort the customs by its title considering language specific
# characters. lower() is needed for windows! # characters. lower() is needed for windows!
@ -144,9 +144,9 @@ class CustomMediaItem(MediaManagerItem):
QtCore.Qt.UserRole, QtCore.QVariant(custom_slide.id)) QtCore.Qt.UserRole, QtCore.QVariant(custom_slide.id))
self.listView.addItem(custom_name) self.listView.addItem(custom_name)
# Auto-select the custom. # Auto-select the custom.
if custom_slide.id == self.auto_select_id: if custom_slide.id == self.autoSelectId:
self.listView.setCurrentItem(custom_name) self.listView.setCurrentItem(custom_name)
self.auto_select_id = -1 self.autoSelectId = -1
# Called to redisplay the custom list screen edith from a search # Called to redisplay the custom list screen edith from a search
# or from the exit of the Custom edit dialog. If remote editing is # 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. # active trigger it and clean up so it will not update again.
@ -180,7 +180,7 @@ class CustomMediaItem(MediaManagerItem):
self.remoteTriggered = remote_type self.remoteTriggered = remote_type
self.edit_custom_form.loadCustom(custom_id, (remote_type == u'P')) self.edit_custom_form.loadCustom(custom_id, (remote_type == u'P'))
self.edit_custom_form.exec_() self.edit_custom_form.exec_()
self.auto_select_id = -1 self.autoSelectId = -1
self.onSearchTextButtonClick() self.onSearchTextButtonClick()
def onEditClick(self): def onEditClick(self):
@ -192,7 +192,7 @@ class CustomMediaItem(MediaManagerItem):
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.edit_custom_form.loadCustom(item_id, False) self.edit_custom_form.loadCustom(item_id, False)
self.edit_custom_form.exec_() self.edit_custom_form.exec_()
self.auto_select_id = -1 self.autoSelectId = -1
self.onSearchTextButtonClick() self.onSearchTextButtonClick()
def onDeleteClick(self): def onDeleteClick(self):
@ -273,7 +273,7 @@ class CustomMediaItem(MediaManagerItem):
CustomSlide.theme_name.like(u'%' + self.whitespace.sub(u' ', CustomSlide.theme_name.like(u'%' + self.whitespace.sub(u' ',
search_keywords) + u'%'), order_by_ref=CustomSlide.title) search_keywords) + u'%'), order_by_ref=CustomSlide.title)
self.loadList(search_results) self.loadList(search_results)
self.check_search_result() self.checkSearchReslt()
def onSearchTextEditChanged(self, text): def onSearchTextEditChanged(self, text):
""" """

View File

@ -877,7 +877,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
pass pass
clean_song(self.manager, self.song) clean_song(self.manager, self.song)
self.manager.save_object(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): def _processLyrics(self):
""" """

View File

@ -229,7 +229,7 @@ class SongMediaItem(MediaManagerItem):
search_results = self.plugin.manager.get_all_objects(Song, search_results = self.plugin.manager.get_all_objects(Song,
Song.theme_name.like(u'%' + search_keywords + u'%')) Song.theme_name.like(u'%' + search_keywords + u'%'))
self.displayResultsSong(search_results) self.displayResultsSong(search_results)
self.check_search_result() self.checkSearchReslt()
def searchEntire(self, search_keywords): def searchEntire(self, search_keywords):
return self.plugin.manager.get_all_objects(Song, return self.plugin.manager.get_all_objects(Song,
@ -263,7 +263,7 @@ class SongMediaItem(MediaManagerItem):
def displayResultsSong(self, searchresults): def displayResultsSong(self, searchresults):
log.debug(u'display results Song') log.debug(u'display results Song')
self.save_auto_select_id() self.saveAutoSelectId()
self.listView.clear() self.listView.clear()
# Sort the songs by its title considering language specific characters. # Sort the songs by its title considering language specific characters.
# lower() is needed for windows! # lower() is needed for windows!
@ -277,9 +277,9 @@ class SongMediaItem(MediaManagerItem):
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id)) song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
self.listView.addItem(song_name) self.listView.addItem(song_name)
# Auto-select the item if name has been set # 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.listView.setCurrentItem(song_name)
self.auto_select_id = -1 self.autoSelectId = -1
def displayResultsAuthor(self, searchresults): def displayResultsAuthor(self, searchresults):
log.debug(u'display results Author') log.debug(u'display results Author')
@ -331,7 +331,7 @@ class SongMediaItem(MediaManagerItem):
self.edit_song_form.exec_() self.edit_song_form.exec_()
self.onClearTextButtonClick() self.onClearTextButtonClick()
self.onSelectionChange() self.onSelectionChange()
self.auto_select_id = -1 self.autoSelectId = -1
def onSongMaintenanceClick(self): def onSongMaintenanceClick(self):
self.song_maintenance_form.exec_() self.song_maintenance_form.exec_()
@ -356,7 +356,7 @@ class SongMediaItem(MediaManagerItem):
self.remoteTriggered = remote_type self.remoteTriggered = remote_type
self.edit_song_form.loadSong(song_id, remote_type == u'P') self.edit_song_form.loadSong(song_id, remote_type == u'P')
self.edit_song_form.exec_() self.edit_song_form.exec_()
self.auto_select_id = -1 self.autoSelectId = -1
self.onSongListLoad() self.onSongListLoad()
def onEditClick(self): def onEditClick(self):
@ -369,7 +369,7 @@ class SongMediaItem(MediaManagerItem):
item_id = (self.editItem.data(QtCore.Qt.UserRole)).toInt()[0] item_id = (self.editItem.data(QtCore.Qt.UserRole)).toInt()[0]
self.edit_song_form.loadSong(item_id, False) self.edit_song_form.loadSong(item_id, False)
self.edit_song_form.exec_() self.edit_song_form.exec_()
self.auto_select_id = -1 self.autoSelectId = -1
self.onSongListLoad() self.onSongListLoad()
self.editItem = None self.editItem = None