forked from openlp/openlp
Tidy up code and change bible search results.
Add option not to clear results to allow same search on different versions. bzr-revno: 309
This commit is contained in:
parent
ee93df9b08
commit
60c1729bc1
@ -37,6 +37,7 @@ from openlp.core.ui import MainWindow, SplashScreen
|
|||||||
class OpenLP(QtGui.QApplication):
|
class OpenLP(QtGui.QApplication):
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
#provide a listener for widgets to reqest a screen update.
|
||||||
QtCore.QObject.connect(Receiver().get_receiver(),QtCore.SIGNAL("openlpprocessevents"),self.processEvents)
|
QtCore.QObject.connect(Receiver().get_receiver(),QtCore.SIGNAL("openlpprocessevents"),self.processEvents)
|
||||||
|
|
||||||
self.setApplicationName('openlp.org')
|
self.setApplicationName('openlp.org')
|
||||||
|
@ -346,12 +346,22 @@ class BiblePlugin(Plugin, PluginUtils):
|
|||||||
versefrom = int(self.AdvancedFromVerse.currentText())
|
versefrom = int(self.AdvancedFromVerse.currentText())
|
||||||
verseto = int(self.AdvancedToVerse.currentText())
|
verseto = int(self.AdvancedToVerse.currentText())
|
||||||
self.searchresults = self.biblemanager.get_verse_text(bible, book, chapfrom, chapto, versefrom, verseto)
|
self.searchresults = self.biblemanager.get_verse_text(bible, book, chapfrom, chapto, versefrom, verseto)
|
||||||
|
if self.ClearAdvancedSearchComboBox.currentText() == "Clear Results":
|
||||||
|
self.BibleListView.clear() # clear the results
|
||||||
|
self.BibleListView.setRowCount(0)
|
||||||
|
self.BibleListView.setHorizontalHeaderLabels(QtCore.QStringList(["","Bible Verses"]))
|
||||||
|
|
||||||
self._display_results(bible)
|
self._display_results(bible)
|
||||||
|
|
||||||
def onQuickSearchButton(self):
|
def onQuickSearchButton(self):
|
||||||
self.log.debug("onQuickSearchButton")
|
self.log.debug("onQuickSearchButton")
|
||||||
bible = str(self.QuickVersionComboBox.currentText())
|
bible = str(self.QuickVersionComboBox.currentText())
|
||||||
text = str(self.QuickSearchEdit.displayText())
|
text = str(self.QuickSearchEdit.displayText())
|
||||||
|
|
||||||
|
if self.ClearQuickSearchComboBox.currentText() == "Clear Results":
|
||||||
|
self.BibleListView.clear() # clear the results
|
||||||
|
self.BibleListView.setRowCount(0)
|
||||||
|
self.BibleListView.setHorizontalHeaderLabels(QtCore.QStringList(["","Bible Verses"]))
|
||||||
|
|
||||||
if self.QuickSearchComboBox.currentText() == "Text Search":
|
if self.QuickSearchComboBox.currentText() == "Text Search":
|
||||||
self._search_text(bible, text)
|
self._search_text(bible, text)
|
||||||
@ -367,15 +377,12 @@ class BiblePlugin(Plugin, PluginUtils):
|
|||||||
# self._display_results()
|
# self._display_results()
|
||||||
|
|
||||||
def _display_results(self, bible):
|
def _display_results(self, bible):
|
||||||
self.BibleListView.clear() # clear the results
|
|
||||||
self.BibleListView.setRowCount(0)
|
|
||||||
self.BibleListView.setHorizontalHeaderLabels(QtCore.QStringList(["","Bible Verses"]))
|
|
||||||
for book, chap, vse , txt in self.searchresults:
|
for book, chap, vse , txt in self.searchresults:
|
||||||
c = self.BibleListView.rowCount()
|
c = self.BibleListView.rowCount()
|
||||||
self.BibleListView.setRowCount(c+1)
|
self.BibleListView.setRowCount(c+1)
|
||||||
twi = QtGui.QTableWidgetItem(str(bible))
|
twi = QtGui.QTableWidgetItem(str(bible))
|
||||||
self.BibleListView.setItem(c , 0, twi)
|
self.BibleListView.setItem(c , 0, twi)
|
||||||
twi = QtGui.QTableWidgetItem(str(book + " " +str(chap) + ":"+ str(vse)))
|
twi = QtGui.QTableWidgetItem(str(book + " " +str(chap) + ":"+ str(vse)) + " ("+str(bible)+")")
|
||||||
self.BibleListView.setItem(c , 1, twi)
|
self.BibleListView.setItem(c , 1, twi)
|
||||||
self.BibleListView.setRowHeight(c, 20)
|
self.BibleListView.setRowHeight(c, 20)
|
||||||
|
|
||||||
|
@ -118,7 +118,6 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog, PluginUtils):
|
|||||||
|
|
||||||
@pyqtSignature("")
|
@pyqtSignature("")
|
||||||
def on_CancelButton_clicked(self):
|
def on_CancelButton_clicked(self):
|
||||||
print "Closed selected"
|
|
||||||
Receiver().send_message("openlpstopimport")
|
Receiver().send_message("openlpstopimport")
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
@ -162,7 +161,7 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog, PluginUtils):
|
|||||||
|
|
||||||
self.biblemanager.save_meta_data(str(self.BibleNameEdit.displayText()), str(self.VersionNameEdit.displayText()), str(self.CopyrightEdit.displayText()), str(self.PermisionEdit.displayText()))
|
self.biblemanager.save_meta_data(str(self.BibleNameEdit.displayText()), str(self.VersionNameEdit.displayText()), str(self.CopyrightEdit.displayText()), str(self.PermisionEdit.displayText()))
|
||||||
self.bibletype = None
|
self.bibletype = None
|
||||||
self.freeAll() # free the scree state restrictions
|
self.freeAll() # free the screen state restrictions
|
||||||
self.resetAll() # reset all the screen fields
|
self.resetAll() # reset all the screen fields
|
||||||
|
|
||||||
def blockCSV(self):
|
def blockCSV(self):
|
||||||
@ -220,6 +219,7 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog, PluginUtils):
|
|||||||
self.BooksLocationEdit.setText("")
|
self.BooksLocationEdit.setText("")
|
||||||
self.VerseLocationEdit.setText("")
|
self.VerseLocationEdit.setText("")
|
||||||
self.OSISLocationEdit.setText("")
|
self.OSISLocationEdit.setText("")
|
||||||
|
self.BibleNameEdit.setText("")
|
||||||
self.LocationComboBox.setCurrentIndex(0)
|
self.LocationComboBox.setCurrentIndex(0)
|
||||||
self.BibleComboBox.setCurrentIndex(0)
|
self.BibleComboBox.setCurrentIndex(0)
|
||||||
self.TypeComboBox.setCurrentIndex(0)
|
self.TypeComboBox.setCurrentIndex(0)
|
||||||
|
@ -91,13 +91,11 @@ class BibleOSISImpl():
|
|||||||
book_ptr = p[0]
|
book_ptr = p[0]
|
||||||
book = self.bibledb.create_book(self.booksOfBible[p[0]] , self.abbrevOfBible[p[0]], testament)
|
book = self.bibledb.create_book(self.booksOfBible[p[0]] , self.abbrevOfBible[p[0]], testament)
|
||||||
dialogobject.incrementBar(self.booksOfBible[p[0]] )
|
dialogobject.incrementBar(self.booksOfBible[p[0]] )
|
||||||
#Receiver().send_message("openlprepaint") # send repaint message to dialog
|
|
||||||
Receiver().send_message("openlpprocessevents")
|
Receiver().send_message("openlpprocessevents")
|
||||||
count = 0
|
count = 0
|
||||||
self.bibledb.add_verse(book.id, p[1], p[2], t)
|
self.bibledb.add_verse(book.id, p[1], p[2], t)
|
||||||
count += 1
|
count += 1
|
||||||
if count % 1 == 0: #Every x verses repaint the screen
|
if count % 3 == 0: #Every x verses repaint the screen
|
||||||
#Receiver().send_message("openlprepaint") # send repaint message to dialog openlpprocessevents
|
|
||||||
Receiver().send_message("openlpprocessevents")
|
Receiver().send_message("openlpprocessevents")
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user