← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~meths/openlp/trivialfixes into lp:openlp

 

Jon Tibble has proposed merging lp:~meths/openlp/trivialfixes into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)


Fixes and cleanups:
* Fix settings call and icons in Song Wizard
* Whitespace cleanups
* Remove getters and setters
-- 
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/30174
Your team OpenLP Core is requested to review the proposed merge of lp:~meths/openlp/trivialfixes into lp:openlp.
=== modified file 'openlp/plugins/songs/forms/songimportform.py'
--- openlp/plugins/songs/forms/songimportform.py	2010-06-30 22:05:51 +0000
+++ openlp/plugins/songs/forms/songimportform.py	2010-07-17 13:28:44 +0000
@@ -178,7 +178,8 @@
             SettingsManager.get_last_dir(self.songsplugin.settingsSection, 1))
         if filename:
             editbox.setText(filename)
-            self.config.set_last_dir(filename, 1)
+            SettingsManager.set_last_dir(self.songsplugin.settingsSection,
+                filename, 1)
 
     def incrementProgressBar(self, status_text):
         log.debug(u'IncrementBar %s', status_text)
@@ -253,4 +254,4 @@
         self.ImportProgressBar.setValue(self.ImportProgressBar.maximum())
         self.finishButton.setVisible(True)
         self.cancelButton.setVisible(False)
-        Receiver.send_message(u'process_events')
\ No newline at end of file
+        Receiver.send_message(u'process_events')

=== modified file 'openlp/plugins/songs/forms/songimportwizard.py'
--- openlp/plugins/songs/forms/songimportwizard.py	2010-07-08 11:46:03 +0000
+++ openlp/plugins/songs/forms/songimportwizard.py	2010-07-17 13:28:44 +0000
@@ -109,16 +109,16 @@
         self.OpenLyricsButtonLayout.setSpacing(8)
         self.OpenLyricsButtonLayout.setObjectName(u'OpenLyricsButtonLayout')
         self.OpenLyricsAddButton = QtGui.QPushButton(self.OpenLyricsPage)
