← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~sfindlay/openlp/cleanup into lp:openlp

 

Samuel Findlay has proposed merging lp:~sfindlay/openlp/cleanup into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~sfindlay/openlp/cleanup/+merge/113846

Various tidy-ups:
* themeform: spelling
* easyslidesimport: old code, comment copied from elsewhere
* importer: clarify docstring
* zionworximport: module constant, variable names
-- 
https://code.launchpad.net/~sfindlay/openlp/cleanup/+merge/113846
Your team OpenLP Core is requested to review the proposed merge of lp:~sfindlay/openlp/cleanup into lp:openlp.
=== modified file 'openlp/core/ui/themeform.py'
--- openlp/core/ui/themeform.py	2012-07-02 17:32:41 +0000
+++ openlp/core/ui/themeform.py	2012-07-08 08:48:19 +0000
@@ -226,7 +226,7 @@
 
     def onCurrentIdChanged(self, pageId):
         """
-        Detects Page changes and updates as approprate.
+        Detects Page changes and updates as appropriate.
         """
         enabled = self.page(pageId) == self.areaPositionPage
         self.setOption(QtGui.QWizard.HaveCustomButton1, enabled)

=== modified file 'openlp/plugins/songs/lib/easyslidesimport.py'
--- openlp/plugins/songs/lib/easyslidesimport.py	2012-06-22 14:14:53 +0000
+++ openlp/plugins/songs/lib/easyslidesimport.py	2012-07-08 08:48:19 +0000
@@ -48,15 +48,8 @@
         Initialise the class.
         """
         SongImport.__init__(self, manager, **kwargs)
-        self.commit = True
 
     def doImport(self):
-        """
-        Import either each of the files in self.importSources - each element of
-        which can be either a single opensong file, or a zipfile containing
-        multiple opensong files. If `self.commit` is set False, the
-        import will not be committed to the database (useful for test scripts).
-        """
         log.info(u'Importing EasySlides XML file %s', self.importSource)
         parser = etree.XMLParser(remove_blank_text=True)
         parsed_file = etree.parse(self.importSource, parser)

=== modified file 'openlp/plugins/songs/lib/importer.py'
--- openlp/plugins/songs/lib/importer.py	2012-07-04 09:50:31 +0000
+++ openlp/plugins/songs/lib/importer.py	2012-07-08 08:48:19 +0000
@@ -100,6 +100,7 @@
 
     ``u'canDisable'``
         Whether song format importer is disablable.
+        If ``True``, then ``u'disabledLabelText'`` must also be defined.
 
     ``u'availability'``
         Whether song format importer is available.

=== modified file 'openlp/plugins/songs/lib/zionworximport.py'
--- openlp/plugins/songs/lib/zionworximport.py	2012-06-22 14:14:53 +0000
+++ openlp/plugins/songs/lib/zionworximport.py	2012-07-08 08:48:19 +0000
@@ -37,6 +37,9 @@
 
 log = logging.getLogger(__name__)
 
+# Used to strip control chars (except 10=LF, 13=CR)
+CONTROL_CHARS_MAP = dict.fromkeys(range(10) + [11, 12] + range(14,32) + [127])
+
 class ZionWorxImport(SongImport):
     """
     The :class:`ZionWorxImport` class provides the ability to import songs
@@ -78,13 +81,10 @@
         """
         Receive a CSV file (from a ZionWorx database dump) to import.
         """
-        # Used to strip control chars (10=LF, 13=CR, 127=DEL)
-        self.control_chars_map = dict.fromkeys(
-            range(10) + [11, 12] + range(14,32) + [127])
         with open(self.importSource, 'rb') as songs_file:
-            fieldnames = [u'SongNum', u'Title1', u'Title2', u'Lyrics',
+            field_names = [u'SongNum', u'Title1', u'Title2', u'Lyrics',
                 u'Writer', u'Copyright', u'Keywords', u'DefaultStyle']
-            songs_reader = csv.DictReader(songs_file, fieldnames)
+            songs_reader = csv.DictReader(songs_file, field_names)
             try:
                 records = list(songs_reader)
             except csv.Error, e:
@@ -140,4 +140,4 @@
         """
         # This encoding choice seems OK. ZionWorx has no option for setting the
         # encoding for its songs, so we assume encoding is always the same.
-        return unicode(str, u'cp1252').translate(self.control_chars_map)
+        return unicode(str, u'cp1252').translate(CONTROL_CHARS_MAP)


Follow ups