forked from openlp/openlp
Refactor wizards
Smaller refactor to web bibles Cleanups bzr-revno: 1216
This commit is contained in:
commit
6beac0d027
@ -207,8 +207,8 @@ class EventReceiver(QtCore.QObject):
|
||||
``bibles_nobook``
|
||||
Attempt to find book resulted in no match
|
||||
|
||||
``bibles_stop_import``
|
||||
Stops the Bible Import
|
||||
``openlp_stop_wizard``
|
||||
Stops a wizard before completion
|
||||
|
||||
``remotes_poll_request``
|
||||
Waits for openlp to do something "interesting" and sends a
|
||||
|
171
openlp/core/ui/wizard.py
Normal file
171
openlp/core/ui/wizard.py
Normal file
@ -0,0 +1,171 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2011 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
|
||||
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
|
||||
# Carsten Tinggaard, Frode Woldsund #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# This program is free software; you can redistribute it and/or modify it #
|
||||
# under the terms of the GNU General Public License as published by the Free #
|
||||
# Software Foundation; version 2 of the License. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||
# more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License along #
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
"""
|
||||
The :mod:``wizard`` module provides generic wizard tools for OpenLP.
|
||||
"""
|
||||
import logging
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import build_icon, Receiver
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class OpenLPWizard(QtGui.QWizard):
|
||||
"""
|
||||
Generic OpenLP wizard to provide generic functionality and a unified look
|
||||
and feel.
|
||||
"""
|
||||
def __init__(self, parent, plugin, name, image):
|
||||
QtGui.QWizard.__init__(self, parent)
|
||||
self.setObjectName(name)
|
||||
self.openIcon = build_icon(u':/general/general_open.png')
|
||||
self.deleteIcon = build_icon(u':/general/general_delete.png')
|
||||
self.finishButton = self.button(QtGui.QWizard.FinishButton)
|
||||
self.cancelButton = self.button(QtGui.QWizard.CancelButton)
|
||||
self.setupUi(image)
|
||||
self.registerFields()
|
||||
self.plugin = plugin
|
||||
self.customInit()
|
||||
self.customSignals()
|
||||
QtCore.QObject.connect(self, QtCore.SIGNAL(u'currentIdChanged(int)'),
|
||||
self.onCurrentIdChanged)
|
||||
|
||||
def setupUi(self, image):
|
||||
"""
|
||||
Set up the wizard UI
|
||||
"""
|
||||
self.setModal(True)
|
||||
self.setWizardStyle(QtGui.QWizard.ModernStyle)
|
||||
self.setOptions(QtGui.QWizard.IndependentPages |
|
||||
QtGui.QWizard.NoBackButtonOnStartPage |
|
||||
QtGui.QWizard.NoBackButtonOnLastPage)
|
||||
self.addWelcomePage(image)
|
||||
self.addCustomPages()
|
||||
self.addProgressPage()
|
||||
self.retranslateUi()
|
||||
QtCore.QMetaObject.connectSlotsByName(self)
|
||||
|
||||
def addWelcomePage(self, image):
|
||||
"""
|
||||
Add the opening welcome page to the wizard.
|
||||
|
||||
``image``
|
||||
A splash image for the wizard
|
||||
"""
|
||||
self.welcomePage = QtGui.QWizardPage()
|
||||
self.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap,
|
||||
QtGui.QPixmap(image))
|
||||
self.welcomePage.setObjectName(u'WelcomePage')
|
||||
self.welcomeLayout = QtGui.QVBoxLayout(self.welcomePage)
|
||||
self.welcomeLayout.setObjectName(u'WelcomeLayout')
|
||||
self.titleLabel = QtGui.QLabel(self.welcomePage)
|
||||
self.titleLabel.setObjectName(u'TitleLabel')
|
||||
self.welcomeLayout.addWidget(self.titleLabel)
|
||||
self.welcomeLayout.addSpacing(40)
|
||||
self.informationLabel = QtGui.QLabel(self.welcomePage)
|
||||
self.informationLabel.setWordWrap(True)
|
||||
self.informationLabel.setObjectName(u'InformationLabel')
|
||||
self.welcomeLayout.addWidget(self.informationLabel)
|
||||
self.welcomeLayout.addStretch()
|
||||
self.addPage(self.welcomePage)
|
||||
|
||||
def addProgressPage(self):
|
||||
"""
|
||||
Add the progress page for the wizard. This page informs the user how
|
||||
the wizard is progressing with its task.
|
||||
"""
|
||||
self.progressPage = QtGui.QWizardPage()
|
||||
self.progressPage.setObjectName(u'progressPage')
|
||||
self.progressLayout = QtGui.QVBoxLayout(self.progressPage)
|
||||
self.progressLayout.setMargin(48)
|
||||
self.progressLayout.setObjectName(u'progressLayout')
|
||||
self.progressLabel = QtGui.QLabel(self.progressPage)
|
||||
self.progressLabel.setObjectName(u'progressLabel')
|
||||
self.progressLayout.addWidget(self.progressLabel)
|
||||
self.progressBar = QtGui.QProgressBar(self.progressPage)
|
||||
self.progressBar.setObjectName(u'progressBar')
|
||||
self.progressLayout.addWidget(self.progressBar)
|
||||
self.addPage(self.progressPage)
|
||||
|
||||
def exec_(self):
|
||||
"""
|
||||
Run the wizard.
|
||||
"""
|
||||
self.setDefaults()
|
||||
return QtGui.QWizard.exec_(self)
|
||||
|
||||
def reject(self):
|
||||
"""
|
||||
Stop the wizard on cancel button, close button or ESC key.
|
||||
"""
|
||||
log.debug(u'Wizard cancelled by user.')
|
||||
if self.currentPage() == self.progressPage:
|
||||
Receiver.send_message(u'openlp_stop_wizard')
|
||||
self.done(QtGui.QDialog.Rejected)
|
||||
|
||||
def onCurrentIdChanged(self, pageId):
|
||||
"""
|
||||
Perform necessary functions depending on which wizard page is active.
|
||||
"""
|
||||
if self.page(pageId) == self.progressPage:
|
||||
self.preWizard()
|
||||
self.performWizard()
|
||||
self.postWizard()
|
||||
|
||||
def incrementProgressBar(self, status_text, increment=1):
|
||||
"""
|
||||
Update the wizard progress page.
|
||||
|
||||
``status_text``
|
||||
Current status information to display.
|
||||
|
||||
``increment``
|
||||
The value to increment the progress bar by.
|
||||
"""
|
||||
log.debug(u'IncrementBar %s', status_text)
|
||||
self.progressLabel.setText(status_text)
|
||||
if increment > 0:
|
||||
self.progressBar.setValue(self.progressBar.value() + increment)
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
|
||||
def preWizard(self):
|
||||
"""
|
||||
Prepare the UI for the import.
|
||||
"""
|
||||
self.finishButton.setVisible(False)
|
||||
self.progressBar.setMinimum(0)
|
||||
self.progressBar.setMaximum(1188)
|
||||
self.progressBar.setValue(0)
|
||||
|
||||
def postWizard(self):
|
||||
"""
|
||||
Clean up the UI after the import has finished.
|
||||
"""
|
||||
self.progressBar.setValue(self.progressBar.maximum())
|
||||
self.finishButton.setVisible(True)
|
||||
self.cancelButton.setVisible(False)
|
||||
Receiver.send_message(u'openlp_process_events')
|
@ -337,9 +337,28 @@ def file_is_unicode(filename):
|
||||
return None
|
||||
return ucsfile
|
||||
|
||||
def string_is_unicode(test_string):
|
||||
"""
|
||||
Makes sure a string is unicode.
|
||||
|
||||
``test_string``
|
||||
The string to confirm is unicode.
|
||||
"""
|
||||
return_string = u''
|
||||
if not test_string:
|
||||
return return_string
|
||||
if isinstance(test_string, unicode):
|
||||
return_string = test_string
|
||||
if not isinstance(test_string, unicode):
|
||||
try:
|
||||
return_string = unicode(test_string, u'utf-8')
|
||||
except UnicodeError:
|
||||
log.exception("Error encoding string to unicode")
|
||||
return return_string
|
||||
|
||||
from languagemanager import LanguageManager
|
||||
from actions import ActionList
|
||||
|
||||
__all__ = [u'AppLocation', u'check_latest_version', u'add_actions',
|
||||
u'get_filesystem_encoding', u'LanguageManager', u'ActionList',
|
||||
u'get_web_page', u'file_is_unicode']
|
||||
u'get_web_page', u'file_is_unicode', u'string_is_unicode']
|
||||
|
@ -23,7 +23,9 @@
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
"""
|
||||
The bible import functions for OpenLP
|
||||
"""
|
||||
import csv
|
||||
import logging
|
||||
import os
|
||||
@ -31,15 +33,18 @@ import os.path
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from bibleimportwizard import Ui_BibleImportWizard
|
||||
from openlp.core.lib import Receiver, SettingsManager, translate
|
||||
from openlp.core.lib.db import delete_database
|
||||
from openlp.core.utils import AppLocation
|
||||
from openlp.core.ui.wizard import OpenLPWizard
|
||||
from openlp.core.utils import AppLocation, string_is_unicode
|
||||
from openlp.plugins.bibles.lib.manager import BibleFormat
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class WebDownload(object):
|
||||
"""
|
||||
Provides an enumeration for the web bible types available to OpenLP.
|
||||
"""
|
||||
Unknown = -1
|
||||
Crosswalk = 0
|
||||
BibleGateway = 1
|
||||
@ -53,10 +58,13 @@ class WebDownload(object):
|
||||
|
||||
@classmethod
|
||||
def get_name(cls, name):
|
||||
"""
|
||||
Get the web bible type name.
|
||||
"""
|
||||
return cls.Names[name]
|
||||
|
||||
|
||||
class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
|
||||
class BibleImportForm(OpenLPWizard):
|
||||
"""
|
||||
This is the Bible Import Wizard, which allows easy importing of Bibles
|
||||
into OpenLP from other formats like OSIS, CSV and OpenSong.
|
||||
@ -76,27 +84,42 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
|
||||
``bibleplugin``
|
||||
The Bible plugin.
|
||||
"""
|
||||
QtGui.QWizard.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
self.registerFields()
|
||||
self.manager = manager
|
||||
self.web_bible_list = {}
|
||||
OpenLPWizard.__init__(self, parent, bibleplugin, u'bibleImportWizard',
|
||||
u':/wizards/wizard_importbible.bmp')
|
||||
|
||||
def setupUi(self, image):
|
||||
"""
|
||||
Set up the UI for the bible wizard.
|
||||
"""
|
||||
OpenLPWizard.setupUi(self, image)
|
||||
QtCore.QObject.connect(self.formatComboBox,
|
||||
QtCore.SIGNAL(u'currentIndexChanged(int)'), self.selectStack,
|
||||
QtCore.SLOT(u'setCurrentIndex(int)'))
|
||||
|
||||
def customInit(self):
|
||||
"""
|
||||
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.finishButton = self.button(QtGui.QWizard.FinishButton)
|
||||
self.cancelButton = self.button(QtGui.QWizard.CancelButton)
|
||||
self.manager = manager
|
||||
self.bibleplugin = bibleplugin
|
||||
self.manager.set_process_dialog(self)
|
||||
self.web_bible_list = {}
|
||||
self.loadWebBibles()
|
||||
self.restart()
|
||||
self.selectStack.setCurrentIndex(0)
|
||||
|
||||
def customSignals(self):
|
||||
"""
|
||||
Set up the signals used in the bible importer.
|
||||
"""
|
||||
QtCore.QObject.connect(self.webSourceComboBox,
|
||||
QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
||||
self.onWebSourceComboBoxCurrentIndexChanged)
|
||||
self.onWebSourceComboBoxIndexChanged)
|
||||
QtCore.QObject.connect(self.osisBrowseButton,
|
||||
QtCore.SIGNAL(u'clicked()'),
|
||||
self.onOsisBrowseButtonClicked)
|
||||
@ -112,25 +135,329 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
|
||||
QtCore.QObject.connect(self.openlp1BrowseButton,
|
||||
QtCore.SIGNAL(u'clicked()'),
|
||||
self.onOpenlp1BrowseButtonClicked)
|
||||
QtCore.QObject.connect(self,
|
||||
QtCore.SIGNAL(u'currentIdChanged(int)'),
|
||||
self.onCurrentIdChanged)
|
||||
|
||||
def exec_(self):
|
||||
def addCustomPages(self):
|
||||
"""
|
||||
Run the wizard.
|
||||
Add the bible import specific wizard pages.
|
||||
"""
|
||||
self.setDefaults()
|
||||
return QtGui.QWizard.exec_(self)
|
||||
# Select Page
|
||||
self.selectPage = QtGui.QWizardPage()
|
||||
self.selectPage.setObjectName(u'SelectPage')
|
||||
self.selectPageLayout = QtGui.QVBoxLayout(self.selectPage)
|
||||
self.selectPageLayout.setObjectName(u'SelectPageLayout')
|
||||
self.formatLayout = QtGui.QFormLayout()
|
||||
self.formatLayout.setObjectName(u'FormatLayout')
|
||||
self.formatLabel = QtGui.QLabel(self.selectPage)
|
||||
self.formatLabel.setObjectName(u'FormatLabel')
|
||||
self.formatComboBox = QtGui.QComboBox(self.selectPage)
|
||||
self.formatComboBox.addItems([u'', u'', u'', u'', u''])
|
||||
self.formatComboBox.setObjectName(u'FormatComboBox')
|
||||
self.formatLayout.addRow(self.formatLabel, self.formatComboBox)
|
||||
self.formatSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
|
||||
QtGui.QSizePolicy.Minimum)
|
||||
self.formatLayout.setItem(1, QtGui.QFormLayout.LabelRole,
|
||||
self.formatSpacer)
|
||||
self.selectPageLayout.addLayout(self.formatLayout)
|
||||
self.selectStack = QtGui.QStackedLayout()
|
||||
self.selectStack.setObjectName(u'SelectStack')
|
||||
self.osisWidget = QtGui.QWidget(self.selectPage)
|
||||
self.osisWidget.setObjectName(u'OsisWidget')
|
||||
self.osisLayout = QtGui.QFormLayout(self.osisWidget)
|
||||
self.osisLayout.setMargin(0)
|
||||
self.osisLayout.setObjectName(u'OsisLayout')
|
||||
self.osisFileLabel = QtGui.QLabel(self.osisWidget)
|
||||
self.osisFileLabel.setObjectName(u'OsisFileLabel')
|
||||
self.osisFileLayout = QtGui.QHBoxLayout()
|
||||
self.osisFileLayout.setObjectName(u'OsisFileLayout')
|
||||
self.osisFileEdit = QtGui.QLineEdit(self.osisWidget)
|
||||
self.osisFileEdit.setObjectName(u'OsisFileEdit')
|
||||
self.osisFileLayout.addWidget(self.osisFileEdit)
|
||||
self.osisBrowseButton = QtGui.QToolButton(self.osisWidget)
|
||||
self.osisBrowseButton.setIcon(self.openIcon)
|
||||
self.osisBrowseButton.setObjectName(u'OsisBrowseButton')
|
||||
self.osisFileLayout.addWidget(self.osisBrowseButton)
|
||||
self.osisLayout.addRow(self.osisFileLabel, self.osisFileLayout)
|
||||
self.osisSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
|
||||
QtGui.QSizePolicy.Minimum)
|
||||
self.osisLayout.setItem(1, QtGui.QFormLayout.LabelRole, self.osisSpacer)
|
||||
self.selectStack.addWidget(self.osisWidget)
|
||||
self.csvWidget = QtGui.QWidget(self.selectPage)
|
||||
self.csvWidget.setObjectName(u'CsvWidget')
|
||||
self.csvLayout = QtGui.QFormLayout(self.csvWidget)
|
||||
self.csvLayout.setMargin(0)
|
||||
self.csvLayout.setObjectName(u'CsvLayout')
|
||||
self.csvBooksLabel = QtGui.QLabel(self.csvWidget)
|
||||
self.csvBooksLabel.setObjectName(u'CsvBooksLabel')
|
||||
self.csvBooksLayout = QtGui.QHBoxLayout()
|
||||
self.csvBooksLayout.setObjectName(u'CsvBooksLayout')
|
||||
self.csvBooksEdit = QtGui.QLineEdit(self.csvWidget)
|
||||
self.csvBooksEdit.setObjectName(u'CsvBooksEdit')
|
||||
self.csvBooksLayout.addWidget(self.csvBooksEdit)
|
||||
self.csvBooksButton = QtGui.QToolButton(self.csvWidget)
|
||||
self.csvBooksButton.setIcon(self.openIcon)
|
||||
self.csvBooksButton.setObjectName(u'CsvBooksButton')
|
||||
self.csvBooksLayout.addWidget(self.csvBooksButton)
|
||||
self.csvLayout.addRow(self.csvBooksLabel, self.csvBooksLayout)
|
||||
self.csvVersesLabel = QtGui.QLabel(self.csvWidget)
|
||||
self.csvVersesLabel.setObjectName(u'CsvVersesLabel')
|
||||
self.csvVersesLayout = QtGui.QHBoxLayout()
|
||||
self.csvVersesLayout.setObjectName(u'CsvVersesLayout')
|
||||
self.csvVersesEdit = QtGui.QLineEdit(self.csvWidget)
|
||||
self.csvVersesEdit.setObjectName(u'CsvVersesEdit')
|
||||
self.csvVersesLayout.addWidget(self.csvVersesEdit)
|
||||
self.csvVersesButton = QtGui.QToolButton(self.csvWidget)
|
||||
self.csvVersesButton.setIcon(self.openIcon)
|
||||
self.csvVersesButton.setObjectName(u'CsvVersesButton')
|
||||
self.csvVersesLayout.addWidget(self.csvVersesButton)
|
||||
self.csvLayout.addRow(self.csvVersesLabel, self.csvVersesLayout)
|
||||
self.csvSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
|
||||
QtGui.QSizePolicy.Minimum)
|
||||
self.csvLayout.setItem(2, QtGui.QFormLayout.LabelRole, self.csvSpacer)
|
||||
self.selectStack.addWidget(self.csvWidget)
|
||||
self.openSongWidget = QtGui.QWidget(self.selectPage)
|
||||
self.openSongWidget.setObjectName(u'OpenSongWidget')
|
||||
self.openSongLayout = QtGui.QFormLayout(self.openSongWidget)
|
||||
self.openSongLayout.setMargin(0)
|
||||
self.openSongLayout.setObjectName(u'OpenSongLayout')
|
||||
self.openSongFileLabel = QtGui.QLabel(self.openSongWidget)
|
||||
self.openSongFileLabel.setObjectName(u'OpenSongFileLabel')
|
||||
self.openSongFileLayout = QtGui.QHBoxLayout()
|
||||
self.openSongFileLayout.setObjectName(u'OpenSongFileLayout')
|
||||
self.openSongFileEdit = QtGui.QLineEdit(self.openSongWidget)
|
||||
self.openSongFileEdit.setObjectName(u'OpenSongFileEdit')
|
||||
self.openSongFileLayout.addWidget(self.openSongFileEdit)
|
||||
self.openSongBrowseButton = QtGui.QToolButton(self.openSongWidget)
|
||||
self.openSongBrowseButton.setIcon(self.openIcon)
|
||||
self.openSongBrowseButton.setObjectName(u'OpenSongBrowseButton')
|
||||
self.openSongFileLayout.addWidget(self.openSongBrowseButton)
|
||||
self.openSongLayout.addRow(self.openSongFileLabel,
|
||||
self.openSongFileLayout)
|
||||
self.openSongSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
|
||||
QtGui.QSizePolicy.Minimum)
|
||||
self.openSongLayout.setItem(1, QtGui.QFormLayout.LabelRole,
|
||||
self.openSongSpacer)
|
||||
self.selectStack.addWidget(self.openSongWidget)
|
||||
self.webTabWidget = QtGui.QTabWidget(self.selectPage)
|
||||
self.webTabWidget.setObjectName(u'WebTabWidget')
|
||||
self.webBibleTab = QtGui.QWidget()
|
||||
self.webBibleTab.setObjectName(u'WebBibleTab')
|
||||
self.webBibleLayout = QtGui.QFormLayout(self.webBibleTab)
|
||||
self.webBibleLayout.setObjectName(u'WebBibleLayout')
|
||||
self.webSourceLabel = QtGui.QLabel(self.webBibleTab)
|
||||
self.webSourceLabel.setObjectName(u'WebSourceLabel')
|
||||
self.webBibleLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
|
||||
self.webSourceLabel)
|
||||
self.webSourceComboBox = QtGui.QComboBox(self.webBibleTab)
|
||||
self.webSourceComboBox.setObjectName(u'WebSourceComboBox')
|
||||
self.webSourceComboBox.addItems([u'', u'', u''])
|
||||
self.webBibleLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
|
||||
self.webSourceComboBox)
|
||||
self.webTranslationLabel = QtGui.QLabel(self.webBibleTab)
|
||||
self.webTranslationLabel.setObjectName(u'webTranslationLabel')
|
||||
self.webBibleLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
|
||||
self.webTranslationLabel)
|
||||
self.webTranslationComboBox = QtGui.QComboBox(self.webBibleTab)
|
||||
self.webTranslationComboBox.setSizeAdjustPolicy(
|
||||
QtGui.QComboBox.AdjustToContents)
|
||||
self.webTranslationComboBox.setObjectName(u'WebTranslationComboBox')
|
||||
self.webBibleLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
|
||||
self.webTranslationComboBox)
|
||||
self.webTabWidget.addTab(self.webBibleTab, u'')
|
||||
self.webProxyTab = QtGui.QWidget()
|
||||
self.webProxyTab.setObjectName(u'WebProxyTab')
|
||||
self.webProxyLayout = QtGui.QFormLayout(self.webProxyTab)
|
||||
self.webProxyLayout.setObjectName(u'WebProxyLayout')
|
||||
self.webServerLabel = QtGui.QLabel(self.webProxyTab)
|
||||
self.webServerLabel.setObjectName(u'WebServerLabel')
|
||||
self.webProxyLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
|
||||
self.webServerLabel)
|
||||
self.webServerEdit = QtGui.QLineEdit(self.webProxyTab)
|
||||
self.webServerEdit.setObjectName(u'WebServerEdit')
|
||||
self.webProxyLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
|
||||
self.webServerEdit)
|
||||
self.webUserLabel = QtGui.QLabel(self.webProxyTab)
|
||||
self.webUserLabel.setObjectName(u'WebUserLabel')
|
||||
self.webProxyLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
|
||||
self.webUserLabel)
|
||||
self.webUserEdit = QtGui.QLineEdit(self.webProxyTab)
|
||||
self.webUserEdit.setObjectName(u'WebUserEdit')
|
||||
self.webProxyLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
|
||||
self.webUserEdit)
|
||||
self.webPasswordLabel = QtGui.QLabel(self.webProxyTab)
|
||||
self.webPasswordLabel.setObjectName(u'WebPasswordLabel')
|
||||
self.webProxyLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
|
||||
self.webPasswordLabel)
|
||||
self.webPasswordEdit = QtGui.QLineEdit(self.webProxyTab)
|
||||
self.webPasswordEdit.setObjectName(u'WebPasswordEdit')
|
||||
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.openIcon)
|
||||
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.openlp1Spacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
|
||||
QtGui.QSizePolicy.Minimum)
|
||||
self.openlp1Layout.setItem(1, QtGui.QFormLayout.LabelRole,
|
||||
self.openlp1Spacer)
|
||||
self.selectStack.addWidget(self.openlp1Widget)
|
||||
self.selectPageLayout.addLayout(self.selectStack)
|
||||
self.addPage(self.selectPage)
|
||||
# License Page
|
||||
self.licenseDetailsPage = QtGui.QWizardPage()
|
||||
self.licenseDetailsPage.setObjectName(u'LicenseDetailsPage')
|
||||
self.licenseDetailsLayout = QtGui.QFormLayout(self.licenseDetailsPage)
|
||||
self.licenseDetailsLayout.setObjectName(u'LicenseDetailsLayout')
|
||||
self.versionNameLabel = QtGui.QLabel(self.licenseDetailsPage)
|
||||
self.versionNameLabel.setObjectName(u'VersionNameLabel')
|
||||
self.licenseDetailsLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
|
||||
self.versionNameLabel)
|
||||
self.versionNameEdit = QtGui.QLineEdit(self.licenseDetailsPage)
|
||||
self.versionNameEdit.setObjectName(u'VersionNameEdit')
|
||||
self.licenseDetailsLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
|
||||
self.versionNameEdit)
|
||||
self.copyrightLabel = QtGui.QLabel(self.licenseDetailsPage)
|
||||
self.copyrightLabel.setObjectName(u'CopyrightLabel')
|
||||
self.licenseDetailsLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
|
||||
self.copyrightLabel)
|
||||
self.copyrightEdit = QtGui.QLineEdit(self.licenseDetailsPage)
|
||||
self.copyrightEdit.setObjectName(u'CopyrightEdit')
|
||||
self.licenseDetailsLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
|
||||
self.copyrightEdit)
|
||||
self.permissionsLabel = QtGui.QLabel(self.licenseDetailsPage)
|
||||
self.permissionsLabel.setObjectName(u'PermissionsLabel')
|
||||
self.licenseDetailsLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
|
||||
self.permissionsLabel)
|
||||
self.permissionsEdit = QtGui.QLineEdit(self.licenseDetailsPage)
|
||||
self.permissionsEdit.setObjectName(u'PermissionsEdit')
|
||||
self.licenseDetailsLayout.setWidget(2, QtGui.QFormLayout.FieldRole,
|
||||
self.permissionsEdit)
|
||||
self.addPage(self.licenseDetailsPage)
|
||||
|
||||
def reject(self):
|
||||
def retranslateUi(self):
|
||||
"""
|
||||
Stop the import on cancel button, close button or ESC key.
|
||||
Allow for localisation of the bible import wizard.
|
||||
"""
|
||||
log.debug(u'Import canceled by user.')
|
||||
if self.currentPage() == self.importPage:
|
||||
Receiver.send_message(u'bibles_stop_import')
|
||||
self.done(QtGui.QDialog.Rejected)
|
||||
self.setWindowTitle(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Bible Import Wizard'))
|
||||
self.titleLabel.setText(
|
||||
u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
|
||||
translate('BiblesPlugin.ImportWizardForm',
|
||||
'Welcome to the Bible Import Wizard'))
|
||||
self.informationLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm',
|
||||
'This wizard will help you to import Bibles from a '
|
||||
'variety of formats. Click the next button below to start the '
|
||||
'process by selecting a format to import from.'))
|
||||
self.selectPage.setTitle(translate('BiblesPlugin.ImportWizardForm',
|
||||
'Select Import Source'))
|
||||
self.selectPage.setSubTitle(
|
||||
translate('BiblesPlugin.ImportWizardForm',
|
||||
'Select the import format, and where to import from.'))
|
||||
self.formatLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Format:'))
|
||||
self.formatComboBox.setItemText(0,
|
||||
translate('BiblesPlugin.ImportWizardForm', 'OSIS'))
|
||||
self.formatComboBox.setItemText(1,
|
||||
translate('BiblesPlugin.ImportWizardForm', 'CSV'))
|
||||
self.formatComboBox.setItemText(2,
|
||||
translate('BiblesPlugin.ImportWizardForm', 'OpenSong'))
|
||||
self.formatComboBox.setItemText(3,
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Web Download'))
|
||||
self.formatComboBox.setItemText(4,
|
||||
translate('BiblesPlugin.ImportWizardForm', 'openlp.org 1.x'))
|
||||
self.openlp1FileLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'File location:'))
|
||||
self.osisFileLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'File location:'))
|
||||
self.csvBooksLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Books location:'))
|
||||
self.csvVersesLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Verse location:'))
|
||||
self.openSongFileLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Bible filename:'))
|
||||
self.webSourceLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Location:'))
|
||||
self.webSourceComboBox.setItemText(0,
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Crosswalk'))
|
||||
self.webSourceComboBox.setItemText(1,
|
||||
translate('BiblesPlugin.ImportWizardForm', 'BibleGateway'))
|
||||
self.webSourceComboBox.setItemText(2,
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Bibleserver'))
|
||||
self.webTranslationLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Bible:'))
|
||||
self.webTabWidget.setTabText(
|
||||
self.webTabWidget.indexOf(self.webBibleTab),
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Download Options'))
|
||||
self.webServerLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Server:'))
|
||||
self.webUserLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Username:'))
|
||||
self.webPasswordLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Password:'))
|
||||
self.webTabWidget.setTabText(
|
||||
self.webTabWidget.indexOf(self.webProxyTab),
|
||||
translate('BiblesPlugin.ImportWizardForm',
|
||||
'Proxy Server (Optional)'))
|
||||
self.licenseDetailsPage.setTitle(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'License Details'))
|
||||
self.licenseDetailsPage.setSubTitle(
|
||||
translate('BiblesPlugin.ImportWizardForm',
|
||||
'Set up the Bible\'s license details.'))
|
||||
self.versionNameLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Version name:'))
|
||||
self.copyrightLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Copyright:'))
|
||||
self.permissionsLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Permissions:'))
|
||||
self.progressPage.setTitle(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Importing'))
|
||||
self.progressPage.setSubTitle(
|
||||
translate('BiblesPlugin.ImportWizardForm',
|
||||
'Please wait while your Bible is imported.'))
|
||||
self.progressLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Ready.'))
|
||||
self.progressBar.setFormat(u'%p%')
|
||||
self.openlp1DisabledLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', '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.'))
|
||||
# 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.formatSpacer.changeSize(labelWidth, 0,
|
||||
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
self.osisSpacer.changeSize(labelWidth, 0,
|
||||
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
self.csvSpacer.changeSize(labelWidth, 0,
|
||||
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
self.openSongSpacer.changeSize(labelWidth, 0,
|
||||
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
self.openlp1Spacer.changeSize(labelWidth, 0,
|
||||
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
|
||||
def validateCurrentPage(self):
|
||||
"""
|
||||
@ -220,10 +547,10 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
|
||||
self.versionNameEdit.setFocus()
|
||||
return False
|
||||
return True
|
||||
if self.currentPage() == self.importPage:
|
||||
if self.currentPage() == self.progressPage:
|
||||
return True
|
||||
|
||||
def onWebSourceComboBoxCurrentIndexChanged(self, index):
|
||||
def onWebSourceComboBoxIndexChanged(self, index):
|
||||
"""
|
||||
Setup the list of Bibles when you select a different source on the web
|
||||
download page.
|
||||
@ -279,13 +606,10 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
|
||||
u'%s (*.bible)' % translate('BiblesPlugin.ImportWizardForm',
|
||||
'openlp.org 1.x bible'))
|
||||
|
||||
def onCurrentIdChanged(self, pageId):
|
||||
if self.page(pageId) == self.importPage:
|
||||
self.preImport()
|
||||
self.performImport()
|
||||
self.postImport()
|
||||
|
||||
def registerFields(self):
|
||||
"""
|
||||
Register the bible import wizard fields.
|
||||
"""
|
||||
self.selectPage.registerField(u'source_format', self.formatComboBox)
|
||||
self.selectPage.registerField(u'osis_location', self.osisFileEdit)
|
||||
self.selectPage.registerField(u'csv_booksfile', self.csvBooksEdit)
|
||||
@ -306,8 +630,11 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
|
||||
u'license_permissions', self.permissionsEdit)
|
||||
|
||||
def setDefaults(self):
|
||||
"""
|
||||
Set default values for the wizard pages.
|
||||
"""
|
||||
settings = QtCore.QSettings()
|
||||
settings.beginGroup(self.bibleplugin.settingsSection)
|
||||
settings.beginGroup(self.plugin.settingsSection)
|
||||
self.restart()
|
||||
self.finishButton.setVisible(False)
|
||||
self.cancelButton.setVisible(True)
|
||||
@ -332,72 +659,50 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
|
||||
QtCore.QVariant(self.copyrightEdit.text()))
|
||||
self.setField(u'license_permissions',
|
||||
QtCore.QVariant(self.permissionsEdit.text()))
|
||||
self.onWebSourceComboBoxCurrentIndexChanged(WebDownload.Crosswalk)
|
||||
self.onWebSourceComboBoxIndexChanged(WebDownload.Crosswalk)
|
||||
settings.endGroup()
|
||||
|
||||
def loadWebBibles(self):
|
||||
"""
|
||||
Load the list of Crosswalk and BibleGateway bibles.
|
||||
Load the lists of Crosswalk, BibleGateway and Bibleserver bibles.
|
||||
"""
|
||||
filepath = AppLocation.get_directory(AppLocation.PluginsDir)
|
||||
filepath = os.path.join(filepath, u'bibles', u'resources')
|
||||
# Load Crosswalk Bibles.
|
||||
filepath = AppLocation.get_directory(AppLocation.PluginsDir)
|
||||
filepath = os.path.join(filepath, u'bibles', u'resources')
|
||||
books_file = None
|
||||
try:
|
||||
self.web_bible_list[WebDownload.Crosswalk] = {}
|
||||
books_file = open(
|
||||
os.path.join(filepath, u'crosswalkbooks.csv'), 'rb')
|
||||
dialect = csv.Sniffer().sniff(books_file.read(1024))
|
||||
books_file.seek(0)
|
||||
books_reader = csv.reader(books_file, dialect)
|
||||
for line in books_reader:
|
||||
ver = unicode(line[0], u'utf-8')
|
||||
name = unicode(line[1], u'utf-8')
|
||||
self.web_bible_list[WebDownload.Crosswalk][ver] = name.strip()
|
||||
except IOError:
|
||||
log.exception(u'Crosswalk resources missing')
|
||||
finally:
|
||||
if books_file:
|
||||
books_file.close()
|
||||
self.loadBibleResourceFile(
|
||||
os.path.join(filepath, u'crosswalkbooks.csv'),
|
||||
WebDownload.Crosswalk)
|
||||
# Load BibleGateway Bibles.
|
||||
books_file = None
|
||||
try:
|
||||
self.web_bible_list[WebDownload.BibleGateway] = {}
|
||||
books_file = open(os.path.join(filepath, u'biblegateway.csv'), 'r')
|
||||
dialect = csv.Sniffer().sniff(books_file.read(1024))
|
||||
books_file.seek(0)
|
||||
books_reader = csv.reader(books_file, dialect)
|
||||
for line in books_reader:
|
||||
ver = line[0]
|
||||
name = line[1]
|
||||
if not isinstance(ver, unicode):
|
||||
ver = unicode(ver, u'utf8')
|
||||
if not isinstance(name, unicode):
|
||||
name = unicode(name, u'utf8')
|
||||
self.web_bible_list[WebDownload.BibleGateway][ver] = \
|
||||
name.strip()
|
||||
except IOError:
|
||||
log.exception(u'Biblegateway resources missing')
|
||||
finally:
|
||||
if books_file:
|
||||
books_file.close()
|
||||
self.loadBibleResourceFile(os.path.join(filepath, u'biblegateway.csv'),
|
||||
WebDownload.BibleGateway)
|
||||
# Load and Bibleserver Bibles.
|
||||
filepath = AppLocation.get_directory(AppLocation.PluginsDir)
|
||||
filepath = os.path.join(filepath, u'bibles', u'resources')
|
||||
self.loadBibleResourceFile(os.path.join(filepath, u'bibleserver.csv'),
|
||||
WebDownload.Bibleserver)
|
||||
|
||||
def loadBibleResourceFile(self, file_path_name, download_type):
|
||||
"""
|
||||
Loads a web bible resource file.
|
||||
|
||||
``file_path_name``
|
||||
The file to load including the file's path.
|
||||
|
||||
``download_type``
|
||||
The WebDownload type this file is for.
|
||||
"""
|
||||
self.web_bible_list[download_type] = {}
|
||||
books_file = None
|
||||
try:
|
||||
self.web_bible_list[WebDownload.Bibleserver] = {}
|
||||
books_file = open(
|
||||
os.path.join(filepath, u'bibleserver.csv'), 'rb')
|
||||
books_file = open(file_path_name, 'rb')
|
||||
dialect = csv.Sniffer().sniff(books_file.read(1024))
|
||||
books_file.seek(0)
|
||||
books_reader = csv.reader(books_file, dialect)
|
||||
for line in books_reader:
|
||||
ver = unicode(line[0], u'utf-8')
|
||||
name = unicode(line[1], u'utf-8')
|
||||
self.web_bible_list[WebDownload.Bibleserver][ver] = name.strip()
|
||||
except IOError, UnicodeError:
|
||||
log.exception(u'Bibleserver resources missing')
|
||||
ver = string_is_unicode(line[0])
|
||||
name = string_is_unicode(line[1])
|
||||
self.web_bible_list[download_type][ver] = name.strip()
|
||||
except IOError:
|
||||
log.exception(u'%s resources missing' %
|
||||
WebDownload.get_name(download_type))
|
||||
finally:
|
||||
if books_file:
|
||||
books_file.close()
|
||||
@ -413,8 +718,8 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
|
||||
A editbox (QLineEdit).
|
||||
|
||||
``filters``
|
||||
The file extension filters. It should contain the file description as
|
||||
well as the file extension. For example::
|
||||
The file extension filters. It should contain the file description
|
||||
as well as the file extension. For example::
|
||||
|
||||
u'openlp.org 1.x bible (*.bible)'
|
||||
"""
|
||||
@ -424,37 +729,28 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
|
||||
'All Files')
|
||||
filename = QtGui.QFileDialog.getOpenFileName(self, title,
|
||||
os.path.dirname(SettingsManager.get_last_dir(
|
||||
self.bibleplugin.settingsSection, 1)), filters)
|
||||
self.plugin.settingsSection, 1)), filters)
|
||||
if filename:
|
||||
editbox.setText(filename)
|
||||
SettingsManager.set_last_dir(
|
||||
self.bibleplugin.settingsSection, filename, 1)
|
||||
self.plugin.settingsSection, filename, 1)
|
||||
|
||||
def incrementProgressBar(self, status_text):
|
||||
log.debug(u'IncrementBar %s', status_text)
|
||||
self.importProgressLabel.setText(status_text)
|
||||
self.importProgressBar.setValue(self.importProgressBar.value() + 1)
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
|
||||
def preImport(self):
|
||||
def preWizard(self):
|
||||
"""
|
||||
Prepare the UI for the import.
|
||||
"""
|
||||
OpenLPWizard.preWizard(self)
|
||||
bible_type = self.field(u'source_format').toInt()[0]
|
||||
self.finishButton.setVisible(False)
|
||||
self.importProgressBar.setMinimum(0)
|
||||
self.importProgressBar.setMaximum(1188)
|
||||
self.importProgressBar.setValue(0)
|
||||
if bible_type == BibleFormat.WebDownload:
|
||||
self.importProgressLabel.setText(translate(
|
||||
self.progressLabel.setText(translate(
|
||||
'BiblesPlugin.ImportWizardForm',
|
||||
'Starting Registering bible...'))
|
||||
else:
|
||||
self.importProgressLabel.setText(translate(
|
||||
self.progressLabel.setText(translate(
|
||||
'BiblesPlugin.ImportWizardForm', 'Starting import...'))
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
|
||||
def performImport(self):
|
||||
def performWizard(self):
|
||||
"""
|
||||
Perform the actual import.
|
||||
"""
|
||||
@ -485,7 +781,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
|
||||
)
|
||||
elif bible_type == BibleFormat.WebDownload:
|
||||
# Import a bible from the web.
|
||||
self.importProgressBar.setMaximum(1)
|
||||
self.progressBar.setMaximum(1)
|
||||
download_location = self.field(u'web_location').toInt()[0]
|
||||
bible_version = unicode(self.webTranslationComboBox.currentText())
|
||||
if download_location == WebDownload.Crosswalk:
|
||||
@ -518,20 +814,14 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
|
||||
license_copyright, license_permissions)
|
||||
self.manager.reload_bibles()
|
||||
if bible_type == BibleFormat.WebDownload:
|
||||
self.importProgressLabel.setText(
|
||||
self.progressLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Registered '
|
||||
'bible. Please note, that verses will be downloaded on\n'
|
||||
'demand and thus an internet connection is required.'))
|
||||
else:
|
||||
self.importProgressLabel.setText(translate(
|
||||
self.progressLabel.setText(translate(
|
||||
'BiblesPlugin.ImportWizardForm', 'Finished import.'))
|
||||
else:
|
||||
self.importProgressLabel.setText(translate(
|
||||
self.progressLabel.setText(translate(
|
||||
'BiblesPlugin.ImportWizardForm', 'Your Bible import failed.'))
|
||||
delete_database(self.bibleplugin.settingsSection, importer.file)
|
||||
|
||||
def postImport(self):
|
||||
self.importProgressBar.setValue(self.importProgressBar.maximum())
|
||||
self.finishButton.setVisible(True)
|
||||
self.cancelButton.setVisible(False)
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
delete_database(self.plugin.settingsSection, importer.file)
|
||||
|
@ -1,391 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2011 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
|
||||
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
|
||||
# Carsten Tinggaard, Frode Woldsund #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# This program is free software; you can redistribute it and/or modify it #
|
||||
# under the terms of the GNU General Public License as published by the Free #
|
||||
# Software Foundation; version 2 of the License. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||
# more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License along #
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import build_icon, translate
|
||||
|
||||
class Ui_BibleImportWizard(object):
|
||||
def setupUi(self, bibleImportWizard):
|
||||
bibleImportWizard.setObjectName(u'bibleImportWizard')
|
||||
bibleImportWizard.setModal(True)
|
||||
bibleImportWizard.setWizardStyle(QtGui.QWizard.ModernStyle)
|
||||
bibleImportWizard.setOptions(
|
||||
QtGui.QWizard.IndependentPages |
|
||||
QtGui.QWizard.NoBackButtonOnStartPage |
|
||||
QtGui.QWizard.NoBackButtonOnLastPage)
|
||||
# Welcome Page
|
||||
self.welcomePage = QtGui.QWizardPage()
|
||||
self.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap,
|
||||
QtGui.QPixmap(u':/wizards/wizard_importbible.bmp'))
|
||||
self.welcomePage.setObjectName(u'WelcomePage')
|
||||
self.welcomeLayout = QtGui.QVBoxLayout(self.welcomePage)
|
||||
self.welcomeLayout.setObjectName(u'WelcomeLayout')
|
||||
self.titleLabel = QtGui.QLabel(self.welcomePage)
|
||||
self.titleLabel.setObjectName(u'TitleLabel')
|
||||
self.welcomeLayout.addWidget(self.titleLabel)
|
||||
self.welcomeLayout.addSpacing(40)
|
||||
self.informationLabel = QtGui.QLabel(self.welcomePage)
|
||||
self.informationLabel.setWordWrap(True)
|
||||
self.informationLabel.setObjectName(u'InformationLabel')
|
||||
self.welcomeLayout.addWidget(self.informationLabel)
|
||||
self.welcomeLayout.addStretch()
|
||||
bibleImportWizard.addPage(self.welcomePage)
|
||||
# Select Page
|
||||
self.selectPage = QtGui.QWizardPage()
|
||||
self.selectPage.setObjectName(u'SelectPage')
|
||||
self.selectPageLayout = QtGui.QVBoxLayout(self.selectPage)
|
||||
self.selectPageLayout.setObjectName(u'SelectPageLayout')
|
||||
self.formatLayout = QtGui.QFormLayout()
|
||||
self.formatLayout.setObjectName(u'FormatLayout')
|
||||
self.formatLabel = QtGui.QLabel(self.selectPage)
|
||||
self.formatLabel.setObjectName(u'FormatLabel')
|
||||
self.formatComboBox = QtGui.QComboBox(self.selectPage)
|
||||
self.formatComboBox.addItems([u'', u'', u'', u'', u''])
|
||||
self.formatComboBox.setObjectName(u'FormatComboBox')
|
||||
self.formatLayout.addRow(self.formatLabel, self.formatComboBox)
|
||||
self.formatSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
|
||||
QtGui.QSizePolicy.Minimum)
|
||||
self.formatLayout.setItem(1, QtGui.QFormLayout.LabelRole,
|
||||
self.formatSpacer)
|
||||
self.selectPageLayout.addLayout(self.formatLayout)
|
||||
self.selectStack = QtGui.QStackedLayout()
|
||||
self.selectStack.setObjectName(u'SelectStack')
|
||||
self.osisWidget = QtGui.QWidget(self.selectPage)
|
||||
self.osisWidget.setObjectName(u'OsisWidget')
|
||||
self.osisLayout = QtGui.QFormLayout(self.osisWidget)
|
||||
self.osisLayout.setMargin(0)
|
||||
self.osisLayout.setObjectName(u'OsisLayout')
|
||||
self.osisFileLabel = QtGui.QLabel(self.osisWidget)
|
||||
self.osisFileLabel.setObjectName(u'OsisFileLabel')
|
||||
self.osisFileLayout = QtGui.QHBoxLayout()
|
||||
self.osisFileLayout.setObjectName(u'OsisFileLayout')
|
||||
self.osisFileEdit = QtGui.QLineEdit(self.osisWidget)
|
||||
self.osisFileEdit.setObjectName(u'OsisFileEdit')
|
||||
self.osisFileLayout.addWidget(self.osisFileEdit)
|
||||
self.osisBrowseButton = QtGui.QToolButton(self.osisWidget)
|
||||
self.osisBrowseButton.setIcon(build_icon(u':/general/general_open.png'))
|
||||
self.osisBrowseButton.setObjectName(u'OsisBrowseButton')
|
||||
self.osisFileLayout.addWidget(self.osisBrowseButton)
|
||||
self.osisLayout.addRow(self.osisFileLabel, self.osisFileLayout)
|
||||
self.osisSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
|
||||
QtGui.QSizePolicy.Minimum)
|
||||
self.osisLayout.setItem(1, QtGui.QFormLayout.LabelRole, self.osisSpacer)
|
||||
self.selectStack.addWidget(self.osisWidget)
|
||||
self.csvWidget = QtGui.QWidget(self.selectPage)
|
||||
self.csvWidget.setObjectName(u'CsvWidget')
|
||||
self.csvLayout = QtGui.QFormLayout(self.csvWidget)
|
||||
self.csvLayout.setMargin(0)
|
||||
self.csvLayout.setObjectName(u'CsvLayout')
|
||||
self.csvBooksLabel = QtGui.QLabel(self.csvWidget)
|
||||
self.csvBooksLabel.setObjectName(u'CsvBooksLabel')
|
||||
self.csvBooksLayout = QtGui.QHBoxLayout()
|
||||
self.csvBooksLayout.setObjectName(u'CsvBooksLayout')
|
||||
self.csvBooksEdit = QtGui.QLineEdit(self.csvWidget)
|
||||
self.csvBooksEdit.setObjectName(u'CsvBooksEdit')
|
||||
self.csvBooksLayout.addWidget(self.csvBooksEdit)
|
||||
self.csvBooksButton = QtGui.QToolButton(self.csvWidget)
|
||||
self.csvBooksButton.setIcon(build_icon(u':/general/general_open.png'))
|
||||
self.csvBooksButton.setObjectName(u'CsvBooksButton')
|
||||
self.csvBooksLayout.addWidget(self.csvBooksButton)
|
||||
self.csvLayout.addRow(self.csvBooksLabel, self.csvBooksLayout)
|
||||
self.csvVersesLabel = QtGui.QLabel(self.csvWidget)
|
||||
self.csvVersesLabel.setObjectName(u'CsvVersesLabel')
|
||||
self.csvVersesLayout = QtGui.QHBoxLayout()
|
||||
self.csvVersesLayout.setObjectName(u'CsvVersesLayout')
|
||||
self.csvVersesEdit = QtGui.QLineEdit(self.csvWidget)
|
||||
self.csvVersesEdit.setObjectName(u'CsvVersesEdit')
|
||||
self.csvVersesLayout.addWidget(self.csvVersesEdit)
|
||||
self.csvVersesButton = QtGui.QToolButton(self.csvWidget)
|
||||
self.csvVersesButton.setIcon(build_icon(u':/general/general_open.png'))
|
||||
self.csvVersesButton.setObjectName(u'CsvVersesButton')
|
||||
self.csvVersesLayout.addWidget(self.csvVersesButton)
|
||||
self.csvLayout.addRow(self.csvVersesLabel, self.csvVersesLayout)
|
||||
self.csvSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
|
||||
QtGui.QSizePolicy.Minimum)
|
||||
self.csvLayout.setItem(2, QtGui.QFormLayout.LabelRole, self.csvSpacer)
|
||||
self.selectStack.addWidget(self.csvWidget)
|
||||
self.openSongWidget = QtGui.QWidget(self.selectPage)
|
||||
self.openSongWidget.setObjectName(u'OpenSongWidget')
|
||||
self.openSongLayout = QtGui.QFormLayout(self.openSongWidget)
|
||||
self.openSongLayout.setMargin(0)
|
||||
self.openSongLayout.setObjectName(u'OpenSongLayout')
|
||||
self.openSongFileLabel = QtGui.QLabel(self.openSongWidget)
|
||||
self.openSongFileLabel.setObjectName(u'OpenSongFileLabel')
|
||||
self.openSongFileLayout = QtGui.QHBoxLayout()
|
||||
self.openSongFileLayout.setObjectName(u'OpenSongFileLayout')
|
||||
self.openSongFileEdit = QtGui.QLineEdit(self.openSongWidget)
|
||||
self.openSongFileEdit.setObjectName(u'OpenSongFileEdit')
|
||||
self.openSongFileLayout.addWidget(self.openSongFileEdit)
|
||||
self.openSongBrowseButton = QtGui.QToolButton(self.openSongWidget)
|
||||
self.openSongBrowseButton.setIcon(
|
||||
build_icon(u':/general/general_open.png'))
|
||||
self.openSongBrowseButton.setObjectName(u'OpenSongBrowseButton')
|
||||
self.openSongFileLayout.addWidget(self.openSongBrowseButton)
|
||||
self.openSongLayout.addRow(self.openSongFileLabel,
|
||||
self.openSongFileLayout)
|
||||
self.openSongSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
|
||||
QtGui.QSizePolicy.Minimum)
|
||||
self.openSongLayout.setItem(1, QtGui.QFormLayout.LabelRole,
|
||||
self.openSongSpacer)
|
||||
self.selectStack.addWidget(self.openSongWidget)
|
||||
self.webTabWidget = QtGui.QTabWidget(self.selectPage)
|
||||
self.webTabWidget.setObjectName(u'WebTabWidget')
|
||||
self.webBibleTab = QtGui.QWidget()
|
||||
self.webBibleTab.setObjectName(u'WebBibleTab')
|
||||
self.webBibleLayout = QtGui.QFormLayout(self.webBibleTab)
|
||||
self.webBibleLayout.setObjectName(u'WebBibleLayout')
|
||||
self.webSourceLabel = QtGui.QLabel(self.webBibleTab)
|
||||
self.webSourceLabel.setObjectName(u'WebSourceLabel')
|
||||
self.webBibleLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
|
||||
self.webSourceLabel)
|
||||
self.webSourceComboBox = QtGui.QComboBox(self.webBibleTab)
|
||||
self.webSourceComboBox.setObjectName(u'WebSourceComboBox')
|
||||
self.webSourceComboBox.addItems([u'', u'', u''])
|
||||
self.webBibleLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
|
||||
self.webSourceComboBox)
|
||||
self.webTranslationLabel = QtGui.QLabel(self.webBibleTab)
|
||||
self.webTranslationLabel.setObjectName(u'webTranslationLabel')
|
||||
self.webBibleLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
|
||||
self.webTranslationLabel)
|
||||
self.webTranslationComboBox = QtGui.QComboBox(self.webBibleTab)
|
||||
self.webTranslationComboBox.setSizeAdjustPolicy(
|
||||
QtGui.QComboBox.AdjustToContents)
|
||||
self.webTranslationComboBox.setObjectName(u'WebTranslationComboBox')
|
||||
self.webBibleLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
|
||||
self.webTranslationComboBox)
|
||||
self.webTabWidget.addTab(self.webBibleTab, u'')
|
||||
self.webProxyTab = QtGui.QWidget()
|
||||
self.webProxyTab.setObjectName(u'WebProxyTab')
|
||||
self.webProxyLayout = QtGui.QFormLayout(self.webProxyTab)
|
||||
self.webProxyLayout.setObjectName(u'WebProxyLayout')
|
||||
self.webServerLabel = QtGui.QLabel(self.webProxyTab)
|
||||
self.webServerLabel.setObjectName(u'WebServerLabel')
|
||||
self.webProxyLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
|
||||
self.webServerLabel)
|
||||
self.webServerEdit = QtGui.QLineEdit(self.webProxyTab)
|
||||
self.webServerEdit.setObjectName(u'WebServerEdit')
|
||||
self.webProxyLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
|
||||
self.webServerEdit)
|
||||
self.webUserLabel = QtGui.QLabel(self.webProxyTab)
|
||||
self.webUserLabel.setObjectName(u'WebUserLabel')
|
||||
self.webProxyLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
|
||||
self.webUserLabel)
|
||||
self.webUserEdit = QtGui.QLineEdit(self.webProxyTab)
|
||||
self.webUserEdit.setObjectName(u'WebUserEdit')
|
||||
self.webProxyLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
|
||||
self.webUserEdit)
|
||||
self.webPasswordLabel = QtGui.QLabel(self.webProxyTab)
|
||||
self.webPasswordLabel.setObjectName(u'WebPasswordLabel')
|
||||
self.webProxyLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
|
||||
self.webPasswordLabel)
|
||||
self.webPasswordEdit = QtGui.QLineEdit(self.webProxyTab)
|
||||
self.webPasswordEdit.setObjectName(u'WebPasswordEdit')
|
||||
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(
|
||||
build_icon(u':/general/general_open.png'))
|
||||
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.openlp1Spacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
|
||||
QtGui.QSizePolicy.Minimum)
|
||||
self.openlp1Layout.setItem(1, QtGui.QFormLayout.LabelRole,
|
||||
self.openlp1Spacer)
|
||||
self.selectStack.addWidget(self.openlp1Widget)
|
||||
self.selectPageLayout.addLayout(self.selectStack)
|
||||
bibleImportWizard.addPage(self.selectPage)
|
||||
# License Page
|
||||
self.licenseDetailsPage = QtGui.QWizardPage()
|
||||
self.licenseDetailsPage.setObjectName(u'LicenseDetailsPage')
|
||||
self.licenseDetailsLayout = QtGui.QFormLayout(self.licenseDetailsPage)
|
||||
self.licenseDetailsLayout.setObjectName(u'LicenseDetailsLayout')
|
||||
self.versionNameLabel = QtGui.QLabel(self.licenseDetailsPage)
|
||||
self.versionNameLabel.setObjectName(u'VersionNameLabel')
|
||||
self.licenseDetailsLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
|
||||
self.versionNameLabel)
|
||||
self.versionNameEdit = QtGui.QLineEdit(self.licenseDetailsPage)
|
||||
self.versionNameEdit.setObjectName(u'VersionNameEdit')
|
||||
self.licenseDetailsLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
|
||||
self.versionNameEdit)
|
||||
self.copyrightLabel = QtGui.QLabel(self.licenseDetailsPage)
|
||||
self.copyrightLabel.setObjectName(u'CopyrightLabel')
|
||||
self.licenseDetailsLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
|
||||
self.copyrightLabel)
|
||||
self.copyrightEdit = QtGui.QLineEdit(self.licenseDetailsPage)
|
||||
self.copyrightEdit.setObjectName(u'CopyrightEdit')
|
||||
self.licenseDetailsLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
|
||||
self.copyrightEdit)
|
||||
self.permissionsLabel = QtGui.QLabel(self.licenseDetailsPage)
|
||||
self.permissionsLabel.setObjectName(u'PermissionsLabel')
|
||||
self.licenseDetailsLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
|
||||
self.permissionsLabel)
|
||||
self.permissionsEdit = QtGui.QLineEdit(self.licenseDetailsPage)
|
||||
self.permissionsEdit.setObjectName(u'PermissionsEdit')
|
||||
self.licenseDetailsLayout.setWidget(2, QtGui.QFormLayout.FieldRole,
|
||||
self.permissionsEdit)
|
||||
bibleImportWizard.addPage(self.licenseDetailsPage)
|
||||
# Progress Page
|
||||
self.importPage = QtGui.QWizardPage()
|
||||
self.importPage.setObjectName(u'ImportPage')
|
||||
self.importLayout = QtGui.QVBoxLayout(self.importPage)
|
||||
self.importLayout.setMargin(48)
|
||||
self.importLayout.setObjectName(u'ImportLayout')
|
||||
self.importProgressLabel = QtGui.QLabel(self.importPage)
|
||||
self.importProgressLabel.setObjectName(u'ImportProgressLabel')
|
||||
self.importLayout.addWidget(self.importProgressLabel)
|
||||
self.importProgressBar = QtGui.QProgressBar(self.importPage)
|
||||
self.importProgressBar.setObjectName(u'ImportProgressBar')
|
||||
self.importLayout.addWidget(self.importProgressBar)
|
||||
bibleImportWizard.addPage(self.importPage)
|
||||
self.retranslateUi(bibleImportWizard)
|
||||
QtCore.QMetaObject.connectSlotsByName(bibleImportWizard)
|
||||
QtCore.QObject.connect(self.formatComboBox,
|
||||
QtCore.SIGNAL(u'currentIndexChanged(int)'), self.selectStack,
|
||||
QtCore.SLOT(u'setCurrentIndex(int)'))
|
||||
|
||||
def retranslateUi(self, bibleImportWizard):
|
||||
bibleImportWizard.setWindowTitle(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Bible Import Wizard'))
|
||||
self.titleLabel.setText(
|
||||
u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
|
||||
translate('BiblesPlugin.ImportWizardForm',
|
||||
'Welcome to the Bible Import Wizard'))
|
||||
self.informationLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm',
|
||||
'This wizard will help you to import Bibles from a '
|
||||
'variety of formats. Click the next button below to start the '
|
||||
'process by selecting a format to import from.'))
|
||||
self.selectPage.setTitle(translate('BiblesPlugin.ImportWizardForm',
|
||||
'Select Import Source'))
|
||||
self.selectPage.setSubTitle(
|
||||
translate('BiblesPlugin.ImportWizardForm',
|
||||
'Select the import format, and where to import from.'))
|
||||
self.formatLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Format:'))
|
||||
self.formatComboBox.setItemText(0,
|
||||
translate('BiblesPlugin.ImportWizardForm', 'OSIS'))
|
||||
self.formatComboBox.setItemText(1,
|
||||
translate('BiblesPlugin.ImportWizardForm', 'CSV'))
|
||||
self.formatComboBox.setItemText(2,
|
||||
translate('BiblesPlugin.ImportWizardForm', 'OpenSong'))
|
||||
self.formatComboBox.setItemText(3,
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Web Download'))
|
||||
self.formatComboBox.setItemText(4,
|
||||
translate('BiblesPlugin.ImportWizardForm', 'openlp.org 1.x'))
|
||||
self.openlp1FileLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'File location:'))
|
||||
self.osisFileLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'File location:'))
|
||||
self.csvBooksLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Books location:'))
|
||||
self.csvVersesLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Verse location:'))
|
||||
self.openSongFileLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Bible filename:'))
|
||||
self.webSourceLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Location:'))
|
||||
self.webSourceComboBox.setItemText(0,
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Crosswalk'))
|
||||
self.webSourceComboBox.setItemText(1,
|
||||
translate('BiblesPlugin.ImportWizardForm', 'BibleGateway'))
|
||||
self.webSourceComboBox.setItemText(2,
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Bibleserver'))
|
||||
self.webTranslationLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Bible:'))
|
||||
self.webTabWidget.setTabText(
|
||||
self.webTabWidget.indexOf(self.webBibleTab),
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Download Options'))
|
||||
self.webServerLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Server:'))
|
||||
self.webUserLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Username:'))
|
||||
self.webPasswordLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Password:'))
|
||||
self.webTabWidget.setTabText(
|
||||
self.webTabWidget.indexOf(self.webProxyTab),
|
||||
translate('BiblesPlugin.ImportWizardForm',
|
||||
'Proxy Server (Optional)'))
|
||||
self.licenseDetailsPage.setTitle(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'License Details'))
|
||||
self.licenseDetailsPage.setSubTitle(
|
||||
translate('BiblesPlugin.ImportWizardForm',
|
||||
'Set up the Bible\'s license details.'))
|
||||
self.versionNameLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Version name:'))
|
||||
self.copyrightLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Copyright:'))
|
||||
self.permissionsLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Permissions:'))
|
||||
self.importPage.setTitle(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Importing'))
|
||||
self.importPage.setSubTitle(
|
||||
translate('BiblesPlugin.ImportWizardForm',
|
||||
'Please wait while your Bible is imported.'))
|
||||
self.importProgressLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Ready.'))
|
||||
self.importProgressBar.setFormat(u'%p%')
|
||||
self.openlp1DisabledLabel.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', '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.'))
|
||||
# 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.formatSpacer.changeSize(labelWidth, 0,
|
||||
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
self.osisSpacer.changeSize(labelWidth, 0,
|
||||
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
self.csvSpacer.changeSize(labelWidth, 0,
|
||||
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
self.openSongSpacer.changeSize(labelWidth, 0,
|
||||
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
self.openlp1Spacer.changeSize(labelWidth, 0,
|
||||
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
@ -31,7 +31,7 @@ import csv
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import Receiver, translate
|
||||
from db import BibleDB
|
||||
from openlp.plugins.bibles.lib.db import BibleDB
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -51,7 +51,7 @@ class CSVBible(BibleDB):
|
||||
self.booksfile = kwargs[u'booksfile']
|
||||
self.versesfile = kwargs[u'versefile']
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'bibles_stop_import'), self.stop_import)
|
||||
QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_import)
|
||||
|
||||
def do_import(self):
|
||||
success = True
|
||||
|
@ -387,7 +387,7 @@ class HTTPBible(BibleDB):
|
||||
Run the import. This method overrides the parent class method. Returns
|
||||
``True`` on success, ``False`` on failure.
|
||||
"""
|
||||
self.wizard.importProgressBar.setMaximum(2)
|
||||
self.wizard.progressBar.setMaximum(2)
|
||||
self.wizard.incrementProgressBar('Registering bible...')
|
||||
self.create_meta(u'download source', self.download_source)
|
||||
self.create_meta(u'download name', self.download_name)
|
||||
@ -532,19 +532,25 @@ def get_soup_for_bible_ref(reference_url, header=None, cleaner=None):
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
return soup
|
||||
|
||||
def send_error_message(reason):
|
||||
if reason == u'download':
|
||||
def send_error_message(error_type):
|
||||
"""
|
||||
Send a standard error message informing the user of an issue.
|
||||
|
||||
``error_type``
|
||||
The type of error that occured for the issue.
|
||||
"""
|
||||
if error_type == u'download':
|
||||
Receiver.send_message(u'openlp_error_message', {
|
||||
u'title': translate('BiblePlugin.HTTPBible', 'Download Error'),
|
||||
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
|
||||
'problem downloading your verse selection. Please check your '
|
||||
'Internet connection, and if this error continues to occur '
|
||||
'consider reporting a bug.')
|
||||
'please consider reporting a bug.')
|
||||
})
|
||||
elif reason == u'parse':
|
||||
elif error_type == u'parse':
|
||||
Receiver.send_message(u'openlp_error_message', {
|
||||
u'title': translate('BiblePlugin.HTTPBible', 'Parse Error'),
|
||||
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
|
||||
'problem extracting your verse selection. If this error continues '
|
||||
'to occur consider reporting a bug.')
|
||||
'to occur please consider reporting a bug.')
|
||||
})
|
||||
|
@ -327,7 +327,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||
if not hasattr(self, u'import_wizard'):
|
||||
self.import_wizard = BibleImportForm(self, self.parent.manager,
|
||||
self.parent)
|
||||
# If the import was not canceled then reload.
|
||||
# If the import was not cancelled then reload.
|
||||
if self.import_wizard.exec_():
|
||||
self.reloadBibles()
|
||||
|
||||
|
@ -30,7 +30,7 @@ import sqlite
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import Receiver, translate
|
||||
from db import BibleDB
|
||||
from openlp.plugins.bibles.lib.db import BibleDB
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -46,7 +46,7 @@ class OpenLP1Bible(BibleDB):
|
||||
BibleDB.__init__(self, parent, **kwargs)
|
||||
self.filename = kwargs[u'filename']
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'bibles_stop_import'), self.stop_import)
|
||||
QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_import)
|
||||
|
||||
def do_import(self):
|
||||
"""
|
||||
@ -62,7 +62,7 @@ class OpenLP1Bible(BibleDB):
|
||||
# Create all books.
|
||||
cursor.execute(u'SELECT id, testament_id, name, abbreviation FROM book')
|
||||
books = cursor.fetchall()
|
||||
self.wizard.importProgressBar.setMaximum(len(books) + 1)
|
||||
self.wizard.progressBar.setMaximum(len(books) + 1)
|
||||
for book in books:
|
||||
if self.stop_import_flag:
|
||||
connection.close()
|
||||
|
@ -30,7 +30,7 @@ from lxml import objectify
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import Receiver, translate
|
||||
from db import BibleDB
|
||||
from openlp.plugins.bibles.lib.db import BibleDB
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -48,7 +48,7 @@ class OpenSongBible(BibleDB):
|
||||
BibleDB.__init__(self, parent, **kwargs)
|
||||
self.filename = kwargs['filename']
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'bibles_stop_import'), self.stop_import)
|
||||
QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_import)
|
||||
|
||||
def do_import(self):
|
||||
"""
|
||||
|
@ -35,7 +35,7 @@ from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import Receiver, translate
|
||||
from openlp.core.utils import AppLocation
|
||||
from db import BibleDB
|
||||
from openlp.plugins.bibles.lib.db import BibleDB
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -87,7 +87,7 @@ class OSISBible(BibleDB):
|
||||
if fbibles:
|
||||
fbibles.close()
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'bibles_stop_import'), self.stop_import)
|
||||
QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_import)
|
||||
|
||||
def do_import(self):
|
||||
"""
|
||||
@ -134,9 +134,9 @@ class OSISBible(BibleDB):
|
||||
testament)
|
||||
if last_chapter == 0:
|
||||
if book == u'Gen':
|
||||
self.wizard.importProgressBar.setMaximum(1188)
|
||||
self.wizard.progressBar.setMaximum(1188)
|
||||
else:
|
||||
self.wizard.importProgressBar.setMaximum(260)
|
||||
self.wizard.progressBar.setMaximum(260)
|
||||
if last_chapter != chapter:
|
||||
if last_chapter != 0:
|
||||
self.session.commit()
|
||||
|
@ -23,19 +23,21 @@
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
"""
|
||||
The song import functions for OpenLP.
|
||||
"""
|
||||
import logging
|
||||
import os
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from songimportwizard import Ui_SongImportWizard
|
||||
from openlp.core.lib import Receiver, SettingsManager, translate
|
||||
from openlp.core.ui.wizard import OpenLPWizard
|
||||
from openlp.plugins.songs.lib.importer import SongFormat
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
|
||||
class SongImportForm(OpenLPWizard):
|
||||
"""
|
||||
This is the Song Import Wizard, which allows easy importing of Songs
|
||||
into OpenLP from other formats like OpenLyrics, OpenSong and CCLI.
|
||||
@ -52,11 +54,23 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
|
||||
``plugin``
|
||||
The songs plugin.
|
||||
"""
|
||||
QtGui.QWizard.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
self.registerFields()
|
||||
self.finishButton = self.button(QtGui.QWizard.FinishButton)
|
||||
self.cancelButton = self.button(QtGui.QWizard.CancelButton)
|
||||
OpenLPWizard.__init__(self, parent, plugin, u'songImportWizard',
|
||||
u':/wizards/wizard_importsong.bmp')
|
||||
|
||||
def setupUi(self, image):
|
||||
"""
|
||||
Set up the song wizard UI.
|
||||
"""
|
||||
OpenLPWizard.setupUi(self, image)
|
||||
self.formatStack.setCurrentIndex(0)
|
||||
QtCore.QObject.connect(self.formatComboBox,
|
||||
QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
||||
self.formatStack.setCurrentIndex)
|
||||
|
||||
def customInit(self):
|
||||
"""
|
||||
Song wizard specific initialisation.
|
||||
"""
|
||||
if not SongFormat.get_availability(SongFormat.OpenLP1):
|
||||
self.openLP1DisabledWidget.setVisible(True)
|
||||
self.openLP1ImportWidget.setVisible(False)
|
||||
@ -66,7 +80,11 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
|
||||
if not SongFormat.get_availability(SongFormat.Generic):
|
||||
self.genericDisabledWidget.setVisible(True)
|
||||
self.genericImportWidget.setVisible(False)
|
||||
self.plugin = plugin
|
||||
|
||||
def customSignals(self):
|
||||
"""
|
||||
Song wizard specific signals.
|
||||
"""
|
||||
QtCore.QObject.connect(self.openLP2BrowseButton,
|
||||
QtCore.SIGNAL(u'clicked()'),
|
||||
self.onOpenLP2BrowseButtonClicked)
|
||||
@ -118,25 +136,184 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
|
||||
QtCore.QObject.connect(self.songBeamerRemoveButton,
|
||||
QtCore.SIGNAL(u'clicked()'),
|
||||
self.onSongBeamerRemoveButtonClicked)
|
||||
QtCore.QObject.connect(self,
|
||||
QtCore.SIGNAL(u'currentIdChanged(int)'),
|
||||
self.onCurrentIdChanged)
|
||||
|
||||
def exec_(self):
|
||||
def addCustomPages(self):
|
||||
"""
|
||||
Run the wizard.
|
||||
Add song wizard specific pages.
|
||||
"""
|
||||
self.setDefaults()
|
||||
return QtGui.QWizard.exec_(self)
|
||||
# Source Page
|
||||
self.sourcePage = QtGui.QWizardPage()
|
||||
self.sourcePage.setObjectName(u'SourcePage')
|
||||
self.sourceLayout = QtGui.QVBoxLayout(self.sourcePage)
|
||||
self.sourceLayout.setObjectName(u'SourceLayout')
|
||||
self.formatLayout = QtGui.QFormLayout()
|
||||
self.formatLayout.setObjectName(u'FormatLayout')
|
||||
self.formatLabel = QtGui.QLabel(self.sourcePage)
|
||||
self.formatLabel.setObjectName(u'FormatLabel')
|
||||
self.formatComboBox = QtGui.QComboBox(self.sourcePage)
|
||||
self.formatComboBox.setObjectName(u'FormatComboBox')
|
||||
self.formatLayout.addRow(self.formatLabel, self.formatComboBox)
|
||||
self.formatSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
|
||||
QtGui.QSizePolicy.Minimum)
|
||||
self.formatLayout.setItem(1, QtGui.QFormLayout.LabelRole,
|
||||
self.formatSpacer)
|
||||
self.sourceLayout.addLayout(self.formatLayout)
|
||||
self.formatStack = QtGui.QStackedLayout()
|
||||
self.formatStack.setObjectName(u'FormatStack')
|
||||
# OpenLP 2.0
|
||||
self.addSingleFileSelectItem(u'openLP2')
|
||||
# openlp.org 1.x
|
||||
self.addSingleFileSelectItem(u'openLP1', None, True)
|
||||
# OpenLyrics
|
||||
self.addMultiFileSelectItem(u'openLyrics', u'OpenLyrics', True)
|
||||
# Open Song
|
||||
self.addMultiFileSelectItem(u'openSong', u'OpenSong')
|
||||
# Words of Worship
|
||||
self.addMultiFileSelectItem(u'wordsOfWorship')
|
||||
# CCLI File import
|
||||
self.addMultiFileSelectItem(u'ccli')
|
||||
# Songs of Fellowship
|
||||
self.addMultiFileSelectItem(u'songsOfFellowship', None, True)
|
||||
# Generic Document/Presentation import
|
||||
self.addMultiFileSelectItem(u'generic', None, True)
|
||||
# EasyWorship
|
||||
self.addSingleFileSelectItem(u'ew')
|
||||
# Words of Worship
|
||||
self.addMultiFileSelectItem(u'songBeamer')
|
||||
# Commented out for future use.
|
||||
# self.addSingleFileSelectItem(u'csv', u'CSV')
|
||||
self.sourceLayout.addLayout(self.formatStack)
|
||||
self.addPage(self.sourcePage)
|
||||
|
||||
def reject(self):
|
||||
def retranslateUi(self):
|
||||
"""
|
||||
Stop the import on cancel button, close button or ESC key.
|
||||
Song wizard localisation.
|
||||
"""
|
||||
log.debug(u'Import canceled by user.')
|
||||
if self.currentPage() == self.importPage:
|
||||
Receiver.send_message(u'songs_stop_import')
|
||||
self.done(QtGui.QDialog.Rejected)
|
||||
self.setWindowTitle(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Song Import Wizard'))
|
||||
self.titleLabel.setText(
|
||||
u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
|
||||
translate('SongsPlugin.ImportWizardForm',
|
||||
'Welcome to the Song Import Wizard'))
|
||||
self.informationLabel.setText(
|
||||
translate('SongsPlugin.ImportWizardForm',
|
||||
'This wizard will help you to import songs from a variety of '
|
||||
'formats. Click the next button below to start the process by '
|
||||
'selecting a format to import from.'))
|
||||
self.sourcePage.setTitle(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Select Import Source'))
|
||||
self.sourcePage.setSubTitle(
|
||||
translate('SongsPlugin.ImportWizardForm',
|
||||
'Select the import format, and where to import from.'))
|
||||
self.formatLabel.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Format:'))
|
||||
self.formatComboBox.setItemText(0,
|
||||
translate('SongsPlugin.ImportWizardForm', 'OpenLP 2.0'))
|
||||
self.formatComboBox.setItemText(1,
|
||||
translate('SongsPlugin.ImportWizardForm', 'openlp.org 1.x'))
|
||||
self.formatComboBox.setItemText(2,
|
||||
translate('SongsPlugin.ImportWizardForm', 'OpenLyrics'))
|
||||
self.formatComboBox.setItemText(3,
|
||||
translate('SongsPlugin.ImportWizardForm', 'OpenSong'))
|
||||
self.formatComboBox.setItemText(4,
|
||||
translate('SongsPlugin.ImportWizardForm', 'Words of Worship'))
|
||||
self.formatComboBox.setItemText(5,
|
||||
translate('SongsPlugin.ImportWizardForm', 'CCLI/SongSelect'))
|
||||
self.formatComboBox.setItemText(6,
|
||||
translate('SongsPlugin.ImportWizardForm', 'Songs of Fellowship'))
|
||||
self.formatComboBox.setItemText(7,
|
||||
translate('SongsPlugin.ImportWizardForm',
|
||||
'Generic Document/Presentation'))
|
||||
self.formatComboBox.setItemText(8,
|
||||
translate('SongsPlugin.ImportWizardForm', 'EasyWorship'))
|
||||
self.formatComboBox.setItemText(9,
|
||||
translate('SongsPlugin.ImportWizardForm', 'SongBeamer'))
|
||||
# self.formatComboBox.setItemText(9,
|
||||
# translate('SongsPlugin.ImportWizardForm', 'CSV'))
|
||||
self.openLP2FilenameLabel.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Filename:'))
|
||||
self.openLP2BrowseButton.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Browse...'))
|
||||
self.openLP1FilenameLabel.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Filename:'))
|
||||
self.openLP1BrowseButton.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Browse...'))
|
||||
self.openLP1DisabledLabel.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', '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.'))
|
||||
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 intending to do so. Hopefully it will be in the next '
|
||||
'release.'))
|
||||
self.openSongAddButton.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
|
||||
self.openSongRemoveButton.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Remove File(s)'))
|
||||
self.wordsOfWorshipAddButton.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
|
||||
self.wordsOfWorshipRemoveButton.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Remove File(s)'))
|
||||
self.ccliAddButton.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
|
||||
self.ccliRemoveButton.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Remove File(s)'))
|
||||
self.songsOfFellowshipAddButton.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
|
||||
self.songsOfFellowshipRemoveButton.setText(
|
||||
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(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
|
||||
self.genericRemoveButton.setText(
|
||||
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.ewFilenameLabel.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Filename:'))
|
||||
self.ewBrowseButton.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Browse...'))
|
||||
self.songBeamerAddButton.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
|
||||
self.songBeamerRemoveButton.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Remove File(s)'))
|
||||
# self.csvFilenameLabel.setText(
|
||||
# translate('SongsPlugin.ImportWizardForm', 'Filename:'))
|
||||
# self.csvBrowseButton.setText(
|
||||
# translate('SongsPlugin.ImportWizardForm', 'Browse...'))
|
||||
self.progressPage.setTitle(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Importing'))
|
||||
self.progressPage.setSubTitle(
|
||||
translate('SongsPlugin.ImportWizardForm',
|
||||
'Please wait while your songs are imported.'))
|
||||
self.progressLabel.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Ready.'))
|
||||
self.progressBar.setFormat(
|
||||
translate('SongsPlugin.ImportWizardForm', '%p%'))
|
||||
# Align all QFormLayouts towards each other.
|
||||
width = max(self.formatLabel.minimumSizeHint().width(),
|
||||
self.openLP2FilenameLabel.minimumSizeHint().width())
|
||||
self.formatSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
|
||||
QtGui.QSizePolicy.Fixed)
|
||||
self.openLP2FormLabelSpacer.changeSize(width, 0,
|
||||
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
self.openLP1FormLabelSpacer.changeSize(width, 0,
|
||||
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
self.ewFormLabelSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
|
||||
QtGui.QSizePolicy.Fixed)
|
||||
# self.csvFormLabelSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
|
||||
# QtGui.QSizePolicy.Fixed)
|
||||
|
||||
def validateCurrentPage(self):
|
||||
"""
|
||||
@ -247,7 +424,7 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
|
||||
self.songBeamerAddButton.setFocus()
|
||||
return False
|
||||
return True
|
||||
elif self.currentPage() == self.importPage:
|
||||
elif self.currentPage() == self.progressPage:
|
||||
return True
|
||||
|
||||
def getFileName(self, title, editbox, filters=u''):
|
||||
@ -308,17 +485,26 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
|
||||
os.path.split(unicode(filenames[0]))[0], 1)
|
||||
|
||||
def getListOfFiles(self, listbox):
|
||||
"""
|
||||
Return a list of file from the listbox
|
||||
"""
|
||||
files = []
|
||||
for row in range(0, listbox.count()):
|
||||
files.append(unicode(listbox.item(row).text()))
|
||||
return files
|
||||
|
||||
def removeSelectedItems(self, listbox):
|
||||
"""
|
||||
Remove selected listbox items
|
||||
"""
|
||||
for item in listbox.selectedItems():
|
||||
item = listbox.takeItem(listbox.row(item))
|
||||
del item
|
||||
|
||||
def onOpenLP2BrowseButtonClicked(self):
|
||||
"""
|
||||
Get OpenLP v2 song database file
|
||||
"""
|
||||
self.getFileName(
|
||||
translate('SongsPlugin.ImportWizardForm',
|
||||
'Select OpenLP 2.0 Database File'),
|
||||
@ -328,6 +514,9 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
|
||||
)
|
||||
|
||||
def onOpenLP1BrowseButtonClicked(self):
|
||||
"""
|
||||
Get OpenLP v1 song database file
|
||||
"""
|
||||
self.getFileName(
|
||||
translate('SongsPlugin.ImportWizardForm',
|
||||
'Select openlp.org 1.x Database File'),
|
||||
@ -337,6 +526,9 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
|
||||
)
|
||||
|
||||
def onOpenLyricsAddButtonClicked(self):
|
||||
"""
|
||||
Get OpenLyrics song database files
|
||||
"""
|
||||
self.getFiles(
|
||||
translate('SongsPlugin.ImportWizardForm',
|
||||
'Select OpenLyrics Files'),
|
||||
@ -344,19 +536,30 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
|
||||
)
|
||||
|
||||
def onOpenLyricsRemoveButtonClicked(self):
|
||||
"""
|
||||
Remove selected OpenLyrics files from the import list
|
||||
"""
|
||||
self.removeSelectedItems(self.openLyricsFileListWidget)
|
||||
|
||||
def onOpenSongAddButtonClicked(self):
|
||||
"""
|
||||
Get OpenSong song database files
|
||||
"""
|
||||
self.getFiles(
|
||||
translate('SongsPlugin.ImportWizardForm',
|
||||
'Select Open Song Files'),
|
||||
translate('SongsPlugin.ImportWizardForm', 'Select Open Song Files'),
|
||||
self.openSongFileListWidget
|
||||
)
|
||||
|
||||
def onOpenSongRemoveButtonClicked(self):
|
||||
"""
|
||||
Remove selected OpenSong files from the import list
|
||||
"""
|
||||
self.removeSelectedItems(self.openSongFileListWidget)
|
||||
|
||||
def onWordsOfWorshipAddButtonClicked(self):
|
||||
"""
|
||||
Get Words of Worship song database files
|
||||
"""
|
||||
self.getFiles(
|
||||
translate('SongsPlugin.ImportWizardForm',
|
||||
'Select Words of Worship Files'),
|
||||
@ -366,9 +569,15 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
|
||||
)
|
||||
|
||||
def onWordsOfWorshipRemoveButtonClicked(self):
|
||||
"""
|
||||
Remove selected Words of Worship files from the import list
|
||||
"""
|
||||
self.removeSelectedItems(self.wordsOfWorshipFileListWidget)
|
||||
|
||||
def onCCLIAddButtonClicked(self):
|
||||
"""
|
||||
Get CCLI song database files
|
||||
"""
|
||||
self.getFiles(
|
||||
translate('SongsPlugin.ImportWizardForm',
|
||||
'Select CCLI Files'),
|
||||
@ -376,9 +585,15 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
|
||||
)
|
||||
|
||||
def onCCLIRemoveButtonClicked(self):
|
||||
"""
|
||||
Remove selected CCLI files from the import list
|
||||
"""
|
||||
self.removeSelectedItems(self.ccliFileListWidget)
|
||||
|
||||
def onSongsOfFellowshipAddButtonClicked(self):
|
||||
"""
|
||||
Get Songs of Fellowship song database files
|
||||
"""
|
||||
self.getFiles(
|
||||
translate('SongsPlugin.ImportWizardForm',
|
||||
'Select Songs of Fellowship Files'),
|
||||
@ -388,9 +603,15 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
|
||||
)
|
||||
|
||||
def onSongsOfFellowshipRemoveButtonClicked(self):
|
||||
"""
|
||||
Remove selected Songs of Fellowship files from the import list
|
||||
"""
|
||||
self.removeSelectedItems(self.songsOfFellowshipFileListWidget)
|
||||
|
||||
def onGenericAddButtonClicked(self):
|
||||
"""
|
||||
Get song database files
|
||||
"""
|
||||
self.getFiles(
|
||||
translate('SongsPlugin.ImportWizardForm',
|
||||
'Select Document/Presentation Files'),
|
||||
@ -398,9 +619,15 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
|
||||
)
|
||||
|
||||
def onGenericRemoveButtonClicked(self):
|
||||
"""
|
||||
Remove selected files from the import list
|
||||
"""
|
||||
self.removeSelectedItems(self.genericFileListWidget)
|
||||
|
||||
def onEWBrowseButtonClicked(self):
|
||||
"""
|
||||
Get EasyWorship song database files
|
||||
"""
|
||||
self.getFileName(
|
||||
translate('SongsPlugin.ImportWizardForm',
|
||||
'Select EasyWorship Database File'),
|
||||
@ -408,6 +635,9 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
|
||||
)
|
||||
|
||||
def onSongBeamerAddButtonClicked(self):
|
||||
"""
|
||||
Get SongBeamer song database files
|
||||
"""
|
||||
self.getFiles(
|
||||
translate('SongsPlugin.ImportWizardForm',
|
||||
'Select SongBeamer Files'),
|
||||
@ -416,18 +646,21 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
|
||||
)
|
||||
|
||||
def onSongBeamerRemoveButtonClicked(self):
|
||||
"""
|
||||
Remove selected SongBeamer files from the import list
|
||||
"""
|
||||
self.removeSelectedItems(self.songBeamerFileListWidget)
|
||||
|
||||
def onCurrentIdChanged(self, id):
|
||||
if self.page(id) == self.importPage:
|
||||
self.preImport()
|
||||
self.performImport()
|
||||
self.postImport()
|
||||
|
||||
def registerFields(self):
|
||||
"""
|
||||
Register song import wizard fields.
|
||||
"""
|
||||
pass
|
||||
|
||||
def setDefaults(self):
|
||||
"""
|
||||
Set default form values for the song import wizard.
|
||||
"""
|
||||
self.restart()
|
||||
self.finishButton.setVisible(False)
|
||||
self.cancelButton.setVisible(True)
|
||||
@ -444,25 +677,16 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
|
||||
self.songBeamerFileListWidget.clear()
|
||||
#self.csvFilenameEdit.setText(u'')
|
||||
|
||||
def incrementProgressBar(self, status_text, increment=1):
|
||||
log.debug(u'IncrementBar %s', status_text)
|
||||
if status_text:
|
||||
self.importProgressLabel.setText(status_text)
|
||||
if increment > 0:
|
||||
self.importProgressBar.setValue(self.importProgressBar.value() +
|
||||
increment)
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
|
||||
def preImport(self):
|
||||
self.finishButton.setVisible(False)
|
||||
self.importProgressBar.setMinimum(0)
|
||||
self.importProgressBar.setMaximum(1188)
|
||||
self.importProgressBar.setValue(0)
|
||||
self.importProgressLabel.setText(
|
||||
def preWizard(self):
|
||||
"""
|
||||
Perform pre import tasks
|
||||
"""
|
||||
OpenLPWizard.preWizard(self)
|
||||
self.progressLabel.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Starting import...'))
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
|
||||
def performImport(self):
|
||||
def performWizard(self):
|
||||
"""
|
||||
Perform the actual import. This method pulls in the correct importer
|
||||
class, and then runs the ``do_import`` method of the importer to do
|
||||
@ -520,20 +744,128 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
|
||||
elif source_format == SongFormat.SongBeamer:
|
||||
# Import SongBeamer songs
|
||||
importer = self.plugin.importSongs(SongFormat.SongBeamer,
|
||||
filenames=self.getListOfFiles(
|
||||
self.songBeamerFileListWidget)
|
||||
filenames=self.getListOfFiles(self.songBeamerFileListWidget)
|
||||
)
|
||||
if importer.do_import():
|
||||
# reload songs
|
||||
self.importProgressLabel.setText(
|
||||
self.progressLabel.setText(
|
||||
translate('SongsPlugin.SongImportForm', 'Finished import.'))
|
||||
else:
|
||||
self.importProgressLabel.setText(
|
||||
self.progressLabel.setText(
|
||||
translate('SongsPlugin.SongImportForm',
|
||||
'Your song import failed.'))
|
||||
|
||||
def postImport(self):
|
||||
self.importProgressBar.setValue(self.importProgressBar.maximum())
|
||||
self.finishButton.setVisible(True)
|
||||
self.cancelButton.setVisible(False)
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
def addSingleFileSelectItem(self, prefix, obj_prefix=None,
|
||||
can_disable=False):
|
||||
if not obj_prefix:
|
||||
obj_prefix = prefix
|
||||
page = QtGui.QWidget()
|
||||
page.setObjectName(obj_prefix + u'Page')
|
||||
if can_disable:
|
||||
importWidget = self.disablableWidget(page, prefix, obj_prefix)
|
||||
else:
|
||||
importWidget = page
|
||||
importLayout = QtGui.QFormLayout(importWidget)
|
||||
importLayout.setMargin(0)
|
||||
if can_disable:
|
||||
importLayout.setObjectName(obj_prefix + u'ImportLayout')
|
||||
else:
|
||||
importLayout.setObjectName(obj_prefix + u'Layout')
|
||||
filenameLabel = QtGui.QLabel(importWidget)
|
||||
filenameLabel.setObjectName(obj_prefix + u'FilenameLabel')
|
||||
fileLayout = QtGui.QHBoxLayout()
|
||||
fileLayout.setObjectName(obj_prefix + u'FileLayout')
|
||||
filenameEdit = QtGui.QLineEdit(importWidget)
|
||||
filenameEdit.setObjectName(obj_prefix + u'FilenameEdit')
|
||||
fileLayout.addWidget(filenameEdit)
|
||||
browseButton = QtGui.QToolButton(importWidget)
|
||||
browseButton.setIcon(self.openIcon)
|
||||
browseButton.setObjectName(obj_prefix + u'BrowseButton')
|
||||
fileLayout.addWidget(browseButton)
|
||||
importLayout.addRow(filenameLabel, fileLayout)
|
||||
formSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
|
||||
QtGui.QSizePolicy.Minimum)
|
||||
importLayout.setItem(1, QtGui.QFormLayout.LabelRole, formSpacer)
|
||||
self.formatStack.addWidget(page)
|
||||
setattr(self, prefix + u'Page', page)
|
||||
setattr(self, prefix + u'FilenameLabel', filenameLabel)
|
||||
setattr(self, prefix + u'FormLabelSpacer', formSpacer)
|
||||
setattr(self, prefix + u'FileLayout', fileLayout)
|
||||
setattr(self, prefix + u'FilenameEdit', filenameEdit)
|
||||
setattr(self, prefix + u'BrowseButton', browseButton)
|
||||
if can_disable:
|
||||
setattr(self, prefix + u'ImportLayout', importLayout)
|
||||
else:
|
||||
setattr(self, prefix + u'Layout', importLayout)
|
||||
self.formatComboBox.addItem(u'')
|
||||
|
||||
def addMultiFileSelectItem(self, prefix, obj_prefix=None,
|
||||
can_disable=False):
|
||||
if not obj_prefix:
|
||||
obj_prefix = prefix
|
||||
page = QtGui.QWidget()
|
||||
page.setObjectName(obj_prefix + u'Page')
|
||||
if can_disable:
|
||||
importWidget = self.disablableWidget(page, prefix, obj_prefix)
|
||||
else:
|
||||
importWidget = page
|
||||
importLayout = QtGui.QVBoxLayout(importWidget)
|
||||
importLayout.setMargin(0)
|
||||
if can_disable:
|
||||
importLayout.setObjectName(obj_prefix + u'ImportLayout')
|
||||
else:
|
||||
importLayout.setObjectName(obj_prefix + u'Layout')
|
||||
fileListWidget = QtGui.QListWidget(importWidget)
|
||||
fileListWidget.setSelectionMode(
|
||||
QtGui.QAbstractItemView.ExtendedSelection)
|
||||
fileListWidget.setObjectName(obj_prefix + u'FileListWidget')
|
||||
importLayout.addWidget(fileListWidget)
|
||||
buttonLayout = QtGui.QHBoxLayout()
|
||||
buttonLayout.setObjectName(obj_prefix + u'ButtonLayout')
|
||||
addButton = QtGui.QPushButton(importWidget)
|
||||
addButton.setIcon(self.openIcon)
|
||||
addButton.setObjectName(obj_prefix + u'AddButton')
|
||||
buttonLayout.addWidget(addButton)
|
||||
buttonLayout.addStretch()
|
||||
removeButton = QtGui.QPushButton(importWidget)
|
||||
removeButton.setIcon(self.deleteIcon)
|
||||
removeButton.setObjectName(obj_prefix + u'RemoveButton')
|
||||
buttonLayout.addWidget(removeButton)
|
||||
importLayout.addLayout(buttonLayout)
|
||||
self.formatStack.addWidget(page)
|
||||
setattr(self, prefix + u'Page', page)
|
||||
setattr(self, prefix + u'FileListWidget', fileListWidget)
|
||||
setattr(self, prefix + u'ButtonLayout', buttonLayout)
|
||||
setattr(self, prefix + u'AddButton', addButton)
|
||||
setattr(self, prefix + u'RemoveButton', removeButton)
|
||||
if can_disable:
|
||||
setattr(self, prefix + u'ImportLayout', importLayout)
|
||||
else:
|
||||
setattr(self, prefix + u'Layout', importLayout)
|
||||
self.formatComboBox.addItem(u'')
|
||||
|
||||
def disablableWidget(self, page, prefix, obj_prefix):
|
||||
layout = QtGui.QVBoxLayout(page)
|
||||
layout.setMargin(0)
|
||||
layout.setSpacing(0)
|
||||
layout.setObjectName(obj_prefix + u'Layout')
|
||||
disabledWidget = QtGui.QWidget(page)
|
||||
disabledWidget.setVisible(False)
|
||||
disabledWidget.setObjectName(obj_prefix + u'DisabledWidget')
|
||||
disabledLayout = QtGui.QVBoxLayout(disabledWidget)
|
||||
disabledLayout.setMargin(0)
|
||||
disabledLayout.setObjectName(obj_prefix + u'DisabledLayout')
|
||||
disabledLabel = QtGui.QLabel(disabledWidget)
|
||||
disabledLabel.setWordWrap(True)
|
||||
disabledLabel.setObjectName(obj_prefix + u'DisabledLabel')
|
||||
disabledLayout.addWidget(disabledLabel)
|
||||
layout.addWidget(disabledWidget)
|
||||
importWidget = QtGui.QWidget(page)
|
||||
importWidget.setObjectName(obj_prefix + u'ImportWidget')
|
||||
layout.addWidget(importWidget)
|
||||
setattr(self, prefix + u'Layout', layout)
|
||||
setattr(self, prefix + u'DisabledWidget', disabledWidget)
|
||||
setattr(self, prefix + u'DisabledLayout', disabledLayout)
|
||||
setattr(self, prefix + u'DisabledLabel', disabledLabel)
|
||||
setattr(self, prefix + u'ImportWidget', importWidget)
|
||||
return importWidget
|
||||
|
@ -1,362 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2011 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
|
||||
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
|
||||
# Carsten Tinggaard, Frode Woldsund #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# This program is free software; you can redistribute it and/or modify it #
|
||||
# under the terms of the GNU General Public License as published by the Free #
|
||||
# Software Foundation; version 2 of the License. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||
# more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License along #
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import build_icon, translate
|
||||
|
||||
class Ui_SongImportWizard(object):
|
||||
def setupUi(self, songImportWizard):
|
||||
self.openIcon = build_icon(u':/general/general_open.png')
|
||||
self.deleteIcon = build_icon(u':/general/general_delete.png')
|
||||
songImportWizard.setObjectName(u'songImportWizard')
|
||||
songImportWizard.setModal(True)
|
||||
songImportWizard.setWizardStyle(QtGui.QWizard.ModernStyle)
|
||||
songImportWizard.setOptions(
|
||||
QtGui.QWizard.IndependentPages |
|
||||
QtGui.QWizard.NoBackButtonOnStartPage |
|
||||
QtGui.QWizard.NoBackButtonOnLastPage)
|
||||
# Welcome Page
|
||||
self.welcomePage = QtGui.QWizardPage()
|
||||
self.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap,
|
||||
QtGui.QPixmap(u':/wizards/wizard_importsong.bmp'))
|
||||
self.welcomePage.setObjectName(u'WelcomePage')
|
||||
self.welcomeLayout = QtGui.QVBoxLayout(self.welcomePage)
|
||||
self.welcomeLayout.setObjectName(u'WelcomeLayout')
|
||||
self.titleLabel = QtGui.QLabel(self.welcomePage)
|
||||
self.titleLabel.setObjectName(u'TitleLabel')
|
||||
self.welcomeLayout.addWidget(self.titleLabel)
|
||||
self.welcomeLayout.addSpacing(40)
|
||||
self.informationLabel = QtGui.QLabel(self.welcomePage)
|
||||
self.informationLabel.setWordWrap(True)
|
||||
self.informationLabel.setObjectName(u'InformationLabel')
|
||||
self.welcomeLayout.addWidget(self.informationLabel)
|
||||
self.welcomeLayout.addStretch()
|
||||
songImportWizard.addPage(self.welcomePage)
|
||||
# Source Page
|
||||
self.sourcePage = QtGui.QWizardPage()
|
||||
self.sourcePage.setObjectName(u'SourcePage')
|
||||
self.sourceLayout = QtGui.QVBoxLayout(self.sourcePage)
|
||||
self.sourceLayout.setObjectName(u'SourceLayout')
|
||||
self.formatLayout = QtGui.QFormLayout()
|
||||
self.formatLayout.setObjectName(u'FormatLayout')
|
||||
self.formatLabel = QtGui.QLabel(self.sourcePage)
|
||||
self.formatLabel.setObjectName(u'FormatLabel')
|
||||
self.formatComboBox = QtGui.QComboBox(self.sourcePage)
|
||||
self.formatComboBox.setObjectName(u'FormatComboBox')
|
||||
self.formatLayout.addRow(self.formatLabel, self.formatComboBox)
|
||||
self.formatSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
|
||||
QtGui.QSizePolicy.Minimum)
|
||||
self.formatLayout.setItem(1, QtGui.QFormLayout.LabelRole,
|
||||
self.formatSpacer)
|
||||
self.sourceLayout.addLayout(self.formatLayout)
|
||||
self.formatStack = QtGui.QStackedLayout()
|
||||
self.formatStack.setObjectName(u'FormatStack')
|
||||
# OpenLP 2.0
|
||||
self.addSingleFileSelectItem(u'openLP2')
|
||||
# openlp.org 1.x
|
||||
self.addSingleFileSelectItem(u'openLP1', None, True)
|
||||
# OpenLyrics
|
||||
self.addMultiFileSelectItem(u'openLyrics', u'OpenLyrics', True)
|
||||
# Open Song
|
||||
self.addMultiFileSelectItem(u'openSong', u'OpenSong')
|
||||
# Words of Worship
|
||||
self.addMultiFileSelectItem(u'wordsOfWorship')
|
||||
# CCLI File import
|
||||
self.addMultiFileSelectItem(u'ccli')
|
||||
# Songs of Fellowship
|
||||
self.addMultiFileSelectItem(u'songsOfFellowship', None, True)
|
||||
# Generic Document/Presentation import
|
||||
self.addMultiFileSelectItem(u'generic', None, True)
|
||||
# EasyWorship
|
||||
self.addSingleFileSelectItem(u'ew')
|
||||
# Words of Worship
|
||||
self.addMultiFileSelectItem(u'songBeamer')
|
||||
# Commented out for future use.
|
||||
# self.addSingleFileSelectItem(u'csv', u'CSV')
|
||||
self.sourceLayout.addLayout(self.formatStack)
|
||||
songImportWizard.addPage(self.sourcePage)
|
||||
# Import Page
|
||||
self.importPage = QtGui.QWizardPage()
|
||||
self.importPage.setObjectName(u'ImportPage')
|
||||
self.importLayout = QtGui.QVBoxLayout(self.importPage)
|
||||
self.importLayout.setMargin(48)
|
||||
self.importLayout.setObjectName(u'ImportLayout')
|
||||
self.importProgressLabel = QtGui.QLabel(self.importPage)
|
||||
self.importProgressLabel.setObjectName(u'ImportProgressLabel')
|
||||
self.importLayout.addWidget(self.importProgressLabel)
|
||||
self.importProgressBar = QtGui.QProgressBar(self.importPage)
|
||||
self.importProgressBar.setObjectName(u'ImportProgressBar')
|
||||
self.importLayout.addWidget(self.importProgressBar)
|
||||
songImportWizard.addPage(self.importPage)
|
||||
self.retranslateUi(songImportWizard)
|
||||
self.formatStack.setCurrentIndex(0)
|
||||
QtCore.QObject.connect(self.formatComboBox,
|
||||
QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
||||
self.formatStack.setCurrentIndex)
|
||||
QtCore.QMetaObject.connectSlotsByName(songImportWizard)
|
||||
|
||||
def retranslateUi(self, songImportWizard):
|
||||
songImportWizard.setWindowTitle(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Song Import Wizard'))
|
||||
self.titleLabel.setText(
|
||||
u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
|
||||
translate('SongsPlugin.ImportWizardForm',
|
||||
'Welcome to the Song Import Wizard'))
|
||||
self.informationLabel.setText(
|
||||
translate('SongsPlugin.ImportWizardForm',
|
||||
'This wizard will help you to import songs from a variety of '
|
||||
'formats. Click the next button below to start the process by '
|
||||
'selecting a format to import from.'))
|
||||
self.sourcePage.setTitle(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Select Import Source'))
|
||||
self.sourcePage.setSubTitle(
|
||||
translate('SongsPlugin.ImportWizardForm',
|
||||
'Select the import format, and where to import from.'))
|
||||
self.formatLabel.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Format:'))
|
||||
self.formatComboBox.setItemText(0,
|
||||
translate('SongsPlugin.ImportWizardForm', 'OpenLP 2.0'))
|
||||
self.formatComboBox.setItemText(1,
|
||||
translate('SongsPlugin.ImportWizardForm', 'openlp.org 1.x'))
|
||||
self.formatComboBox.setItemText(2,
|
||||
translate('SongsPlugin.ImportWizardForm', 'OpenLyrics'))
|
||||
self.formatComboBox.setItemText(3,
|
||||
translate('SongsPlugin.ImportWizardForm', 'OpenSong'))
|
||||
self.formatComboBox.setItemText(4,
|
||||
translate('SongsPlugin.ImportWizardForm', 'Words of Worship'))
|
||||
self.formatComboBox.setItemText(5,
|
||||
translate('SongsPlugin.ImportWizardForm', 'CCLI/SongSelect'))
|
||||
self.formatComboBox.setItemText(6,
|
||||
translate('SongsPlugin.ImportWizardForm', 'Songs of Fellowship'))
|
||||
self.formatComboBox.setItemText(7,
|
||||
translate('SongsPlugin.ImportWizardForm',
|
||||
'Generic Document/Presentation'))
|
||||
self.formatComboBox.setItemText(8,
|
||||
translate('SongsPlugin.ImportWizardForm', 'EasyWorship'))
|
||||
self.formatComboBox.setItemText(9,
|
||||
translate('SongsPlugin.ImportWizardForm', 'SongBeamer'))
|
||||
# self.formatComboBox.setItemText(9,
|
||||
# translate('SongsPlugin.ImportWizardForm', 'CSV'))
|
||||
self.openLP2FilenameLabel.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Filename:'))
|
||||
self.openLP2BrowseButton.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Browse...'))
|
||||
self.openLP1FilenameLabel.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Filename:'))
|
||||
self.openLP1BrowseButton.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Browse...'))
|
||||
self.openLP1DisabledLabel.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', '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.'))
|
||||
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 intending to do so. Hopefully it will be in the next '
|
||||
'release.'))
|
||||
self.openSongAddButton.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
|
||||
self.openSongRemoveButton.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Remove File(s)'))
|
||||
self.wordsOfWorshipAddButton.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
|
||||
self.wordsOfWorshipRemoveButton.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Remove File(s)'))
|
||||
self.ccliAddButton.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
|
||||
self.ccliRemoveButton.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Remove File(s)'))
|
||||
self.songsOfFellowshipAddButton.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
|
||||
self.songsOfFellowshipRemoveButton.setText(
|
||||
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(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
|
||||
self.genericRemoveButton.setText(
|
||||
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.ewFilenameLabel.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Filename:'))
|
||||
self.ewBrowseButton.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Browse...'))
|
||||
self.songBeamerAddButton.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
|
||||
self.songBeamerRemoveButton.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Remove File(s)'))
|
||||
# self.csvFilenameLabel.setText(
|
||||
# translate('SongsPlugin.ImportWizardForm', 'Filename:'))
|
||||
# self.csvBrowseButton.setText(
|
||||
# translate('SongsPlugin.ImportWizardForm', 'Browse...'))
|
||||
self.importPage.setTitle(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Importing'))
|
||||
self.importPage.setSubTitle(
|
||||
translate('SongsPlugin.ImportWizardForm',
|
||||
'Please wait while your songs are imported.'))
|
||||
self.importProgressLabel.setText(
|
||||
translate('SongsPlugin.ImportWizardForm', 'Ready.'))
|
||||
self.importProgressBar.setFormat(
|
||||
translate('SongsPlugin.ImportWizardForm', '%p%'))
|
||||
# Align all QFormLayouts towards each other.
|
||||
width = max(self.formatLabel.minimumSizeHint().width(),
|
||||
self.openLP2FilenameLabel.minimumSizeHint().width())
|
||||
self.formatSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
|
||||
QtGui.QSizePolicy.Fixed)
|
||||
self.openLP2FormLabelSpacer.changeSize(width, 0,
|
||||
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
self.openLP1FormLabelSpacer.changeSize(width, 0,
|
||||
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
self.ewFormLabelSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
|
||||
QtGui.QSizePolicy.Fixed)
|
||||
# self.csvFormLabelSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
|
||||
# QtGui.QSizePolicy.Fixed)
|
||||
|
||||
def addSingleFileSelectItem(self, prefix, obj_prefix=None,
|
||||
can_disable=False):
|
||||
if not obj_prefix:
|
||||
obj_prefix = prefix
|
||||
page = QtGui.QWidget()
|
||||
page.setObjectName(obj_prefix + u'Page')
|
||||
if can_disable:
|
||||
importWidget = self.disablableWidget(page, prefix, obj_prefix)
|
||||
else:
|
||||
importWidget = page
|
||||
importLayout = QtGui.QFormLayout(importWidget)
|
||||
importLayout.setMargin(0)
|
||||
if can_disable:
|
||||
importLayout.setObjectName(obj_prefix + u'ImportLayout')
|
||||
else:
|
||||
importLayout.setObjectName(obj_prefix + u'Layout')
|
||||
filenameLabel = QtGui.QLabel(importWidget)
|
||||
filenameLabel.setObjectName(obj_prefix + u'FilenameLabel')
|
||||
fileLayout = QtGui.QHBoxLayout()
|
||||
fileLayout.setObjectName(obj_prefix + u'FileLayout')
|
||||
filenameEdit = QtGui.QLineEdit(importWidget)
|
||||
filenameEdit.setObjectName(obj_prefix + u'FilenameEdit')
|
||||
fileLayout.addWidget(filenameEdit)
|
||||
browseButton = QtGui.QToolButton(importWidget)
|
||||
browseButton.setIcon(self.openIcon)
|
||||
browseButton.setObjectName(obj_prefix + u'BrowseButton')
|
||||
fileLayout.addWidget(browseButton)
|
||||
importLayout.addRow(filenameLabel, fileLayout)
|
||||
formSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
|
||||
QtGui.QSizePolicy.Minimum)
|
||||
importLayout.setItem(1, QtGui.QFormLayout.LabelRole, formSpacer)
|
||||
self.formatStack.addWidget(page)
|
||||
setattr(self, prefix + u'Page', page)
|
||||
setattr(self, prefix + u'FilenameLabel', filenameLabel)
|
||||
setattr(self, prefix + u'FormLabelSpacer', formSpacer)
|
||||
setattr(self, prefix + u'FileLayout', fileLayout)
|
||||
setattr(self, prefix + u'FilenameEdit', filenameEdit)
|
||||
setattr(self, prefix + u'BrowseButton', browseButton)
|
||||
if can_disable:
|
||||
setattr(self, prefix + u'ImportLayout', importLayout)
|
||||
else:
|
||||
setattr(self, prefix + u'Layout', importLayout)
|
||||
self.formatComboBox.addItem(u'')
|
||||
|
||||
def addMultiFileSelectItem(self, prefix, obj_prefix=None,
|
||||
can_disable=False):
|
||||
if not obj_prefix:
|
||||
obj_prefix = prefix
|
||||
page = QtGui.QWidget()
|
||||
page.setObjectName(obj_prefix + u'Page')
|
||||
if can_disable:
|
||||
importWidget = self.disablableWidget(page, prefix, obj_prefix)
|
||||
else:
|
||||
importWidget = page
|
||||
importLayout = QtGui.QVBoxLayout(importWidget)
|
||||
importLayout.setMargin(0)
|
||||
if can_disable:
|
||||
importLayout.setObjectName(obj_prefix + u'ImportLayout')
|
||||
else:
|
||||
importLayout.setObjectName(obj_prefix + u'Layout')
|
||||
fileListWidget = QtGui.QListWidget(importWidget)
|
||||
fileListWidget.setSelectionMode(
|
||||
QtGui.QAbstractItemView.ExtendedSelection)
|
||||
fileListWidget.setObjectName(obj_prefix + u'FileListWidget')
|
||||
importLayout.addWidget(fileListWidget)
|
||||
buttonLayout = QtGui.QHBoxLayout()
|
||||
buttonLayout.setObjectName(obj_prefix + u'ButtonLayout')
|
||||
addButton = QtGui.QPushButton(importWidget)
|
||||
addButton.setIcon(self.openIcon)
|
||||
addButton.setObjectName(obj_prefix + u'AddButton')
|
||||
buttonLayout.addWidget(addButton)
|
||||
buttonLayout.addStretch()
|
||||
removeButton = QtGui.QPushButton(importWidget)
|
||||
removeButton.setIcon(self.deleteIcon)
|
||||
removeButton.setObjectName(obj_prefix + u'RemoveButton')
|
||||
buttonLayout.addWidget(removeButton)
|
||||
importLayout.addLayout(buttonLayout)
|
||||
self.formatStack.addWidget(page)
|
||||
setattr(self, prefix + u'Page', page)
|
||||
setattr(self, prefix + u'FileListWidget', fileListWidget)
|
||||
setattr(self, prefix + u'ButtonLayout', buttonLayout)
|
||||
setattr(self, prefix + u'AddButton', addButton)
|
||||
setattr(self, prefix + u'RemoveButton', removeButton)
|
||||
if can_disable:
|
||||
setattr(self, prefix + u'ImportLayout', importLayout)
|
||||
else:
|
||||
setattr(self, prefix + u'Layout', importLayout)
|
||||
self.formatComboBox.addItem(u'')
|
||||
|
||||
def disablableWidget(self, page, prefix, obj_prefix):
|
||||
layout = QtGui.QVBoxLayout(page)
|
||||
layout.setMargin(0)
|
||||
layout.setSpacing(0)
|
||||
layout.setObjectName(obj_prefix + u'Layout')
|
||||
disabledWidget = QtGui.QWidget(page)
|
||||
disabledWidget.setVisible(False)
|
||||
disabledWidget.setObjectName(obj_prefix + u'DisabledWidget')
|
||||
disabledLayout = QtGui.QVBoxLayout(disabledWidget)
|
||||
disabledLayout.setMargin(0)
|
||||
disabledLayout.setObjectName(obj_prefix + u'DisabledLayout')
|
||||
disabledLabel = QtGui.QLabel(disabledWidget)
|
||||
disabledLabel.setWordWrap(True)
|
||||
disabledLabel.setObjectName(obj_prefix + u'DisabledLabel')
|
||||
disabledLayout.addWidget(disabledLabel)
|
||||
layout.addWidget(disabledWidget)
|
||||
importWidget = QtGui.QWidget(page)
|
||||
importWidget.setObjectName(obj_prefix + u'ImportWidget')
|
||||
layout.addWidget(importWidget)
|
||||
setattr(self, prefix + u'Layout', layout)
|
||||
setattr(self, prefix + u'DisabledWidget', disabledWidget)
|
||||
setattr(self, prefix + u'DisabledLayout', disabledLayout)
|
||||
setattr(self, prefix + u'DisabledLabel', disabledLabel)
|
||||
setattr(self, prefix + u'ImportWidget', importWidget)
|
||||
return importWidget
|
@ -67,7 +67,7 @@ class CCLIFileImport(SongImport):
|
||||
"""
|
||||
log.debug(u'Starting CCLI File Import')
|
||||
song_total = len(self.filenames)
|
||||
self.import_wizard.importProgressBar.setMaximum(song_total)
|
||||
self.import_wizard.progressBar.setMaximum(song_total)
|
||||
song_count = 1
|
||||
for filename in self.filenames:
|
||||
self.import_wizard.incrementProgressBar(unicode(translate(
|
||||
|
@ -186,7 +186,7 @@ class EasyWorshipSongImport(SongImport):
|
||||
# There does not appear to be a _reliable_ way of getting the number
|
||||
# of songs/records, so let's use file blocks for measuring progress.
|
||||
total_blocks = (db_size - header_size) / (block_size * 1024)
|
||||
self.import_wizard.importProgressBar.setMaximum(total_blocks)
|
||||
self.import_wizard.progressBar.setMaximum(total_blocks)
|
||||
# Read the field description information
|
||||
db_file.seek(120)
|
||||
field_info = db_file.read(num_fields * 2)
|
||||
|
@ -78,7 +78,7 @@ class OpenLP1SongImport(SongImport):
|
||||
cursor.execute(u'SELECT COUNT(songid) FROM songs')
|
||||
count = cursor.fetchone()[0]
|
||||
success = True
|
||||
self.import_wizard.importProgressBar.setMaximum(count)
|
||||
self.import_wizard.progressBar.setMaximum(count)
|
||||
# "cache" our list of authors
|
||||
cursor.execute(u'-- types int, unicode')
|
||||
cursor.execute(u'SELECT authorid, authorname FROM authors')
|
||||
|
@ -146,7 +146,7 @@ class OpenLPSongImport(SongImport):
|
||||
|
||||
source_songs = self.source_session.query(OldSong).all()
|
||||
song_total = len(source_songs)
|
||||
self.import_wizard.importProgressBar.setMaximum(song_total)
|
||||
self.import_wizard.progressBar.setMaximum(song_total)
|
||||
song_count = 1
|
||||
for song in source_songs:
|
||||
self.import_wizard.incrementProgressBar(unicode(translate(
|
||||
|
@ -63,11 +63,11 @@ class OooImport(SongImport):
|
||||
self.filenames = kwargs[u'filenames']
|
||||
self.uno_connection_type = u'pipe' #u'socket'
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'song_stop_import'), self.stop_import)
|
||||
QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_import)
|
||||
|
||||
def do_import(self):
|
||||
self.abort = False
|
||||
self.import_wizard.importProgressBar.setMaximum(0)
|
||||
self.import_wizard.progressBar.setMaximum(0)
|
||||
self.start_ooo()
|
||||
for filename in self.filenames:
|
||||
if self.abort:
|
||||
@ -85,7 +85,7 @@ class OooImport(SongImport):
|
||||
self.process_doc()
|
||||
self.close_ooo_file()
|
||||
self.close_ooo()
|
||||
self.import_wizard.importProgressBar.setMaximum(1)
|
||||
self.import_wizard.progressBar.setMaximum(1)
|
||||
self.import_wizard.incrementProgressBar(u'', 1)
|
||||
return True
|
||||
|
||||
|
@ -60,7 +60,7 @@ class OpenLyricsImport(SongImport):
|
||||
"""
|
||||
Imports the songs.
|
||||
"""
|
||||
self.import_wizard.importProgressBar.setMaximum(len(self.import_source))
|
||||
self.import_wizard.progressBar.setMaximum(len(self.import_source))
|
||||
for file_path in self.import_source:
|
||||
if self.stop_import_flag:
|
||||
return False
|
||||
@ -68,8 +68,8 @@ class OpenLyricsImport(SongImport):
|
||||
'SongsPlugin.OpenLyricsImport', 'Importing %s...')) %
|
||||
os.path.basename(file_path))
|
||||
parser = etree.XMLParser(remove_blank_text=True)
|
||||
file = etree.parse(file_path, parser)
|
||||
xml = unicode(etree.tostring(file))
|
||||
parsed_file = etree.parse(file_path, parser)
|
||||
xml = unicode(etree.tostring(parsed_file))
|
||||
if self.openLyrics.xml_to_song(xml) is None:
|
||||
log.debug(u'File could not be imported: %s' % file_path)
|
||||
# Importing this song failed! For now we stop import.
|
||||
|
@ -129,7 +129,7 @@ class OpenSongImport(SongImport):
|
||||
else:
|
||||
numfiles += 1
|
||||
log.debug(u'Total number of files: %d', numfiles)
|
||||
self.import_wizard.importProgressBar.setMaximum(numfiles)
|
||||
self.import_wizard.progressBar.setMaximum(numfiles)
|
||||
for filename in self.filenames:
|
||||
if self.stop_import_flag:
|
||||
success = False
|
||||
|
@ -89,7 +89,7 @@ class SofImport(OooImport):
|
||||
self.process_sof_file()
|
||||
self.close_ooo_file()
|
||||
self.close_ooo()
|
||||
self.import_wizard.importProgressBar.setMaximum(1)
|
||||
self.import_wizard.progressBar.setMaximum(1)
|
||||
self.import_wizard.incrementProgressBar(u'', 1)
|
||||
return True
|
||||
|
||||
@ -550,4 +550,4 @@ class SofImport(OooImport):
|
||||
return 6
|
||||
if song_number == 1119:
|
||||
return 7
|
||||
return None
|
||||
return None
|
||||
|
@ -75,7 +75,6 @@ class SongBeamerImport(SongImport):
|
||||
The song manager for the running OpenLP installation.
|
||||
"""
|
||||
SongImport.__init__(self, master_manager)
|
||||
self.master_manager = master_manager
|
||||
if kwargs.has_key(u'filename'):
|
||||
self.import_source = kwargs[u'filename']
|
||||
if kwargs.has_key(u'filenames'):
|
||||
@ -87,7 +86,7 @@ class SongBeamerImport(SongImport):
|
||||
Recieve a single file, or a list of files to import.
|
||||
"""
|
||||
if isinstance(self.import_source, list):
|
||||
self.import_wizard.importProgressBar.setMaximum(
|
||||
self.import_wizard.progressBar.setMaximum(
|
||||
len(self.import_source))
|
||||
for file in self.import_source:
|
||||
# TODO: check that it is a valid SongBeamer file
|
||||
|
@ -55,7 +55,7 @@ class SongImport(QtCore.QObject):
|
||||
self.stop_import_flag = False
|
||||
self.set_defaults()
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'songs_stop_import'), self.stop_import)
|
||||
QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_import)
|
||||
|
||||
def set_defaults(self):
|
||||
"""
|
||||
@ -364,4 +364,4 @@ class SongImport(QtCore.QObject):
|
||||
if self.theme_name:
|
||||
print u'THEME: ' + self.theme_name
|
||||
if self.ccli_number:
|
||||
print u'CCLI: ' + self.ccli_number
|
||||
print u'CCLI: ' + self.ccli_number
|
||||
|
@ -35,7 +35,7 @@ logging.basicConfig(filename=LOG_FILENAME,level=logging.INFO)
|
||||
# Stubs to replace the UI functions for raw testing
|
||||
class wizard_stub:
|
||||
def __init__(self):
|
||||
self.importProgressBar=progbar_stub()
|
||||
self.progressBar=progbar_stub()
|
||||
def incrementProgressBar(self, str):
|
||||
pass
|
||||
class progbar_stub:
|
||||
|
@ -99,7 +99,6 @@ class WowImport(SongImport):
|
||||
The song manager for the running OpenLP installation.
|
||||
"""
|
||||
SongImport.__init__(self, master_manager)
|
||||
self.master_manager = master_manager
|
||||
if kwargs.has_key(u'filename'):
|
||||
self.import_source = kwargs[u'filename']
|
||||
if kwargs.has_key(u'filenames'):
|
||||
@ -112,8 +111,7 @@ class WowImport(SongImport):
|
||||
"""
|
||||
|
||||
if isinstance(self.import_source, list):
|
||||
self.import_wizard.importProgressBar.setMaximum(
|
||||
len(self.import_source))
|
||||
self.import_wizard.progressBar.setMaximum(len(self.import_source))
|
||||
for file in self.import_source:
|
||||
self.author = u''
|
||||
self.copyright = u''
|
||||
|
Loading…
Reference in New Issue
Block a user