diff --git a/openlp/core/lib/eventreceiver.py b/openlp/core/lib/eventreceiver.py index 99d325a44..4fbb979af 100644 --- a/openlp/core/lib/eventreceiver.py +++ b/openlp/core/lib/eventreceiver.py @@ -27,8 +27,8 @@ class EventReceiver(QObject): def __init__(self): QObject.__init__(self) - def send_repaint(self): - self.emit(SIGNAL("openlprepaint"), None) + def send_message(self, event, msg=None): + self.emit(SIGNAL(event), msg) def received(self, msg=None): print msg @@ -40,17 +40,15 @@ class Receiver(): As there is only one instance of it in the systems the QT signal/slot architecture can send messages across the system Send message - receiver = Receiver() - receiver.send_repaint() + Receiver().send_message("messageid",data) Receive Message - self.receiver = Receiver() - QtCore.QObject.connect(self.receiver.get_receiver(),QtCore.SIGNAL("openlprepaint"),<>) + QtCore.QObject.connect(Receiver().get_receiver(),QtCore.SIGNAL("openlprepaint"),<>) """ eventreceiver=EventReceiver() @staticmethod - def send_repaint(): - Receiver.eventreceiver.send_repaint() + def send_message(event, msg=None): + Receiver.eventreceiver.send_message(event, msg) @staticmethod def receive(): Receiver.eventreceiver.receive() diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index e25947265..cd7ca8906 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -40,8 +40,7 @@ class MainWindow(object): pluginpath = os.path.abspath(os.path.join(pluginpath, '..', '..','plugins')) self.plugin_manager = PluginManager(pluginpath) self.setupUi() - self.receiver = Receiver() - QtCore.QObject.connect(self.receiver.get_receiver(),QtCore.SIGNAL("openlprepaint"),self.repaint) + QtCore.QObject.connect(Receiver().get_receiver(),QtCore.SIGNAL("openlprepaint"),self.repaint) def repaint(self): self.main_window.repaint() diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index 7a372981f..ac7661266 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -119,9 +119,13 @@ class BiblePlugin(Plugin, PluginUtils): self.QuickSearchButton.setObjectName('QuickSearchButton') self.QuickSearchButton.setText('Search') self.QuickLayout.addWidget(self.QuickSearchButton, 3, 2, 1, 1) + self.SearchTabWidget.addTab(self.QuickTab, 'Quick Search') + self.ClearQuickSearchComboBox = QtGui.QComboBox(self.QuickTab) + self.ClearQuickSearchComboBox.setObjectName('ClearQuickSearchComboBox') + self.QuickLayout.addWidget(self.ClearQuickSearchComboBox, 3, 0, 1, 1) QuickSpacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.QuickLayout.addItem(QuickSpacerItem, 4, 2, 1, 1) - self.SearchTabWidget.addTab(self.QuickTab, 'Quick Search') + # Add the Advanced Search tab self.AdvancedTab = QtGui.QWidget() self.AdvancedTab.setObjectName('AdvancedTab') @@ -172,6 +176,9 @@ class BiblePlugin(Plugin, PluginUtils): self.AdvancedToVerse.setObjectName('AdvancedToVerse') self.AdvancedLayout.addWidget(self.AdvancedToVerse, 4, 3, 1, 1) + self.ClearAdvancedSearchComboBox = QtGui.QComboBox(self.QuickTab) + self.ClearAdvancedSearchComboBox.setObjectName('ClearAdvancedSearchComboBox') + self.AdvancedLayout.addWidget(self.ClearAdvancedSearchComboBox, 5, 0, 1, 1) self.AdvancedSearchButton = QtGui.QPushButton(self.AdvancedTab) self.AdvancedSearchButton.setObjectName('AdvancedSearchButton') self.AdvancedSearchButton.setText('Search') @@ -266,8 +273,12 @@ class BiblePlugin(Plugin, PluginUtils): self.QuickVersionComboBox.clear() self.AdvancedVersionComboBox.clear() bibles = self.biblemanager.get_bibles("full") + self.QuickSearchComboBox.addItem("Verse Search") self.QuickSearchComboBox.addItem("Text Search") - self.QuickSearchComboBox.addItem("Verse Search") + self.ClearQuickSearchComboBox.addItem("Clear Results") + self.ClearQuickSearchComboBox.addItem("Keep Results") + self.ClearAdvancedSearchComboBox.addItem("Clear Results") + self.ClearAdvancedSearchComboBox.addItem("Keep Results") for b in bibles: # load bibles into the combo boxes self.QuickVersionComboBox.addItem(b) diff --git a/openlp/plugins/bibles/forms/bibleimportdialog.py b/openlp/plugins/bibles/forms/bibleimportdialog.py index 42a377526..bf9f968ab 100644 --- a/openlp/plugins/bibles/forms/bibleimportdialog.py +++ b/openlp/plugins/bibles/forms/bibleimportdialog.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'bibleimportdialog.ui' # -# Created: Sat Jan 24 07:46:38 2009 +# Created: Wed Feb 11 16:48:24 2009 # by: PyQt4 UI code generator 4.4.4 # # WARNING! All changes made in this file will be lost! @@ -16,11 +16,6 @@ class Ui_BibleImportDialog(object): icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/icon/openlp.org-icon-32.bmp"), QtGui.QIcon.Normal, QtGui.QIcon.Off) BibleImportDialog.setWindowIcon(icon) - self.BibleImportButtonBox = QtGui.QDialogButtonBox(BibleImportDialog) - self.BibleImportButtonBox.setGeometry(QtCore.QRect(10, 690, 481, 33)) - self.BibleImportButtonBox.setOrientation(QtCore.Qt.Horizontal) - self.BibleImportButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save) - self.BibleImportButtonBox.setObjectName("BibleImportButtonBox") self.ImportToolBox = QtGui.QToolBox(BibleImportDialog) self.ImportToolBox.setGeometry(QtCore.QRect(10, 0, 471, 431)) self.ImportToolBox.setObjectName("ImportToolBox") @@ -191,6 +186,17 @@ class Ui_BibleImportDialog(object): self.ProgressBar.setInvertedAppearance(False) self.ProgressBar.setObjectName("ProgressBar") self.gridLayout_3.addWidget(self.ProgressBar, 0, 0, 1, 1) + self.widget = QtGui.QWidget(BibleImportDialog) + self.widget.setGeometry(QtCore.QRect(320, 680, 170, 28)) + self.widget.setObjectName("widget") + self.horizontalLayout = QtGui.QHBoxLayout(self.widget) + self.horizontalLayout.setObjectName("horizontalLayout") + self.ImportButton = QtGui.QPushButton(self.widget) + self.ImportButton.setObjectName("ImportButton") + self.horizontalLayout.addWidget(self.ImportButton) + self.CancelButton = QtGui.QPushButton(self.widget) + self.CancelButton.setObjectName("CancelButton") + self.horizontalLayout.addWidget(self.CancelButton) self.retranslateUi(BibleImportDialog) self.ImportToolBox.setCurrentIndex(1) @@ -210,7 +216,6 @@ class Ui_BibleImportDialog(object): BibleImportDialog.setTabOrder(self.PasswordEdit, self.VersionNameEdit) BibleImportDialog.setTabOrder(self.VersionNameEdit, self.CopyrightEdit) BibleImportDialog.setTabOrder(self.CopyrightEdit, self.PermisionEdit) - BibleImportDialog.setTabOrder(self.PermisionEdit, self.BibleImportButtonBox) def retranslateUi(self, BibleImportDialog): BibleImportDialog.setWindowTitle(QtGui.QApplication.translate("BibleImportDialog", "Bible Registration", None, QtGui.QApplication.UnicodeUTF8)) @@ -240,3 +245,6 @@ class Ui_BibleImportDialog(object): self.PermisionLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "Permission:", None, QtGui.QApplication.UnicodeUTF8)) self.ProgressGroupBox.setTitle(QtGui.QApplication.translate("BibleImportDialog", "Import Progress", None, QtGui.QApplication.UnicodeUTF8)) self.ProgressBar.setFormat(QtGui.QApplication.translate("BibleImportDialog", "%p", None, QtGui.QApplication.UnicodeUTF8)) + self.ImportButton.setText(QtGui.QApplication.translate("BibleImportDialog", "Import", None, QtGui.QApplication.UnicodeUTF8)) + self.CancelButton.setText(QtGui.QApplication.translate("BibleImportDialog", "Cancel", None, QtGui.QApplication.UnicodeUTF8)) + diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index a4ff9b27c..dacdee73b 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -37,13 +37,12 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog, PluginUtils): self.bibleplugin = bibleplugin self.bibletype = None self.barmax = 0 - self.receiver = Receiver() QtCore.QObject.connect(self.LocationComboBox, QtCore.SIGNAL("activated(int)"), self.onLocationComboBox) QtCore.QObject.connect(self.TypeComboBox, QtCore.SIGNAL("activated(int)"), self.onTypeComboBox) QtCore.QObject.connect(self.BibleComboBox, QtCore.SIGNAL("activated(int)"), self.onBibleComboBox) QtCore.QObject.connect(self.ProgressBar, QtCore.SIGNAL("valueChanged(int)"), self.on_ProgressBar_changed) - QtCore.QObject.connect(self.receiver.get_receiver(),QtCore.SIGNAL("openlprepaint"),self.on_ProgressBar_changed) + QtCore.QObject.connect(Receiver().get_receiver(),QtCore.SIGNAL("openlprepaint"),self.on_ProgressBar_changed) def on_ProgressBar_changed(self): self.repaint() @@ -122,22 +121,23 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog, PluginUtils): def on_BibleNameEdit_lostFocus(self): pass - def on_BibleImportButtonBox_clicked(self,button): - log.debug("BibleImportButtonBox %s , %s", button.text() , self.bibletype) - if button.text() == "Save": - if self.biblemanager != None: - if not self.bibletype == None or len(self.BibleNameEdit.displayText()) > 0: - self.MessageLabel.setText("Import Started") - self.ProgressBar.setMinimum(0) - self.ProgressBar.setValue(0) - self.progress = 0 - self.biblemanager.process_dialog(self) - self._import_bible() - self.MessageLabel.setText("Import Complete") - self.ProgressBar.setValue(self.barmax) - self.bibleplugin.reload_bibles() # Update form as we have a new bible - elif button.text() == "Cancel": - self.close() + @pyqtSignature("") + def on_CancelButton_clicked(self): + self.close() + + @pyqtSignature("") + def on_ImportButton_clicked(self): + if self.biblemanager != None: + if not self.bibletype == None or len(self.BibleNameEdit.displayText()) > 0: + self.MessageLabel.setText("Import Started") + self.ProgressBar.setMinimum(0) + self.ProgressBar.setValue(0) + self.progress = 0 + self.biblemanager.process_dialog(self) + self._import_bible() + self.MessageLabel.setText("Import Complete") + self.ProgressBar.setValue(self.barmax) + self.bibleplugin.reload_bibles() # Update form as we have a new bible def setMax(self, max): log.debug("set Max %s", max) diff --git a/openlp/plugins/bibles/lib/bibleOSISimpl.py b/openlp/plugins/bibles/lib/bibleOSISimpl.py index 360a8e9fe..c9cbea933 100644 --- a/openlp/plugins/bibles/lib/bibleOSISimpl.py +++ b/openlp/plugins/bibles/lib/bibleOSISimpl.py @@ -28,7 +28,6 @@ class BibleOSISImpl(): self.booksOfBible = {} # books of the bible linked to bibleid {osis , name} self.abbrevOfBible = {} # books of the bible linked to bibleid {osis ,Abbrev } fbibles=open(biblepath+"/osisbooks_en.txt", 'r') - self.receiver = Receiver() for line in fbibles: p = line.split(",") self.booksOfBible[p[0]] = p[1].replace('\n', '') @@ -85,12 +84,12 @@ class BibleOSISImpl(): book_ptr = p[0] book = self.bibledb.create_book(self.booksOfBible[p[0]] , self.abbrevOfBible[p[0]], testament) dialogobject.incrementBar(self.booksOfBible[p[0]] ) - self.receiver.send_repaint() # send repaint message to dialog as book changed + Receiver().send_message("openlprepaint") # send repaint message to dialog count = 0 self.bibledb.add_verse(book.id, p[1], p[2], t) count += 1 if count % 100 == 0: #Every x verses repaint the screen - self.receiver.send_repaint() # send repaint message to dialog + Receiver().send_message("openlprepaint") # send repaint message to dialog count = 0 diff --git a/resources/forms/bibleimportdialog.ui b/resources/forms/bibleimportdialog.ui index 5e7db5a46..e379cc587 100644 --- a/resources/forms/bibleimportdialog.ui +++ b/resources/forms/bibleimportdialog.ui @@ -17,22 +17,6 @@ :/icon/openlp.org-icon-32.bmp:/icon/openlp.org-icon-32.bmp - - - - 10 - 690 - 481 - 33 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Save - - @@ -458,6 +442,32 @@ + + + + 320 + 680 + 170 + 28 + + + + + + + Import + + + + + + + Cancel + + + + + BibleNameEdit @@ -476,7 +486,6 @@ VersionNameEdit CopyrightEdit PermisionEdit - BibleImportButtonBox