From 8d5aaa927daa61e9fba67edac9afcf3a88deb1d0 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 15 Apr 2013 23:31:04 +0200 Subject: [PATCH] removed import from gui --- openlp/core/lib/uistrings.py | 1 - openlp/core/ui/wizard.py | 2 - .../plugins/bibles/forms/bibleimportform.py | 55 +----------------- openlp/plugins/bibles/lib/manager.py | 13 +---- openlp/plugins/songs/lib/importer.py | 56 +++++++------------ 5 files changed, 24 insertions(+), 103 deletions(-) diff --git a/openlp/core/lib/uistrings.py b/openlp/core/lib/uistrings.py index a5a45961a..6d4b4d250 100644 --- a/openlp/core/lib/uistrings.py +++ b/openlp/core/lib/uistrings.py @@ -107,7 +107,6 @@ class UiStrings(object): self.NFSp = translate('OpenLP.Ui', 'No Files Selected', 'Plural') self.NISs = translate('OpenLP.Ui', 'No Item Selected', 'Singular') self.NISp = translate('OpenLP.Ui', 'No Items Selected', 'Plural') - self.OLPV1 = translate('OpenLP.Ui', 'openlp.org 1.x') self.OLPV2 = translate('OpenLP.Ui', 'OpenLP 2') self.OLPV2x = translate('OpenLP.Ui', 'OpenLP 2.1') self.OpenLPStart = translate('OpenLP.Ui', 'OpenLP is already running. Do you wish to continue?') diff --git a/openlp/core/ui/wizard.py b/openlp/core/ui/wizard.py index f8b32a9c0..783b310b3 100644 --- a/openlp/core/ui/wizard.py +++ b/openlp/core/ui/wizard.py @@ -58,8 +58,6 @@ class WizardStrings(object): ImportingType = translate('OpenLP.Ui', 'Importing "%s"...') ImportSelect = translate('OpenLP.Ui', 'Select Import Source') ImportSelectLong = translate('OpenLP.Ui', 'Select the import format and the location to import from.') - NoSqlite = translate('OpenLP.Ui', 'The openlp.org 1.x importer has been disabled due to a missing Python module. ' - 'If you want to use this importer, you will need to install the "python-sqlite" module.') OpenTypeFile = translate('OpenLP.Ui', 'Open %s File') OpenTypeFolder = translate('OpenLP.Ui', 'Open %s Folder') PercentSymbolFormat = translate('OpenLP.Ui', '%p%') diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index f8d771e77..847b2b7a2 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -101,12 +101,6 @@ class BibleImportForm(OpenLPWizard): """ Perform any custom initialisation for bible importing. """ - if BibleFormat.get_availability(BibleFormat.OpenLP1): - self.openlp1DisabledLabel.hide() - else: - self.openlp1FileLabel.hide() - self.openlp1FileEdit.hide() - self.openlp1BrowseButton.hide() self.manager.set_process_dialog(self) self.loadWebBibles() self.restart() @@ -121,7 +115,6 @@ class BibleImportForm(OpenLPWizard): self.csvBooksButton.clicked.connect(self.onCsvBooksBrowseButtonClicked) self.csvVersesButton.clicked.connect(self.onCsvVersesBrowseButtonClicked) self.openSongBrowseButton.clicked.connect(self.onOpenSongBrowseButtonClicked) - self.openlp1BrowseButton.clicked.connect(self.onOpenlp1BrowseButtonClicked) def add_custom_pages(self): """ @@ -259,29 +252,6 @@ class BibleImportForm(OpenLPWizard): self.webProxyLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.webPasswordEdit) self.webTabWidget.addTab(self.webProxyTab, u'') self.selectStack.addWidget(self.webTabWidget) - self.openlp1Widget = QtGui.QWidget(self.selectPage) - self.openlp1Widget.setObjectName(u'Openlp1Widget') - self.openlp1Layout = QtGui.QFormLayout(self.openlp1Widget) - self.openlp1Layout.setMargin(0) - self.openlp1Layout.setObjectName(u'Openlp1Layout') - self.openlp1FileLabel = QtGui.QLabel(self.openlp1Widget) - self.openlp1FileLabel.setObjectName(u'Openlp1FileLabel') - self.openlp1FileLayout = QtGui.QHBoxLayout() - self.openlp1FileLayout.setObjectName(u'Openlp1FileLayout') - self.openlp1FileEdit = QtGui.QLineEdit(self.openlp1Widget) - self.openlp1FileEdit.setObjectName(u'Openlp1FileEdit') - self.openlp1FileLayout.addWidget(self.openlp1FileEdit) - self.openlp1BrowseButton = QtGui.QToolButton(self.openlp1Widget) - self.openlp1BrowseButton.setIcon(self.open_icon) - self.openlp1BrowseButton.setObjectName(u'Openlp1BrowseButton') - self.openlp1FileLayout.addWidget(self.openlp1BrowseButton) - self.openlp1Layout.addRow(self.openlp1FileLabel, self.openlp1FileLayout) - self.openlp1DisabledLabel = QtGui.QLabel(self.openlp1Widget) - self.openlp1DisabledLabel.setWordWrap(True) - self.openlp1DisabledLabel.setObjectName(u'Openlp1DisabledLabel') - self.openlp1Layout.addRow(self.openlp1DisabledLabel) - self.openlp1Layout.setItem(1, QtGui.QFormLayout.LabelRole, self.spacer) - self.selectStack.addWidget(self.openlp1Widget) self.selectPageLayout.addLayout(self.selectStack) self.addPage(self.selectPage) # License Page @@ -330,8 +300,6 @@ class BibleImportForm(OpenLPWizard): self.formatComboBox.setItemText(BibleFormat.OpenSong, WizardStrings.OS) self.formatComboBox.setItemText(BibleFormat.WebDownload, translate('BiblesPlugin.ImportWizardForm', 'Web Download')) - self.formatComboBox.setItemText(BibleFormat.OpenLP1, UiStrings().OLPV1) - self.openlp1FileLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Bible file:')) self.osisFileLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Bible file:')) self.csvBooksLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Books file:')) self.csvVersesLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Verses file:')) @@ -364,14 +332,12 @@ class BibleImportForm(OpenLPWizard): 'Please wait while your Bible is imported.')) self.progress_label.setText(WizardStrings.Ready) self.progress_bar.setFormat(u'%p%') - self.openlp1DisabledLabel.setText(WizardStrings.NoSqlite) # Align all QFormLayouts towards each other. labelWidth = max(self.formatLabel.minimumSizeHint().width(), self.osisFileLabel.minimumSizeHint().width(), self.csvBooksLabel.minimumSizeHint().width(), self.csvVersesLabel.minimumSizeHint().width(), - self.openSongFileLabel.minimumSizeHint().width(), - self.openlp1FileLabel.minimumSizeHint().width()) + self.openSongFileLabel.minimumSizeHint().width()) self.spacer.changeSize(labelWidth, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) def validateCurrentPage(self): @@ -406,11 +372,6 @@ class BibleImportForm(OpenLPWizard): elif self.field(u'source_format') == BibleFormat.WebDownload: self.versionNameEdit.setText(self.webTranslationComboBox.currentText()) return True - elif self.field(u'source_format') == BibleFormat.OpenLP1: - if not self.field(u'openlp1_location'): - critical_error_message_box(UiStrings().NFSs, WizardStrings.YouSpecifyFile % UiStrings().OLPV1) - self.openlp1FileEdit.setFocus() - return False return True elif self.currentPage() == self.licenseDetailsPage: license_version = self.field(u'license_version') @@ -484,13 +445,6 @@ class BibleImportForm(OpenLPWizard): """ self.get_file_name(WizardStrings.OpenTypeFile % WizardStrings.OS, self.openSongFileEdit, u'last directory import') - def onOpenlp1BrowseButtonClicked(self): - """ - Show the file open dialog for the openlp.org 1.x file. - """ - self.get_file_name(WizardStrings.OpenTypeFile % UiStrings().OLPV1, self.openlp1FileEdit, u'last directory import', - u'%s (*.bible)' % translate('BiblesPlugin.ImportWizardForm', 'openlp.org 1.x Bible Files')) - def register_fields(self): """ Register the bible import wizard fields. @@ -505,7 +459,6 @@ class BibleImportForm(OpenLPWizard): self.selectPage.registerField(u'proxy_server', self.webServerEdit) self.selectPage.registerField(u'proxy_username', self.webUserEdit) self.selectPage.registerField(u'proxy_password', self.webPasswordEdit) - self.selectPage.registerField(u'openlp1_location', self.openlp1FileEdit) self.licenseDetailsPage.registerField(u'license_version', self.versionNameEdit) self.licenseDetailsPage.registerField(u'license_copyright', self.copyrightEdit) self.licenseDetailsPage.registerField(u'license_permissions', self.permissionsEdit) @@ -615,12 +568,6 @@ class BibleImportForm(OpenLPWizard): proxy_username=self.field(u'proxy_username'), proxy_password=self.field(u'proxy_password') ) - elif bible_type == BibleFormat.OpenLP1: - # Import an openlp.org 1.x bible. - importer = self.manager.import_bible(BibleFormat.OpenLP1, - name=license_version, - filename=self.field(u'openlp1_location') - ) if importer.do_import(license_version): self.manager.save_meta_data(license_version, license_version, license_copyright, license_permissions) diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 15c2e5d80..abcfa7ddc 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -38,12 +38,8 @@ from csvbible import CSVBible from http import HTTPBible from opensong import OpenSongBible from osis import OSISBible -# Imports that might fail. -try: - from openlp1 import OpenLP1Bible - HAS_OPENLP1 = True -except ImportError: - HAS_OPENLP1 = False + + log = logging.getLogger(__name__) @@ -59,7 +55,6 @@ class BibleFormat(object): CSV = 1 OpenSong = 2 WebDownload = 3 - OpenLP1 = 4 @staticmethod def get_class(format): @@ -77,8 +72,6 @@ class BibleFormat(object): return OpenSongBible elif format == BibleFormat.WebDownload: return HTTPBible - elif format == BibleFormat.OpenLP1: - return OpenLP1Bible else: return None @@ -92,7 +85,6 @@ class BibleFormat(object): BibleFormat.CSV, BibleFormat.OpenSong, BibleFormat.WebDownload, - BibleFormat.OpenLP1 ] @staticmethod @@ -463,6 +455,5 @@ class BibleManager(object): main_window = property(_get_main_window) -BibleFormat.set_availability(BibleFormat.OpenLP1, HAS_OPENLP1) __all__ = [u'BibleFormat'] diff --git a/openlp/plugins/songs/lib/importer.py b/openlp/plugins/songs/lib/importer.py index ff018abf3..76b3e0a70 100644 --- a/openlp/plugins/songs/lib/importer.py +++ b/openlp/plugins/songs/lib/importer.py @@ -50,13 +50,11 @@ from sundayplusimport import SundayPlusImport from foilpresenterimport import FoilPresenterImport from zionworximport import ZionWorxImport # Imports that might fail + + log = logging.getLogger(__name__) -try: - from olp1import import OpenLP1SongImport - HAS_OPENLP1 = True -except ImportError: - log.exception('Error importing %s', 'OpenLP1SongImport') - HAS_OPENLP1 = False + + try: from sofimport import SofImport HAS_SOF = True @@ -144,23 +142,22 @@ class SongFormat(object): Unknown = -1 OpenLyrics = 0 OpenLP2 = 1 - OpenLP1 = 2 - Generic = 3 - CCLI = 4 - DreamBeam = 5 - EasySlides = 6 - EasyWorship = 7 - FoilPresenter = 8 - MediaShout = 9 - OpenSong = 10 - PowerSong = 11 - SongBeamer = 12 - SongPro = 13 - SongShowPlus = 14 - SongsOfFellowship = 15 - SundayPlus = 16 - WordsOfWorship = 17 - ZionWorx = 18 + Generic = 2 + CCLI = 3 + DreamBeam = 4 + EasySlides = 5 + EasyWorship = 6 + FoilPresenter = 7 + MediaShout = 8 + OpenSong = 9 + PowerSong = 10 + SongBeamer = 11 + SongPro = 12 + SongShowPlus = 13 + SongsOfFellowship = 14 + SundayPlus = 15 + WordsOfWorship = 16 + ZionWorx = 17 # Set optional attribute defaults __defaults__ = { @@ -191,14 +188,6 @@ class SongFormat(object): u'selectMode': SongFormatSelect.SingleFile, u'filter': u'%s (*.sqlite)' % (translate('SongsPlugin.ImportWizardForm', 'OpenLP 2.0 Databases')) }, - OpenLP1: { - u'name': UiStrings().OLPV1, - u'prefix': u'openLP1', - u'canDisable': True, - u'selectMode': SongFormatSelect.SingleFile, - u'filter': u'%s (*.olp)' % translate('SongsPlugin.ImportWizardForm', 'openlp.org v1.x Databases'), - u'disabledLabelText': WizardStrings.NoSqlite - }, Generic: { u'name': translate('SongsPlugin.ImportWizardForm', 'Generic Document/Presentation'), u'prefix': u'generic', @@ -332,7 +321,6 @@ class SongFormat(object): return [ SongFormat.OpenLyrics, SongFormat.OpenLP2, - SongFormat.OpenLP1, SongFormat.Generic, SongFormat.CCLI, SongFormat.DreamBeam, @@ -387,9 +375,7 @@ class SongFormat(object): """ SongFormat.__attributes__[format][attribute] = value -SongFormat.set(SongFormat.OpenLP1, u'availability', HAS_OPENLP1) -if HAS_OPENLP1: - SongFormat.set(SongFormat.OpenLP1, u'class', OpenLP1SongImport) + SongFormat.set(SongFormat.SongsOfFellowship, u'availability', HAS_SOF) if HAS_SOF: SongFormat.set(SongFormat.SongsOfFellowship, u'class', SofImport)