forked from openlp/openlp
Add in code to display a disabled message if an importer is not available.
This commit is contained in:
parent
0a84fc0bcc
commit
2f33ae1bab
@ -306,39 +306,45 @@ class Ui_SongImportWizard(object):
|
||||
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.songsOfFellowshipDisabledLabel = QtGui.QLabel(
|
||||
self.songsOfFellowshipDisabledWidget)
|
||||
self.songsOfFellowshipDisabledLabel.setWordWrap(True)
|
||||
self.songsOfFellowshipDisabledLabel.setObjectName(
|
||||
u'songsOfFellowshipDisabledLabel')
|
||||
self.songsOfFellowshipDisabledLayout.addWidget(
|
||||
self.songsOfFellowshipDisabledLabel)
|
||||
self.songsOfFellowshipLayout.addWidget(
|
||||
self.songsOfFellowshipDisabledWidget)
|
||||
self.songsOfFellowshipImporterWidget = QtGui.QWidget(
|
||||
self.songsOfFellowshipImportWidget = QtGui.QWidget(
|
||||
self.songsOfFellowshipPage)
|
||||
self.songsOfFellowshipImporterLayout = QtGui.QVBoxLayout(
|
||||
self.songsOfFellowshipImporterWidget)
|
||||
self.songsOfFellowshipImporterLayout.setObjectName(
|
||||
u'songsOfFellowshipImporterLayout')
|
||||
self.songsOfFellowshipImportWidget.setObjectName(
|
||||
u'songsOfFellowshipImportWidget')
|
||||
self.songsOfFellowshipImportLayout = QtGui.QVBoxLayout(
|
||||
self.songsOfFellowshipImportWidget)
|
||||
self.songsOfFellowshipImportLayout.setMargin(0)
|
||||
self.songsOfFellowshipImportLayout.setSpacing(8)
|
||||
self.songsOfFellowshipImportLayout.setObjectName(
|
||||
u'songsOfFellowshipImportLayout')
|
||||
self.songsOfFellowshipFileListWidget = QtGui.QListWidget(
|
||||
self.songsOfFellowshipImporterWidget)
|
||||
self.songsOfFellowshipImportWidget)
|
||||
self.songsOfFellowshipFileListWidget.setSelectionMode(
|
||||
QtGui.QAbstractItemView.ExtendedSelection)
|
||||
self.songsOfFellowshipFileListWidget.setObjectName(
|
||||
u'songsOfFellowshipFileListWidget')
|
||||
self.songsOfFellowshipImporterLayout.addWidget(
|
||||
self.songsOfFellowshipImportLayout.addWidget(
|
||||
self.songsOfFellowshipFileListWidget)
|
||||
self.songsOfFellowshipButtonLayout = QtGui.QHBoxLayout()
|
||||
self.songsOfFellowshipButtonLayout.setSpacing(8)
|
||||
self.songsOfFellowshipButtonLayout.setObjectName(
|
||||
u'songsOfFellowshipButtonLayout')
|
||||
self.songsOfFellowshipAddButton = QtGui.QPushButton(
|
||||
self.songsOfFellowshipImporterWidget)
|
||||
self.songsOfFellowshipImportWidget)
|
||||
self.songsOfFellowshipAddButton.setIcon(openIcon)
|
||||
self.songsOfFellowshipAddButton.setObjectName(
|
||||
u'songsOfFellowshipAddButton')
|
||||
@ -349,42 +355,47 @@ class Ui_SongImportWizard(object):
|
||||
self.songsOfFellowshipButtonLayout.addItem(
|
||||
self.songsOfFellowshipButtonSpacer)
|
||||
self.songsOfFellowshipRemoveButton = QtGui.QPushButton(
|
||||
self.songsOfFellowshipImporterWidget)
|
||||
self.songsOfFellowshipImportWidget)
|
||||
self.songsOfFellowshipRemoveButton.setIcon(deleteIcon)
|
||||
self.songsOfFellowshipRemoveButton.setObjectName(
|
||||
u'songsOfFellowshipRemoveButton')
|
||||
self.songsOfFellowshipButtonLayout.addWidget(
|
||||
self.songsOfFellowshipRemoveButton)
|
||||
self.songsOfFellowshipImporterLayout.addLayout(
|
||||
self.songsOfFellowshipImportLayout.addLayout(
|
||||
self.songsOfFellowshipButtonLayout)
|
||||
self.songsOfFellowshipLayout.addWidget(
|
||||
self.songsOfFellowshipImporterWidget)
|
||||
self.songsOfFellowshipImportWidget)
|
||||
self.formatStackedWidget.addWidget(self.songsOfFellowshipPage)
|
||||
# Generic Document/Presentation import
|
||||
self.genericPage = QtGui.QWidget()
|
||||
self.genericPage.setObjectName(u'genericPage')
|
||||
self.genericLayout = QtGui.QVBoxLayout(self.genericPage)
|
||||
self.genericLayout.setMargin(0)
|
||||
self.genericLayout.setSpacing(8)
|
||||
self.genericLayout.setSpacing(0)
|
||||
self.genericLayout.setObjectName(u'genericLayout')
|
||||
self.genericDisabledWidget = QtGui.QWidget(self.genericPage)
|
||||
self.genericDisabledWidget.setObjectName(u'genericDisabledWidget')
|
||||
self.genericDisabledLayout = QtGui.QVBoxLayout(self.genericDisabledWidget)
|
||||
self.genericDisabledLayout.setMargin(0)
|
||||
self.genericDisabledLayout.setSpacing(8)
|
||||
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.genericImportWidget.setObjectName(u'genericImportWidget')
|
||||
self.genericImportLayout = QtGui.QVBoxLayout(self.genericImportWidget)
|
||||
self.genericImportLayout.setMargin(0)
|
||||
self.genericImportLayout.setSpacing(8)
|
||||
self.genericImportLayout.setObjectName(u'genericImportLayout')
|
||||
self.genericFileListWidget = QtGui.QListWidget(self.genericImportWidget)
|
||||
self.genericFileListWidget.setSelectionMode(
|
||||
QtGui.QAbstractItemView.ExtendedSelection)
|
||||
self.genericFileListWidget.setObjectName(u'genericFileListWidget')
|
||||
self.genericLayout.addWidget(self.genericFileListWidget)
|
||||
self.genericImportLayout.addWidget(self.genericFileListWidget)
|
||||
self.genericButtonLayout = QtGui.QHBoxLayout()
|
||||
self.genericButtonLayout.setSpacing(8)
|
||||
self.genericButtonLayout.setObjectName(u'genericButtonLayout')
|
||||
|
@ -31,10 +31,19 @@ from cclifileimport import CCLIFileImport
|
||||
# Imports that might fail
|
||||
try:
|
||||
from olp1import import OpenLP1SongImport
|
||||
from sofimport import SofImport
|
||||
from oooimport import OooImport
|
||||
has_openlp1 = True
|
||||
except ImportError:
|
||||
pass
|
||||
has_openlp1 = False
|
||||
try:
|
||||
from sofimport import SofImport
|
||||
has_sof = True
|
||||
except ImportError:
|
||||
has_sof = False
|
||||
try:
|
||||
from oooimport import OooImport
|
||||
has_ooo = True
|
||||
except ImportError:
|
||||
has_ooo = False
|
||||
|
||||
class SongFormat(object):
|
||||
"""
|
||||
@ -103,11 +112,8 @@ class SongFormat(object):
|
||||
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)
|
||||
SongFormat.set_availability(SongFormat.OpenLP1, has_openlp1)
|
||||
SongFormat.set_availability(SongFormat.SongsOfFellowship, has_sof)
|
||||
SongFormat.set_availability(SongFormat.Generic, has_ooo)
|
||||
|
||||
__all__ = [u'SongFormat']
|
||||
|
@ -29,10 +29,7 @@ openlp.org 1.x song databases into the current installation database.
|
||||
"""
|
||||
import logging
|
||||
import chardet
|
||||
try:
|
||||
import sqlite
|
||||
except:
|
||||
pass
|
||||
import sqlite
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from songimport import SongImport
|
||||
|
Loading…
Reference in New Issue
Block a user