← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~mahfiaz/openlp/song_import_order into lp:openlp

 

mahfiaz has proposed merging lp:~mahfiaz/openlp/song_import_order into lp:openlp.

Requested reviews:
  Raoul Snyman (raoul-snyman)
  Tim Bentley (trb143)
Related bugs:
  Bug #828385 in OpenLP: "Alphabetize song import source format"
  https://bugs.launchpad.net/openlp/+bug/828385

For more details, see:
https://code.launchpad.net/~mahfiaz/openlp/song_import_order/+merge/85539

Fix for bug #828385, song import plugins order more alphabetical, but OpenLP related ones in front. It saves last used item's index. Saving of last used simply saves item's index in list, so if the order of import types changes (or one is added before the one), wrong item is selected for once.
-- 
https://code.launchpad.net/~mahfiaz/openlp/song_import_order/+merge/85539
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/plugins/songs/forms/songimportform.py'
--- openlp/plugins/songs/forms/songimportform.py	2011-10-05 22:17:57 +0000
+++ openlp/plugins/songs/forms/songimportform.py	2011-12-13 19:57:23 +0000
@@ -191,32 +191,32 @@
             QtGui.QSizePolicy.Expanding)
         self.formatStack = QtGui.QStackedLayout()
         self.formatStack.setObjectName(u'FormatStack')
+        # OpenLyrics
+        self.addFileSelectItem(u'openLyrics', u'OpenLyrics', True)
         # OpenLP 2.0
         self.addFileSelectItem(u'openLP2', single_select=True)
         # openlp.org 1.x
         self.addFileSelectItem(u'openLP1', None, True, True)
-        # OpenLyrics
-        self.addFileSelectItem(u'openLyrics', u'OpenLyrics', True)
-        # Open Song
-        self.addFileSelectItem(u'openSong', u'OpenSong')
-        # Words of Worship
-        self.addFileSelectItem(u'wordsOfWorship')
+        # Generic Document/Presentation import
+        self.addFileSelectItem(u'generic', None, True)
         # CCLI File import
         self.addFileSelectItem(u'ccli')
-        # Songs of Fellowship
-        self.addFileSelectItem(u'songsOfFellowship', None, True)
-        # Generic Document/Presentation import
-        self.addFileSelectItem(u'generic', None, True)
-        # EasySlides
+        # EasiSlides
         self.addFileSelectItem(u'easiSlides', single_select=True)
         # EasyWorship
         self.addFileSelectItem(u'ew', single_select=True)
-        # Words of Worship
+        # Foilpresenter
+        self.addFileSelectItem(u'foilPresenter')
+        # Open Song
+        self.addFileSelectItem(u'openSong', u'OpenSong')
+        # SongBeamer
         self.addFileSelectItem(u'songBeamer')
         # Song Show Plus
         self.addFileSelectItem(u'songShowPlus')
-        # Foilpresenter
-        self.addFileSelectItem(u'foilPresenter')
+        # Songs of Fellowship
+        self.addFileSelectItem(u'songsOfFellowship', None, True)
+        # Words of Worship
+        self.addFileSelectItem(u'wordsOfWorship')
 #        Commented out for future use.
 #        self.addFileSelectItem(u'csv', u'CSV', single_select=True)
         self.sourceLayout.addLayout(self.formatStack)
@@ -238,30 +238,30 @@
         self.sourcePage.setTitle(WizardStrings.ImportSelect)
         self.sourcePage.setSubTitle(WizardStrings.ImportSelectLong)
         self.formatLabel.setText(WizardStrings.FormatLabel)
+        self.formatComboBox.setItemText(SongFormat.OpenLyrics,
+            translate('SongsPlugin.ImportWizardForm',
+            'OpenLyrics or OpenLP 2.0 Exported Song'))
         self.formatComboBox.setItemText(SongFormat.OpenLP2, UiStrings().OLPV2)
         self.formatComboBox.setItemText(SongFormat.OpenLP1, UiStrings().OLPV1)
