Previous change of order was not enough, now is actually works. It also saves the type of import last time used and uses that value as default (as suggested), otherwise defaults to OpenLyrics.

This commit is contained in:
Mattias Põldaru 2011-12-13 21:33:49 +02:00
parent 88d7176900
commit 4f603d7353
1 changed files with 31 additions and 25 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,31 +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,
translate('SongsPlugin.ImportWizardForm', 'OpenLP 2.0 database'))
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:'))
@ -360,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,
@ -658,7 +659,12 @@ class SongImportForm(OpenLPWizard):
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())
self.formatComboBox.setCurrentIndex(last_import_type)
except ValueError:
self.formatComboBox.setCurrentIndex(0)
self.openLP2FilenameEdit.setText(u'')
self.openLP1FilenameEdit.setText(u'')
self.openLyricsFileListWidget.clear()