Fix merge problem.

Song search works again
Bible import fixes

bzr-revno: 297
This commit is contained in:
Tim Bentley 2009-02-05 18:27:51 +00:00
parent 3f0ba7a3ba
commit 11e3d43caf
7 changed files with 30 additions and 15 deletions

View File

@ -91,6 +91,4 @@ class MediaManagerItem(QtGui.QWidget):
return QtGui.QFileDialog.getOpenFileNames(self, dialogname,
dialoglocation, dialogfilter)
def refresh(self):
self.update()

View File

@ -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):
"""

View File

@ -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)

View File

@ -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")

View File

@ -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 = ""

View File

@ -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):

View File

@ -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()