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

Proposed by mahfiaz
Status: Superseded
Proposed branch: lp:~mahfiaz/openlp/song_import_order
Merge into: lp:openlp
Diff against target: 181 lines (+55/-45)
2 files modified
openlp/plugins/songs/forms/songimportform.py (+35/-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 Pending
Raoul Snyman Pending
Review via email: mp+85539@code.launchpad.net

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

This proposal has been superseded by 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
lp:~mahfiaz/openlp/song_import_order updated
1838. By mahfiaz

One more list which needs right order.

1839. By mahfiaz

I always forget something :(

1840. By mahfiaz

Using toInt of QVariant for sure is better than a chain of toString, str and int. Thanks to superfly.

Revision history for this message
Meinert Jordan (m2j) wrote :

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

Unmerged revisions

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 20:24:25 +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,15 @@
102 self.restart()
103 self.finishButton.setVisible(False)
104 self.cancelButton.setVisible(True)
105- self.formatComboBox.setCurrentIndex(0)
106+ try:
107+ last_import_type = int(QtCore.QSettings().value(
108+ u'songs/last import type').toString())
109+ if last_import_type >= self.formatComboBox.count() or \
110+ last_import_type < 0:
111+ last_import_type = 0
112+ self.formatComboBox.setCurrentIndex(last_import_type)
113+ except ValueError:
114+ self.formatComboBox.setCurrentIndex(0)
115 self.openLP2FilenameEdit.setText(u'')
116 self.openLP1FilenameEdit.setText(u'')
117 self.openLyricsFileListWidget.clear()
118
119=== modified file 'openlp/plugins/songs/lib/importer.py'
120--- openlp/plugins/songs/lib/importer.py 2011-06-12 16:02:52 +0000
121+++ openlp/plugins/songs/lib/importer.py 2011-12-13 20:24:25 +0000
122@@ -68,19 +68,19 @@
123 """
124 _format_availability = {}
125 Unknown = -1
126- OpenLP2 = 0
127- OpenLP1 = 1
128- OpenLyrics = 2
129- OpenSong = 3
130- WordsOfWorship = 4
131- CCLI = 5
132- SongsOfFellowship = 6
133- Generic = 7
134- EasiSlides = 8
135- EasyWorship = 9
136- SongBeamer = 10
137- SongShowPlus = 11
138- FoilPresenter = 12
139+ OpenLyrics = 0
140+ OpenLP2 = 1
141+ OpenLP1 = 2
142+ Generic = 3
143+ CCLI = 4
144+ EasiSlides = 5
145+ EasyWorship = 6
146+ FoilPresenter = 7
147+ OpenSong = 8
148+ SongBeamer = 9
149+ SongShowPlus = 10
150+ SongsOfFellowship = 11
151+ WordsOfWorship = 12
152 #CSV = 13
153
154 @staticmethod
155@@ -125,19 +125,19 @@
156 Return a list of the supported song formats.
157 """
158 return [
159+ SongFormat.OpenLyrics,
160 SongFormat.OpenLP2,
161 SongFormat.OpenLP1,
162- SongFormat.OpenLyrics,
163- SongFormat.OpenSong,
164- SongFormat.WordsOfWorship,
165+ SongFormat.Generic,
166 SongFormat.CCLI,
167- SongFormat.SongsOfFellowship,
168- SongFormat.Generic,
169 SongFormat.EasiSlides,
170- SongFormat.EasyWorship,
171+ SongFormat.EasyWorship,
172+ SongFormat.FoilPresenter,
173+ SongFormat.OpenSong,
174 SongFormat.SongBeamer,
175 SongFormat.SongShowPlus,
176- SongFormat.FoilPresenter
177+ SongFormat.SongsOfFellowship,
178+ SongFormat.WordsOfWorship
179 ]
180
181 @staticmethod