In this commit:

- Replace '. ' with ' ' in Reference search, so for an example Gen. 1 works
- Modified related error messages

To do:
- Write tests

Optional fixes that are not yet done/may not be done.
- Block spaces + single character combos since they kind of break the search.
- Listing search results when typing for Text search
This commit is contained in:
suutari-olli 2016-03-09 00:46:47 +02:00
parent 432177fd2d
commit 6de4a5c923
3 changed files with 11 additions and 11 deletions

View File

@ -161,8 +161,9 @@ class UiStrings(object):
'(list)sChapter%(verse)sVerse%(range)sVerse | John 3%(verse)'
's16%(range)s17%(list)s5%(verse)s7%(range)s9<br>Book Chapter%'
'(verse)sVerse%(range)sChapter%(verse)sVerse | John 3%(verse)'
's16%(range)s4%(verse)s2<br><br>',
'Please pay attention to the appended "s" of the wildcards and refrain '
's16%(range)s4%(verse)s2<br><br> Book names may be shortened '
'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 '

View File

@ -280,10 +280,8 @@ class BibleManager(RegistryProperties):
self.main_window.information_message(
translate('BiblesPlugin.BibleManager', 'Scripture Reference Error'),
translate('BiblesPlugin.BibleManager', '<strong>OpenLP couldnt find anything '
'with your search.</strong><br><br>'
'Please make sure that your reference follows one of these patterns:%sBook names may be '
'shortened from full names<br>but must not contain any '
'additional dots.'
'with your search.<br><br>'
'Please make sure that your reference follows one of these patterns:</strong>%s'
% UiStrings().BibleScriptureError % reference_separators))
return None

View File

@ -662,7 +662,10 @@ class BibleMediaItem(MediaManagerItem):
self.application.process_events()
bible = self.quickVersionComboBox.currentText()
second_bible = self.quickSecondComboBox.currentText()
text = self.quick_search_edit.text()
# Get input from field and replace '. ' with ''
text_direct = self.quick_search_edit.text()
text = text_direct.replace('. ', ' ')
# This will check if field has any '.' and removes them. Eg. Gen. 1 = Gen 1 = Genesis 1
if self.quick_search_edit.current_search_type() == BibleSearch.Reference:
# We are doing a 'Reference Search'.
self.search_results = self.plugin.manager.get_verses(bible, text)
@ -759,10 +762,8 @@ class BibleMediaItem(MediaManagerItem):
translate('BiblesPlugin.BibleManager', 'Nothing found'),
translate('BiblesPlugin.BibleManager', '<strong>OpenLP couldnt find '
'anything with your search.</strong><br><br>'
'If you tried to search with Scripture Reference, please make sure that '
'your reference follows one of these patterns:%sBook names may be shortened '
'from full names<br>but must not contain any '
'additional dots.'
'If you tried to search with Scripture Reference, please make<br>sure that '
'your reference follows one of these patterns:%s'
% UiStrings().BibleScriptureError % reference_separators))
# Finalizing the search
if not self.quickLockButton.isChecked():