Added extra labels to show that an item is disabled.

Added functionality to the SongFormat class to keep track of availability of importers.
This commit is contained in:
Raoul Snyman 2010-09-13 23:09:13 +02:00
parent 4e8f663444
commit 0a84fc0bcc
3 changed files with 175 additions and 68 deletions

View File

@ -57,6 +57,15 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
self.registerFields() self.registerFields()
self.finishButton = self.button(QtGui.QWizard.FinishButton) self.finishButton = self.button(QtGui.QWizard.FinishButton)
self.cancelButton = self.button(QtGui.QWizard.CancelButton) self.cancelButton = self.button(QtGui.QWizard.CancelButton)
if not SongFormat.get_availability(SongFormat.OpenLP1):
self.openLP1DisabledWidget.setVisible(True)
self.openLP1ImportWidget.setVisible(False)
if not SongFormat.get_availability(SongFormat.SongsOfFellowship):
self.songsOfFellowshipDisabledWidget.setVisible(True)
self.songsOfFellowshipImportWidget.setVisible(False)
if not SongFormat.get_availability(SongFormat.Generic):
self.genericDisabledWidget.setVisible(True)
self.genericImportWidget.setVisible(False)
self.plugin = plugin self.plugin = plugin
QtCore.QObject.connect(self.openLP2BrowseButton, QtCore.QObject.connect(self.openLP2BrowseButton,
QtCore.SIGNAL(u'clicked()'), QtCore.SIGNAL(u'clicked()'),
@ -64,12 +73,12 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
QtCore.QObject.connect(self.openLP1BrowseButton, QtCore.QObject.connect(self.openLP1BrowseButton,
QtCore.SIGNAL(u'clicked()'), QtCore.SIGNAL(u'clicked()'),
self.onOpenLP1BrowseButtonClicked) self.onOpenLP1BrowseButtonClicked)
QtCore.QObject.connect(self.openLyricsAddButton, #QtCore.QObject.connect(self.openLyricsAddButton,
QtCore.SIGNAL(u'clicked()'), # QtCore.SIGNAL(u'clicked()'),
self.onOpenLyricsAddButtonClicked) # self.onOpenLyricsAddButtonClicked)
QtCore.QObject.connect(self.openLyricsRemoveButton, #QtCore.QObject.connect(self.openLyricsRemoveButton,
QtCore.SIGNAL(u'clicked()'), # QtCore.SIGNAL(u'clicked()'),
self.onOpenLyricsRemoveButtonClicked) # self.onOpenLyricsRemoveButtonClicked)
QtCore.QObject.connect(self.openSongAddButton, QtCore.QObject.connect(self.openSongAddButton,
QtCore.SIGNAL(u'clicked()'), QtCore.SIGNAL(u'clicked()'),
self.onOpenSongAddButtonClicked) self.onOpenSongAddButtonClicked)
@ -145,15 +154,16 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
self.openLP1BrowseButton.setFocus() self.openLP1BrowseButton.setFocus()
return False return False
elif source_format == SongFormat.OpenLyrics: elif source_format == SongFormat.OpenLyrics:
if self.openLyricsFileListWidget.count() == 0: #if self.openLyricsFileListWidget.count() == 0:
QtGui.QMessageBox.critical(self, # QtGui.QMessageBox.critical(self,
translate('SongsPlugin.ImportWizardForm', # translate('SongsPlugin.ImportWizardForm',
'No OpenLyrics Files Selected'), # 'No OpenLyrics Files Selected'),
translate('SongsPlugin.ImportWizardForm', # translate('SongsPlugin.ImportWizardForm',
'You need to add at least one OpenLyrics ' # 'You need to add at least one OpenLyrics '
'song file to import from.')) # 'song file to import from.'))
self.openLyricsAddButton.setFocus() # self.openLyricsAddButton.setFocus()
return False # return False
return False
elif source_format == SongFormat.OpenSong: elif source_format == SongFormat.OpenSong:
if self.openSongFileListWidget.count() == 0: if self.openSongFileListWidget.count() == 0:
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
@ -252,15 +262,15 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
self.openLP1FilenameEdit self.openLP1FilenameEdit
) )
def onOpenLyricsAddButtonClicked(self): #def onOpenLyricsAddButtonClicked(self):
self.getFiles( # self.getFiles(
translate('SongsPlugin.ImportWizardForm', # translate('SongsPlugin.ImportWizardForm',
'Select OpenLyrics Files'), # 'Select OpenLyrics Files'),
self.openLyricsFileListWidget # self.openLyricsFileListWidget
) # )
def onOpenLyricsRemoveButtonClicked(self): #def onOpenLyricsRemoveButtonClicked(self):
self.removeSelectedItems(self.openLyricsFileListWidget) # self.removeSelectedItems(self.openLyricsFileListWidget)
def onOpenSongAddButtonClicked(self): def onOpenSongAddButtonClicked(self):
self.getFiles( self.getFiles(
@ -334,7 +344,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
self.formatComboBox.setCurrentIndex(0) self.formatComboBox.setCurrentIndex(0)
self.openLP2FilenameEdit.setText(u'') self.openLP2FilenameEdit.setText(u'')
self.openLP1FilenameEdit.setText(u'') self.openLP1FilenameEdit.setText(u'')
self.openLyricsFileListWidget.clear() #self.openLyricsFileListWidget.clear()
self.openSongFileListWidget.clear() self.openSongFileListWidget.clear()
self.wordsOfWorshipFileListWidget.clear() self.wordsOfWorshipFileListWidget.clear()
self.ccliFileListWidget.clear() self.ccliFileListWidget.clear()

View File

@ -131,26 +131,43 @@ class Ui_SongImportWizard(object):
# openlp.org 1.x # openlp.org 1.x
self.openLP1Page = QtGui.QWidget() self.openLP1Page = QtGui.QWidget()
self.openLP1Page.setObjectName(u'openLP1Page') self.openLP1Page.setObjectName(u'openLP1Page')
self.openLP1Layout = QtGui.QFormLayout(self.openLP1Page) self.openLP1Layout = QtGui.QVBoxLayout(self.openLP1Page)
self.openLP1Layout.setMargin(0) self.openLP1Layout.setMargin(0)
self.openLP1Layout.setSpacing(8) self.openLP1Layout.setSpacing(0)
self.openLP1Layout.setObjectName(u'openLP1Layout') self.openLP1Layout.setObjectName(u'openLP1Layout')
self.openLP1FilenameLabel = QtGui.QLabel(self.openLP1Page) self.openLP1DisabledWidget = QtGui.QWidget(self.openLP1Page)
self.openLP1DisabledLayout = QtGui.QVBoxLayout(self.openLP1DisabledWidget)
self.openLP1DisabledLayout.setMargin(0)
self.openLP1DisabledLayout.setSpacing(8)
self.openLP1DisabledLayout.setObjectName(u'openLP1DisabledLayout')
self.openLP1DisabledLabel = QtGui.QLabel(self.openLP1DisabledWidget)
self.openLP1DisabledLabel.setWordWrap(True)
self.openLP1DisabledLabel.setObjectName(u'openLP1DisabledLabel')
self.openLP1DisabledLayout.addWidget(self.openLP1DisabledLabel)
self.openLP1DisabledWidget.setVisible(False)
self.openLP1Layout.addWidget(self.openLP1DisabledWidget)
self.openLP1ImportWidget = QtGui.QWidget(self.openLP1Page)
self.openLP1ImportLayout = QtGui.QFormLayout(self.openLP1ImportWidget)
self.openLP1ImportLayout.setMargin(0)
self.openLP1ImportLayout.setSpacing(8)
self.openLP1ImportLayout.setObjectName(u'openLP1ImportLayout')
self.openLP1FilenameLabel = QtGui.QLabel(self.openLP1ImportWidget)
self.openLP1FilenameLabel.setObjectName(u'openLP1FilenameLabel') self.openLP1FilenameLabel.setObjectName(u'openLP1FilenameLabel')
self.openLP1Layout.setWidget(0, QtGui.QFormLayout.LabelRole, self.openLP1ImportLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
self.openLP1FilenameLabel) self.openLP1FilenameLabel)
self.openLP1FileLayout = QtGui.QHBoxLayout() self.openLP1FileLayout = QtGui.QHBoxLayout()
self.openLP1FileLayout.setSpacing(8) self.openLP1FileLayout.setSpacing(8)
self.openLP1FileLayout.setObjectName(u'openLP1FileLayout') self.openLP1FileLayout.setObjectName(u'openLP1FileLayout')
self.openLP1FilenameEdit = QtGui.QLineEdit(self.openLP1Page) self.openLP1FilenameEdit = QtGui.QLineEdit(self.openLP1ImportWidget)
self.openLP1FilenameEdit.setObjectName(u'openLP1FilenameEdit') self.openLP1FilenameEdit.setObjectName(u'openLP1FilenameEdit')
self.openLP1FileLayout.addWidget(self.openLP1FilenameEdit) self.openLP1FileLayout.addWidget(self.openLP1FilenameEdit)
self.openLP1BrowseButton = QtGui.QToolButton(self.openLP1Page) self.openLP1BrowseButton = QtGui.QToolButton(self.openLP1ImportWidget)
self.openLP1BrowseButton.setIcon(openIcon) self.openLP1BrowseButton.setIcon(openIcon)
self.openLP1BrowseButton.setObjectName(u'openLP1BrowseButton') self.openLP1BrowseButton.setObjectName(u'openLP1BrowseButton')
self.openLP1FileLayout.addWidget(self.openLP1BrowseButton) self.openLP1FileLayout.addWidget(self.openLP1BrowseButton)
self.openLP1Layout.setLayout(0, QtGui.QFormLayout.FieldRole, self.openLP1ImportLayout.setLayout(0, QtGui.QFormLayout.FieldRole,
self.openLP1FileLayout) self.openLP1FileLayout)
self.openLP1Layout.addWidget(self.openLP1ImportWidget)
self.formatStackedWidget.addWidget(self.openLP1Page) self.formatStackedWidget.addWidget(self.openLP1Page)
# OpenLyrics # OpenLyrics
self.openLyricsPage = QtGui.QWidget() self.openLyricsPage = QtGui.QWidget()
@ -159,26 +176,31 @@ class Ui_SongImportWizard(object):
self.openLyricsLayout.setSpacing(8) self.openLyricsLayout.setSpacing(8)
self.openLyricsLayout.setMargin(0) self.openLyricsLayout.setMargin(0)
self.openLyricsLayout.setObjectName(u'OpenLyricsLayout') self.openLyricsLayout.setObjectName(u'OpenLyricsLayout')
self.openLyricsFileListWidget = QtGui.QListWidget(self.openLyricsPage) self.openLyricsDisabledLabel = QtGui.QLabel(self.openLyricsPage)
self.openLyricsFileListWidget.setSelectionMode( self.openLyricsDisabledLabel.setWordWrap(True)
QtGui.QAbstractItemView.ExtendedSelection) self.openLyricsDisabledLabel.setObjectName(u'openLyricsDisabledLabel')
self.openLyricsFileListWidget.setObjectName(u'OpenLyricsFileListWidget') self.openLyricsLayout.addWidget(self.openLyricsDisabledLabel)
self.openLyricsLayout.addWidget(self.openLyricsFileListWidget) # Commented out for future use.
self.openLyricsButtonLayout = QtGui.QHBoxLayout() #self.openLyricsFileListWidget = QtGui.QListWidget(self.openLyricsPage)
self.openLyricsButtonLayout.setSpacing(8) #self.openLyricsFileListWidget.setSelectionMode(
self.openLyricsButtonLayout.setObjectName(u'OpenLyricsButtonLayout') # QtGui.QAbstractItemView.ExtendedSelection)
self.openLyricsAddButton = QtGui.QPushButton(self.openLyricsPage) #self.openLyricsFileListWidget.setObjectName(u'OpenLyricsFileListWidget')
self.openLyricsAddButton.setIcon(openIcon) #self.openLyricsLayout.addWidget(self.openLyricsFileListWidget)
self.openLyricsAddButton.setObjectName(u'OpenLyricsAddButton') #self.openLyricsButtonLayout = QtGui.QHBoxLayout()
self.openLyricsButtonLayout.addWidget(self.openLyricsAddButton) #self.openLyricsButtonLayout.setSpacing(8)
self.openLyricsButtonSpacer = QtGui.QSpacerItem(40, 20, #self.openLyricsButtonLayout.setObjectName(u'OpenLyricsButtonLayout')
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) #self.openLyricsAddButton = QtGui.QPushButton(self.openLyricsPage)
self.openLyricsButtonLayout.addItem(self.openLyricsButtonSpacer) #self.openLyricsAddButton.setIcon(openIcon)
self.openLyricsRemoveButton = QtGui.QPushButton(self.openLyricsPage) #self.openLyricsAddButton.setObjectName(u'OpenLyricsAddButton')
self.openLyricsRemoveButton.setIcon(deleteIcon) #self.openLyricsButtonLayout.addWidget(self.openLyricsAddButton)
self.openLyricsRemoveButton.setObjectName(u'OpenLyricsRemoveButton') #self.openLyricsButtonSpacer = QtGui.QSpacerItem(40, 20,
self.openLyricsButtonLayout.addWidget(self.openLyricsRemoveButton) # QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.openLyricsLayout.addLayout(self.openLyricsButtonLayout) #self.openLyricsButtonLayout.addItem(self.openLyricsButtonSpacer)
#self.openLyricsRemoveButton = QtGui.QPushButton(self.openLyricsPage)
#self.openLyricsRemoveButton.setIcon(deleteIcon)
#self.openLyricsRemoveButton.setObjectName(u'OpenLyricsRemoveButton')
#self.openLyricsButtonLayout.addWidget(self.openLyricsRemoveButton)
#self.openLyricsLayout.addLayout(self.openLyricsButtonLayout)
self.formatStackedWidget.addWidget(self.openLyricsPage) self.formatStackedWidget.addWidget(self.openLyricsPage)
# Open Song # Open Song
self.openSongPage = QtGui.QWidget() self.openSongPage = QtGui.QWidget()
@ -277,22 +299,46 @@ class Ui_SongImportWizard(object):
self.songsOfFellowshipLayout = QtGui.QVBoxLayout( self.songsOfFellowshipLayout = QtGui.QVBoxLayout(
self.songsOfFellowshipPage) self.songsOfFellowshipPage)
self.songsOfFellowshipLayout.setMargin(0) self.songsOfFellowshipLayout.setMargin(0)
self.songsOfFellowshipLayout.setSpacing(8) self.songsOfFellowshipLayout.setSpacing(0)
self.songsOfFellowshipLayout.setObjectName(u'songsOfFellowshipLayout') self.songsOfFellowshipLayout.setObjectName(u'songsOfFellowshipLayout')
self.songsOfFellowshipFileListWidget = QtGui.QListWidget( self.songsOfFellowshipDisabledWidget = QtGui.QWidget(
self.songsOfFellowshipPage) self.songsOfFellowshipPage)
self.songsOfFellowshipDisabledWidget.setVisible(False)
self.songsOfFellowshipDisabledWidget.setObjectName(
u'songsOfFellowshipDisabledWidget')
self.songsOfFellowshipDisabledLabel = QtGui.QLabel(
self.songsOfFellowshipDisabledWidget)
self.songsOfFellowshipDisabledLabel.setWordWrap(True)
self.songsOfFellowshipDisabledLabel.setObjectName(
u'songsOfFellowshipDisabledLabel')
self.songsOfFellowshipDisabledLayout = QtGui.QVBoxLayout(
self.songsOfFellowshipDisabledWidget)
self.songsOfFellowshipDisabledLayout.setMargin(0)
self.songsOfFellowshipDisabledLayout.setSpacing(8)
self.songsOfFellowshipDisabledLayout.setObjectName(
u'songsOfFellowshipDisabledLayout')
self.songsOfFellowshipLayout.addWidget(
self.songsOfFellowshipDisabledWidget)
self.songsOfFellowshipImporterWidget = QtGui.QWidget(
self.songsOfFellowshipPage)
self.songsOfFellowshipImporterLayout = QtGui.QVBoxLayout(
self.songsOfFellowshipImporterWidget)
self.songsOfFellowshipImporterLayout.setObjectName(
u'songsOfFellowshipImporterLayout')
self.songsOfFellowshipFileListWidget = QtGui.QListWidget(
self.songsOfFellowshipImporterWidget)
self.songsOfFellowshipFileListWidget.setSelectionMode( self.songsOfFellowshipFileListWidget.setSelectionMode(
QtGui.QAbstractItemView.ExtendedSelection) QtGui.QAbstractItemView.ExtendedSelection)
self.songsOfFellowshipFileListWidget.setObjectName( self.songsOfFellowshipFileListWidget.setObjectName(
u'songsOfFellowshipFileListWidget') u'songsOfFellowshipFileListWidget')
self.songsOfFellowshipLayout.addWidget( self.songsOfFellowshipImporterLayout.addWidget(
self.songsOfFellowshipFileListWidget) self.songsOfFellowshipFileListWidget)
self.songsOfFellowshipButtonLayout = QtGui.QHBoxLayout() self.songsOfFellowshipButtonLayout = QtGui.QHBoxLayout()
self.songsOfFellowshipButtonLayout.setSpacing(8) self.songsOfFellowshipButtonLayout.setSpacing(8)
self.songsOfFellowshipButtonLayout.setObjectName( self.songsOfFellowshipButtonLayout.setObjectName(
u'songsOfFellowshipButtonLayout') u'songsOfFellowshipButtonLayout')
self.songsOfFellowshipAddButton = QtGui.QPushButton( self.songsOfFellowshipAddButton = QtGui.QPushButton(
self.songsOfFellowshipPage) self.songsOfFellowshipImporterWidget)
self.songsOfFellowshipAddButton.setIcon(openIcon) self.songsOfFellowshipAddButton.setIcon(openIcon)
self.songsOfFellowshipAddButton.setObjectName( self.songsOfFellowshipAddButton.setObjectName(
u'songsOfFellowshipAddButton') u'songsOfFellowshipAddButton')
@ -303,14 +349,16 @@ class Ui_SongImportWizard(object):
self.songsOfFellowshipButtonLayout.addItem( self.songsOfFellowshipButtonLayout.addItem(
self.songsOfFellowshipButtonSpacer) self.songsOfFellowshipButtonSpacer)
self.songsOfFellowshipRemoveButton = QtGui.QPushButton( self.songsOfFellowshipRemoveButton = QtGui.QPushButton(
self.songsOfFellowshipPage) self.songsOfFellowshipImporterWidget)
self.songsOfFellowshipRemoveButton.setIcon(deleteIcon) self.songsOfFellowshipRemoveButton.setIcon(deleteIcon)
self.songsOfFellowshipRemoveButton.setObjectName( self.songsOfFellowshipRemoveButton.setObjectName(
u'songsOfFellowshipRemoveButton') u'songsOfFellowshipRemoveButton')
self.songsOfFellowshipButtonLayout.addWidget( self.songsOfFellowshipButtonLayout.addWidget(
self.songsOfFellowshipRemoveButton) self.songsOfFellowshipRemoveButton)
self.songsOfFellowshipLayout.addLayout( self.songsOfFellowshipImporterLayout.addLayout(
self.songsOfFellowshipButtonLayout) self.songsOfFellowshipButtonLayout)
self.songsOfFellowshipLayout.addWidget(
self.songsOfFellowshipImporterWidget)
self.formatStackedWidget.addWidget(self.songsOfFellowshipPage) self.formatStackedWidget.addWidget(self.songsOfFellowshipPage)
# Generic Document/Presentation import # Generic Document/Presentation import
self.genericPage = QtGui.QWidget() self.genericPage = QtGui.QWidget()
@ -319,7 +367,20 @@ class Ui_SongImportWizard(object):
self.genericLayout.setMargin(0) self.genericLayout.setMargin(0)
self.genericLayout.setSpacing(8) self.genericLayout.setSpacing(8)
self.genericLayout.setObjectName(u'genericLayout') self.genericLayout.setObjectName(u'genericLayout')
self.genericFileListWidget = QtGui.QListWidget(self.genericPage) self.genericDisabledWidget = QtGui.QWidget(self.genericPage)
self.genericDisabledWidget.setObjectName(u'genericDisabledWidget')
self.genericDisabledLayout = QtGui.QVBoxLayout(self.genericDisabledWidget)
self.genericDisabledLayout.setObjectName(u'genericDisabledLayout')
self.genericDisabledLabel = QtGui.QLabel(self.genericDisabledWidget)
self.genericDisabledLabel.setWordWrap(True)
self.genericDisabledLabel.setObjectName(u'genericDisabledLabel')
self.genericDisabledWidget.setVisible(False)
self.genericDisabledLabel.setObjectName(u'genericDisabledWidget')
self.genericDisabledLayout.addWidget(self.genericDisabledLabel)
self.genericLayout.addWidget(self.genericDisabledWidget)
self.genericImportWidget = QtGui.QWidget(self.genericPage)
self.genericImportLayout = QtGui.QVBoxLayout(self.genericImportWidget)
self.genericFileListWidget = QtGui.QListWidget(self.genericImportWidget)
self.genericFileListWidget.setSelectionMode( self.genericFileListWidget.setSelectionMode(
QtGui.QAbstractItemView.ExtendedSelection) QtGui.QAbstractItemView.ExtendedSelection)
self.genericFileListWidget.setObjectName(u'genericFileListWidget') self.genericFileListWidget.setObjectName(u'genericFileListWidget')
@ -327,18 +388,19 @@ class Ui_SongImportWizard(object):
self.genericButtonLayout = QtGui.QHBoxLayout() self.genericButtonLayout = QtGui.QHBoxLayout()
self.genericButtonLayout.setSpacing(8) self.genericButtonLayout.setSpacing(8)
self.genericButtonLayout.setObjectName(u'genericButtonLayout') self.genericButtonLayout.setObjectName(u'genericButtonLayout')
self.genericAddButton = QtGui.QPushButton(self.genericPage) self.genericAddButton = QtGui.QPushButton(self.genericImportWidget)
self.genericAddButton.setIcon(openIcon) self.genericAddButton.setIcon(openIcon)
self.genericAddButton.setObjectName(u'genericAddButton') self.genericAddButton.setObjectName(u'genericAddButton')
self.genericButtonLayout.addWidget(self.genericAddButton) self.genericButtonLayout.addWidget(self.genericAddButton)
self.genericButtonSpacer = QtGui.QSpacerItem(40, 20, self.genericButtonSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.genericButtonLayout.addItem(self.genericButtonSpacer) self.genericButtonLayout.addItem(self.genericButtonSpacer)
self.genericRemoveButton = QtGui.QPushButton(self.genericPage) self.genericRemoveButton = QtGui.QPushButton(self.genericImportWidget)
self.genericRemoveButton.setIcon(deleteIcon) self.genericRemoveButton.setIcon(deleteIcon)
self.genericRemoveButton.setObjectName(u'genericRemoveButton') self.genericRemoveButton.setObjectName(u'genericRemoveButton')
self.genericButtonLayout.addWidget(self.genericRemoveButton) self.genericButtonLayout.addWidget(self.genericRemoveButton)
self.genericLayout.addLayout(self.genericButtonLayout) self.genericImportLayout.addLayout(self.genericButtonLayout)
self.genericLayout.addWidget(self.genericImportWidget)
self.formatStackedWidget.addWidget(self.genericPage) self.formatStackedWidget.addWidget(self.genericPage)
# Commented out for future use. # Commented out for future use.
# self.csvPage = QtGui.QWidget() # self.csvPage = QtGui.QWidget()
@ -434,10 +496,20 @@ class Ui_SongImportWizard(object):
translate('SongsPlugin.ImportWizardForm', 'Filename:')) translate('SongsPlugin.ImportWizardForm', 'Filename:'))
self.openLP1BrowseButton.setText( self.openLP1BrowseButton.setText(
translate('SongsPlugin.ImportWizardForm', 'Browse...')) translate('SongsPlugin.ImportWizardForm', 'Browse...'))
self.openLyricsAddButton.setText( self.openLP1DisabledLabel.setText(
translate('SongsPlugin.ImportWizardForm', 'Add Files...')) translate('SongsPlugin.ImportWizardForm', 'The openlp.org 1.x '
self.openLyricsRemoveButton.setText( 'importer has been disabled due to a missing Python module. If '
translate('SongsPlugin.ImportWizardForm', 'Remove File(s)')) 'you want to use this importer, you will need to install the '
'"python-sqlite" module.'))
#self.openLyricsAddButton.setText(
# translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
#self.openLyricsRemoveButton.setText(
# translate('SongsPlugin.ImportWizardForm', 'Remove File(s)'))
self.openLyricsDisabledLabel.setText(
translate('SongsPlugin.ImportWizardForm', 'The OpenLyrics '
'importer has not yet been developed, but as you can see, we are '
'still intendeding to do so. Hopefully it will be in the next '
'release.'))
self.openSongAddButton.setText( self.openSongAddButton.setText(
translate('SongsPlugin.ImportWizardForm', 'Add Files...')) translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
self.openSongRemoveButton.setText( self.openSongRemoveButton.setText(
@ -454,10 +526,18 @@ class Ui_SongImportWizard(object):
translate('SongsPlugin.ImportWizardForm', 'Add Files...')) translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
self.songsOfFellowshipRemoveButton.setText( self.songsOfFellowshipRemoveButton.setText(
translate('SongsPlugin.ImportWizardForm', 'Remove File(s)')) translate('SongsPlugin.ImportWizardForm', 'Remove File(s)'))
self.songsOfFellowshipDisabledLabel.setText(
translate('SongsPlugin.ImportWizardForm', 'The Songs of '
'Fellowship importer has been disabled because OpenLP cannot '
'find OpenOffice.org on your computer.'))
self.genericAddButton.setText( self.genericAddButton.setText(
translate('SongsPlugin.ImportWizardForm', 'Add Files...')) translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
self.genericRemoveButton.setText( self.genericRemoveButton.setText(
translate('SongsPlugin.ImportWizardForm', 'Remove File(s)')) translate('SongsPlugin.ImportWizardForm', 'Remove File(s)'))
self.genericDisabledLabel.setText(
translate('SongsPlugin.ImportWizardForm', 'The generic document/'
'presentation importer has been disabled because OpenLP cannot '
'find OpenOffice.org on your computer.'))
# self.csvFilenameLabel.setText( # self.csvFilenameLabel.setText(
# translate('SongsPlugin.ImportWizardForm', 'Filename:')) # translate('SongsPlugin.ImportWizardForm', 'Filename:'))
# self.csvBrowseButton.setText( # self.csvBrowseButton.setText(

View File

@ -26,12 +26,13 @@
from opensongimport import OpenSongImport from opensongimport import OpenSongImport
from olpimport import OpenLPSongImport from olpimport import OpenLPSongImport
from olp1import import OpenLP1SongImport from wowimport import WowImport
from cclifileimport import CCLIFileImport
# Imports that might fail
try: try:
from olp1import import OpenLP1SongImport
from sofimport import SofImport from sofimport import SofImport
from oooimport import OooImport from oooimport import OooImport
from cclifileimport import CCLIFileImport
from wowimport import WowImport
except ImportError: except ImportError:
pass pass
@ -41,6 +42,7 @@ class SongFormat(object):
plus a few helper functions to facilitate generic handling of song types plus a few helper functions to facilitate generic handling of song types
for importing. for importing.
""" """
_format_availability = {}
Unknown = -1 Unknown = -1
OpenLP2 = 0 OpenLP2 = 0
OpenLP1 = 1 OpenLP1 = 1
@ -93,4 +95,19 @@ class SongFormat(object):
SongFormat.Generic SongFormat.Generic
] ]
@staticmethod
def set_availability(format, available):
SongFormat._format_availability[format] = available
@staticmethod
def get_availability(format):
return SongFormat._format_availability.get(format, True)
if u'OpenLP1SongImport' not in locals():
SongFormat.set_availability(SongFormat.OpenLP1, False)
if u'SofImport' not in locals():
SongFormat.set_availability(SongFormat.SongsOfFellowship, False)
if u'OooImport' not in locals():
SongFormat.set_availability(SongFormat.Generic, False)
__all__ = [u'SongFormat'] __all__ = [u'SongFormat']