From 63099832ad80bf8d4ac2a4f8e904f8b2b7723f40 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 24 Feb 2011 16:55:17 +0000 Subject: [PATCH 1/8] Fix order --- openlp/core/ui/mainwindow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 9071016e8..eb9ce530e 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -279,7 +279,7 @@ class Ui_MainWindow(object): add_actions(self.SettingsLanguageMenu, self.LanguageGroup.actions()) add_actions(self.SettingsMenu, (self.settingsPluginListItem, self.SettingsLanguageMenu.menuAction(), None, - self.SettingsShortcutsItem, self.DisplayTagItem, + self.DisplayTagItem, self.SettingsShortcutsItem, self.SettingsConfigureItem)) add_actions(self.ToolsMenu, (self.ToolsAddToolItem, None)) add_actions(self.ToolsMenu, (self.ToolsOpenDataFolder, None)) From 4cac889279f3582d41345cf59326e57c6db5c752 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 24 Feb 2011 22:07:12 +0100 Subject: [PATCH 2/8] fix bug, clean ups --- openlp/plugins/bibles/lib/manager.py | 10 ---------- openlp/plugins/bibles/lib/mediaitem.py | 8 ++------ 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 251ce350b..1f56ef932 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -46,16 +46,6 @@ except ImportError: log = logging.getLogger(__name__) -class BibleMode(object): - """ - This is basically an enumeration class which specifies the mode of a Bible. - Mode refers to whether or not a Bible in OpenLP is a full Bible or needs to - be downloaded from the Internet on an as-needed basis. - """ - Full = 1 - Partial = 2 - - class BibleFormat(object): """ This is a special enumeration class that holds the various types of Bibles, diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index e7cf273c1..ab7897828 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -482,7 +482,7 @@ class BibleMediaItem(MediaManagerItem): self.listView.clear() if self.listView.count() != 0: self.__checkSecondBible(bible, second_bible) - else: + elif self.search_results: self.displayResults(bible, second_bible) Receiver.send_message(u'cursor_normal') self.advancedSearchButton.setEnabled(True) @@ -698,11 +698,7 @@ class BibleMediaItem(MediaManagerItem): service_item.add_capability(ItemCapabilities.AllowsPreview) service_item.add_capability(ItemCapabilities.AllowsLoop) # Service Item: Title - for title in raw_title: - if not service_item.title: - service_item.title = title - else: - service_item.title += u', ' + title + service_item.title = u', '.join(raw_title) # Service Item: Theme if len(self.settings.bible_theme) == 0: service_item.theme = None From 0dbc1c6e1a06375b5968587995309907049ed7f4 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 25 Feb 2011 17:29:03 +0100 Subject: [PATCH 3/8] different clean ups --- .../plugins/songs/lib/foilpresenterimport.py | 8 +++---- openlp/plugins/songs/lib/mediaitem.py | 23 +++++-------------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/openlp/plugins/songs/lib/foilpresenterimport.py b/openlp/plugins/songs/lib/foilpresenterimport.py index 1a2aaa18d..e232d7d2f 100644 --- a/openlp/plugins/songs/lib/foilpresenterimport.py +++ b/openlp/plugins/songs/lib/foilpresenterimport.py @@ -133,6 +133,7 @@ class FoilPresenterImport(SongImport): log.exception(u'XML syntax error in file %s' % file_path) return True + class FoilPresenter(object): """ This class represents the converter for Foilpresenter XML from a song. @@ -259,7 +260,6 @@ class FoilPresenter(object): copyright = None if copyright: strings = [] - author_temp = [] if copyright.find(u'Copyright') != -1: temp = copyright.partition(u'Copyright') copyright = temp[0] @@ -305,7 +305,7 @@ class FoilPresenter(object): while i != 1: if copyright.find(u'') != -1: temp = copyright.partition(u'') - if (temp[0].strip() != u'') & (x > 0): + if temp[0].strip() and x > 0: strings.append(temp[0]) copyright = temp[2] x += 1 @@ -330,12 +330,12 @@ class FoilPresenter(object): author = author.strip() if re.search( u'\w+\.?\s+\w{3,}\s+[a|u]nd\s|\w+\.?\s+\w{3,}\s+&\s', - author, re.U) != None: + author, re.U): temp = re.split(u'\s[a|u]nd\s|\s&\s', author) for tempx in temp: tempx = tempx.strip() authors.append(tempx) - elif (len(author) > 2): + elif len(author) > 2: authors.append(author) for display_name in authors: author = self.manager.get_object_filtered(Author, diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 1bf00b403..37579ce1d 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -218,13 +218,9 @@ class SongMediaItem(MediaManagerItem): self.listView.clear() searchresults.sort(cmp=self.collateSongTitles) for song in searchresults: - author_list = u'' - for author in song.authors: - if author_list != u'': - author_list = author_list + u', ' - author_list = author_list + author.display_name + author_list = [author.display_name for author in song.authors] song_title = unicode(song.title) - song_detail = u'%s (%s)' % (song_title, author_list) + song_detail = u'%s (%s)' % (song_title, u', '.join(author_list)) song_name = QtGui.QListWidgetItem(song_detail) song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id)) self.listView.addItem(song_name) @@ -334,9 +330,6 @@ class SongMediaItem(MediaManagerItem): def generateSlideData(self, service_item, item=None, xmlVersion=False): log.debug(u'generateSlideData (%s:%s)' % (service_item, item)) raw_footer = [] - author_list = u'' - author_audit = [] - ccli = u'' item_id = self._getIdOfItemToGenerate(item, self.remoteSong) service_item.add_capability(ItemCapabilities.AllowsEdit) service_item.add_capability(ItemCapabilities.AllowsPreview) @@ -397,13 +390,9 @@ class SongMediaItem(MediaManagerItem): for slide in verses: service_item.add_from_text(slide[:30], unicode(slide)) service_item.title = song.title - for author in song.authors: - if len(author_list) > 1: - author_list = author_list + u', ' - author_list = author_list + unicode(author.display_name) - author_audit.append(unicode(author.display_name)) + author_list = [unicode(author.display_name) for author in song.authors] raw_footer.append(song.title) - raw_footer.append(author_list) + raw_footer.append(u', '.join(author_list)) raw_footer.append(song.copyright) if QtCore.QSettings().value(u'general/ccli number', QtCore.QVariant(u'')).toString(): @@ -413,10 +402,10 @@ class SongMediaItem(MediaManagerItem): QtCore.QVariant(u'')).toString())) service_item.raw_footer = raw_footer service_item.audit = [ - song.title, author_audit, song.copyright, unicode(song.ccli_number) + song.title, author_list, song.copyright, unicode(song.ccli_number) ] service_item.data_string = {u'title': song.search_title, - u'authors': author_list} + u'authors': u', '.join(author_list)} service_item.xml_version = self.openLyrics.song_to_xml(song) return True From 0ed7e259fc86585ed65fa24ff7ba050f2ec9fa2d Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 25 Feb 2011 18:05:01 +0100 Subject: [PATCH 4/8] removed white spaces --- openlp/core/lib/__init__.py | 4 ++-- openlp/core/lib/db.py | 10 +++++----- openlp/core/lib/settingsmanager.py | 8 ++++---- openlp/core/lib/ui.py | 14 +++++++------- openlp/core/theme/theme.py | 8 ++++---- openlp/core/ui/displaytagform.py | 2 +- openlp/core/ui/generaltab.py | 2 +- openlp/core/ui/thememanager.py | 6 +++--- openlp/core/utils/__init__.py | 4 ++-- openlp/plugins/bibles/lib/db.py | 2 +- openlp/plugins/bibles/lib/http.py | 10 +++++----- openlp/plugins/bibles/lib/manager.py | 2 +- openlp/plugins/media/mediaplugin.py | 2 +- .../plugins/presentations/lib/impresscontroller.py | 4 ++-- .../presentations/lib/presentationcontroller.py | 2 +- openlp/plugins/remotes/lib/httpserver.py | 2 +- openlp/plugins/songs/forms/editsongform.py | 6 +++--- openlp/plugins/songs/lib/easislidesimport.py | 2 +- openlp/plugins/songs/lib/ewimport.py | 4 ++-- openlp/plugins/songs/lib/foilpresenterimport.py | 4 ++-- openlp/plugins/songs/lib/mediaitem.py | 2 +- openlp/plugins/songs/lib/songimport.py | 2 +- 22 files changed, 51 insertions(+), 51 deletions(-) diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 89ecaf3be..dc60a5a65 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -106,8 +106,8 @@ def translate(context, text, comment=None, def get_text_file_string(text_file): """ - Open a file and return its content as unicode string. If the supplied file - name is not a file then the function returns False. If there is an error + Open a file and return its content as unicode string. If the supplied file + name is not a file then the function returns False. If there is an error loading the file or the content can't be decoded then the function will return None. diff --git a/openlp/core/lib/db.py b/openlp/core/lib/db.py index 62150cce3..f6a7fdaad 100644 --- a/openlp/core/lib/db.py +++ b/openlp/core/lib/db.py @@ -65,7 +65,7 @@ def delete_database(plugin_name, db_file_name=None): The name of the plugin to remove the database for ``db_file_name`` - The database file name. Defaults to None resulting in the + The database file name. Defaults to None resulting in the plugin_name being used. """ db_file_path = None @@ -107,7 +107,7 @@ class Manager(object): The init_schema function for this database ``db_file_name`` - The file name to use for this database. Defaults to None resulting + The file name to use for this database. Defaults to None resulting in the plugin_name being used. """ settings = QtCore.QSettings() @@ -211,11 +211,11 @@ class Manager(object): The type of objects to return ``filter_clause`` - The filter governing selection of objects to return. Defaults to + The filter governing selection of objects to return. Defaults to None. ``order_by_ref`` - Any parameters to order the returned objects by. Defaults to None. + Any parameters to order the returned objects by. Defaults to None. """ query = self.session.query(object_class) if filter_clause is not None: @@ -232,7 +232,7 @@ class Manager(object): The type of objects to return. ``filter_clause`` - The filter governing selection of objects to return. Defaults to + The filter governing selection of objects to return. Defaults to None. """ query = self.session.query(object_class) diff --git a/openlp/core/lib/settingsmanager.py b/openlp/core/lib/settingsmanager.py index 3d8d8059e..d09497540 100644 --- a/openlp/core/lib/settingsmanager.py +++ b/openlp/core/lib/settingsmanager.py @@ -64,7 +64,7 @@ class SettingsManager(object): Read the last directory used for plugin. ``section`` - The section of code calling the method. This is used in the + The section of code calling the method. This is used in the settings key. ``num`` @@ -84,7 +84,7 @@ class SettingsManager(object): Save the last directory used for plugin. ``section`` - The section of code calling the method. This is used in the + The section of code calling the method. This is used in the settings key. ``directory`` @@ -160,11 +160,11 @@ class SettingsManager(object): Get a list of files from the data files path. ``section`` - Defaults to *None*. The section of code getting the files - used + Defaults to *None*. The section of code getting the files - used to load from a section's data subdirectory. ``extension`` - Defaults to *None*. The extension to search for. + Defaults to *None*. The extension to search for. """ path = AppLocation.get_data_path() if section: diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index c127d810d..eae4f60ca 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -130,7 +130,7 @@ def create_accept_reject_button_box(parent, okay=False): methods to handle the default ``accepted()`` and ``rejected()`` signals. ``parent`` - The parent object. This should be a ``QWidget`` descendant. + The parent object. This should be a ``QWidget`` descendant. ``okay`` If true creates an okay/cancel combination instead of save/cancel. @@ -185,15 +185,15 @@ def media_item_combo_box(parent, name): def create_delete_push_button(parent, icon=None): """ - Creates a standard push button with a delete label and optional icon. The + Creates a standard push button with a delete label and optional icon. The button is connected to the parent's ``onDeleteButtonClicked()`` method to handle the ``clicked()`` signal. ``parent`` - The parent object. This should be a ``QWidget`` descendant. + The parent object. This should be a ``QWidget`` descendant. ``icon`` - An icon to display on the button. This can be either a ``QIcon``, a + An icon to display on the button. This can be either a ``QIcon``, a resource path or a file name. """ delete_button = QtGui.QPushButton(parent) @@ -210,12 +210,12 @@ def create_delete_push_button(parent, icon=None): def create_up_down_push_button_set(parent): """ Creates a standard set of two push buttons, one for up and the other for - down, for use with lists. The buttons use arrow icons and no text and are + down, for use with lists. The buttons use arrow icons and no text and are connected to the parent's ``onUpButtonClicked()`` and ``onDownButtonClicked()`` to handle their respective ``clicked()`` signals. ``parent`` - The parent object. This should be a ``QWidget`` descendant. + The parent object. This should be a ``QWidget`` descendant. """ up_button = QtGui.QPushButton(parent) up_button.setIcon(build_icon(u':/services/service_up.png')) @@ -295,7 +295,7 @@ def create_valign_combo(form, parent, layout): The UI screen that the label and combo will appear on. ``parent`` - The parent object. This should be a ``QWidget`` descendant. + The parent object. This should be a ``QWidget`` descendant. ``layout`` A layout object to add the label and combo widgets to. diff --git a/openlp/core/theme/theme.py b/openlp/core/theme/theme.py index 17217113a..bb6b25a9e 100644 --- a/openlp/core/theme/theme.py +++ b/openlp/core/theme/theme.py @@ -92,7 +92,7 @@ class Theme(object): * ``solid`` - color ``BackgroundParameter2`` - Extra information about the background. The contents of this attribute + Extra information about the background. The contents of this attribute depend on the BackgroundType: * ``image`` - border color @@ -100,7 +100,7 @@ class Theme(object): * ``solid`` - N/A ``BackgroundParameter3`` - Extra information about the background. The contents of this attribute + Extra information about the background. The contents of this attribute depend on the BackgroundType: * ``image`` - N/A @@ -142,7 +142,7 @@ class Theme(object): Color for the outline (or None if Outline is 0) ``HorizontalAlign`` - The horizontal alignment to apply to text. Valid alignments are: + The horizontal alignment to apply to text. Valid alignments are: * ``0`` - left align * ``1`` - right align @@ -156,7 +156,7 @@ class Theme(object): * ``2`` - centre align ``WrapStyle`` - The wrap style to apply to the text. Valid styles are: + The wrap style to apply to the text. Valid styles are: * ``0`` - normal * ``1`` - lyrics diff --git a/openlp/core/ui/displaytagform.py b/openlp/core/ui/displaytagform.py index 114a52bf6..e29fe3384 100644 --- a/openlp/core/ui/displaytagform.py +++ b/openlp/core/ui/displaytagform.py @@ -72,7 +72,7 @@ class DisplayTagForm(QtGui.QDialog, Ui_DisplayTagDialog): def preLoad(self): """ Load the Tags from store so can be used in the system or used to - update the display. If Cancel was selected this is needed to reset the + update the display. If Cancel was selected this is needed to reset the dsiplay to the correct version. """ # Initial Load of the Tags diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index f2bcbbe7e..4eacc5959 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -45,7 +45,7 @@ class ValidEdit(QtGui.QLineEdit): def validText(self): """ - Only return Integers. Space is 0 + Only return Integers. Space is 0 """ if self.text().isEmpty(): return QtCore.QString(u'0') diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 974f98f61..0e04d7b46 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -266,7 +266,7 @@ class ThemeManager(QtGui.QWidget): oldThemeName = unicode(item.data(QtCore.Qt.UserRole).toString()) self.fileRenameForm.fileNameEdit.setText(oldThemeName) if self.fileRenameForm.exec_(): - newThemeName = unicode(self.fileRenameForm.fileNameEdit.text()) + newThemeName = unicode(self.fileRenameForm.fileNameEdit.text()) if self.checkIfThemeExists(newThemeName): oldThemeData = self.getThemeData(oldThemeName) self.cloneThemeData(oldThemeData, newThemeName) @@ -284,7 +284,7 @@ class ThemeManager(QtGui.QWidget): oldThemeName = unicode(item.data(QtCore.Qt.UserRole).toString()) self.fileRenameForm.fileNameEdit.setText(oldThemeName) if self.fileRenameForm.exec_(True): - newThemeName = unicode(self.fileRenameForm.fileNameEdit.text()) + newThemeName = unicode(self.fileRenameForm.fileNameEdit.text()) if self.checkIfThemeExists(newThemeName): themeData = self.getThemeData(oldThemeName) self.cloneThemeData(themeData, newThemeName) @@ -399,7 +399,7 @@ class ThemeManager(QtGui.QWidget): def onImportTheme(self): """ Opens a file dialog to select the theme file(s) to import before - attempting to extract OpenLP themes from those files. This process + attempting to extract OpenLP themes from those files. This process will load both OpenLP version 1 and version 2 themes. """ files = QtGui.QFileDialog.getOpenFileNames(self, diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 86372e080..70b994653 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -242,7 +242,7 @@ def add_actions(target, actions): The menu or toolbar to add actions to. ``actions`` - The actions to be added. An action consisting of the keyword 'None' + The actions to be added. An action consisting of the keyword 'None' will result in a separator being inserted into the target. """ for action in actions: @@ -318,7 +318,7 @@ def get_web_page(url, header=None, update_openlp=False): Tells OpenLP to update itself if the page is successfully downloaded. Defaults to False. """ - # TODO: Add proxy usage. Get proxy info from OpenLP settings, add to a + # TODO: Add proxy usage. Get proxy info from OpenLP settings, add to a # proxy_handler, build into an opener and install the opener into urllib2. # http://docs.python.org/library/urllib2.html if not url: diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index 63dd15466..5cf000ee1 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -322,7 +322,7 @@ class BibleDB(QtCore.QObject, Manager): def get_books(self): """ A wrapper so both local and web bibles have a get_books() method that - manager can call. Used in the media manager advanced search tab. + manager can call. Used in the media manager advanced search tab. """ return self.get_all_objects(Book, order_by_ref=Book.id) diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index 60b515f88..e13985e4b 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -238,8 +238,8 @@ class BGExtract(object): raw_verse_num = content.next clean_verse_num = 0 # Not all verses exist in all translations and may or may not be - # represented by a verse number. If they are not fine, if they are - # it will probably be in a format that breaks int(). We will then + # represented by a verse number. If they are not fine, if they are + # it will probably be in a format that breaks int(). We will then # have no idea what garbage may be sucked in to the verse text so # if we do not get a clean int() then ignore the verse completely. try: @@ -384,7 +384,7 @@ class HTTPBible(BibleDB): BibleDB.__init__(self, parent, **kwargs) self.download_source = kwargs[u'download_source'] self.download_name = kwargs[u'download_name'] - # TODO: Clean up proxy stuff. We probably want one global proxy per + # TODO: Clean up proxy stuff. We probably want one global proxy per # connection type (HTTP and HTTPS) at most. self.proxy_server = None self.proxy_username = None @@ -458,8 +458,8 @@ class HTTPBible(BibleDB): search_results = self.get_chapter(book, reference[1]) if search_results and search_results.has_verselist(): ## We have found a book of the bible lets check to see - ## if it was there. By reusing the returned book name - ## we get a correct book. For example it is possible + ## if it was there. By reusing the returned book name + ## we get a correct book. For example it is possible ## to request ac and get Acts back. bookname = search_results.book Receiver.send_message(u'openlp_process_events') diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 251ce350b..6794ec1ba 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -275,7 +275,7 @@ class BibleManager(object): 'Scripture Reference Error'), u'message': translate('BiblesPlugin.BibleManager', 'Your scripture reference is either not supported by OpenLP ' - 'or is invalid. Please make sure your reference conforms to ' + 'or is invalid. Please make sure your reference conforms to ' 'one of the following patterns:\n\n' 'Book Chapter\n' 'Book Chapter-Chapter\n' diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index ac3a2636b..3438f0279 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -63,7 +63,7 @@ class MediaPlugin(Plugin): if ext not in list: list.append(ext) self.serviceManager.supportedSuffixes(extension[1:]) - log.info(u'MediaPlugin: %s extensions: %s' % (mimetype, + log.info(u'MediaPlugin: %s extensions: %s' % (mimetype, u' '.join(extensions))) def about(self): diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py index 2880bd27a..48fb85ed3 100644 --- a/openlp/plugins/presentations/lib/impresscontroller.py +++ b/openlp/plugins/presentations/lib/impresscontroller.py @@ -211,8 +211,8 @@ class ImpressDocument(PresentationDocument): """ Called when a presentation is added to the SlideController. It builds the environment, starts communcations with the background - OpenOffice task started earlier. If OpenOffice is not present is is - started. Once the environment is available the presentation is loaded + OpenOffice task started earlier. If OpenOffice is not present is is + started. Once the environment is available the presentation is loaded and started. ``presentation`` diff --git a/openlp/plugins/presentations/lib/presentationcontroller.py b/openlp/plugins/presentations/lib/presentationcontroller.py index d995baa8c..bd37746c1 100644 --- a/openlp/plugins/presentations/lib/presentationcontroller.py +++ b/openlp/plugins/presentations/lib/presentationcontroller.py @@ -357,7 +357,7 @@ class PresentationController(object): def __init__(self, plugin=None, name=u'PresentationController', document_class=PresentationDocument): """ - This is the constructor for the presentationcontroller object. This + This is the constructor for the presentationcontroller object. This provides an easy way for descendent plugins to populate common data. This method *must* be overridden, like so:: diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index 173c89e13..c92569a4a 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -43,7 +43,7 @@ log = logging.getLogger(__name__) class HttpServer(object): """ Ability to control OpenLP via a webbrowser - e.g. http://localhost:4316/send/slidecontroller_live_next + e.g. http://localhost:4316/send/slidecontroller_live_next http://localhost:4316/send/alerts_text?q=your%20alert%20text """ def __init__(self, parent): diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index ef47e5694..0e874c3d5 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -557,7 +557,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): """ Check the validity of the song. """ - # This checks data in the form *not* self.song. self.song is still + # This checks data in the form *not* self.song. self.song is still # None at this point. log.debug(u'Validate Song') # Lets be nice and assume the data is correct. @@ -714,14 +714,14 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): def saveSong(self, preview=False): """ Get all the data from the widgets on the form, and then save it to the - database. The form has been validated and all reference items + database. The form has been validated and all reference items (Authors, Books and Topics) have been saved before this function is called. ``preview`` Should be ``True`` if the song is also previewed (boolean). """ - # The Song() assignment. No database calls should be made while a + # The Song() assignment. No database calls should be made while a # Song() is in a partially complete state. if not self.song: self.song = Song() diff --git a/openlp/plugins/songs/lib/easislidesimport.py b/openlp/plugins/songs/lib/easislidesimport.py index 67f889898..c4683765b 100644 --- a/openlp/plugins/songs/lib/easislidesimport.py +++ b/openlp/plugins/songs/lib/easislidesimport.py @@ -96,7 +96,7 @@ class EasiSlidesImport(SongImport): mandatory=False): """ Add imported values to the song model converting them to unicode at the - same time. If the unicode decode fails or a mandatory attribute is not + same time. If the unicode decode fails or a mandatory attribute is not present _success is set to False so the importer can react appropriately. diff --git a/openlp/plugins/songs/lib/ewimport.py b/openlp/plugins/songs/lib/ewimport.py index 2119cc245..1f4ded5bd 100644 --- a/openlp/plugins/songs/lib/ewimport.py +++ b/openlp/plugins/songs/lib/ewimport.py @@ -72,7 +72,7 @@ def strip_rtf(blob, encoding): elif control_str == 'tab': clear_text.append(u'\t') # Prefer the encoding specified by the RTF data to that - # specified by the Paradox table header + # specified by the Paradox table header # West European encoding elif control_str == 'fcharset0': encoding = u'cp1252' @@ -163,7 +163,7 @@ class EasyWorshipSongImport(SongImport): if code_page == 852: self.encoding = u'cp1250' # The following codepage to actual encoding mappings have not been - # observed, but merely guessed. Actual example files are needed. + # observed, but merely guessed. Actual example files are needed. elif code_page == 737: self.encoding = u'cp1253' elif code_page == 775: diff --git a/openlp/plugins/songs/lib/foilpresenterimport.py b/openlp/plugins/songs/lib/foilpresenterimport.py index e232d7d2f..c0f9f093d 100644 --- a/openlp/plugins/songs/lib/foilpresenterimport.py +++ b/openlp/plugins/songs/lib/foilpresenterimport.py @@ -296,7 +296,7 @@ class FoilPresenter(object): u'Text +u\.?n?d? +Musik', u'T & M', u'Melodie und Satz', u'Text[\w\,\. ]*:', u'Melodie', u'Musik', u'Satz', u'Weise', u'[dD]eutsch', u'[dD]t[\.\:]', u'Englisch', - u'[oO]riginal', u'Bearbeitung', u'[R|r]efrain'] + u'[oO]riginal', u'Bearbeitung', u'[R|r]efrain'] for marker in markers: copyright = re.compile(marker).sub(u'', copyright, re.U) copyright = re.compile(u'(?<=) *:').sub(u'', copyright) @@ -411,7 +411,7 @@ class FoilPresenter(object): temp_verse_order_backup = [] temp_sortnr_backup = 1 temp_sortnr_liste = [] - versenumber = {u'V': 1, u'C': 1, u'B': 1, u'E': 1, u'O': 1, u'I': 1, + versenumber = {u'V': 1, u'C': 1, u'B': 1, u'E': 1, u'O': 1, u'I': 1, u'P': 1} for strophe in foilpresenterfolie.strophen.strophe: text = self._child(strophe.text_) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 37579ce1d..d9e9b3063 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -199,7 +199,7 @@ class SongMediaItem(MediaManagerItem): """ log.debug(u'onSongListLoad') # Called to redisplay the song list screen edit from a search - # or from the exit of the Song edit dialog. If remote editing is active + # or from the exit of the Song edit dialog. If remote editing is active # Trigger it and clean up so it will not update again. if self.remoteTriggered == u'L': self.onAddClick() diff --git a/openlp/plugins/songs/lib/songimport.py b/openlp/plugins/songs/lib/songimport.py index 0212184f8..5bfba9b77 100644 --- a/openlp/plugins/songs/lib/songimport.py +++ b/openlp/plugins/songs/lib/songimport.py @@ -347,7 +347,7 @@ class SongImport(QtCore.QObject): """ For debugging """ - print u'========================================' \ + print u'========================================' \ + u'========================================' print u'TITLE: ' + self.title print u'ALT TITLE: ' + self.alternate_title From 123b1beded13310a55e8da0c370160742d1750f8 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 25 Feb 2011 18:27:06 +0100 Subject: [PATCH 5/8] added missing lines --- openlp/core/lib/db.py | 1 + openlp/core/lib/theme.py | 3 +++ openlp/plugins/presentations/lib/messagelistener.py | 1 + openlp/plugins/songs/lib/ewimport.py | 1 + openlp/plugins/songs/lib/mediaitem.py | 1 + openlp/plugins/songs/lib/opensongimport.py | 1 - 6 files changed, 7 insertions(+), 1 deletion(-) diff --git a/openlp/core/lib/db.py b/openlp/core/lib/db.py index f6a7fdaad..c92f992c8 100644 --- a/openlp/core/lib/db.py +++ b/openlp/core/lib/db.py @@ -91,6 +91,7 @@ class BaseModel(object): instance.__setattr__(key, kwargs[key]) return instance + class Manager(object): """ Provide generic object persistence management diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index 6f97c0608..ef26ca842 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -91,6 +91,7 @@ class ThemeLevel(object): Service = 2 Song = 3 + class BackgroundType(object): """ Type enumeration for backgrounds. @@ -123,6 +124,7 @@ class BackgroundType(object): elif type_string == u'image': return BackgroundType.Image + class BackgroundGradientType(object): """ Type enumeration for background gradients. @@ -200,6 +202,7 @@ INTEGER_LIST = [u'size', u'line_adjustment', u'x', u'height', u'y', u'width', u'shadow_size', u'outline_size', u'horizontal_align', u'vertical_align', u'wrap_style'] + class ThemeXML(object): """ A class to encapsulate the Theme XML. diff --git a/openlp/plugins/presentations/lib/messagelistener.py b/openlp/plugins/presentations/lib/messagelistener.py index cf43566ae..4db78f7a5 100644 --- a/openlp/plugins/presentations/lib/messagelistener.py +++ b/openlp/plugins/presentations/lib/messagelistener.py @@ -213,6 +213,7 @@ class Controller(object): def poll(self): self.doc.poll_slidenumber(self.is_live) + class MessageListener(object): """ This is the Presentation listener who acts on events from the slide diff --git a/openlp/plugins/songs/lib/ewimport.py b/openlp/plugins/songs/lib/ewimport.py index 1f4ded5bd..880c7f547 100644 --- a/openlp/plugins/songs/lib/ewimport.py +++ b/openlp/plugins/songs/lib/ewimport.py @@ -129,6 +129,7 @@ class FieldDescEntry: self.type = type self.size = size + class EasyWorshipSongImport(SongImport): """ The :class:`EasyWorshipSongImport` class provides OpenLP with the diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index d9e9b3063..d29e18c1d 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -53,6 +53,7 @@ class SongSearch(object): Authors = 4 Themes = 5 + class SongMediaItem(MediaManagerItem): """ This is the custom media manager item for Songs. diff --git a/openlp/plugins/songs/lib/opensongimport.py b/openlp/plugins/songs/lib/opensongimport.py index 8fddf5e4f..4da1234a5 100644 --- a/openlp/plugins/songs/lib/opensongimport.py +++ b/openlp/plugins/songs/lib/opensongimport.py @@ -36,7 +36,6 @@ from openlp.plugins.songs.lib.songimport import SongImport log = logging.getLogger(__name__) -#TODO: Use lxml for parsing and make sure we use methods of "SongImport" . class OpenSongImport(SongImport): """ Import songs exported from OpenSong From c12b84fa38417f4b2a3b11196a5beef118768da3 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 25 Feb 2011 18:05:02 +0000 Subject: [PATCH 6/8] Make static static --- openlp/core/lib/rendermanager.py | 34 +++++++++++++++----------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/openlp/core/lib/rendermanager.py b/openlp/core/lib/rendermanager.py index b68237b4a..eaf628a34 100644 --- a/openlp/core/lib/rendermanager.py +++ b/openlp/core/lib/rendermanager.py @@ -34,6 +34,15 @@ from openlp.core.ui import MainDisplay log = logging.getLogger(__name__) +VERSE = u'The Lord said to {r}Noah{/r}: \n' \ + 'There\'s gonna be a {su}floody{/su}, {sb}floody{/sb}\n' \ + 'The Lord said to {g}Noah{/g}:\n' \ + 'There\'s gonna be a {st}floody{/st}, {it}floody{/it}\n' \ + 'Get those children out of the muddy, muddy \n' \ + '{r}C{/r}{b}h{/b}{bl}i{/bl}{y}l{/y}{g}d{/g}{pk}' \ + 'r{/pk}{o}e{/o}{pp}n{/pp} of the Lord\n' +FOOTER = [u'Arky Arky (Unknown)', u'Public Domain', u'CCLI 123456'] + class RenderManager(object): """ Class to pull all Renderer interactions into one place. The plugins will @@ -202,28 +211,17 @@ class RenderManager(object): self.force_page = force_page # set the default image size for previews self.calculate_default(self.screens.preview[u'size']) - verse = u'The Lord said to {r}Noah{/r}: \n' \ - 'There\'s gonna be a {su}floody{/su}, {sb}floody{/sb}\n' \ - 'The Lord said to {g}Noah{/g}:\n' \ - 'There\'s gonna be a {st}floody{/st}, {it}floody{/it}\n' \ - 'Get those children out of the muddy, muddy \n' \ - '{r}C{/r}{b}h{/b}{bl}i{/bl}{y}l{/y}{g}d{/g}{pk}' \ - 'r{/pk}{o}e{/o}{pp}n{/pp} of the Lord\n' - # make big page for theme edit dialog to get line count - if self.force_page: - verse = verse + verse + verse - else: - self.image_manager.del_image(theme_data.theme_name) - footer = [] - footer.append(u'Arky Arky (Unknown)') - footer.append(u'Public Domain') - footer.append(u'CCLI 123456') # build a service item to generate preview serviceItem = ServiceItem() serviceItem.theme = theme_data - serviceItem.add_from_text(u'', verse, footer) + if self.force_page: + # make big page for theme edit dialog to get line count + serviceItem.add_from_text(u'', VERSE + VERSE + VERSE, FOOTER) + else: + self.image_manager.del_image(theme_data.theme_name) + serviceItem.add_from_text(u'', VERSE, FOOTER) serviceItem.render_manager = self - serviceItem.raw_footer = footer + serviceItem.raw_footer = FOOTER serviceItem.render(True) if not self.force_page: self.display.buildHtml(serviceItem) From fe2f80d1478c63a910f08b67142132c84723fe49 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Sat, 26 Feb 2011 00:34:46 +0000 Subject: [PATCH 7/8] Fix BibleGateway Jesus' speech --- openlp/plugins/bibles/lib/http.py | 38 ++++++++++++++++++------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index 60b515f88..fcb1467f2 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -35,7 +35,7 @@ import socket import urllib from HTMLParser import HTMLParseError -from BeautifulSoup import BeautifulSoup, NavigableString +from BeautifulSoup import BeautifulSoup, NavigableString, Tag from openlp.core.lib import Receiver, translate from openlp.core.lib.ui import critical_error_message_box @@ -221,21 +221,14 @@ class BGExtract(object): crossrefs = soup.findAll(u'sup', u'xref') if crossrefs: [crossref.extract() for crossref in crossrefs] + headings = soup.findAll(u'h5') + if headings: + [heading.extract() for heading in headings] cleanup = [(re.compile('\s+'), lambda match: ' ')] verses = BeautifulSoup(str(soup), markupMassage=cleanup) - content = verses.find(u'div', u'result-text-style-normal') - if not content: - content = verses.find(u'div', u'result-text-style-rtl-serif') - if not content: - log.debug(u'No content found in the BibleGateway response.') - send_error_message(u'parse') - return None - verse_count = len(verses.findAll(u'sup', u'versenum')) - found_count = 0 verse_list = {} - while found_count < verse_count: - content = content.findNext(u'sup', u'versenum') - raw_verse_num = content.next + for verse in verses(u'sup', u'versenum'): + raw_verse_num = verse.next clean_verse_num = 0 # Not all verses exist in all translations and may or may not be # represented by a verse number. If they are not fine, if they are @@ -248,9 +241,22 @@ class BGExtract(object): log.exception(u'Illegal verse number in %s %s %s:%s', version, bookname, chapter, unicode(raw_verse_num)) if clean_verse_num: - raw_verse_text = raw_verse_num.next - verse_list[clean_verse_num] = unicode(raw_verse_text) - found_count += 1 + verse_text = raw_verse_num.next + part = raw_verse_num.next.next + while not (isinstance(part, Tag) and part.attrMap and + part.attrMap[u'class'] == u'versenum'): + # While we are still in the same verse grab all the text. + if isinstance(part, NavigableString): + verse_text = verse_text + part + if isinstance(part.next, Tag) and part.next.name == u'div': + # Run out of verses so stop. + break + part = part.next + verse_list[clean_verse_num] = unicode(verse_text) + if not verse_list: + log.debug(u'No content found in the BibleGateway response.') + send_error_message(u'parse') + return None return SearchResults(bookname, chapter, verse_list) From 631d8e84ff8e068320821631195869e6eec6d558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Armin=20K=C3=B6hler?= Date: Sat, 26 Feb 2011 09:14:37 +0100 Subject: [PATCH 8/8] adapt regex define author_temp again --- openlp/plugins/songs/lib/foilpresenterimport.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/songs/lib/foilpresenterimport.py b/openlp/plugins/songs/lib/foilpresenterimport.py index c0f9f093d..0d81e6f41 100644 --- a/openlp/plugins/songs/lib/foilpresenterimport.py +++ b/openlp/plugins/songs/lib/foilpresenterimport.py @@ -314,14 +314,15 @@ class FoilPresenter(object): i = 1 else: i = 1 + author_temp = [] for author in strings: temp = re.split(u',(?=\D{2})|(?<=\D),|\/(?=\D{3,})|(?<=\D);', author) for tempx in temp: author_temp.append(tempx) for author in author_temp: - regex = u'^[\/,;\-\s]+|[\/,;\-\s]+$|'\ - '\s*[0-9]{4}\s*[\-\/]?\s*([0-9]{4})?[\/,;\-\s]*$' + regex = u'^[\/,;\-\s\.]+|[\/,;\-\s\.]+$|'\ + '\s*[0-9]{4}\s*[\-\/]?\s*([0-9]{4})?[\/,;\-\s\.]*$' author = re.compile(regex).sub(u'', author) author = re.compile( u'[0-9]{1,2}\.\s?J(ahr)?h\.|um\s*$|vor\s*$').sub(u'',