diff --git a/.eric4project/openlp.org 2.0.e4q b/.eric4project/openlp.org 2.0.e4q index ae7e4050a..6279a779d 100644 --- a/.eric4project/openlp.org 2.0.e4q +++ b/.eric4project/openlp.org 2.0.e4q @@ -1,7 +1,7 @@ - + \ No newline at end of file diff --git a/.eric4project/openlp.org 2.0.e4t b/.eric4project/openlp.org 2.0.e4t index 5516db058..d85c5718e 100644 --- a/.eric4project/openlp.org 2.0.e4t +++ b/.eric4project/openlp.org 2.0.e4t @@ -1,7 +1,7 @@ - + TODO: what is the tags for bridge, pre-chorus? diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index 788afbfba..fd4838667 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -40,6 +40,8 @@ class Plugin(object): A log object used to log debugging messages. This is pre-instantiated. Hook functions: + * check_pre_conditions() + Provides the Plugin with a handle to check if it can be loaded. * get_media_manager_item() Returns an instance of MediaManagerItem to be used in the Media Manager. * get_import_menu_item() @@ -87,6 +89,13 @@ class Plugin(object): # Set up logging self.log = logging.getLogger(self.name) + def check_pre_conditions(self): + """ + Provides the Plugin with a handle to check if it can be loaded. + Returns True or False. + """ + return True + def get_media_manager_item(self): """ Construct a MediaManagerItem object with all the buttons and things you @@ -151,31 +160,9 @@ class Plugin(object): """ pass - def initalise(self): + def initialise(self): """ Called by the plugin Manager to initialise anything it needs. """ pass - def addToMenu(self, menubar): - """ - Add menu items to the menu, given the menubar. - """ - pass - - def handleEvent(self, event): - """ - Handle the event contained in the event object. - """ - pass - - def getName(self): - return self.Name - - def checkPreConditions(self): - """ - Provides the Plugin with a handle to check if it can be loaded. - Returns True or False. - """ - return True - diff --git a/openlp/core/pluginmanager.py b/openlp/core/pluginmanager.py index 372473485..d340c5222 100644 --- a/openlp/core/pluginmanager.py +++ b/openlp/core/pluginmanager.py @@ -72,7 +72,7 @@ class PluginManager(object): plugin_objects = [] for p in self.plugin_classes: plugin = p() - if plugin.checkPreConditions() == True: + if plugin.check_pre_conditions(): plugin_objects.append(plugin) self.plugins = sorted(plugin_objects, self.order_by_weight) @@ -89,7 +89,7 @@ class PluginManager(object): if media_manager_item is not None: log.debug('Inserting media manager item from %s' % plugin.name) mediatoolbox.addItem(media_manager_item, plugin.icon, media_manager_item.title) - plugin.initalise() + plugin.initialise() def hook_handle_event(self, event): pass diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index 4fc40ebdf..58893e9ad 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -183,21 +183,21 @@ class BiblePlugin(Plugin): QtCore.QObject.connect(self.AdvancedFromVerse, QtCore.SIGNAL("activated(int)"), self.onAdvancedFromVerse) QtCore.QObject.connect(self.AdvancedToChapter, QtCore.SIGNAL("activated(int)"), self.onAdvancedToChapter) - self._initialiseForm() + self._initialise_form() QtCore.QObject.connect(self.AdvancedSearchButton, QtCore.SIGNAL("pressed()"), self.onAdvancedSearchButton) QtCore.QObject.connect(self.QuickSearchButton, QtCore.SIGNAL("pressed()"), self.onQuickSearchButton) return self.MediaManagerItem - def initalise(self): - self._initialiseForm() + def initialise(self): + self._initialise_form() def onAdvancedVersionComboBox(self): - self._initialiseBibleAdvanced(str(self.AdvancedVersionComboBox.currentText())) # restet the bible info + self._initialise_bible_advanced(str(self.AdvancedVersionComboBox.currentText())) # restet the bible info def onAdvancedBookComboBox(self): print self.AdvancedVersionComboBox.currentText() - self._initialiseBibleAdvanced(str(self.AdvancedVersionComboBox.currentText())) # restet the bible info + self._initialise_bible_advanced(str(self.AdvancedVersionComboBox.currentText())) # restet the bible info def onQuickTabClick(self): print "onQuickTabClick" @@ -220,7 +220,7 @@ class BiblePlugin(Plugin): def onBibleAddClick(self): pass - def _initialiseForm(self): + def _initialise_form(self): bibles = self.biblemanager.getBibles() self.QuickSearchComboBox.addItem("Text Search") self.QuickSearchComboBox.addItem("Verse Search") @@ -230,15 +230,15 @@ class BiblePlugin(Plugin): self.AdvancedVersionComboBox.addItem(b) if first: first = False - self._initialiseBible(b) # use the fist bible as the trigger + self._initialise_bible(b) # use the fist bible as the trigger - def _initialiseBible(self, bible): - log.debug("_initialiseBible %s ", bible) - self._initialiseBibleQuick(bible) - self._initialiseBibleAdvanced(bible) + def _initialise_bible(self, bible): + log.debug("_initialise_bible %s ", bible) + self._initialise_bible_quick(bible) + self._initialise_bible_advanced(bible) - def _initialiseBibleAdvanced(self, bible): - log.debug("_initialiseBibleAdvanced %s ", bible) + def _initialise_bible_advanced(self, bible): + log.debug("_initialise_bible_advanced %s ", bible) currentBook = str(self.AdvancedBookComboBox.currentText()) cf = self.biblemanager.getBookChapterCount(bible, currentBook)[0] log.debug("Book change bible %s book %s ChapterCount %s", bible, currentBook, cf) @@ -251,35 +251,35 @@ class BiblePlugin(Plugin): if first: book = b first = False - self._initialiseChapterVerse(bible, b[0]) + self._initialise_chapter_verse(bible, b[0]) - def _initialiseChapterVerse(self, bible, book): - log.debug("_initialiseChapterVerse %s , %s", bible, book) + def _initialise_chapter_verse(self, bible, book): + log.debug("_initialise_chapter_verse %s , %s", bible, book) self.chaptersfrom = self.biblemanager.getBookChapterCount(bible, book)[0] self.verses = self.biblemanager.getBookVerseCount(bible, book, 1)[0] - self._adjustComboBox(1, self.chaptersfrom, self.AdvancedFromChapter) - self._adjustComboBox(1, self.chaptersfrom, self.AdvancedToChapter) - self._adjustComboBox(1, self.verses, self.AdvancedFromVerse) - self._adjustComboBox(1, self.verses, self.AdvancedToVerse) + self._adjust_combobox(1, self.chaptersfrom, self.AdvancedFromChapter) + self._adjust_combobox(1, self.chaptersfrom, self.AdvancedToChapter) + self._adjust_combobox(1, self.verses, self.AdvancedFromVerse) + self._adjust_combobox(1, self.verses, self.AdvancedToVerse) def onAdvancedFromChapter(self): bible = str(self.AdvancedVersionComboBox.currentText()) book = str(self.AdvancedBookComboBox.currentText()) cf = self.AdvancedFromChapter.currentText() - self._adjustComboBox(cf, self.chaptersfrom, self.AdvancedToChapter) + self._adjust_combobox(cf, self.chaptersfrom, self.AdvancedToChapter) vse = self.biblemanager.getBookVerseCount(bible, book, int(cf))[0] # get the verse count for new chapter - self._adjustComboBox(1, vse, self.AdvancedFromVerse) - self._adjustComboBox(1, vse, self.AdvancedToVerse) + self._adjust_combobox(1, vse, self.AdvancedFromVerse) + self._adjust_combobox(1, vse, self.AdvancedToVerse) - def _adjustComboBox(self, frm, to , combo): - log.debug("_adjustComboBox %s , %s , %s", combo, frm, to) + def _adjust_combobox(self, frm, to , combo): + log.debug("_adjust_combobox %s , %s , %s", combo, frm, to) combo.clear() for i in range(int(frm), int(to) + 1): combo.addItem(str(i)) def onAdvancedFromVerse(self): frm = self.AdvancedFromVerse.currentText() - self._adjustComboBox(frm, self.verses, self.AdvancedToVerse) + self._adjust_combobox(frm, self.verses, self.AdvancedToVerse) def onAdvancedToChapter(self): t1 = self.AdvancedFromChapter.currentText() @@ -288,7 +288,7 @@ class BiblePlugin(Plugin): bible = str(self.AdvancedVersionComboBox.currentText()) book = str(self.AdvancedBookComboBox.currentText()) vse = self.biblemanager.getBookVerseCount(bible, book, int(t2))[0] # get the verse count for new chapter - self._adjustComboBox(1, vse, self.AdvancedToVerse) + self._adjust_combobox(1, vse, self.AdvancedToVerse) def onAdvancedSearchButton(self): bible = str(self.AdvancedVersionComboBox.currentText()) @@ -309,17 +309,17 @@ class BiblePlugin(Plugin): else: self._verseSearch() - def _searchText(self, bible, text): + def _search_text(self, bible, text): self.searchresults = self.biblemanager.getVersesFromText(bible,text) self._displayResults() - def _verseSearch(self): + def _verse_search(self): self._displayResults() - def _displayResults(self): + def _display_results(self): self.listView.clear() # clear the results for book, chap, vse , txt in self.searchresults: self.listView.addItem(book + " " +str(chap) + ":"+ str(vse)) - def _initialiseBibleQuick(self, bible): # not sure if needed yet! + def _initialise_bible_quick(self, bible): # not sure if needed yet! a=1 diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index 4a20e20a7..4b125b33e 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -67,7 +67,7 @@ class PresentationPlugin(Plugin): return self.MediaManagerItem - def initalise(self): + def initialise(self): self.onPresentationLoadClick() def onPresentationLoadClick(self): diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index 57555fc30..ba03a98cd 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -105,7 +105,7 @@ class SongsPlugin(Plugin): return self.MediaManagerItem - def initalise(self): + def initialise(self): self.SearchTypeComboBox.addItem("Lyrics") self.SearchTypeComboBox.addItem("Titles") self.SearchTypeComboBox.addItem("Authors")