forked from openlp/openlp
each search 'type' has its own place holder text instead of the generic 'Search...' place holder
This commit is contained in:
parent
384d61b302
commit
7f4664b69b
@ -64,12 +64,6 @@ class SearchEdit(QtGui.QLineEdit):
|
|||||||
)
|
)
|
||||||
self._updateStyleSheet()
|
self._updateStyleSheet()
|
||||||
self.setAcceptDrops(False)
|
self.setAcceptDrops(False)
|
||||||
# setPlaceholderText has been implemented in Qt 4.7 and in at least
|
|
||||||
# PyQt 4.9 (I am not sure, if it was implemented in PyQt 4.8).
|
|
||||||
try:
|
|
||||||
self.setPlaceholderText(translate('OpenLP.searchedit', 'Search...'))
|
|
||||||
except AttributeError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def _updateStyleSheet(self):
|
def _updateStyleSheet(self):
|
||||||
"""
|
"""
|
||||||
@ -128,6 +122,13 @@ class SearchEdit(QtGui.QLineEdit):
|
|||||||
menu = self.menuButton.menu()
|
menu = self.menuButton.menu()
|
||||||
for action in menu.actions():
|
for action in menu.actions():
|
||||||
if identifier == action.data().toInt()[0]:
|
if identifier == action.data().toInt()[0]:
|
||||||
|
# setPlaceholderText has been implemented in Qt 4.7 and in at
|
||||||
|
# least PyQt 4.9 (I am not sure, if it was implemented in
|
||||||
|
# PyQt 4.8).
|
||||||
|
try:
|
||||||
|
self.setPlaceholderText(action.placeholderText)
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
self.menuButton.setDefaultAction(action)
|
self.menuButton.setDefaultAction(action)
|
||||||
self._currentSearchType = identifier
|
self._currentSearchType = identifier
|
||||||
self.emit(QtCore.SIGNAL(u'searchTypeChanged(int)'), identifier)
|
self.emit(QtCore.SIGNAL(u'searchTypeChanged(int)'), identifier)
|
||||||
@ -143,21 +144,22 @@ class SearchEdit(QtGui.QLineEdit):
|
|||||||
identifier, an icon (QIcon instance or string) and a title for the
|
identifier, an icon (QIcon instance or string) and a title for the
|
||||||
item in the menu. In short, they should look like this::
|
item in the menu. In short, they should look like this::
|
||||||
|
|
||||||
(<identifier>, <icon>, <title>)
|
(<identifier>, <icon>, <title>, <place holder text>)
|
||||||
|
|
||||||
For instance::
|
For instance::
|
||||||
|
|
||||||
(1, <QIcon instance>, "Titles")
|
(1, <QIcon instance>, "Titles", "Search Song Titles...")
|
||||||
|
|
||||||
Or::
|
Or::
|
||||||
|
|
||||||
(2, ":/songs/authors.png", "Authors")
|
(2, ":/songs/authors.png", "Authors", "Search Authors...")
|
||||||
"""
|
"""
|
||||||
menu = QtGui.QMenu(self)
|
menu = QtGui.QMenu(self)
|
||||||
first = None
|
first = None
|
||||||
for identifier, icon, title in items:
|
for identifier, icon, title, placeholder in items:
|
||||||
action = create_widget_action(menu, text=title, icon=icon,
|
action = create_widget_action(menu, text=title, icon=icon,
|
||||||
data=identifier, triggers=self._onMenuActionTriggered)
|
data=identifier, triggers=self._onMenuActionTriggered)
|
||||||
|
action.placeholderText = placeholder
|
||||||
if first is None:
|
if first is None:
|
||||||
first = action
|
first = action
|
||||||
self._currentSearchType = identifier
|
self._currentSearchType = identifier
|
||||||
@ -208,5 +210,12 @@ class SearchEdit(QtGui.QLineEdit):
|
|||||||
action.setChecked(False)
|
action.setChecked(False)
|
||||||
self.menuButton.setDefaultAction(sender)
|
self.menuButton.setDefaultAction(sender)
|
||||||
self._currentSearchType = sender.data().toInt()[0]
|
self._currentSearchType = sender.data().toInt()[0]
|
||||||
|
# setPlaceholderText has been implemented in Qt 4.7 and in at least
|
||||||
|
# PyQt 4.9 (I am not sure, if it was implemented in PyQt 4.8).
|
||||||
|
try:
|
||||||
|
self.setPlaceholderText(
|
||||||
|
self.menuButton.defaultAction().placeholderText)
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
self.emit(QtCore.SIGNAL(u'searchTypeChanged(int)'),
|
self.emit(QtCore.SIGNAL(u'searchTypeChanged(int)'),
|
||||||
self._currentSearchType)
|
self._currentSearchType)
|
||||||
|
@ -354,9 +354,12 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
find_and_set_in_combo_box(self.quickVersionComboBox, bible)
|
find_and_set_in_combo_box(self.quickVersionComboBox, bible)
|
||||||
self.quickSearchEdit.setSearchTypes([
|
self.quickSearchEdit.setSearchTypes([
|
||||||
(BibleSearch.Reference, u':/bibles/bibles_search_reference.png',
|
(BibleSearch.Reference, u':/bibles/bibles_search_reference.png',
|
||||||
translate('BiblesPlugin.MediaItem', 'Scripture Reference')),
|
translate('BiblesPlugin.MediaItem', 'Scripture Reference'),
|
||||||
|
translate(
|
||||||
|
'BiblesPlugin.MediaItem', 'Search Scripture Reference...')),
|
||||||
(BibleSearch.Text, u':/bibles/bibles_search_text.png',
|
(BibleSearch.Text, u':/bibles/bibles_search_text.png',
|
||||||
translate('BiblesPlugin.MediaItem', 'Text Search'))
|
translate('BiblesPlugin.MediaItem', 'Text Search'),
|
||||||
|
translate('BiblesPlugin.MediaItem', 'Search Text...'))
|
||||||
])
|
])
|
||||||
self.quickSearchEdit.setCurrentSearchType(QtCore.QSettings().value(
|
self.quickSearchEdit.setCurrentSearchType(QtCore.QSettings().value(
|
||||||
u'%s/last search type' % self.settingsSection,
|
u'%s/last search type' % self.settingsSection,
|
||||||
|
@ -92,9 +92,10 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
def initialise(self):
|
def initialise(self):
|
||||||
self.searchTextEdit.setSearchTypes([
|
self.searchTextEdit.setSearchTypes([
|
||||||
(CustomSearch.Titles, u':/songs/song_search_title.png',
|
(CustomSearch.Titles, u':/songs/song_search_title.png',
|
||||||
translate('SongsPlugin.MediaItem', 'Titles')),
|
translate('SongsPlugin.MediaItem', 'Titles'),
|
||||||
|
translate('SongsPlugin.MediaItem', 'Search Titles...')),
|
||||||
(CustomSearch.Themes, u':/slides/slide_theme.png',
|
(CustomSearch.Themes, u':/slides/slide_theme.png',
|
||||||
UiStrings().Themes)
|
UiStrings().Themes, translate('SongsPlugin.MediaItem', 'Search'))
|
||||||
])
|
])
|
||||||
self.loadList(self.manager.get_all_objects(
|
self.loadList(self.manager.get_all_objects(
|
||||||
CustomSlide, order_by_ref=CustomSlide.title))
|
CustomSlide, order_by_ref=CustomSlide.title))
|
||||||
|
@ -151,16 +151,23 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
def initialise(self):
|
def initialise(self):
|
||||||
self.searchTextEdit.setSearchTypes([
|
self.searchTextEdit.setSearchTypes([
|
||||||
(SongSearch.Entire, u':/songs/song_search_all.png',
|
(SongSearch.Entire, u':/songs/song_search_all.png',
|
||||||
translate('SongsPlugin.MediaItem', 'Entire Song')),
|
translate('SongsPlugin.MediaItem', 'Entire Song'),
|
||||||
|
translate('SongsPlugin.MediaItem', 'Search Entire Song...')),
|
||||||
(SongSearch.Titles, u':/songs/song_search_title.png',
|
(SongSearch.Titles, u':/songs/song_search_title.png',
|
||||||
translate('SongsPlugin.MediaItem', 'Titles')),
|
translate('SongsPlugin.MediaItem', 'Titles'),
|
||||||
|
translate('SongsPlugin.MediaItem', 'Search Titles...')),
|
||||||
(SongSearch.Lyrics, u':/songs/song_search_lyrics.png',
|
(SongSearch.Lyrics, u':/songs/song_search_lyrics.png',
|
||||||
translate('SongsPlugin.MediaItem', 'Lyrics')),
|
translate('SongsPlugin.MediaItem', 'Lyrics'),
|
||||||
|
translate('SongsPlugin.MediaItem', 'Search Lyrics...')),
|
||||||
(SongSearch.Authors, u':/songs/song_search_author.png',
|
(SongSearch.Authors, u':/songs/song_search_author.png',
|
||||||
SongStrings.Authors),
|
SongStrings.Authors,
|
||||||
|
translate('SongsPlugin.MediaItem', 'Search Authors...')),
|
||||||
(SongSearch.Books, u':/songs/song_book_edit.png',
|
(SongSearch.Books, u':/songs/song_book_edit.png',
|
||||||
SongStrings.SongBooks),
|
SongStrings.SongBooks,
|
||||||
(SongSearch.Themes, u':/slides/slide_theme.png', UiStrings().Themes)
|
translate('SongsPlugin.MediaItem', 'Search Song Books...')),
|
||||||
|
(SongSearch.Themes, u':/slides/slide_theme.png',
|
||||||
|
UiStrings().Themes,
|
||||||
|
translate('SongsPlugin.MediaItem', 'Search Themes...'))
|
||||||
])
|
])
|
||||||
self.searchTextEdit.setCurrentSearchType(QtCore.QSettings().value(
|
self.searchTextEdit.setCurrentSearchType(QtCore.QSettings().value(
|
||||||
u'%s/last search type' % self.settingsSection,
|
u'%s/last search type' % self.settingsSection,
|
||||||
|
Loading…
Reference in New Issue
Block a user