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.setVisible(False)
|
||||||
self.songsOfFellowshipDisabledWidget.setObjectName(
|
self.songsOfFellowshipDisabledWidget.setObjectName(
|
||||||
u'songsOfFellowshipDisabledWidget')
|
u'songsOfFellowshipDisabledWidget')
|
||||||
self.songsOfFellowshipDisabledLabel = QtGui.QLabel(
|
|
||||||
self.songsOfFellowshipDisabledWidget)
|
|
||||||
self.songsOfFellowshipDisabledLabel.setWordWrap(True)
|
|
||||||
self.songsOfFellowshipDisabledLabel.setObjectName(
|
|
||||||
u'songsOfFellowshipDisabledLabel')
|
|
||||||
self.songsOfFellowshipDisabledLayout = QtGui.QVBoxLayout(
|
self.songsOfFellowshipDisabledLayout = QtGui.QVBoxLayout(
|
||||||
self.songsOfFellowshipDisabledWidget)
|
self.songsOfFellowshipDisabledWidget)
|
||||||
self.songsOfFellowshipDisabledLayout.setMargin(0)
|
self.songsOfFellowshipDisabledLayout.setMargin(0)
|
||||||
self.songsOfFellowshipDisabledLayout.setSpacing(8)
|
self.songsOfFellowshipDisabledLayout.setSpacing(8)
|
||||||
self.songsOfFellowshipDisabledLayout.setObjectName(
|
self.songsOfFellowshipDisabledLayout.setObjectName(
|
||||||
u'songsOfFellowshipDisabledLayout')
|
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.songsOfFellowshipLayout.addWidget(
|
||||||
self.songsOfFellowshipDisabledWidget)
|
self.songsOfFellowshipDisabledWidget)
|
||||||
self.songsOfFellowshipImporterWidget = QtGui.QWidget(
|
self.songsOfFellowshipImportWidget = QtGui.QWidget(
|
||||||
self.songsOfFellowshipPage)
|
self.songsOfFellowshipPage)
|
||||||
self.songsOfFellowshipImporterLayout = QtGui.QVBoxLayout(
|
self.songsOfFellowshipImportWidget.setObjectName(
|
||||||
self.songsOfFellowshipImporterWidget)
|
u'songsOfFellowshipImportWidget')
|
||||||
self.songsOfFellowshipImporterLayout.setObjectName(
|
self.songsOfFellowshipImportLayout = QtGui.QVBoxLayout(
|
||||||
u'songsOfFellowshipImporterLayout')
|
self.songsOfFellowshipImportWidget)
|
||||||
|
self.songsOfFellowshipImportLayout.setMargin(0)
|
||||||
|
self.songsOfFellowshipImportLayout.setSpacing(8)
|
||||||
|
self.songsOfFellowshipImportLayout.setObjectName(
|
||||||
|
u'songsOfFellowshipImportLayout')
|
||||||
self.songsOfFellowshipFileListWidget = QtGui.QListWidget(
|
self.songsOfFellowshipFileListWidget = QtGui.QListWidget(
|
||||||
self.songsOfFellowshipImporterWidget)
|
self.songsOfFellowshipImportWidget)
|
||||||
self.songsOfFellowshipFileListWidget.setSelectionMode(
|
self.songsOfFellowshipFileListWidget.setSelectionMode(
|
||||||
QtGui.QAbstractItemView.ExtendedSelection)
|
QtGui.QAbstractItemView.ExtendedSelection)
|
||||||
self.songsOfFellowshipFileListWidget.setObjectName(
|
self.songsOfFellowshipFileListWidget.setObjectName(
|
||||||
u'songsOfFellowshipFileListWidget')
|
u'songsOfFellowshipFileListWidget')
|
||||||
self.songsOfFellowshipImporterLayout.addWidget(
|
self.songsOfFellowshipImportLayout.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.songsOfFellowshipImporterWidget)
|
self.songsOfFellowshipImportWidget)
|
||||||
self.songsOfFellowshipAddButton.setIcon(openIcon)
|
self.songsOfFellowshipAddButton.setIcon(openIcon)
|
||||||
self.songsOfFellowshipAddButton.setObjectName(
|
self.songsOfFellowshipAddButton.setObjectName(
|
||||||
u'songsOfFellowshipAddButton')
|
u'songsOfFellowshipAddButton')
|
||||||
@ -349,42 +355,47 @@ class Ui_SongImportWizard(object):
|
|||||||
self.songsOfFellowshipButtonLayout.addItem(
|
self.songsOfFellowshipButtonLayout.addItem(
|
||||||
self.songsOfFellowshipButtonSpacer)
|
self.songsOfFellowshipButtonSpacer)
|
||||||
self.songsOfFellowshipRemoveButton = QtGui.QPushButton(
|
self.songsOfFellowshipRemoveButton = QtGui.QPushButton(
|
||||||
self.songsOfFellowshipImporterWidget)
|
self.songsOfFellowshipImportWidget)
|
||||||
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.songsOfFellowshipImporterLayout.addLayout(
|
self.songsOfFellowshipImportLayout.addLayout(
|
||||||
self.songsOfFellowshipButtonLayout)
|
self.songsOfFellowshipButtonLayout)
|
||||||
self.songsOfFellowshipLayout.addWidget(
|
self.songsOfFellowshipLayout.addWidget(
|
||||||
self.songsOfFellowshipImporterWidget)
|
self.songsOfFellowshipImportWidget)
|
||||||
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()
|
||||||
self.genericPage.setObjectName(u'genericPage')
|
self.genericPage.setObjectName(u'genericPage')
|
||||||
self.genericLayout = QtGui.QVBoxLayout(self.genericPage)
|
self.genericLayout = QtGui.QVBoxLayout(self.genericPage)
|
||||||
self.genericLayout.setMargin(0)
|
self.genericLayout.setMargin(0)
|
||||||
self.genericLayout.setSpacing(8)
|
self.genericLayout.setSpacing(0)
|
||||||
self.genericLayout.setObjectName(u'genericLayout')
|
self.genericLayout.setObjectName(u'genericLayout')
|
||||||
self.genericDisabledWidget = QtGui.QWidget(self.genericPage)
|
self.genericDisabledWidget = QtGui.QWidget(self.genericPage)
|
||||||
self.genericDisabledWidget.setObjectName(u'genericDisabledWidget')
|
self.genericDisabledWidget.setObjectName(u'genericDisabledWidget')
|
||||||
self.genericDisabledLayout = QtGui.QVBoxLayout(self.genericDisabledWidget)
|
self.genericDisabledLayout = QtGui.QVBoxLayout(self.genericDisabledWidget)
|
||||||
|
self.genericDisabledLayout.setMargin(0)
|
||||||
|
self.genericDisabledLayout.setSpacing(8)
|
||||||
self.genericDisabledLayout.setObjectName(u'genericDisabledLayout')
|
self.genericDisabledLayout.setObjectName(u'genericDisabledLayout')
|
||||||
self.genericDisabledLabel = QtGui.QLabel(self.genericDisabledWidget)
|
self.genericDisabledLabel = QtGui.QLabel(self.genericDisabledWidget)
|
||||||
self.genericDisabledLabel.setWordWrap(True)
|
self.genericDisabledLabel.setWordWrap(True)
|
||||||
self.genericDisabledLabel.setObjectName(u'genericDisabledLabel')
|
self.genericDisabledLabel.setObjectName(u'genericDisabledLabel')
|
||||||
self.genericDisabledWidget.setVisible(False)
|
self.genericDisabledWidget.setVisible(False)
|
||||||
self.genericDisabledLabel.setObjectName(u'genericDisabledWidget')
|
|
||||||
self.genericDisabledLayout.addWidget(self.genericDisabledLabel)
|
self.genericDisabledLayout.addWidget(self.genericDisabledLabel)
|
||||||
self.genericLayout.addWidget(self.genericDisabledWidget)
|
self.genericLayout.addWidget(self.genericDisabledWidget)
|
||||||
self.genericImportWidget = QtGui.QWidget(self.genericPage)
|
self.genericImportWidget = QtGui.QWidget(self.genericPage)
|
||||||
|
self.genericImportWidget.setObjectName(u'genericImportWidget')
|
||||||
self.genericImportLayout = QtGui.QVBoxLayout(self.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 = 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')
|
||||||
self.genericLayout.addWidget(self.genericFileListWidget)
|
self.genericImportLayout.addWidget(self.genericFileListWidget)
|
||||||
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')
|
||||||
|
@ -31,10 +31,19 @@ from cclifileimport import CCLIFileImport
|
|||||||
# Imports that might fail
|
# Imports that might fail
|
||||||
try:
|
try:
|
||||||
from olp1import import OpenLP1SongImport
|
from olp1import import OpenLP1SongImport
|
||||||
from sofimport import SofImport
|
has_openlp1 = True
|
||||||
from oooimport import OooImport
|
|
||||||
except ImportError:
|
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):
|
class SongFormat(object):
|
||||||
"""
|
"""
|
||||||
@ -103,11 +112,8 @@ class SongFormat(object):
|
|||||||
def get_availability(format):
|
def get_availability(format):
|
||||||
return SongFormat._format_availability.get(format, True)
|
return SongFormat._format_availability.get(format, True)
|
||||||
|
|
||||||
if u'OpenLP1SongImport' not in locals():
|
SongFormat.set_availability(SongFormat.OpenLP1, has_openlp1)
|
||||||
SongFormat.set_availability(SongFormat.OpenLP1, False)
|
SongFormat.set_availability(SongFormat.SongsOfFellowship, has_sof)
|
||||||
if u'SofImport' not in locals():
|
SongFormat.set_availability(SongFormat.Generic, has_ooo)
|
||||||
SongFormat.set_availability(SongFormat.SongsOfFellowship, False)
|
|
||||||
if u'OooImport' not in locals():
|
|
||||||
SongFormat.set_availability(SongFormat.Generic, False)
|
|
||||||
|
|
||||||
__all__ = [u'SongFormat']
|
__all__ = [u'SongFormat']
|
||||||
|
@ -29,10 +29,7 @@ openlp.org 1.x song databases into the current installation database.
|
|||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
import chardet
|
import chardet
|
||||||
try:
|
import sqlite
|
||||||
import sqlite
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
from openlp.core.lib import translate
|
from openlp.core.lib import translate
|
||||||
from songimport import SongImport
|
from songimport import SongImport
|
||||||
|
Loading…
Reference in New Issue
Block a user