renamed forgotten methods

This commit is contained in:
Andreas Preikschat 2013-03-06 23:11:30 +01:00
parent b864d360d3
commit 0eaa3aa5f4
5 changed files with 21 additions and 21 deletions

View File

@ -99,7 +99,7 @@ class Priority(object):
class Image(object):
"""
This class represents an image. To mark an image as *dirty* call the :class:`ImageManager`'s ``_resetImage`` method
This class represents an image. To mark an image as *dirty* call the :class:`ImageManager`'s ``_reset_image`` method
with the Image instance as argument.
"""
secondary_priority = 0

View File

@ -90,13 +90,13 @@ class SearchEdit(QtGui.QLineEdit):
size = self.menu_button.size()
self.menu_button.move(self.rect().left() + frame_width + 2, (self.rect().bottom() + 1 - size.height()) / 2)
def currentSearchType(self):
def current_search_type(self):
"""
Readonly property to return the current search type.
"""
return self._current_search_type
def setCurrentSearchType(self, identifier):
def set_current_search_type(self, identifier):
"""
Set a new current search type.
@ -117,7 +117,7 @@ class SearchEdit(QtGui.QLineEdit):
self.emit(QtCore.SIGNAL(u'searchTypeChanged(int)'), identifier)
return True
def setSearchTypes(self, items):
def set_search_types(self, items):
"""
A list of tuples to be used in the search type menu. The first item in the list will be preselected as the
default.
@ -140,7 +140,7 @@ class SearchEdit(QtGui.QLineEdit):
first = None
for identifier, icon, title, placeholder in items:
action = create_widget_action(
menu, text=title, icon=icon, data=identifier, triggers=self._onMenuActionTriggered)
menu, text=title, icon=icon, data=identifier, triggers=self._on_menu_action_triggered)
action.placeholder_text = placeholder
if first is None:
first = action
@ -176,7 +176,7 @@ class SearchEdit(QtGui.QLineEdit):
self.clear()
self.emit(QtCore.SIGNAL(u'cleared()'))
def _onMenuActionTriggered(self):
def _on_menu_action_triggered(self):
"""
Internally implemented slot to react to the select of one of the search types in the menu. Once it has set the
correct action on the button, and set the current search type (using the list of identifiers provided by the

View File

@ -304,7 +304,7 @@ class BibleMediaItem(MediaManagerItem):
log.debug(u'bible manager initialise')
self.plugin.manager.media = self
self.loadBibles()
self.quickSearchEdit.setSearchTypes([
self.quickSearchEdit.set_search_types([
(BibleSearch.Reference, u':/bibles/bibles_search_reference.png',
translate('BiblesPlugin.MediaItem', 'Scripture Reference'),
translate('BiblesPlugin.MediaItem', 'Search Scripture Reference...')),
@ -312,7 +312,7 @@ class BibleMediaItem(MediaManagerItem):
translate('BiblesPlugin.MediaItem', 'Text Search'),
translate('BiblesPlugin.MediaItem', 'Search Text...'))
])
self.quickSearchEdit.setCurrentSearchType(Settings().value(u'%s/last search type' % self.settingsSection))
self.quickSearchEdit.set_current_search_type(Settings().value(u'%s/last search type' % self.settingsSection))
self.config_update()
log.debug(u'bible manager initialise complete')
@ -432,12 +432,12 @@ class BibleMediaItem(MediaManagerItem):
"""
log.debug(u'updateAutoCompleter')
# Save the current search type to the configuration.
Settings().setValue(u'%s/last search type' % self.settingsSection, self.quickSearchEdit.currentSearchType())
Settings().setValue(u'%s/last search type' % self.settingsSection, self.quickSearchEdit.current_search_type())
# Save the current bible to the configuration.
Settings().setValue(self.settingsSection + u'/quick bible', self.quickVersionComboBox.currentText())
books = []
# We have to do a 'Reference Search'.
if self.quickSearchEdit.currentSearchType() == BibleSearch.Reference:
if self.quickSearchEdit.current_search_type() == BibleSearch.Reference:
bibles = self.plugin.manager.get_bibles()
bible = self.quickVersionComboBox.currentText()
if bible:
@ -653,7 +653,7 @@ class BibleMediaItem(MediaManagerItem):
bible = self.quickVersionComboBox.currentText()
second_bible = self.quickSecondComboBox.currentText()
text = self.quickSearchEdit.text()
if self.quickSearchEdit.currentSearchType() == BibleSearch.Reference:
if self.quickSearchEdit.current_search_type() == BibleSearch.Reference:
# We are doing a 'Reference Search'.
self.search_results = self.plugin.manager.get_verses(bible, text)
if second_bible and self.search_results:

