Wizard works, though not functional.

This commit is contained in:
Raoul Snyman 2010-04-02 22:03:51 +02:00
parent 031ef1530d
commit 20636bf655
5 changed files with 368 additions and 150 deletions

View File

@ -32,8 +32,8 @@ class Ui_BibleImportWizard(object):
BibleImportWizard.setModal(True) BibleImportWizard.setModal(True)
BibleImportWizard.setWizardStyle(QtGui.QWizard.ModernStyle) BibleImportWizard.setWizardStyle(QtGui.QWizard.ModernStyle)
BibleImportWizard.setOptions( BibleImportWizard.setOptions(
QtGui.QWizard.IndependentPages | \ QtGui.QWizard.IndependentPages |
QtGui.QWizard.NoBackButtonOnStartPage | \ QtGui.QWizard.NoBackButtonOnStartPage |
QtGui.QWizard.NoBackButtonOnLastPage) QtGui.QWizard.NoBackButtonOnLastPage)
self.WelcomePage = QtGui.QWizardPage() self.WelcomePage = QtGui.QWizardPage()
self.WelcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap, self.WelcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap,
@ -309,8 +309,8 @@ class Ui_BibleImportWizard(object):
def retranslateUi(self, BibleImportWizard): def retranslateUi(self, BibleImportWizard):
BibleImportWizard.setWindowTitle(self.trUtf8('Bible Import Wizard')) BibleImportWizard.setWindowTitle(self.trUtf8('Bible Import Wizard'))
self.TitleLabel.setText( self.TitleLabel.setText(
u'<span style=\" font-size:14pt; font-weight:600;\">' + \ u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
self.trUtf8('Welcome to the Bible Import Wizard') + u'</span>') self.trUtf8('Welcome to the Bible Import Wizard'))
self.InformationLabel.setText( self.InformationLabel.setText(
self.trUtf8('This wizard will help you to import Bibles from a ' self.trUtf8('This wizard will help you to import Bibles from a '
'variety of formats. Click the next button below to start the ' 'variety of formats. Click the next button below to start the '

View File

@ -193,39 +193,41 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
# self.preImport() # self.preImport()
# self.performImport() # self.performImport()
# self.postImport() # self.postImport()
#
# def registerFields(self): def registerFields(self):
# self.SelectPage.registerField( pass
# self.SourcePage.registerField(
# u'source_format', self.FormatComboBox) # u'source_format', self.FormatComboBox)
# self.SelectPage.registerField( # self.SourcePage.registerField(
# u'osis_location', self.OSISLocationEdit) # u'openlyrics_filename', self.OpenLyricsFilenameEdit)
# self.SelectPage.registerField( # self.SourcePage.registerField(
# u'csv_booksfile', self.BooksLocationEdit) # u'openlyrics_directory', self.OpenLyricsDirectoryEdit)
# self.SelectPage.registerField( # self.SourcePage.registerField(
# u'opensong_filename', self.OpenSongFilenameEdit)
# self.SourcePage.registerField(
# u'opensong_directory', self.OpenSongDirectoryEdit)
# self.SourcePage.registerField(
# u'csv_versefile', self.CsvVerseLocationEdit) # u'csv_versefile', self.CsvVerseLocationEdit)
# self.SelectPage.registerField( # self.SourcePage.registerField(
# u'opensong_file', self.OpenSongFileEdit) # u'opensong_file', self.OpenSongFileEdit)
# self.SelectPage.registerField( # self.SourcePage.registerField(
# u'web_location', self.LocationComboBox) # u'web_location', self.LocationComboBox)
# self.SelectPage.registerField( # self.SourcePage.registerField(
# u'web_biblename', self.BibleComboBox) # u'web_biblename', self.BibleComboBox)
# self.SelectPage.registerField( # self.SourcePage.registerField(
# u'proxy_server', self.AddressEdit) # u'proxy_server', self.AddressEdit)
# self.SelectPage.registerField( # self.SourcePage.registerField(
# u'proxy_username', self.UsernameEdit) # u'proxy_username', self.UsernameEdit)
# self.SelectPage.registerField( # self.SourcePage.registerField(
# u'proxy_password', self.PasswordEdit) # u'proxy_password', self.PasswordEdit)
# self.LicenseDetailsPage.registerField(
# u'license_version', self.VersionNameEdit) def setDefaults(self):
# self.LicenseDetailsPage.registerField( pass
# u'license_copyright', self.CopyrightEdit)
# self.LicenseDetailsPage.registerField(
# u'license_permission', self.PermissionEdit)
#
# def setDefaults(self):
# self.setField(u'source_format', QtCore.QVariant(0)) # self.setField(u'source_format', QtCore.QVariant(0))
# self.setField(u'osis_location', QtCore.QVariant('')) # self.setField(u'openlyrics_filename', QtCore.QVariant(''))
# self.setField(u'csv_booksfile', QtCore.QVariant('')) # self.setField(u'openlyrics_directory', QtCore.QVariant(''))
# self.setField(u'opensong_filename', QtCore.QVariant(''))
# self.setField(u'opensong_directory', QtCore.QVariant(''))
# self.setField(u'csv_versefile', QtCore.QVariant('')) # self.setField(u'csv_versefile', QtCore.QVariant(''))
# self.setField(u'opensong_file', QtCore.QVariant('')) # self.setField(u'opensong_file', QtCore.QVariant(''))
# self.setField(u'web_location', QtCore.QVariant(WebDownload.Crosswalk)) # self.setField(u'web_location', QtCore.QVariant(WebDownload.Crosswalk))
@ -241,7 +243,6 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
# self.setField(u'license_permission', QtCore.QVariant(self.PermissionEdit)) # self.setField(u'license_permission', QtCore.QVariant(self.PermissionEdit))
# self.onLocationComboBoxChanged(WebDownload.Crosswalk) # self.onLocationComboBoxChanged(WebDownload.Crosswalk)
def getFileName(self, title, editbox): def getFileName(self, title, editbox):
filename = QtGui.QFileDialog.getOpenFileName(self, title, filename = QtGui.QFileDialog.getOpenFileName(self, title,
self.config.get_last_dir(1)) self.config.get_last_dir(1))

View File

@ -29,24 +29,20 @@ class Ui_SongImportWizard(object):
def setupUi(self, SongImportWizard): def setupUi(self, SongImportWizard):
SongImportWizard.setObjectName(u'SongImportWizard') SongImportWizard.setObjectName(u'SongImportWizard')
SongImportWizard.resize(550, 386) SongImportWizard.resize(550, 386)
SongImportWizard.setMinimumSize(QtCore.QSize(166, 386))
SongImportWizard.setModal(True) SongImportWizard.setModal(True)
SongImportWizard.setWizardStyle(QtGui.QWizard.ModernStyle) SongImportWizard.setWizardStyle(QtGui.QWizard.ModernStyle)
SongImportWizard.setOptions(QtGui.QWizard.NoBackButtonOnLastPage | SongImportWizard.setOptions(
QtGui.QWizard.NoBackButtonOnStartPage) QtGui.QWizard.IndependentPages |
QtGui.QWizard.NoBackButtonOnStartPage |
QtGui.QWizard.NoBackButtonOnLastPage)
self.WelcomePage = QtGui.QWizardPage() self.WelcomePage = QtGui.QWizardPage()
self.WelcomePage.setObjectName(u'WelcomePage') self.WelcomePage.setObjectName(u'WelcomePage')
self.WelcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap,
QtGui.QPixmap(u':/wizards/wizard_importsong.bmp'))
self.WelcomeLayout = QtGui.QHBoxLayout(self.WelcomePage) self.WelcomeLayout = QtGui.QHBoxLayout(self.WelcomePage)
self.WelcomeLayout.setSpacing(8) self.WelcomeLayout.setSpacing(8)
self.WelcomeLayout.setMargin(0) self.WelcomeLayout.setMargin(0)
self.WelcomeLayout.setObjectName(u'WelcomeLayout') self.WelcomeLayout.setObjectName(u'WelcomeLayout')
self.ImportSongImage = QtGui.QLabel(self.WelcomePage)
self.ImportSongImage.setMinimumSize(QtCore.QSize(163, 0))
self.ImportSongImage.setMaximumSize(QtCore.QSize(163, 16777215))
self.ImportSongImage.setPixmap(
QtGui.QPixmap(u':/wizards/wizard_importsong.bmp'))
self.ImportSongImage.setObjectName(u'ImportSongImage')
self.WelcomeLayout.addWidget(self.ImportSongImage)
self.WelcomeTextLayout = QtGui.QVBoxLayout() self.WelcomeTextLayout = QtGui.QVBoxLayout()
self.WelcomeTextLayout.setSpacing(8) self.WelcomeTextLayout.setSpacing(8)
self.WelcomeTextLayout.setObjectName(u'WelcomeTextLayout') self.WelcomeTextLayout.setObjectName(u'WelcomeTextLayout')
@ -79,15 +75,18 @@ class Ui_SongImportWizard(object):
self.FormatLabel.setObjectName(u'FormatLabel') self.FormatLabel.setObjectName(u'FormatLabel')
self.FormatLayout.addWidget(self.FormatLabel) self.FormatLayout.addWidget(self.FormatLabel)
self.FormatComboBox = QtGui.QComboBox(self.SourcePage) self.FormatComboBox = QtGui.QComboBox(self.SourcePage)
sizePolicy = QtGui.QSizePolicy( sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding,
QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0) sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0) sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.FormatComboBox.sizePolicy().hasHeightForWidth()) sizePolicy.setHeightForWidth(
self.FormatComboBox.sizePolicy().hasHeightForWidth())
self.FormatComboBox.setSizePolicy(sizePolicy) self.FormatComboBox.setSizePolicy(sizePolicy)
self.FormatComboBox.setObjectName(u'FormatComboBox') self.FormatComboBox.setObjectName(u'FormatComboBox')
self.FormatComboBox.addItem(u'') self.FormatComboBox.addItem(u'')
self.FormatComboBox.addItem(u'') self.FormatComboBox.addItem(u'')
self.FormatComboBox.addItem(u'')
self.FormatComboBox.addItem(u'')
self.FormatLayout.addWidget(self.FormatComboBox) self.FormatLayout.addWidget(self.FormatComboBox)
self.FormatSpacer = QtGui.QSpacerItem(40, 20, self.FormatSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
@ -95,58 +94,108 @@ class Ui_SongImportWizard(object):
self.SourceLayout.addLayout(self.FormatLayout) self.SourceLayout.addLayout(self.FormatLayout)
self.FormatStackedWidget = QtGui.QStackedWidget(self.SourcePage) self.FormatStackedWidget = QtGui.QStackedWidget(self.SourcePage)
self.FormatStackedWidget.setObjectName(u'FormatStackedWidget') self.FormatStackedWidget.setObjectName(u'FormatStackedWidget')
self.OpenSongFilePage = QtGui.QWidget() self.OpenLyricsPage = QtGui.QWidget()
self.OpenSongFilePage.setObjectName(u'OpenSongFilePage') self.OpenLyricsPage.setObjectName(u'OpenLyricsPage')
self.OpenSongFileLayout = QtGui.QFormLayout(self.OpenSongFilePage) self.OpenLyricsLayout = QtGui.QVBoxLayout(self.OpenLyricsPage)
self.OpenSongFileLayout.setMargin(0) self.OpenLyricsLayout.setSpacing(8)
self.OpenSongFileLayout.setSpacing(8) self.OpenLyricsLayout.setMargin(0)
self.OpenSongFileLayout.setObjectName(u'OpenSongFileLayout') self.OpenLyricsLayout.setObjectName(u'OpenLyricsLayout')
self.OpenSongFileLabel = QtGui.QLabel(self.OpenSongFilePage) self.OpenLyricsFileListWidget = QtGui.QListWidget(self.OpenLyricsPage)
self.OpenSongFileLabel.setObjectName(u'OpenSongFileLabel') self.OpenLyricsFileListWidget.setObjectName(u'OpenLyricsFileListWidget')
self.OpenSongFileLayout.setWidget(0, self.OpenLyricsLayout.addWidget(self.OpenLyricsFileListWidget)
QtGui.QFormLayout.LabelRole, self.OpenSongFileLabel) self.OpenLyricsButtonLayout = QtGui.QHBoxLayout()
self.OpenSongFilenameLayout = QtGui.QHBoxLayout() self.OpenLyricsButtonLayout.setSpacing(8)
self.OpenSongFilenameLayout.setSpacing(8) self.OpenLyricsButtonLayout.setObjectName(u'OpenLyricsButtonLayout')
self.OpenSongFilenameLayout.setObjectName(u'OpenSongFilenameLayout') self.OpenLyricsAddButton = QtGui.QPushButton(self.OpenLyricsPage)
self.OpenSongFilenameLineEdit = QtGui.QLineEdit(self.OpenSongFilePage) self.OpenIcon = QtGui.QIcon()
self.OpenSongFilenameLineEdit.setObjectName(u'OpenSongFilenameLineEdit') self.OpenIcon.addPixmap(QtGui.QPixmap(u':/general/general_open.png'),
self.OpenSongFilenameLayout.addWidget(self.OpenSongFilenameLineEdit)
self.OpenSongFilenameButton = QtGui.QToolButton(self.OpenSongFilePage)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(u':/imports/import_load.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off) QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.OpenSongFilenameButton.setIcon(icon) self.DeleteIcon = QtGui.QIcon()
self.OpenSongFilenameButton.setObjectName(u'OpenSongFilenameButton') self.DeleteIcon.addPixmap(QtGui.QPixmap(u':/general/general_delete.png'),
self.OpenSongFilenameLayout.addWidget(self.OpenSongFilenameButton)
self.OpenSongFileLayout.setLayout(0,
QtGui.QFormLayout.FieldRole, self.OpenSongFilenameLayout)
self.FormatStackedWidget.addWidget(self.OpenSongFilePage)
self.OpenSongDirectoryPage = QtGui.QWidget()
self.OpenSongDirectoryPage.setObjectName(u'OpenSongDirectoryPage')
self.OpenSongDirectoryLayout = QtGui.QFormLayout(self.OpenSongDirectoryPage)
self.OpenSongDirectoryLayout.setMargin(0)
self.OpenSongDirectoryLayout.setSpacing(8)
self.OpenSongDirectoryLayout.setObjectName(u'OpenSongDirectoryLayout')
self.OpenSongDirectoryLabel = QtGui.QLabel(self.OpenSongDirectoryPage)
self.OpenSongDirectoryLabel.setObjectName(u'OpenSongDirectoryLabel')
self.OpenSongDirectoryLayout.setWidget(0,
QtGui.QFormLayout.LabelRole, self.OpenSongDirectoryLabel)
self.OpenSongDirLayout = QtGui.QHBoxLayout()
self.OpenSongDirLayout.setSpacing(8)
self.OpenSongDirLayout.setObjectName(u'OpenSongDirLayout')
self.OpenSongDirectoryLineEdit = QtGui.QLineEdit(self.OpenSongDirectoryPage)
self.OpenSongDirectoryLineEdit.setObjectName(u'OpenSongDirectoryLineEdit')
self.OpenSongDirLayout.addWidget(self.OpenSongDirectoryLineEdit)
self.OpenSongDirectoryButton = QtGui.QToolButton(self.OpenSongDirectoryPage)
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(u':/exports/export_load.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off) QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.OpenSongDirectoryButton.setIcon(icon1) self.OpenLyricsAddButton.setIcon(self.OpenIcon)
self.OpenSongDirectoryButton.setObjectName(u'OpenSongDirectoryButton') self.OpenLyricsAddButton.setObjectName(u'OpenLyricsAddButton')
self.OpenSongDirLayout.addWidget(self.OpenSongDirectoryButton) self.OpenLyricsButtonLayout.addWidget(self.OpenLyricsAddButton)
self.OpenSongDirectoryLayout.setLayout(0, self.OpenLyricsButtonSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QFormLayout.FieldRole, self.OpenSongDirLayout) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.FormatStackedWidget.addWidget(self.OpenSongDirectoryPage) self.OpenLyricsButtonLayout.addItem(self.OpenLyricsButtonSpacer)
self.OpenLyricsRemoveButton = QtGui.QPushButton(self.OpenLyricsPage)
self.OpenLyricsRemoveButton.setIcon(self.DeleteIcon)
self.OpenLyricsRemoveButton.setObjectName(u'OpenLyricsRemoveButton')
self.OpenLyricsButtonLayout.addWidget(self.OpenLyricsRemoveButton)
self.OpenLyricsLayout.addLayout(self.OpenLyricsButtonLayout)
self.FormatStackedWidget.addWidget(self.OpenLyricsPage)
self.OpenSongPage = QtGui.QWidget()
self.OpenSongPage.setObjectName(u'OpenSongPage')
self.OpenSongLayout = QtGui.QVBoxLayout(self.OpenSongPage)
self.OpenSongLayout.setSpacing(8)
self.OpenSongLayout.setMargin(0)
self.OpenSongLayout.setObjectName(u'OpenSongLayout')
self.OpenSongFileListWidget = QtGui.QListWidget(self.OpenSongPage)
self.OpenSongFileListWidget.setObjectName(u'OpenSongFileListWidget')
self.OpenSongLayout.addWidget(self.OpenSongFileListWidget)
self.OpenSongButtonLayout = QtGui.QHBoxLayout()
self.OpenSongButtonLayout.setSpacing(8)
self.OpenSongButtonLayout.setObjectName(u'OpenSongButtonLayout')
self.OpenSongAddButton = QtGui.QPushButton(self.OpenSongPage)
self.OpenSongAddButton.setIcon(self.OpenIcon)
self.OpenSongAddButton.setObjectName(u'OpenSongAddButton')
self.OpenSongButtonLayout.addWidget(self.OpenSongAddButton)
self.OpenSongButtonSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.OpenSongButtonLayout.addItem(self.OpenSongButtonSpacer)
self.OpenSongRemoveButton = QtGui.QPushButton(self.OpenSongPage)
self.OpenSongRemoveButton.setIcon(self.DeleteIcon)
self.OpenSongRemoveButton.setObjectName(u'OpenSongRemoveButton')
self.OpenSongButtonLayout.addWidget(self.OpenSongRemoveButton)
self.OpenSongLayout.addLayout(self.OpenSongButtonLayout)
self.FormatStackedWidget.addWidget(self.OpenSongPage)
self.CCLIPage = QtGui.QWidget()
self.CCLIPage.setObjectName(u'CCLIPage')
self.CCLILayout = QtGui.QVBoxLayout(self.CCLIPage)
self.CCLILayout.setSpacing(8)
self.CCLILayout.setMargin(0)
self.CCLILayout.setObjectName(u'CCLILayout')
self.CCLIFileListWidget = QtGui.QListWidget(self.CCLIPage)
self.CCLIFileListWidget.setObjectName(u'CCLIFileListWidget')
self.CCLILayout.addWidget(self.CCLIFileListWidget)
self.CCLIButtonLayout = QtGui.QHBoxLayout()
self.CCLIButtonLayout.setSpacing(8)
self.CCLIButtonLayout.setObjectName(u'CCLIButtonLayout')
self.CCLIAddButton = QtGui.QPushButton(self.CCLIPage)
self.CCLIAddButton.setIcon(self.OpenIcon)
self.CCLIAddButton.setObjectName(u'CCLIAddButton')
self.CCLIButtonLayout.addWidget(self.CCLIAddButton)
self.CCLIButtonSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.CCLIButtonLayout.addItem(self.CCLIButtonSpacer)
self.CCLIRemoveButton = QtGui.QPushButton(self.CCLIPage)
self.CCLIRemoveButton.setIcon(self.DeleteIcon)
self.CCLIRemoveButton.setObjectName(u'CCLIRemoveButton')
self.CCLIButtonLayout.addWidget(self.CCLIRemoveButton)
self.CCLILayout.addLayout(self.CCLIButtonLayout)
self.FormatStackedWidget.addWidget(self.CCLIPage)
self.CSVPage = QtGui.QWidget()
self.CSVPage.setObjectName(u'CSVPage')
self.CSVLayout = QtGui.QFormLayout(self.CSVPage)
self.CSVLayout.setMargin(0)
self.CSVLayout.setSpacing(8)
self.CSVLayout.setObjectName(u'CSVLayout')
self.CSVFilenameLabel = QtGui.QLabel(self.CSVPage)
self.CSVFilenameLabel.setObjectName(u'CSVFilenameLabel')
self.CSVLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.CSVFilenameLabel)
self.CSVFileLayout = QtGui.QHBoxLayout()
self.CSVFileLayout.setSpacing(8)
self.CSVFileLayout.setObjectName(u'CSVFileLayout')
self.CSVFilenameEdit = QtGui.QLineEdit(self.CSVPage)
self.CSVFilenameEdit.setObjectName(u'CSVFilenameEdit')
self.CSVFileLayout.addWidget(self.CSVFilenameEdit)
self.CSVBrowseButton = QtGui.QToolButton(self.CSVPage)
self.CSVBrowseButton.setIcon(self.OpenIcon)
self.CSVBrowseButton.setObjectName(u'CSVBrowseButton')
self.CSVFileLayout.addWidget(self.CSVBrowseButton)
self.CSVLayout.setLayout(0, QtGui.QFormLayout.FieldRole, self.CSVFileLayout)
self.FormatStackedWidget.addWidget(self.CSVPage)
self.SourceLayout.addWidget(self.FormatStackedWidget) self.SourceLayout.addWidget(self.FormatStackedWidget)
SongImportWizard.addPage(self.SourcePage) SongImportWizard.addPage(self.SourcePage)
self.ImportPage = QtGui.QWizardPage() self.ImportPage = QtGui.QWizardPage()
@ -164,7 +213,6 @@ class Ui_SongImportWizard(object):
self.ImportProgressBar.setObjectName(u'ImportProgressBar') self.ImportProgressBar.setObjectName(u'ImportProgressBar')
self.ImportLayout.addWidget(self.ImportProgressBar) self.ImportLayout.addWidget(self.ImportProgressBar)
SongImportWizard.addPage(self.ImportPage) SongImportWizard.addPage(self.ImportPage)
self.OpenSongFileLabel.setBuddy(self.OpenSongFilenameLineEdit)
self.retranslateUi(SongImportWizard) self.retranslateUi(SongImportWizard)
self.FormatStackedWidget.setCurrentIndex(0) self.FormatStackedWidget.setCurrentIndex(0)
@ -177,23 +225,9 @@ class Ui_SongImportWizard(object):
def retranslateUi(self, SongImportWizard): def retranslateUi(self, SongImportWizard):
SongImportWizard.setWindowTitle(self.trUtf8('Song Import Wizard')) SongImportWizard.setWindowTitle(self.trUtf8('Song Import Wizard'))
self.TitleLabel.setText(self.trUtf8( self.TitleLabel.setText(
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" \n' '<span style="font-size:14pt; font-weight:600;">%s</span>' % \
' "http://www.w3.org/TR/REC-html40/strict.dtd">\n' self.trUtf8('Welcome to the Song Import Wizard'))
'<html>\n'
' <head>\n'
' <meta name="qrichtext" content="1" />\n'
' <style type="text/css">p, li { white-space: pre-wrap; }</style>\n'
' </head>\n'
' <body style="font-family: Lucida Grande; font-size:10pt; font-weight:400; font-style:normal;">\n'
' <p style="margin: 0; -qt-block-indent:0; text-indent:0px;">\n'
' <span style="font-size:14pt; font-weight:600;">\n'
' Welcome to the Song Import Wizard\n'
' </span>\n'
' </p>\n'
' </body>\n'
'</html>'
))
self.InformationLabel.setText(self.trUtf8('This wizard will help you ' self.InformationLabel.setText(self.trUtf8('This wizard will help you '
'to import songs from a variety of formats. Click the next button ' 'to import songs from a variety of formats. Click the next button '
'below to start the process by selecting a format to import from.')) 'below to start the process by selecting a format to import from.'))
@ -201,10 +235,18 @@ class Ui_SongImportWizard(object):
self.SourcePage.setSubTitle(self.trUtf8('Select the import format, ' self.SourcePage.setSubTitle(self.trUtf8('Select the import format, '
'and where to import from.')) 'and where to import from.'))
self.FormatLabel.setText(self.trUtf8('Format:')) self.FormatLabel.setText(self.trUtf8('Format:'))
self.FormatComboBox.setItemText(0, self.trUtf8('OpenSong (Single File)')) self.FormatComboBox.setItemText(0, self.trUtf8('OpenLyrics'))
self.FormatComboBox.setItemText(1, self.trUtf8('OpenSong (Directory of Files)')) self.FormatComboBox.setItemText(1, self.trUtf8('OpenSong'))
self.OpenSongFileLabel.setText(self.trUtf8('Filename:')) self.FormatComboBox.setItemText(2, self.trUtf8('CCLI'))
self.OpenSongDirectoryLabel.setText(self.trUtf8('Directory:')) self.FormatComboBox.setItemText(3, self.trUtf8('CSV'))
self.OpenLyricsAddButton.setText(self.trUtf8('Add Files...'))
self.OpenLyricsRemoveButton.setText(self.trUtf8('Remove File(s)'))
self.OpenSongAddButton.setText(self.trUtf8('Add Files...'))
self.OpenSongRemoveButton.setText(self.trUtf8('Remove File(s)'))
self.CCLIAddButton.setText(self.trUtf8('Add Files...'))
self.CCLIRemoveButton.setText(self.trUtf8('Remove File(s)'))
self.CSVFilenameLabel.setText(self.trUtf8('Filename:'))
self.CSVBrowseButton.setText(self.trUtf8('Browse...'))
self.ImportPage.setTitle(self.trUtf8('Importing')) self.ImportPage.setTitle(self.trUtf8('Importing'))
self.ImportPage.setSubTitle(self.trUtf8('Please wait while your songs ' self.ImportPage.setSubTitle(self.trUtf8('Please wait while your songs '
'are imported.')) 'are imported.'))

View File

@ -30,7 +30,51 @@ from openlp.plugins.songs.lib.models import init_models, metadata, Song, \
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class SongManager(): class SongFormat(object):
"""
This is a special enumeration class that holds the various types of songs,
plus a few helper functions to facilitate generic handling of song types
for importing.
"""
Unknown = -1
OpenLyrics = 0
OpenSongFile = 1
OpenSongDirectory = 2
CSV = 3
@staticmethod
def get_class(id):
"""
Return the appropriate imeplementation class.
``id``
The Bible format.
"""
if id == BibleFormat.OSIS:
return OSISBible
elif id == BibleFormat.CSV:
return CSVBible
elif id == BibleFormat.OpenSong:
return OpenSongBible
elif id == BibleFormat.WebDownload:
return HTTPBible
else:
return None
@staticmethod
def list():
"""
Return a list of the supported Bible formats.
"""
return [
BibleFormat.OSIS,
BibleFormat.CSV,
BibleFormat.OpenSong,
BibleFormat.WebDownload
]
class SongManager(object):
""" """
The Song Manager provides a central location for all database code. This The Song Manager provides a central location for all database code. This
class takes care of connecting to the database and running all the queries. class takes care of connecting to the database and running all the queries.

View File

@ -156,12 +156,22 @@ p, li { white-space: pre-wrap; }
</property> </property>
<item> <item>
<property name="text"> <property name="text">
<string>OpenSong (Single File)</string> <string>OpenLyrics</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>OpenSong (Directory of Files)</string> <string>OpenSong</string>
</property>
</item>
<item>
<property name="text">
<string>CCLI</string>
</property>
</item>
<item>
<property name="text">
<string>CSV</string>
</property> </property>
</item> </item>
</widget> </widget>
@ -184,45 +194,56 @@ p, li { white-space: pre-wrap; }
<item> <item>
<widget class="QStackedWidget" name="FormatStackedWidget"> <widget class="QStackedWidget" name="FormatStackedWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>3</number>
</property> </property>
<widget class="QWidget" name="OpenSongFilePage"> <widget class="QWidget" name="OpenLyricsPage">
<layout class="QFormLayout" name="OpenSongFileLayout"> <layout class="QVBoxLayout" name="OpenLyricsLayout">
<property name="horizontalSpacing"> <property name="spacing">
<number>8</number>
</property>
<property name="verticalSpacing">
<number>8</number> <number>8</number>
</property> </property>
<property name="margin"> <property name="margin">
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0"> <item>
<widget class="QLabel" name="OpenSongFileLabel"> <widget class="QListWidget" name="OpenLyricsFileListWidget"/>
<property name="text">
<string>Filename:</string>
</property>
<property name="buddy">
<cstring>OpenSongFilenameLineEdit</cstring>
</property>
</widget>
</item> </item>
<item row="0" column="1"> <item>
<layout class="QHBoxLayout" name="OpenSongFilenameLayout"> <layout class="QHBoxLayout" name="OpenLyricsButtonLayout">
<property name="spacing"> <property name="spacing">
<number>8</number> <number>8</number>
</property> </property>
<item> <item>
<widget class="QLineEdit" name="OpenSongFilenameLineEdit"/> <widget class="QPushButton" name="OpenLyricsAddButton">
</item>
<item>
<widget class="QToolButton" name="OpenSongFilenameButton">
<property name="text"> <property name="text">
<string/> <string>Add Files...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images/openlp-2.qrc"> <iconset resource="../images/openlp-2.qrc">
<normaloff>:/imports/import_load.png</normaloff>:/imports/import_load.png</iconset> <normaloff>:/general/general_open.png</normaloff>:/general/general_open.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="OpenLyricsButtonSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="OpenLyricsRemoveButton">
<property name="text">
<string>Remove File(s)</string>
</property>
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/general/general_delete.png</normaloff>:/general/general_delete.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@ -230,8 +251,118 @@ p, li { white-space: pre-wrap; }
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="OpenSongDirectoryPage"> <widget class="QWidget" name="OpenSongPage">
<layout class="QFormLayout" name="OpenSongDirectoryLayout"> <layout class="QVBoxLayout" name="OpenSongLayout">
<property name="spacing">
<number>8</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QListWidget" name="OpenSongFileListWidget"/>
</item>
<item>
<layout class="QHBoxLayout" name="OpenSongButtonLayout">
<property name="spacing">
<number>8</number>
</property>
<item>
<widget class="QPushButton" name="OpenSongAddButton">
<property name="text">
<string>Add Files...</string>
</property>
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/general/general_open.png</normaloff>:/general/general_open.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="OpenSongButtonSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="OpenSongRemoveButton">
<property name="text">
<string>Remove File(s)</string>
</property>
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/general/general_delete.png</normaloff>:/general/general_delete.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="CCLIPage">
<layout class="QVBoxLayout" name="CCLILayout">
<property name="spacing">
<number>8</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QListWidget" name="CCLIFileListWidget"/>
</item>
<item>
<layout class="QHBoxLayout" name="CCLIButtonLayout">
<property name="spacing">
<number>8</number>
</property>
<item>
<widget class="QPushButton" name="CCLIAddButton">
<property name="text">
<string>Add Files...</string>
</property>
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/general/general_open.png</normaloff>:/general/general_open.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="CCLIButtonSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="CCLIRemoveButton">
<property name="text">
<string>Remove File(s)</string>
</property>
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/general/general_delete.png</normaloff>:/general/general_delete.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="CSVPage">
<layout class="QFormLayout" name="CSVLayout">
<property name="horizontalSpacing"> <property name="horizontalSpacing">
<number>8</number> <number>8</number>
</property> </property>
@ -242,28 +373,28 @@ p, li { white-space: pre-wrap; }
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="OpenSongDirectoryLabel"> <widget class="QLabel" name="CSVFilenameLabel">
<property name="text"> <property name="text">
<string>Directory:</string> <string>Filename:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<layout class="QHBoxLayout" name="OpenSongDirLayout"> <layout class="QHBoxLayout" name="CSVFileLayout">
<property name="spacing"> <property name="spacing">
<number>8</number> <number>8</number>
</property> </property>
<item> <item>
<widget class="QLineEdit" name="OpenSongDirectoryLineEdit"/> <widget class="QLineEdit" name="CSVFilenameEdit"/>
</item> </item>
<item> <item>
<widget class="QToolButton" name="OpenSongDirectoryButton"> <widget class="QToolButton" name="CSVBrowseButton">
<property name="text"> <property name="text">
<string/> <string>Browse...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images/openlp-2.qrc"> <iconset resource="../images/openlp-2.qrc">
<normaloff>:/exports/export_load.png</normaloff>:/exports/export_load.png</iconset> <normaloff>:/general/general_open.png</normaloff>:/general/general_open.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>