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

View File

@ -191,32 +191,32 @@ class SongImportForm(OpenLPWizard):
QtGui.QSizePolicy.Expanding) QtGui.QSizePolicy.Expanding)
self.formatStack = QtGui.QStackedLayout() self.formatStack = QtGui.QStackedLayout()
self.formatStack.setObjectName(u'FormatStack') self.formatStack.setObjectName(u'FormatStack')
# OpenLyrics
self.addFileSelectItem(u'openLyrics', u'OpenLyrics', True)
# OpenLP 2.0 # OpenLP 2.0
self.addFileSelectItem(u'openLP2', single_select=True) self.addFileSelectItem(u'openLP2', single_select=True)
# openlp.org 1.x # openlp.org 1.x
self.addFileSelectItem(u'openLP1', None, True, True) 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 # Generic Document/Presentation import
self.addFileSelectItem(u'generic', None, True) self.addFileSelectItem(u'generic', None, True)
# EasySlides # CCLI File import
self.addFileSelectItem(u'ccli')
# EasiSlides
self.addFileSelectItem(u'easiSlides', single_select=True) self.addFileSelectItem(u'easiSlides', single_select=True)
# EasyWorship # EasyWorship
self.addFileSelectItem(u'ew', single_select=True) 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') self.addFileSelectItem(u'songBeamer')
# Song Show Plus # Song Show Plus
self.addFileSelectItem(u'songShowPlus') self.addFileSelectItem(u'songShowPlus')
# Foilpresenter # Songs of Fellowship
self.addFileSelectItem(u'foilPresenter') self.addFileSelectItem(u'songsOfFellowship', None, True)
# Words of Worship
self.addFileSelectItem(u'wordsOfWorship')
# Commented out for future use. # Commented out for future use.
# self.addFileSelectItem(u'csv', u'CSV', single_select=True) # self.addFileSelectItem(u'csv', u'CSV', single_select=True)
self.sourceLayout.addLayout(self.formatStack) self.sourceLayout.addLayout(self.formatStack)
@ -238,31 +238,30 @@ class SongImportForm(OpenLPWizard):
self.sourcePage.setTitle(WizardStrings.ImportSelect) self.sourcePage.setTitle(WizardStrings.ImportSelect)
self.sourcePage.setSubTitle(WizardStrings.ImportSelectLong) self.sourcePage.setSubTitle(WizardStrings.ImportSelectLong)
self.formatLabel.setText(WizardStrings.FormatLabel) 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, self.formatComboBox.setItemText(SongFormat.OpenLyrics,
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'OpenLyrics or OpenLP 2.0 Exported Song')) 'OpenLyrics or OpenLP 2.0 Exported Song'))
self.formatComboBox.setItemText(SongFormat.OpenSong, WizardStrings.OS) self.formatComboBox.setItemText(SongFormat.OpenLP2, UiStrings().OLPV2)
self.formatComboBox.setItemText( self.formatComboBox.setItemText(SongFormat.OpenLP1, UiStrings().OLPV1)
SongFormat.WordsOfWorship, WizardStrings.WoW)
self.formatComboBox.setItemText(SongFormat.CCLI, WizardStrings.CCLI)
self.formatComboBox.setItemText(
SongFormat.SongsOfFellowship, WizardStrings.SoF)
self.formatComboBox.setItemText(SongFormat.Generic, self.formatComboBox.setItemText(SongFormat.Generic,
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'Generic Document/Presentation')) 'Generic Document/Presentation'))
self.formatComboBox.setItemText(SongFormat.CCLI, WizardStrings.CCLI)
self.formatComboBox.setItemText( self.formatComboBox.setItemText(
SongFormat.EasiSlides, WizardStrings.ES) SongFormat.EasiSlides, WizardStrings.ES)
self.formatComboBox.setItemText( self.formatComboBox.setItemText(
SongFormat.EasyWorship, WizardStrings.EW) SongFormat.EasyWorship, WizardStrings.EW)
self.formatComboBox.setItemText(
SongFormat.FoilPresenter, WizardStrings.FP)
self.formatComboBox.setItemText(SongFormat.OpenSong, WizardStrings.OS)
self.formatComboBox.setItemText( self.formatComboBox.setItemText(
SongFormat.SongBeamer, WizardStrings.SB) SongFormat.SongBeamer, WizardStrings.SB)
self.formatComboBox.setItemText( self.formatComboBox.setItemText(
SongFormat.SongShowPlus, WizardStrings.SSP) SongFormat.SongShowPlus, WizardStrings.SSP)
self.formatComboBox.setItemText( 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.formatComboBox.setItemText(SongFormat.CSV, WizardStrings.CSV)
self.openLP2FilenameLabel.setText( self.openLP2FilenameLabel.setText(
translate('SongsPlugin.ImportWizardForm', 'Filename:')) translate('SongsPlugin.ImportWizardForm', 'Filename:'))
@ -360,6 +359,8 @@ class SongImportForm(OpenLPWizard):
return True return True
elif self.currentPage() == self.sourcePage: elif self.currentPage() == self.sourcePage:
source_format = self.formatComboBox.currentIndex() source_format = self.formatComboBox.currentIndex()
QtCore.QSettings().setValue(u'songs/last import type',
source_format)
if source_format == SongFormat.OpenLP2: if source_format == SongFormat.OpenLP2:
if self.openLP2FilenameEdit.text().isEmpty(): if self.openLP2FilenameEdit.text().isEmpty():
critical_error_message_box(UiStrings().NFSs, critical_error_message_box(UiStrings().NFSs,
@ -658,6 +659,11 @@ class SongImportForm(OpenLPWizard):
self.restart() self.restart()
self.finishButton.setVisible(False) self.finishButton.setVisible(False)
self.cancelButton.setVisible(True) self.cancelButton.setVisible(True)
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.formatComboBox.setCurrentIndex(0)
self.openLP2FilenameEdit.setText(u'') self.openLP2FilenameEdit.setText(u'')
self.openLP1FilenameEdit.setText(u'') self.openLP1FilenameEdit.setText(u'')