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

Proposed by mahfiaz
Status: Merged
Approved by: Tim Bentley
Approved revision: 1840
Merged at revision: 1837
Proposed branch: lp:~mahfiaz/openlp/song_import_order
Merge into: lp:openlp
Diff against target: 178 lines (+52/-45)
2 files modified
openlp/plugins/songs/forms/songimportform.py (+32/-25)
openlp/plugins/songs/lib/importer.py (+20/-20)
To merge this branch: bzr merge lp:~mahfiaz/openlp/song_import_order
Reviewer Review Type Date Requested Status
Tim Bentley Approve
Raoul Snyman Approve
Review via email: mp+85555@code.launchpad.net

This proposal supersedes a proposal from 2011-12-13.

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

Assuming the numbers do not mess things up.
If it goes in today I am happy with a string changed.

review: Approve
Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

We're past string freeze, I'm afraid I can't let this through with the changed string.

review: Needs Fixing
Revision history for this message
John Cegalis (jseagull1) wrote : Posted in a previous version of this proposal

Shouldn't CCLI be number one in alphabetical order?

Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

You also can't just arbitrarily change the numbers of the import sources without changing the order of the import sources in the combobox.

review: Needs Fixing
Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

apologies, I spotted one last thing... you can use QVariant's toInt() method, instead of toString() -> http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qvariant.html#toInt (line 107)

review: Needs Fixing
Revision history for this message
Raoul Snyman (raoul-snyman) :
review: Approve
Revision history for this message
Tim Bentley (trb143) :
review: Approve
Revision history for this message
Meinert Jordan (m2j) wrote : Posted in a previous version of this proposal