-        self.OpenLyricsAddButton.setIcon(
-            build_icon(u':/general/general_open.png'))
+        openIcon = build_icon(u':/general/general_open.png')
+        self.OpenLyricsAddButton.setIcon(openIcon)
         self.OpenLyricsAddButton.setObjectName(u'OpenLyricsAddButton')
         self.OpenLyricsButtonLayout.addWidget(self.OpenLyricsAddButton)
         self.OpenLyricsButtonSpacer = QtGui.QSpacerItem(40, 20,
             QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
         self.OpenLyricsButtonLayout.addItem(self.OpenLyricsButtonSpacer)
         self.OpenLyricsRemoveButton = QtGui.QPushButton(self.OpenLyricsPage)
-        self.OpenLyricsRemoveButton.setIcon(
-            build_icon(u':/general/general_delete.png'))
+        deleteIcon = build_icon(u':/general/general_delete.png')
+        self.OpenLyricsRemoveButton.setIcon(deleteIcon)
         self.OpenLyricsRemoveButton.setObjectName(u'OpenLyricsRemoveButton')
         self.OpenLyricsButtonLayout.addWidget(self.OpenLyricsRemoveButton)
         self.OpenLyricsLayout.addLayout(self.OpenLyricsButtonLayout)
@@ -136,14 +136,14 @@
         self.OpenSongButtonLayout.setSpacing(8)
         self.OpenSongButtonLayout.setObjectName(u'OpenSongButtonLayout')
         self.OpenSongAddButton = QtGui.QPushButton(self.OpenSongPage)
-        self.OpenSongAddButton.setIcon(self.OpenIcon)
+        self.OpenSongAddButton.setIcon(openIcon)
         self.OpenSongAddButton.setObjectName(u'OpenSongAddButton')
         self.OpenSongButtonLayout.addWidget(self.OpenSongAddButton)
         self.OpenSongButtonSpacer = QtGui.QSpacerItem(40, 20,
             QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
         self.OpenSongButtonLayout.addItem(self.OpenSongButtonSpacer)
         self.OpenSongRemoveButton = QtGui.QPushButton(self.OpenSongPage)
-        self.OpenSongRemoveButton.setIcon(self.DeleteIcon)
+        self.OpenSongRemoveButton.setIcon(deleteIcon)
         self.OpenSongRemoveButton.setObjectName(u'OpenSongRemoveButton')
         self.OpenSongButtonLayout.addWidget(self.OpenSongRemoveButton)
         self.OpenSongLayout.addLayout(self.OpenSongButtonLayout)
@@ -161,14 +161,14 @@
         self.CCLIButtonLayout.setSpacing(8)
         self.CCLIButtonLayout.setObjectName(u'CCLIButtonLayout')
         self.CCLIAddButton = QtGui.QPushButton(self.CCLIPage)
-        self.CCLIAddButton.setIcon(self.OpenIcon)
+        self.CCLIAddButton.setIcon(openIcon)
         self.CCLIAddButton.setObjectName(u'CCLIAddButton')
         self.CCLIButtonLayout.addWidget(self.CCLIAddButton)
         self.CCLIButtonSpacer = QtGui.QSpacerItem(40, 20,
             QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
         self.CCLIButtonLayout.addItem(self.CCLIButtonSpacer)
         self.CCLIRemoveButton = QtGui.QPushButton(self.CCLIPage)
-        self.CCLIRemoveButton.setIcon(self.DeleteIcon)
+        self.CCLIRemoveButton.setIcon(deleteIcon)
         self.CCLIRemoveButton.setObjectName(u'CCLIRemoveButton')
         self.CCLIButtonLayout.addWidget(self.CCLIRemoveButton)
         self.CCLILayout.addLayout(self.CCLIButtonLayout)
@@ -190,7 +190,7 @@
         self.CSVFilenameEdit.setObjectName(u'CSVFilenameEdit')
         self.CSVFileLayout.addWidget(self.CSVFilenameEdit)
         self.CSVBrowseButton = QtGui.QToolButton(self.CSVPage)
-        self.CSVBrowseButton.setIcon(self.OpenIcon)
+        self.CSVBrowseButton.setIcon(openIcon)
         self.CSVBrowseButton.setObjectName(u'CSVBrowseButton')
         self.CSVFileLayout.addWidget(self.CSVBrowseButton)
         self.CSVLayout.setLayout(0, QtGui.QFormLayout.FieldRole,
@@ -213,14 +213,11 @@
         self.ImportProgressBar.setObjectName(u'ImportProgressBar')
         self.ImportLayout.addWidget(self.ImportProgressBar)
         SongImportWizard.addPage(self.ImportPage)
-
         self.retranslateUi(SongImportWizard)
         self.FormatStackedWidget.setCurrentIndex(0)
-        QtCore.QObject.connect(
-            self.FormatComboBox,
+        QtCore.QObject.connect(self.FormatComboBox,
             QtCore.SIGNAL(u'currentIndexChanged(int)'),
-            self.FormatStackedWidget.setCurrentIndex
-        )
+            self.FormatStackedWidget.setCurrentIndex)
         QtCore.QMetaObject.connectSlotsByName(SongImportWizard)
 
     def retranslateUi(self, SongImportWizard):
@@ -275,4 +272,3 @@
             translate('SongsPlugin.ImportWizardForm', 'Ready.'))
         self.ImportProgressBar.setFormat(
             translate('SongsPlugin.ImportWizardForm', '%p%'))
-

=== modified file 'openlp/plugins/songs/lib/sofimport.py'
--- openlp/plugins/songs/lib/sofimport.py	2010-06-26 11:16:59 +0000
+++ openlp/plugins/songs/lib/sofimport.py	2010-07-17 13:28:44 +0000
@@ -142,7 +142,7 @@
             self.blanklines += 1
             if self.blanklines > 1:
                 return
-            if self.song.get_title() != u'':
+            if self.song.title != u'':
                 self.finish_verse()
             return
         self.blanklines = 0
@@ -166,8 +166,8 @@
             self.finish_verse()
             self.song.repeat_verse()
             return
-        if self.song.get_title() == u'':
-            if self.song.get_copyright() == u'':
+        if self.song.title == u'':
+            if self.song.copyright == u'':
                 self.add_author(text)
             else:
                 self.song.add_copyright(text)
@@ -187,10 +187,10 @@
             return text
         if textportion.CharWeight == BOLD:
             boldtext = text.strip()
-            if boldtext.isdigit() and self.song.get_song_number() == '':
+            if boldtext.isdigit() and self.song.song_number == '':
                 self.add_songnumber(boldtext)
                 return u''
-            if self.song.get_title() == u'':
+            if self.song.title == u'':
                 text = self.uncap_text(text)
                 self.add_title(text)
             return text
@@ -220,20 +220,17 @@
         Add a song number, store as alternate title. Also use the song
         number to work out which songbook we're in
         """
-        self.song.set_song_number(song_no)
-        self.song.set_alternate_title(song_no + u'.')
+        self.song.song_number = song_no
+        self.song.alternate_title = song_no + u'.'
+        self.song.song_book_pub = u'Kingsway Publications'
         if int(song_no) <= 640:
-            self.song.set_song_book(u'Songs of Fellowship 1', 
-                u'Kingsway Publications')
+            self.song.song_book = u'Songs of Fellowship 1'
         elif int(song_no) <= 1150:
-            self.song.set_song_book(u'Songs of Fellowship 2', 
-                u'Kingsway Publications')
+            self.song.song_book = u'Songs of Fellowship 2'
         elif int(song_no) <= 1690:
-            self.song.set_song_book(u'Songs of Fellowship 3', 
-                u'Kingsway Publications')
+            self.song.song_book = u'Songs of Fellowship 3'
         else:
-            self.song.set_song_book(u'Songs of Fellowship 4', 
-                u'Kingsway Publications')
+            self.song.song_book = u'Songs of Fellowship 4'
 
     def add_title(self, text):
         """
@@ -245,7 +242,7 @@
             title = title[1:]
         if title.endswith(u','):
             title = title[:-1]
-        self.song.set_title(title)
+        self.song.title = title
 
     def add_author(self, text):
         """
@@ -283,7 +280,7 @@
             splitat = None
         else:
             versetag = u'V'
-            splitat = self.verse_splits(self.song.get_song_number())
+            splitat = self.verse_splits(self.song.song_number)
         if splitat:
             ln = 0
             verse = u''
@@ -538,4 +535,3 @@
         if song_number == 1119:
             return 7
         return None
-

=== modified file 'openlp/plugins/songs/lib/songimport.py'
--- openlp/plugins/songs/lib/songimport.py	2010-07-15 22:45:55 +0000
+++ openlp/plugins/songs/lib/songimport.py	2010-07-17 13:28:44 +0000
@@ -123,53 +123,10 @@
         if len(lines) == 1:
             self.parse_author(lines[0])
             return
-        if not self.get_title():
-            self.set_title(lines[0])
+        if not self.title:
+            self.title = lines[0]
         self.add_verse(text)
 
-    def get_title(self):
-        """
-        Return the title
-        """
-        return self.title
-
-    def get_copyright(self):
-        """
-        Return the copyright
-        """
-        return self.copyright
-
-    def get_song_number(self):
-        """
-        Return the song number
-        """
-        return self.song_number
-
-    def set_title(self, title):
-        """
-        Set the title
-        """
-        self.title = title
-
-    def set_alternate_title(self, title):
-        """
-        Set the alternate title
-        """
-        self.alternate_title = title
-
-    def set_song_number(self, song_number):
-        """
-        Set the song number
-        """
-        self.song_number = song_number
-
-    def set_song_book(self, song_book, publisher):
-        """
-        Set the song book name and publisher
-        """
-        self.song_book_name = song_book
-        self.song_book_pub = publisher
-
     def add_copyright(self, copyright):
         """
         Build the copyright field

=== modified file 'openlp/plugins/songs/lib/songxml.py'
--- openlp/plugins/songs/lib/songxml.py	2010-07-03 13:26:29 +0000
+++ openlp/plugins/songs/lib/songxml.py	2010-07-17 13:28:44 +0000
@@ -366,10 +366,6 @@
         if len(self.search_title) < 1:
             raise SongTitleError(u'The searchable title is empty')
 
-    def get_title(self):
-        """Return title value"""
-        return self.title
-
     def from_ccli_text_buffer(self, textList):
         """
         Create song from a list of texts (strings) - CCLI text format expected
@@ -688,7 +684,7 @@
             raise SongSlideError(u'Slide number too high')
         res = []
         if self.show_title:
-            title = self.get_title()
+            title = self.title
         else:
             title = ""
         if self.show_author_list:


Follow ups