-        self.formatComboBox.setItemText(SongFormat.OpenLyrics,
-            translate('SongsPlugin.ImportWizardForm',
-            'OpenLyrics or OpenLP 2.0 Exported Song'))
-        self.formatComboBox.setItemText(SongFormat.OpenSong, WizardStrings.OS)
-        self.formatComboBox.setItemText(
-            SongFormat.WordsOfWorship, WizardStrings.WoW)
-        self.formatComboBox.setItemText(SongFormat.CCLI, WizardStrings.CCLI)
-        self.formatComboBox.setItemText(
-            SongFormat.SongsOfFellowship, WizardStrings.SoF)
         self.formatComboBox.setItemText(SongFormat.Generic,
             translate('SongsPlugin.ImportWizardForm',
             'Generic Document/Presentation'))
+        self.formatComboBox.setItemText(SongFormat.CCLI, WizardStrings.CCLI)
         self.formatComboBox.setItemText(
             SongFormat.EasiSlides, WizardStrings.ES)
         self.formatComboBox.setItemText(
             SongFormat.EasyWorship, WizardStrings.EW)
         self.formatComboBox.setItemText(
+            SongFormat.FoilPresenter, WizardStrings.FP)
+        self.formatComboBox.setItemText(SongFormat.OpenSong, WizardStrings.OS)
+        self.formatComboBox.setItemText(
             SongFormat.SongBeamer, WizardStrings.SB)
         self.formatComboBox.setItemText(
             SongFormat.SongShowPlus, WizardStrings.SSP)
         self.formatComboBox.setItemText(
-            SongFormat.FoilPresenter, WizardStrings.FP)
+            SongFormat.SongsOfFellowship, WizardStrings.SoF)
+        self.formatComboBox.setItemText(
+            SongFormat.WordsOfWorship, WizardStrings.WoW)
 #        self.formatComboBox.setItemText(SongFormat.CSV, WizardStrings.CSV)
         self.openLP2FilenameLabel.setText(
             translate('SongsPlugin.ImportWizardForm', 'Filename:'))
@@ -359,6 +359,8 @@
             return True
         elif self.currentPage() == self.sourcePage:
             source_format = self.formatComboBox.currentIndex()
+            QtCore.QSettings().setValue(u'songs/last import type',
+                source_format)
             if source_format == SongFormat.OpenLP2:
                 if self.openLP2FilenameEdit.text().isEmpty():
                     critical_error_message_box(UiStrings().NFSs,
@@ -657,7 +659,15 @@
         self.restart()
         self.finishButton.setVisible(False)
         self.cancelButton.setVisible(True)
-        self.formatComboBox.setCurrentIndex(0)
+        try:
+            last_import_type = int(QtCore.QSettings().value(
+                u'songs/last import type').toString())
+            if last_import_type >= self.formatComboBox.count() or \
+                last_import_type < 0:
+                last_import_type = 0
+            self.formatComboBox.setCurrentIndex(last_import_type)
+        except ValueError:
+            self.formatComboBox.setCurrentIndex(0)
         self.openLP2FilenameEdit.setText(u'')
         self.openLP1FilenameEdit.setText(u'')
         self.openLyricsFileListWidget.clear()

=== modified file 'openlp/plugins/songs/lib/importer.py'
--- openlp/plugins/songs/lib/importer.py	2011-06-12 16:02:52 +0000
+++ openlp/plugins/songs/lib/importer.py	2011-12-13 19:57:23 +0000
@@ -68,19 +68,19 @@
     """
     _format_availability = {}
     Unknown = -1
-    OpenLP2 = 0
-    OpenLP1 = 1
-    OpenLyrics = 2
-    OpenSong = 3
-    WordsOfWorship = 4
-    CCLI = 5
-    SongsOfFellowship = 6
-    Generic = 7
-    EasiSlides = 8
-    EasyWorship = 9
-    SongBeamer = 10
-    SongShowPlus = 11
-    FoilPresenter = 12
+    OpenLyrics = 0
+    OpenLP2 = 1
+    OpenLP1 = 2
+    Generic = 3
+    CCLI = 4
+    EasiSlides = 5
+    EasyWorship = 6
+    FoilPresenter = 7
+    OpenSong = 8
+    SongBeamer = 9
+    SongShowPlus = 10
+    SongsOfFellowship = 11
+    WordsOfWorship = 12
     #CSV = 13
 
     @staticmethod


Follow ups