From 11e3d43caff3514575c7b4e3a69a4193d7768b59 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 5 Feb 2009 18:27:51 +0000 Subject: [PATCH] Fix merge problem. Song search works again Bible import fixes bzr-revno: 297 --- openlp/core/lib/mediamanageritem.py | 2 -- openlp/core/lib/plugin.py | 7 +++++++ openlp/core/pluginmanager.py | 7 ++++++- openlp/core/ui/mainwindow.py | 7 ++++++- openlp/plugins/bibles/bibleplugin.py | 4 ++-- openlp/plugins/bibles/forms/bibleimportform.py | 6 +++--- openlp/plugins/songs/songsplugin.py | 12 ++++++------ 7 files changed, 30 insertions(+), 15 deletions(-) diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index c55dcd506..ffb7fd3f5 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -91,6 +91,4 @@ class MediaManagerItem(QtGui.QWidget): return QtGui.QFileDialog.getOpenFileNames(self, dialogname, dialoglocation, dialogfilter) - def refresh(self): - self.update() diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index 50eb5638b..a8c03916f 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -88,6 +88,7 @@ class Plugin(object): self.weight = 0 # Set up logging self.log = logging.getLogger(self.name) + self.repaint_main_window = None def check_pre_conditions(self): """ @@ -114,6 +115,12 @@ class Plugin(object): Create a menu item and add it to the "Export" menu. """ pass + + def add_repaint_main_window(self, repaint_main_window): + """ + Create ability to repaint main window. + """ + self.repaint_main_window = repaint_main_window def get_settings_tab(self): """ diff --git a/openlp/core/pluginmanager.py b/openlp/core/pluginmanager.py index ec1a44dfd..efe74978d 100644 --- a/openlp/core/pluginmanager.py +++ b/openlp/core/pluginmanager.py @@ -112,5 +112,10 @@ class PluginManager(object): for plugin in self.plugins: plugin.add_export_menu_item(export_menu) - def hook_handle_event(self, event): + def hook_handle_event(self, event): pass + + def hook_repaint_main_window(self, repaint_main_window): + for plugin in self.plugins: + plugin.add_repaint_main_window(repaint_main_window) + diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 9101180d4..ad939137b 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -37,7 +37,10 @@ class MainWindow(object): pluginpath = os.path.abspath(os.path.join(pluginpath, '..', '..','plugins')) self.plugin_manager = PluginManager(pluginpath) self.setupUi() - + + def repaint_window(self): + self.main_window.update() + def setupUi(self): self.main_window.setObjectName("main_window") self.main_window.resize(1087, 847) @@ -119,6 +122,8 @@ class MainWindow(object): self.FileExportMenu.setObjectName("FileExportMenu") # Call the hook method to pull in export menus. self.plugin_manager.hook_import_menu(self.FileExportMenu) + # Call the hook method to export refresh. + self.plugin_manager.hook_repaint_main_window(self.repaint_window) # self.OptionsMenu = QtGui.QMenu(self.MenuBar) self.OptionsMenu.setObjectName("OptionsMenu") diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index 0fefdfea8..985ec8475 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -252,7 +252,7 @@ class BiblePlugin(Plugin, PluginUtils): pass def refresh(self): - self.MediaManagerItem.refresh() + self.repaint_main_window() def reload_bibles(self): self.biblemanager.reload_bibles() @@ -372,7 +372,7 @@ class BiblePlugin(Plugin, PluginUtils): def _initialise_bible_quick(self, bible): # not sure if needed yet! - a=1 + pass def translate(self, bible, search): book = "" diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index 296917399..f9c19048c 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -127,7 +127,6 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog, PluginUtils): self._import_bible() self.MessageLabel.setText("Import Complete") self.ProgressBar.setValue(self.barmax) - self.update() self.bibleplugin.reload_bibles() # Update form as we have a new bible elif button.text() == "Cancel": self.close() @@ -137,13 +136,14 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog, PluginUtils): self.ProgressBar.setMaximum(max) def incrementBar(self, text = None): + print self.progress, text, self.barmax if text != None: - self.MessageLabel.setText("Import progressing with " + text) + self.MessageLabel.setText("Import processed " + text) else: self.MessageLabel.setText("Import progressing") self.progress +=1 self.ProgressBar.setValue(self.progress) - self.update() + #self.update() self.bibleplugin.refresh() def _import_bible(self): diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index d74f6821c..ae1e7b28b 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -204,11 +204,11 @@ class SongsPlugin(Plugin, PluginUtils): self.SearchTextEdit.clear() def onSearchTextEditChanged(self, text): - #sl = 3 - #if self.SearchTypeComboBox.currentText() == u'Lyrics': - # sl = 7 - #if len(text) > sl: # only search if > 3 characters - self.onSearchTextButtonClick() + sl = 3 + if self.SearchTypeComboBox.currentText() == u'Lyrics': + sl = 7 + if len(text) > sl: # only search if > 3 characters + self.onSearchTextButtonClick() def onSearchTextButtonClick(self): search_keywords = str(self.SearchTextEdit.displayText()) @@ -267,7 +267,7 @@ class SongsPlugin(Plugin, PluginUtils): self.SongListView.setHorizontalHeaderLabels(QtCore.QStringList(["","Song Name","Author"])) self.SongListView.setVerticalHeaderLabels(QtCore.QStringList([""])) self.SongListView.setRowCount(0) - log.debug("Records returned from search %s", len(searchresults)) + #log.debug("Records returned from search %s", len(searchresults)) for song in searchresults: for author in song.authors: c = self.SongListView.rowCount()