View File

@ -86,14 +86,14 @@ class CustomMediaItem(MediaManagerItem):
self.searchTextButton.setText(UiStrings().Search)
def initialise(self):
self.searchTextEdit.setSearchTypes([
self.searchTextEdit.set_search_types([
(CustomSearch.Titles, u':/songs/song_search_title.png',
translate('SongsPlugin.MediaItem', 'Titles'),
translate('SongsPlugin.MediaItem', 'Search Titles...')),
(CustomSearch.Themes, u':/slides/slide_theme.png', UiStrings().Themes, UiStrings().SearchThemes)
])
self.loadList(self.manager.get_all_objects(CustomSlide, order_by_ref=CustomSlide.title))
self.searchTextEdit.setCurrentSearchType(Settings().value( u'%s/last search type' % self.settingsSection))
self.searchTextEdit.set_current_search_type(Settings().value( u'%s/last search type' % self.settingsSection))
self.config_updated()
def loadList(self, custom_slides):
@ -207,11 +207,11 @@ class CustomMediaItem(MediaManagerItem):
def onSearchTextButtonClicked(self):
# Save the current search type to the configuration.
Settings().setValue(u'%s/last search type' % self.settingsSection, self.searchTextEdit.currentSearchType())
Settings().setValue(u'%s/last search type' % self.settingsSection, self.searchTextEdit.current_search_type())
# Reload the list considering the new search type.
search_keywords = self.searchTextEdit.displayText()
search_results = []
search_type = self.searchTextEdit.currentSearchType()
search_type = self.searchTextEdit.current_search_type()
if search_type == CustomSearch.Titles:
log.debug(u'Titles Search')
search_results = self.plugin.manager.get_all_objects(CustomSlide,

View File

@ -128,7 +128,7 @@ class SongMediaItem(MediaManagerItem):
'Maintain the lists of authors, topics and books.'))
def initialise(self):
self.searchTextEdit.setSearchTypes([
self.searchTextEdit.set_search_types([
(SongSearch.Entire, u':/songs/song_search_all.png',
translate('SongsPlugin.MediaItem', 'Entire Song'),
translate('SongsPlugin.MediaItem', 'Search Entire Song...')),
@ -145,16 +145,16 @@ class SongMediaItem(MediaManagerItem):
(SongSearch.Themes, u':/slides/slide_theme.png',
UiStrings().Themes, UiStrings().SearchThemes)
])
self.searchTextEdit.setCurrentSearchType(Settings().value(u'%s/last search type' % self.settingsSection))
self.searchTextEdit.set_current_search_type(Settings().value(u'%s/last search type' % self.settingsSection))
self.config_update()
def onSearchTextButtonClicked(self):
# Save the current search type to the configuration.
Settings().setValue(u'%s/last search type' % self.settingsSection, self.searchTextEdit.currentSearchType())
Settings().setValue(u'%s/last search type' % self.settingsSection, self.searchTextEdit.current_search_type())
# Reload the list considering the new search type.
search_keywords = unicode(self.searchTextEdit.displayText())
search_results = []
search_type = self.searchTextEdit.currentSearchType()
search_type = self.searchTextEdit.current_search_type()
if search_type == SongSearch.Entire:
log.debug(u'Entire Song Search')
search_results = self.searchEntire(search_keywords)
@ -279,9 +279,9 @@ class SongMediaItem(MediaManagerItem):
"""
if self.searchAsYouType:
search_length = 1
if self.searchTextEdit.currentSearchType() == SongSearch.Entire:
if self.searchTextEdit.current_search_type() == SongSearch.Entire:
search_length = 4
elif self.searchTextEdit.currentSearchType() == SongSearch.Lyrics:
elif self.searchTextEdit.current_search_type() == SongSearch.Lyrics:
search_length = 3
if len(text) > search_length:
self.onSearchTextButtonClicked()