EasiSlides has been renamed to EasySlides [ref http://easislides.com]

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/plugins/songs/forms/songimportform.py'
2--- openlp/plugins/songs/forms/songimportform.py 2011-10-05 22:17:57 +0000
3+++ openlp/plugins/songs/forms/songimportform.py 2011-12-13 21:12:22 +0000
4@@ -191,32 +191,32 @@
5 QtGui.QSizePolicy.Expanding)
6 self.formatStack = QtGui.QStackedLayout()
7 self.formatStack.setObjectName(u'FormatStack')
8+ # OpenLyrics
9+ self.addFileSelectItem(u'openLyrics', u'OpenLyrics', True)
10 # OpenLP 2.0
11 self.addFileSelectItem(u'openLP2', single_select=True)
12 # openlp.org 1.x
13 self.addFileSelectItem(u'openLP1', None, True, True)
14- # OpenLyrics
15- self.addFileSelectItem(u'openLyrics', u'OpenLyrics', True)
16- # Open Song
17- self.addFileSelectItem(u'openSong', u'OpenSong')
18- # Words of Worship
19- self.addFileSelectItem(u'wordsOfWorship')
20+ # Generic Document/Presentation import
21+ self.addFileSelectItem(u'generic', None, True)
22 # CCLI File import
23 self.addFileSelectItem(u'ccli')
24- # Songs of Fellowship
25- self.addFileSelectItem(u'songsOfFellowship', None, True)
26- # Generic Document/Presentation import
27- self.addFileSelectItem(u'generic', None, True)
28- # EasySlides
29+ # EasiSlides
30 self.addFileSelectItem(u'easiSlides', single_select=True)
31 # EasyWorship
32 self.addFileSelectItem(u'ew', single_select=True)
33- # Words of Worship
34+ # Foilpresenter
35+ self.addFileSelectItem(u'foilPresenter')
36+ # Open Song
37+ self.addFileSelectItem(u'openSong', u'OpenSong')
38+ # SongBeamer
39 self.addFileSelectItem(u'songBeamer')
40 # Song Show Plus
41 self.addFileSelectItem(u'songShowPlus')
42- # Foilpresenter
43- self.addFileSelectItem(u'foilPresenter')
44+ # Songs of Fellowship
45+ self.addFileSelectItem(u'songsOfFellowship', None, True)
46+ # Words of Worship
47+ self.addFileSelectItem(u'wordsOfWorship')
48 # Commented out for future use.
49 # self.addFileSelectItem(u'csv', u'CSV', single_select=True)
50 self.sourceLayout.addLayout(self.formatStack)
51@@ -238,30 +238,30 @@
52 self.sourcePage.setTitle(WizardStrings.ImportSelect)
53 self.sourcePage.setSubTitle(WizardStrings.ImportSelectLong)
54 self.formatLabel.setText(WizardStrings.FormatLabel)
55+ self.formatComboBox.setItemText(SongFormat.OpenLyrics,
56+ translate('SongsPlugin.ImportWizardForm',
57+ 'OpenLyrics or OpenLP 2.0 Exported Song'))
58 self.formatComboBox.setItemText(SongFormat.OpenLP2, UiStrings().OLPV2)
59 self.formatComboBox.setItemText(SongFormat.OpenLP1, UiStrings().OLPV1)
60- self.formatComboBox.setItemText(SongFormat.OpenLyrics,
61- translate('SongsPlugin.ImportWizardForm',
62- 'OpenLyrics or OpenLP 2.0 Exported Song'))
63- self.formatComboBox.setItemText(SongFormat.OpenSong, WizardStrings.OS)
64- self.formatComboBox.setItemText(
65- SongFormat.WordsOfWorship, WizardStrings.WoW)
66- self.formatComboBox.setItemText(SongFormat.CCLI, WizardStrings.CCLI)
67- self.formatComboBox.setItemText(
68- SongFormat.SongsOfFellowship, WizardStrings.SoF)
69 self.formatComboBox.setItemText(SongFormat.Generic,
70 translate('SongsPlugin.ImportWizardForm',
71 'Generic Document/Presentation'))
72+ self.formatComboBox.setItemText(SongFormat.CCLI, WizardStrings.CCLI)
73 self.formatComboBox.setItemText(
74 SongFormat.EasiSlides, WizardStrings.ES)
75 self.formatComboBox.setItemText(
76 SongFormat.EasyWorship, WizardStrings.EW)
77 self.formatComboBox.setItemText(
78+ SongFormat.FoilPresenter, WizardStrings.FP)
79+ self.formatComboBox.setItemText(SongFormat.OpenSong, WizardStrings.OS)
80+ self.formatComboBox.setItemText(
81 SongFormat.SongBeamer, WizardStrings.SB)
82 self.formatComboBox.setItemText(
83 SongFormat.SongShowPlus, WizardStrings.SSP)
84 self.formatComboBox.setItemText(
85- SongFormat.FoilPresenter, WizardStrings.FP)
86+ SongFormat.SongsOfFellowship, WizardStrings.SoF)
87+ self.formatComboBox.setItemText(
88+ SongFormat.WordsOfWorship, WizardStrings.WoW)
89 # self.formatComboBox.setItemText(SongFormat.CSV, WizardStrings.CSV)
90 self.openLP2FilenameLabel.setText(
91 translate('SongsPlugin.ImportWizardForm', 'Filename:'))
92@@ -359,6 +359,8 @@
93 return True
94 elif self.currentPage() == self.sourcePage:
95 source_format = self.formatComboBox.currentIndex()
96+ QtCore.QSettings().setValue(u'songs/last import type',
97+ source_format)
98 if source_format == SongFormat.OpenLP2:
99 if self.openLP2FilenameEdit.text().isEmpty():
100 critical_error_message_box(UiStrings().NFSs,
101@@ -657,7 +659,12 @@
102 self.restart()
103 self.finishButton.setVisible(False)
104 self.cancelButton.setVisible(True)
105- self.formatComboBox.setCurrentIndex(0)
106+ last_import_type = QtCore.QSettings().value(
107+ u'songs/last import type').toInt()[0]
108+ if last_import_type < 0 or \
109+ last_import_type >= self.formatComboBox.count():
110+ last_import_type = 0
111+ self.formatComboBox.setCurrentIndex(last_import_type)
112 self.openLP2FilenameEdit.setText(u'')
113 self.openLP1FilenameEdit.setText(u'')
114 self.openLyricsFileListWidget.clear()
115
116=== modified file 'openlp/plugins/songs/lib/importer.py'
117--- openlp/plugins/songs/lib/importer.py 2011-06-12 16:02:52 +0000
118+++ openlp/plugins/songs/lib/importer.py 2011-12-13 21:12:22 +0000
119@@ -68,19 +68,19 @@
120 """
121 _format_availability = {}
122 Unknown = -1
123- OpenLP2 = 0
124- OpenLP1 = 1
125- OpenLyrics = 2
126- OpenSong = 3
127- WordsOfWorship = 4
128- CCLI = 5
129- SongsOfFellowship = 6
130- Generic = 7
131- EasiSlides = 8
132- EasyWorship = 9
133- SongBeamer = 10
134- SongShowPlus = 11
135- FoilPresenter = 12
136+ OpenLyrics = 0
137+ OpenLP2 = 1
138+ OpenLP1 = 2
139+ Generic = 3
140+ CCLI = 4
141+ EasiSlides = 5
142+ EasyWorship = 6
143+ FoilPresenter = 7
144+ OpenSong = 8
145+ SongBeamer = 9
146+ SongShowPlus = 10
147+ SongsOfFellowship = 11
148+ WordsOfWorship = 12
149 #CSV = 13
150
151 @staticmethod
152@@ -125,19 +125,19 @@
153 Return a list of the supported song formats.
154 """
155 return [
156+ SongFormat.OpenLyrics,
157 SongFormat.OpenLP2,
158 SongFormat.OpenLP1,
159- SongFormat.OpenLyrics,
160- SongFormat.OpenSong,
161- SongFormat.WordsOfWorship,
162+ SongFormat.Generic,
163 SongFormat.CCLI,
164- SongFormat.SongsOfFellowship,
165- SongFormat.Generic,
166 SongFormat.EasiSlides,
167- SongFormat.EasyWorship,
168+ SongFormat.EasyWorship,
169+ SongFormat.FoilPresenter,
170+ SongFormat.OpenSong,
171 SongFormat.SongBeamer,
172 SongFormat.SongShowPlus,
173- SongFormat.FoilPresenter
174+ SongFormat.SongsOfFellowship,
175+ SongFormat.WordsOfWorship
176 ]
177
178 @staticmethod