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.

bzr-revno: 1837
Fixes: https://launchpad.net/bugs/828385
This commit is contained in:
Mattias Põldaru 2011-12-14 12:50:04 +02:00 committed by Raoul Snyman
commit c10f73144d
2 changed files with 51 additions and 44 deletions

View File

@ -191,32 +191,32 @@ class SongImportForm(OpenLPWizard):
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')
# 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
# CCLI File import
self.addFileSelectItem(u'ccli')
# 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 @@ class SongImportForm(OpenLPWizard):
self.sourcePage.setTitle(WizardStrings.ImportSelect)
self.sourcePage.setSubTitle(WizardStrings.ImportSelectLong)
self.formatLabel.setText(WizardStrings.FormatLabel)
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.OpenLP2, UiStrings().OLPV2)
self.formatComboBox.setItemText(SongFormat.OpenLP1, UiStrings().OLPV1)
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 @@ class SongImportForm(OpenLPWizard):
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,12 @@ class SongImportForm(OpenLPWizard):
self.restart()
self.finishButton.setVisible(False)
self.cancelButton.setVisible(True)
self.formatComboBox.setCurrentIndex(0)
last_import_type = QtCore.QSettings().value(
u'songs/last import type').toInt()[0]
if last_import_type < 0 or \
last_import_type >= self.formatComboBox.count():
last_import_type = 0
self.formatComboBox.setCurrentIndex(last_import_type)
self.openLP2FilenameEdit.setText(u'')
self.openLP1FilenameEdit.setText(u'')
self.openLyricsFileListWidget.clear()

View File

@ -68,19 +68,19 @@ class SongFormat(object):
"""
_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
@ -125,19 +125,19 @@ class SongFormat(object):
Return a list of the supported song formats.
"""
return [
SongFormat.OpenLyrics,
SongFormat.OpenLP2,
SongFormat.OpenLP1,
SongFormat.OpenLyrics,
SongFormat.OpenSong,
SongFormat.WordsOfWorship,
SongFormat.CCLI,
SongFormat.SongsOfFellowship,
SongFormat.Generic,
SongFormat.CCLI,
SongFormat.EasiSlides,
SongFormat.EasyWorship,
SongFormat.EasyWorship,
SongFormat.FoilPresenter,
SongFormat.OpenSong,
SongFormat.SongBeamer,
SongFormat.SongShowPlus,
SongFormat.FoilPresenter
SongFormat.SongsOfFellowship,
SongFormat.WordsOfWorship
]
@staticmethod