forked from openlp/openlp
In this Merge:
- Min. search lenght no longer counts spaces. - Bolded part of "Empty or too short" error message - Modified some comments To do: - Write tests Optional fixes that are not yet done/may not be done. - Listing search results when typing for Text search
This commit is contained in:
parent
6de4a5c923
commit
d61ded487e
@ -165,11 +165,11 @@ class UiStrings(object):
|
||||
'from full names, for an example: Joh 3 = John 3'
|
||||
, 'Please pay attention to the appended "s" of the wildcards and refrain '
|
||||
'from translating the words inside the names in the brackets.')
|
||||
self.BibleShortSearch = translate('OpenLP.Ui', 'The keyword you have entered is empty or shorter '
|
||||
'than 3 characters long.\nPlease try again with '
|
||||
'a longer keyword.\n\nYou can separate different keywords by '
|
||||
'a space to search for all of your keywords and you can '
|
||||
'separate them by a comma to search for one of them.')
|
||||
self.BibleShortSearch = translate('OpenLP.Ui', '<strong>The search you have entered is empty or shorter '
|
||||
'than 3 characters long.<br>Please try again with '
|
||||
'a longer search.</strong><br><br>You can separate different '
|
||||
'keywords by a space to search for all of your keywords and you '
|
||||
'can separate them by a comma to search for one of them.')
|
||||
|
||||
|
||||
|
||||
|
@ -335,7 +335,7 @@ class BibleManager(RegistryProperties):
|
||||
'Please use the Scripture Reference Search instead.')
|
||||
)
|
||||
return None
|
||||
if len(text) < 3 or str.isspace(text):
|
||||
if len(text) - text.count(' ') < 3:
|
||||
self.main_window.information_message(
|
||||
('%s' % UiStrings().BibleShortSearchTitle),
|
||||
('%s' % UiStrings().BibleShortSearch))
|
||||
|
@ -706,9 +706,9 @@ class BibleMediaItem(MediaManagerItem):
|
||||
if second_bible and self.search_results:
|
||||
self.second_search_results = \
|
||||
self.plugin.manager.get_verses(second_bible, text, self.search_results[0].book.book_reference_id)
|
||||
# If keyword is shorter than 3, message is given and search is finalized.
|
||||
# If keyword is shorter than 3 (not including spaces), message is given and search is finalized.
|
||||
# This needs to be here in order to avoid deadlock/duplicate errors.
|
||||
if len(text) < 3 or str.isspace(text):
|
||||
if len(text) - text.count(' ') < 3:
|
||||
self.main_window.information_message(
|
||||
('%s' % UiStrings().BibleShortSearchTitle),
|
||||
('%s' % UiStrings().BibleShortSearch))
|
||||
@ -723,8 +723,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||
self.application.set_normal_cursor()
|
||||
# Text search starts here if no reference was found and keyword is longer than 2.
|
||||
# This is required in order to avoid duplicate error messages for short keywords.
|
||||
# If only spaces are searched OLP becomes unresponsive and may crash eventually. "isspace" prevents this.
|
||||
if not self.search_results and len(text) > 2 and not str.isspace(text):
|
||||
if not self.search_results and len(text) - text.count(' ') > 2:
|
||||
self.application.set_busy_cursor()
|
||||
bibles = self.plugin.manager.get_bibles()
|
||||
self.search_results = self.plugin.manager.verse_search(bible, second_bible, text)
|
||||
|
Loading…
Reference in New Issue
Block a user