From d9768b6536f6d64cba63ac5bf53749d3b6b92b23 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 13 Dec 2010 15:24:16 +0100 Subject: [PATCH] whitespaces --- openlp/core/lib/mailto/__init__.py | 6 +-- openlp/core/ui/exceptionform.py | 4 +- openlp/plugins/bibles/lib/mediaitem.py | 2 +- openlp/plugins/images/imageplugin.py | 14 +++--- .../presentations/lib/impresscontroller.py | 12 ++--- .../presentations/lib/messagelistener.py | 4 +- .../presentations/lib/pptviewcontroller.py | 2 +- .../presentations/lib/presentationtab.py | 2 +- .../presentations/presentationplugin.py | 10 ++-- openlp/plugins/remotes/remoteplugin.py | 2 +- .../songs/forms/songmaintenanceform.py | 2 +- openlp/plugins/songs/lib/ewimport.py | 2 +- openlp/plugins/songs/lib/oooimport.py | 16 +++--- openlp/plugins/songs/lib/opensongimport.py | 4 +- openlp/plugins/songs/lib/sofimport.py | 50 +++++++++---------- openlp/plugins/songs/lib/songbeamerimport.py | 6 +-- scripts/openlp-remoteclient.py | 2 +- 17 files changed, 70 insertions(+), 70 deletions(-) mode change 100755 => 100644 scripts/openlp-remoteclient.py diff --git a/openlp/core/lib/mailto/__init__.py b/openlp/core/lib/mailto/__init__.py index 102c4c94a..9cfc319a8 100644 --- a/openlp/core/lib/mailto/__init__.py +++ b/openlp/core/lib/mailto/__init__.py @@ -300,13 +300,13 @@ def mailto(address, to=None, cc=None, bcc=None, subject=None, body=None, ``cc`` specify a recipient to be copied on the e-mail - ``bcc`` + ``bcc`` specify a recipient to be blindly copied on the e-mail - ``subject`` + ``subject`` specify a subject for the e-mail - ``body`` + ``body`` specify a body for the e-mail. Since the user will be able to make changes before actually sending the e-mail, this can be used to provide the user with a template for the e-mail text may contain linebreaks diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py index 5fa0a7dd1..7ccf3fc4c 100644 --- a/openlp/core/ui/exceptionform.py +++ b/openlp/core/ui/exceptionform.py @@ -70,7 +70,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): def _createReport(self): openlp_version = self.parent().applicationVersion[u'full'] - traceback = unicode(self.exceptionTextEdit.toPlainText()) + traceback = unicode(self.exceptionTextEdit.toPlainText()) system = unicode(translate('OpenLP.ExceptionForm', 'Platform: %s\n')) % platform.platform() libraries = u'Python: %s\n' % platform.python_version() + \ @@ -89,7 +89,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): elif os.environ.get(u'GNOME_DESKTOP_SESSION_ID'): system = system + u'Desktop: GNOME\n' return (openlp_version, traceback, system, libraries) - + def onSaveReportButtonPressed(self): """ Saving exception log and system informations to a file. diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 949035c0b..339dac41f 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -875,7 +875,7 @@ class BibleMediaItem(MediaManagerItem): old_second_bible = self._decodeQtObject(old_bitem, 'second_bible') if old_bible != bible or old_second_bible != second_bible or \ old_book != book: - # The bible, second bible or book has changed. + # The bible, second bible or book has changed. return True elif old_verse + 1 != verse and old_chapter == chapter: # We are still in the same chapter, but a verse has been skipped. diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py index 5bcf75af0..a1e539799 100644 --- a/openlp/plugins/images/imageplugin.py +++ b/openlp/plugins/images/imageplugin.py @@ -75,42 +75,42 @@ class ImagePlugin(Plugin): ## Load Button ## self.textStrings[StringContent.Load] = { u'title': translate('ImagePlugin', 'Load'), - u'tooltip': translate('ImagePlugin', + u'tooltip': translate('ImagePlugin', 'Load a new Image') } ## New Button ## self.textStrings[StringContent.New] = { u'title': translate('ImagePlugin', 'Add'), - u'tooltip': translate('ImagePlugin', + u'tooltip': translate('ImagePlugin', 'Add a new Image') } ## Edit Button ## self.textStrings[StringContent.Edit] = { u'title': translate('ImagePlugin', 'Edit'), - u'tooltip': translate('ImagePlugin', + u'tooltip': translate('ImagePlugin', 'Edit the selected Image') } ## Delete Button ## self.textStrings[StringContent.Delete] = { u'title': translate('ImagePlugin', 'Delete'), - u'tooltip': translate('ImagePlugin', + u'tooltip': translate('ImagePlugin', 'Delete the selected Image') } ## Preview ## self.textStrings[StringContent.Preview] = { u'title': translate('ImagePlugin', 'Preview'), - u'tooltip': translate('ImagePlugin', + u'tooltip': translate('ImagePlugin', 'Preview the selected Image') } ## Live Button ## self.textStrings[StringContent.Live] = { u'title': translate('ImagePlugin', 'Live'), - u'tooltip': translate('ImagePlugin', + u'tooltip': translate('ImagePlugin', 'Send the selected Image live') } ## Add to service Button ## self.textStrings[StringContent.Service] = { u'title': translate('ImagePlugin', 'Service'), - u'tooltip': translate('ImagePlugin', + u'tooltip': translate('ImagePlugin', 'Add the selected Image to the service') } \ No newline at end of file diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py index 69c9347f9..8f8e06734 100644 --- a/openlp/plugins/presentations/lib/impresscontroller.py +++ b/openlp/plugins/presentations/lib/impresscontroller.py @@ -48,7 +48,7 @@ else: uno_available = True except ImportError: uno_available = False - + from PyQt4 import QtCore from presentationcontroller import PresentationController, PresentationDocument @@ -210,12 +210,12 @@ class ImpressController(PresentationController): class ImpressDocument(PresentationDocument): """ Class which holds information and controls a single presentation - """ - + """ + def __init__(self, controller, presentation): """ - Constructor, store information about the file and initialise - """ + Constructor, store information about the file and initialise + """ log.debug(u'Init Presentation OpenOffice') PresentationDocument.__init__(self, controller, presentation) self.document = None @@ -287,7 +287,7 @@ class ImpressDocument(PresentationDocument): page = pages.getByIndex(idx) doc.getCurrentController().setCurrentPage(page) urlpath = u'%s/%s.png' % (thumbdirurl, unicode(idx + 1)) - path = os.path.join(self.get_temp_folder(), + path = os.path.join(self.get_temp_folder(), unicode(idx + 1) + u'.png') try: doc.storeToURL(urlpath, props) diff --git a/openlp/plugins/presentations/lib/messagelistener.py b/openlp/plugins/presentations/lib/messagelistener.py index 6fd901a86..535744369 100644 --- a/openlp/plugins/presentations/lib/messagelistener.py +++ b/openlp/plugins/presentations/lib/messagelistener.py @@ -51,7 +51,7 @@ class Controller(object): def add_handler(self, controller, file, is_blank): """ - Add a handler, which is an instance of a presentation and + Add a handler, which is an instance of a presentation and slidecontroller combination. If the slidecontroller has a display then load the presentation. """ @@ -362,7 +362,7 @@ class MessageListener(object): def timeout(self): """ - The presentation may be timed or might be controlled by the + The presentation may be timed or might be controlled by the application directly, rather than through OpenLP. Poll occassionally to check which slide is currently displayed so the slidecontroller view can be updated diff --git a/openlp/plugins/presentations/lib/pptviewcontroller.py b/openlp/plugins/presentations/lib/pptviewcontroller.py index 54b09be32..281e647de 100644 --- a/openlp/plugins/presentations/lib/pptviewcontroller.py +++ b/openlp/plugins/presentations/lib/pptviewcontroller.py @@ -108,7 +108,7 @@ class PptviewDocument(PresentationDocument): """ def __init__(self, controller, presentation): """ - Constructor, store information about the file and initialise + Constructor, store information about the file and initialise """ log.debug(u'Init Presentation PowerPoint') PresentationDocument.__init__(self, controller, presentation) diff --git a/openlp/plugins/presentations/lib/presentationtab.py b/openlp/plugins/presentations/lib/presentationtab.py index a7b16cd5a..d1ebb570c 100644 --- a/openlp/plugins/presentations/lib/presentationtab.py +++ b/openlp/plugins/presentations/lib/presentationtab.py @@ -133,7 +133,7 @@ class PresentationTab(SettingsTab): self.settingsSection + u'/' + controller.name, QtCore.QVariant(QtCore.Qt.Checked)).toInt()[0]) self.OverrideAppCheckBox.setChecked(QtCore.QSettings().value( - self.settingsSection + u'/override app', + self.settingsSection + u'/override app', QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0]) def save(self): diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index 8ee3e2811..300314bde 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -163,30 +163,30 @@ class PresentationPlugin(Plugin): ## Load Button ## self.textStrings[StringContent.Load] = { u'title': translate('PresentationPlugin', 'Load'), - u'tooltip': translate('PresentationPlugin', + u'tooltip': translate('PresentationPlugin', 'Load a new Presentation') } ## Delete Button ## self.textStrings[StringContent.Delete] = { u'title': translate('PresentationPlugin', 'Delete'), - u'tooltip': translate('PresentationPlugin', + u'tooltip': translate('PresentationPlugin', 'Delete the selected Presentation') } ## Preview ## self.textStrings[StringContent.Preview] = { u'title': translate('PresentationPlugin', 'Preview'), - u'tooltip': translate('PresentationPlugin', + u'tooltip': translate('PresentationPlugin', 'Preview the selected Presentation') } ## Live Button ## self.textStrings[StringContent.Live] = { u'title': translate('PresentationPlugin', 'Live'), - u'tooltip': translate('PresentationPlugin', + u'tooltip': translate('PresentationPlugin', 'Send the selected Presentation live') } ## Add to service Button ## self.textStrings[StringContent.Service] = { u'title': translate('PresentationPlugin', 'Service'), - u'tooltip': translate('PresentationPlugin', + u'tooltip': translate('PresentationPlugin', 'Add the selected Presentation to the service') } diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py index 4302486a3..fe2776802 100644 --- a/openlp/plugins/remotes/remoteplugin.py +++ b/openlp/plugins/remotes/remoteplugin.py @@ -77,7 +77,7 @@ class RemotesPlugin(Plugin): 'a running version of OpenLP on a different computer via a web ' 'browser or through the remote API.') return about_text - + def setPluginTextStrings(self): """ Called to define all translatable texts of the plugin diff --git a/openlp/plugins/songs/forms/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py index e057bb516..f004ef026 100644 --- a/openlp/plugins/songs/forms/songmaintenanceform.py +++ b/openlp/plugins/songs/forms/songmaintenanceform.py @@ -411,7 +411,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): """ existing_author = self.manager.get_object_filtered(Author, and_(Author.first_name == old_author.first_name, - Author.last_name == old_author.last_name, + Author.last_name == old_author.last_name, Author.display_name == old_author.display_name)) songs = self.manager.get_all_objects(Song, Song.authors.contains(old_author)) diff --git a/openlp/plugins/songs/lib/ewimport.py b/openlp/plugins/songs/lib/ewimport.py index cb360cf59..6b9b675c5 100644 --- a/openlp/plugins/songs/lib/ewimport.py +++ b/openlp/plugins/songs/lib/ewimport.py @@ -41,7 +41,7 @@ def strip_rtf(blob, encoding): control_word = [] for c in blob: if control: - # for delimiters, set control to False + # for delimiters, set control to False if c == '{': if len(control_word) > 0: depth += 1 diff --git a/openlp/plugins/songs/lib/oooimport.py b/openlp/plugins/songs/lib/oooimport.py index 26a0abfcc..727af2c7b 100644 --- a/openlp/plugins/songs/lib/oooimport.py +++ b/openlp/plugins/songs/lib/oooimport.py @@ -46,7 +46,7 @@ else: class OooImport(SongImport): """ - Import songs from Impress/Powerpoint docs using Impress + Import songs from Impress/Powerpoint docs using Impress """ def __init__(self, master_manager, **kwargs): """ @@ -122,7 +122,7 @@ class OooImport(SongImport): manager = ctx.ServiceManager self.desktop = manager.createInstanceWithContext( "com.sun.star.frame.Desktop", ctx) - + def start_ooo_process(self): try: if os.name == u'nt': @@ -168,11 +168,11 @@ class OooImport(SongImport): u'Processing file ' + filepath, 0) except: pass - return + return def close_ooo_file(self): """ - Close file. + Close file. """ self.document.close(True) self.document = None @@ -187,7 +187,7 @@ class OooImport(SongImport): def process_pres(self): """ Process the file - """ + """ doc = self.document slides = doc.getDrawPages() text = u'' @@ -195,7 +195,7 @@ class OooImport(SongImport): if self.abort: self.import_wizard.incrementProgressBar(u'Import cancelled', 0) return - slide = slides.getByIndex(slide_no) + slide = slides.getByIndex(slide_no) slidetext = u'' for idx in range(slide.getCount()): shape = slide.getByIndex(idx) @@ -209,12 +209,12 @@ class OooImport(SongImport): songs = SongImport.process_songs_text(self.manager, text) for song in songs: song.finish() - return + return def process_doc(self): """ Process the doc file, a paragraph at a time - """ + """ text = u'' paragraphs = self.document.getText().createEnumeration() while paragraphs.hasMoreElements(): diff --git a/openlp/plugins/songs/lib/opensongimport.py b/openlp/plugins/songs/lib/opensongimport.py index 47f4ecee5..767fc012a 100644 --- a/openlp/plugins/songs/lib/opensongimport.py +++ b/openlp/plugins/songs/lib/opensongimport.py @@ -249,7 +249,7 @@ class OpenSongImport(SongImport): words = thisline[1:].strip() if words is None: words = thisline - if not versenum: + if not versenum: versenum = u'1' if versenum is not None: versetag = u'%s%s' % (versetype, versenum) @@ -298,7 +298,7 @@ class OpenSongImport(SongImport): for tag in order: if tag[0].isdigit(): # Assume it's a verse if it has no prefix - tag = u'V' + tag + tag = u'V' + tag elif not re.search('\d+', tag): # Assume it's no.1 if there's no digits tag = tag + u'1' diff --git a/openlp/plugins/songs/lib/sofimport.py b/openlp/plugins/songs/lib/sofimport.py index ab91e1923..b9cd428c0 100644 --- a/openlp/plugins/songs/lib/sofimport.py +++ b/openlp/plugins/songs/lib/sofimport.py @@ -56,13 +56,13 @@ class SofImport(OooImport): """ Import songs provided on disks with the Songs of Fellowship music books VOLS1_2.RTF, sof3words.rtf and sof4words.rtf - + Use OpenOffice.org Writer for processing the rtf file - The three books are not only inconsistant with each other, they are + The three books are not only inconsistant with each other, they are inconsistant in themselves too with their formatting. Not only this, but the 1+2 book does not space out verses correctly. This script attempts - to sort it out, but doesn't get it 100% right. But better than having to + to sort it out, but doesn't get it 100% right. But better than having to type them all out! It attempts to detect italiced verses, and treats these as choruses in @@ -96,7 +96,7 @@ class SofImport(OooImport): def process_sof_file(self): """ Process the RTF file, a paragraph at a time - """ + """ self.blanklines = 0 self.new_song() paragraphs = self.document.getText().createEnumeration() @@ -113,11 +113,11 @@ class SofImport(OooImport): def process_paragraph(self, paragraph): """ - Process a paragraph. + Process a paragraph. In the first book, a paragraph is a single line. In the latter ones they may contain multiple lines. Each paragraph contains textportions. Each textportion has it's own - styling, e.g. italics, bold etc. + styling, e.g. italics, bold etc. Also check for page breaks, which indicates a new song in books 1+2. In later books, there may not be line breaks, so check for 3 or more newlines @@ -136,7 +136,7 @@ class SofImport(OooImport): self.new_song() text = u'' self.process_paragraph_text(text) - + def process_paragraph_text(self, text): """ Split the paragraph text into multiple lines and process @@ -147,12 +147,12 @@ class SofImport(OooImport): self.new_song() def process_paragraph_line(self, text): - """ + """ Process a single line. Throw away that text which isn't relevant, i.e. stuff that appears at the end of the song. Anything that is OK, append to the current verse """ - text = text.strip() + text = text.strip() if text == u'': self.blanklines += 1 if self.blanklines > 1: @@ -164,7 +164,7 @@ class SofImport(OooImport): if self.skip_to_close_bracket: if text.endswith(u')'): self.skip_to_close_bracket = False - return + return if text.startswith(u'CCL Licence'): self.italics = False return @@ -264,7 +264,7 @@ class SofImport(OooImport): """ Add the author. OpenLP stores them individually so split by 'and', '&' and comma. - However need to check for "Mr and Mrs Smith" and turn it to + However need to check for "Mr and Mrs Smith" and turn it to "Mr Smith" and "Mrs Smith". """ text = text.replace(u' and ', u' & ') @@ -276,7 +276,7 @@ class SofImport(OooImport): we're beyond the second line of first verse, then this indicates a change of verse. Italics are a chorus """ - if self.italics != self.is_chorus and ((len(self.song.verses) > 0) or + if self.italics != self.is_chorus and ((len(self.song.verses) > 0) or (self.currentverse.count(u'\n') > 1)): self.finish_verse() if self.italics: @@ -307,7 +307,7 @@ class SofImport(OooImport): ln = 0 if line: verse = line + u'\n' - else: + else: verse = u'' else: verse += line + u'\n' @@ -320,34 +320,34 @@ class SofImport(OooImport): def uncap_text(self, text): - """ + """ Words in the title are in all capitals, so we lowercase them. - However some of these words, e.g. referring to God need a leading + However some of these words, e.g. referring to God need a leading capital letter. - - There is a complicated word "One", which is sometimes lower and + + There is a complicated word "One", which is sometimes lower and sometimes upper depending on context. Never mind, keep it lower. """ textarr = re.split(u'(\W+)', text) textarr[0] = textarr[0].capitalize() for i in range(1, len(textarr)): # Do not translate these. Fixed strings in SOF song file - if textarr[i] in (u'JESUS', u'CHRIST', u'KING', u'ALMIGHTY', - u'REDEEMER', u'SHEPHERD', u'SON', u'GOD', u'LORD', u'FATHER', - u'HOLY', u'SPIRIT', u'LAMB', u'YOU', u'YOUR', u'I', u'I\'VE', - u'I\'M', u'I\'LL', u'SAVIOUR', u'O', u'YOU\'RE', u'HE', u'HIS', - u'HIM', u'ZION', u'EMMANUEL', u'MAJESTY', u'JESUS\'', u'JIREH', - u'JUDAH', u'LION', u'LORD\'S', u'ABRAHAM', u'GOD\'S', + if textarr[i] in (u'JESUS', u'CHRIST', u'KING', u'ALMIGHTY', + u'REDEEMER', u'SHEPHERD', u'SON', u'GOD', u'LORD', u'FATHER', + u'HOLY', u'SPIRIT', u'LAMB', u'YOU', u'YOUR', u'I', u'I\'VE', + u'I\'M', u'I\'LL', u'SAVIOUR', u'O', u'YOU\'RE', u'HE', u'HIS', + u'HIM', u'ZION', u'EMMANUEL', u'MAJESTY', u'JESUS\'', u'JIREH', + u'JUDAH', u'LION', u'LORD\'S', u'ABRAHAM', u'GOD\'S', u'FATHER\'S', u'ELIJAH'): textarr[i] = textarr[i].capitalize() else: textarr[i] = textarr[i].lower() text = u''.join(textarr) return text - + def verse_splits(self, song_number): """ - Because someone at Kingsway forgot to check the 1+2 RTF file, + Because someone at Kingsway forgot to check the 1+2 RTF file, some verses were not formatted correctly. """ if song_number == 11: diff --git a/openlp/plugins/songs/lib/songbeamerimport.py b/openlp/plugins/songs/lib/songbeamerimport.py index 30d29c1be..f45fcc268 100644 --- a/openlp/plugins/songs/lib/songbeamerimport.py +++ b/openlp/plugins/songs/lib/songbeamerimport.py @@ -24,7 +24,7 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### """ -The :mod:`songbeamerimport` module provides the functionality for importing +The :mod:`songbeamerimport` module provides the functionality for importing SongBeamer songs into the OpenLP database. """ import logging @@ -90,7 +90,7 @@ class SongBeamerImport(SongImport): len(self.import_source)) for file in self.import_source: # TODO: check that it is a valid SongBeamer file - self.current_verse = u'' + self.current_verse = u'' self.current_verse_type = u'V' read_verses = False self.file_name = os.path.split(file)[1] @@ -115,7 +115,7 @@ class SongBeamerImport(SongImport): self.replace_html_tags() self.add_verse(self.current_verse, self.current_verse_type) - self.current_verse = u'' + self.current_verse = u'' self.current_verse_type = u'V' read_verses = True verse_start = True diff --git a/scripts/openlp-remoteclient.py b/scripts/openlp-remoteclient.py old mode 100755 new mode 100644 index 9d047d478..34fef44a8 --- a/scripts/openlp-remoteclient.py +++ b/scripts/openlp-remoteclient.py @@ -47,7 +47,7 @@ def main(): help="Recipient address ", default="localhost") parser.add_option("-e", "--event", - help="Action to be performed", + help="Action to be performed", default="alerts_text") parser.add_option("-m", "--message", help="Message to be passed for the action",