forked from openlp/openlp
First go at the Song Import Wizard.
This commit is contained in:
parent
3956772814
commit
21b6bedcb4
@ -30,7 +30,9 @@ from editverseform import EditVerseForm
|
||||
from editsongform import EditSongForm
|
||||
from songmaintenanceform import SongMaintenanceForm
|
||||
|
||||
from openlpexportform import OpenLPExportForm
|
||||
from openlpimportform import OpenLPImportForm
|
||||
from opensongexportform import OpenSongExportForm
|
||||
from opensongimportform import OpenSongImportForm
|
||||
#from openlpexportform import OpenLPExportForm
|
||||
#from openlpimportform import OpenLPImportForm
|
||||
#from opensongexportform import OpenSongExportForm
|
||||
#from opensongimportform import OpenSongImportForm
|
||||
|
||||
from songimportform import ImportWizardForm
|
||||
|
327
openlp/plugins/songs/forms/songimportform.py
Normal file
327
openlp/plugins/songs/forms/songimportform.py
Normal file
@ -0,0 +1,327 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2010 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
|
||||
# Thompson, Jon Tibble, Carsten Tinggaard #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# 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 #
|
||||
###############################################################################
|
||||
|
||||
import csv
|
||||
import logging
|
||||
import os
|
||||
import os.path
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from songimportwizard import Ui_SongImportWizard
|
||||
#from openlp.core.lib import Receiver
|
||||
#from openlp.core.utils import AppLocation, variant_to_unicode
|
||||
#from openlp.plugins.bibles.lib.manager import BibleFormat
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
|
||||
"""
|
||||
This is the Bible Import Wizard, which allows easy importing of Bibles
|
||||
into OpenLP from other formats like OSIS, CSV and OpenSong.
|
||||
"""
|
||||
log.info(u'BibleImportForm loaded')
|
||||
|
||||
def __init__(self, parent, config, manager, songsplugin):
|
||||
"""
|
||||
Instantiate the wizard, and run any extra setup we need to.
|
||||
|
||||
``parent``
|
||||
The QWidget-derived parent of the wizard.
|
||||
|
||||
``config``
|
||||
The configuration object for storing and retrieving settings.
|
||||
|
||||
``manager``
|
||||
The Bible manager.
|
||||
|
||||
``bibleplugin``
|
||||
The Bible 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)
|
||||
self.manager = manager
|
||||
self.config = config
|
||||
self.songsplugin = songsplugin
|
||||
#self.manager.set_process_dialog(self)
|
||||
#self.web_bible_list = {}
|
||||
#self.loadWebBibles()
|
||||
#QtCore.QObject.connect(self.LocationComboBox,
|
||||
# QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
||||
# self.onLocationComboBoxChanged)
|
||||
# QtCore.QObject.connect(self.OsisFileButton,
|
||||
# QtCore.SIGNAL(u'clicked()'),
|
||||
# self.onOsisFileButtonClicked)
|
||||
# QtCore.QObject.connect(self.BooksFileButton,
|
||||
# QtCore.SIGNAL(u'clicked()'),
|
||||
# self.onBooksFileButtonClicked)
|
||||
# QtCore.QObject.connect(self.CsvVersesFileButton,
|
||||
# QtCore.SIGNAL(u'clicked()'),
|
||||
# self.onCsvVersesFileButtonClicked)
|
||||
# QtCore.QObject.connect(self.OpenSongBrowseButton,
|
||||
# QtCore.SIGNAL(u'clicked()'),
|
||||
# self.onOpenSongBrowseButtonClicked)
|
||||
QtCore.QObject.connect(self.cancelButton,
|
||||
QtCore.SIGNAL(u'clicked(bool)'),
|
||||
self.onCancelButtonClicked)
|
||||
# QtCore.QObject.connect(self,
|
||||
# QtCore.SIGNAL(u'currentIdChanged(int)'),
|
||||
# self.onCurrentIdChanged)
|
||||
|
||||
def exec_(self):
|
||||
"""
|
||||
Run the wizard.
|
||||
"""
|
||||
#self.setDefaults()
|
||||
return QtGui.QWizard.exec_(self)
|
||||
|
||||
def validateCurrentPage(self):
|
||||
"""
|
||||
Validate the current page before moving on to the next page.
|
||||
"""
|
||||
return True
|
||||
# if self.currentId() == 0:
|
||||
# # Welcome page
|
||||
# return True
|
||||
# elif self.currentId() == 1:
|
||||
# # Select page
|
||||
# if self.field(u'source_format').toInt()[0] == BibleFormat.OSIS:
|
||||
# if self.field(u'osis_location').toString() == u'':
|
||||
# QtGui.QMessageBox.critical(self,
|
||||
# self.trUtf8('Invalid Bible Location'),
|
||||
# self.trUtf8('You need to specify a file to import your '
|
||||
# 'Bible from.'),
|
||||
# QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
# self.OSISLocationEdit.setFocus()
|
||||
# return False
|
||||
# elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV:
|
||||
# if self.field(u'csv_booksfile').toString() == u'':
|
||||
# QtGui.QMessageBox.critical(self,
|
||||
# self.trUtf8('Invalid Books File'),
|
||||
# self.trUtf8('You need to specify a file with books of '
|
||||
# 'the Bible to use in the import.'),
|
||||
# QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
# self.BooksLocationEdit.setFocus()
|
||||
# return False
|
||||
# elif self.field(u'csv_versefile').toString() == u'':
|
||||
# QtGui.QMessageBox.critical(self,
|
||||
# self.trUtf8('Invalid Verse File'),
|
||||
# self.trUtf8('You need to specify a file of Bible '
|
||||
# 'verses to import.'),
|
||||
# QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
# self.CsvVerseLocationEdit.setFocus()
|
||||
# return False
|
||||
# elif self.field(u'source_format').toInt()[0] == BibleFormat.OpenSong:
|
||||
# if self.field(u'opensong_file').toString() == u'':
|
||||
# QtGui.QMessageBox.critical(self,
|
||||
# self.trUtf8('Invalid OpenSong Bible'),
|
||||
# self.trUtf8('You need to specify an OpenSong Bible '
|
||||
# 'file to import.'),
|
||||
# QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
# self.OpenSongFileEdit.setFocus()
|
||||
# return False
|
||||
# return True
|
||||
# elif self.currentId() == 2:
|
||||
# # License details
|
||||
# license_version = variant_to_unicode(self.field(u'license_version'))
|
||||
# license_copyright = variant_to_unicode(self.field(u'license_copyright'))
|
||||
# if license_version == u'':
|
||||
# QtGui.QMessageBox.critical(self,
|
||||
# self.trUtf8('Empty Version Name'),
|
||||
# self.trUtf8('You need to specify a version name for your '
|
||||
# 'Bible.'),
|
||||
# QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
# self.VersionNameEdit.setFocus()
|
||||
# return False
|
||||
# elif license_copyright == u'':
|
||||
# QtGui.QMessageBox.critical(self,
|
||||
# self.trUtf8('Empty Copyright'),
|
||||
# self.trUtf8('You need to set a copyright for your Bible! '
|
||||
# 'Bibles in the Public Domain need to be marked as '
|
||||
# 'such.'),
|
||||
# QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
# self.CopyrightEdit.setFocus()
|
||||
# return False
|
||||
# elif self.manager.exists(license_version):
|
||||
# QtGui.QMessageBox.critical(self,
|
||||
# self.trUtf8('Bible Exists'),
|
||||
# self.trUtf8('This Bible already exists! Please import '
|
||||
# 'a different Bible or first delete the existing one.'),
|
||||
# QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
# self.VersionNameEdit.setFocus()
|
||||
# return False
|
||||
# return True
|
||||
# if self.currentId() == 3:
|
||||
# # Progress page
|
||||
# return True
|
||||
|
||||
def onCancelButtonClicked(self, checked):
|
||||
"""
|
||||
Stop the import on pressing the cancel button.
|
||||
"""
|
||||
log.debug('Cancel button pressed!')
|
||||
if self.currentId() == 3:
|
||||
Receiver.send_message(u'openlpstopimport')
|
||||
|
||||
# def onCurrentIdChanged(self, id):
|
||||
# if id == 3:
|
||||
# self.preImport()
|
||||
# self.performImport()
|
||||
# self.postImport()
|
||||
#
|
||||
# def registerFields(self):
|
||||
# self.SelectPage.registerField(
|
||||
# u'source_format', self.FormatComboBox)
|
||||
# self.SelectPage.registerField(
|
||||
# u'osis_location', self.OSISLocationEdit)
|
||||
# self.SelectPage.registerField(
|
||||
# u'csv_booksfile', self.BooksLocationEdit)
|
||||
# self.SelectPage.registerField(
|
||||
# u'csv_versefile', self.CsvVerseLocationEdit)
|
||||
# self.SelectPage.registerField(
|
||||
# u'opensong_file', self.OpenSongFileEdit)
|
||||
# self.SelectPage.registerField(
|
||||
# u'web_location', self.LocationComboBox)
|
||||
# self.SelectPage.registerField(
|
||||
# u'web_biblename', self.BibleComboBox)
|
||||
# self.SelectPage.registerField(
|
||||
# u'proxy_server', self.AddressEdit)
|
||||
# self.SelectPage.registerField(
|
||||
# u'proxy_username', self.UsernameEdit)
|
||||
# self.SelectPage.registerField(
|
||||
# u'proxy_password', self.PasswordEdit)
|
||||
# self.LicenseDetailsPage.registerField(
|
||||
# u'license_version', self.VersionNameEdit)
|
||||
# self.LicenseDetailsPage.registerField(
|
||||
# u'license_copyright', self.CopyrightEdit)
|
||||
# self.LicenseDetailsPage.registerField(
|
||||
# u'license_permission', self.PermissionEdit)
|
||||
#
|
||||
# def setDefaults(self):
|
||||
# self.setField(u'source_format', QtCore.QVariant(0))
|
||||
# self.setField(u'osis_location', QtCore.QVariant(''))
|
||||
# self.setField(u'csv_booksfile', QtCore.QVariant(''))
|
||||
# self.setField(u'csv_versefile', QtCore.QVariant(''))
|
||||
# self.setField(u'opensong_file', QtCore.QVariant(''))
|
||||
# self.setField(u'web_location', QtCore.QVariant(WebDownload.Crosswalk))
|
||||
# self.setField(u'web_biblename', QtCore.QVariant(self.BibleComboBox))
|
||||
# self.setField(u'proxy_server',
|
||||
# QtCore.QVariant(self.config.get_config(u'proxy address', '')))
|
||||
# self.setField(u'proxy_username',
|
||||
# QtCore.QVariant(self.config.get_config(u'proxy username','')))
|
||||
# self.setField(u'proxy_password',
|
||||
# QtCore.QVariant(self.config.get_config(u'proxy password','')))
|
||||
# self.setField(u'license_version', QtCore.QVariant(self.VersionNameEdit))
|
||||
# self.setField(u'license_copyright', QtCore.QVariant(self.CopyrightEdit))
|
||||
# self.setField(u'license_permission', QtCore.QVariant(self.PermissionEdit))
|
||||
# self.onLocationComboBoxChanged(WebDownload.Crosswalk)
|
||||
|
||||
|
||||
def getFileName(self, title, editbox):
|
||||
filename = QtGui.QFileDialog.getOpenFileName(self, title,
|
||||
self.config.get_last_dir(1))
|
||||
if filename:
|
||||
editbox.setText(filename)
|
||||
self.config.set_last_dir(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'process_events')
|
||||
|
||||
def preImport(self):
|
||||
self.finishButton.setVisible(False)
|
||||
self.ImportProgressBar.setMinimum(0)
|
||||
self.ImportProgressBar.setMaximum(1188)
|
||||
self.ImportProgressBar.setValue(0)
|
||||
self.ImportProgressLabel.setText(self.trUtf8('Starting import...'))
|
||||
Receiver.send_message(u'process_events')
|
||||
|
||||
def performImport(self):
|
||||
pass
|
||||
# bible_type = self.field(u'source_format').toInt()[0]
|
||||
# license_version = variant_to_unicode(self.field(u'license_version'))
|
||||
# license_copyright = variant_to_unicode(self.field(u'license_copyright'))
|
||||
# license_permission = variant_to_unicode(self.field(u'license_permission'))
|
||||
# importer = None
|
||||
# if bible_type == BibleFormat.OSIS:
|
||||
# # Import an OSIS bible
|
||||
# importer = self.manager.import_bible(BibleFormat.OSIS,
|
||||
# name=license_version,
|
||||
# filename=variant_to_unicode(self.field(u'osis_location'))
|
||||
# )
|
||||
# elif bible_type == BibleFormat.CSV:
|
||||
# # Import a CSV bible
|
||||
# importer = self.manager.import_bible(BibleFormat.CSV,
|
||||
# name=license_version,
|
||||
# booksfile=variant_to_unicode(self.field(u'csv_booksfile')),
|
||||
# versefile=variant_to_unicode(self.field(u'csv_versefile'))
|
||||
# )
|
||||
# elif bible_type == BibleFormat.OpenSong:
|
||||
# # Import an OpenSong bible
|
||||
# importer = self.manager.import_bible(BibleFormat.OpenSong,
|
||||
# name=license_version,
|
||||
# filename=variant_to_unicode(self.field(u'opensong_file'))
|
||||
# )
|
||||
# elif bible_type == BibleFormat.WebDownload:
|
||||
# # Import a bible from the web
|
||||
# self.ImportProgressBar.setMaximum(1)
|
||||
# download_location = self.field(u'web_location').toInt()[0]
|
||||
# bible_version = self.BibleComboBox.currentText()
|
||||
# if not isinstance(bible_version, unicode):
|
||||
# bible_version = unicode(bible_version, u'utf8')
|
||||
# if download_location == WebDownload.Crosswalk:
|
||||
# bible = self.web_bible_list[WebDownload.Crosswalk][bible_version]
|
||||
# elif download_location == WebDownload.BibleGateway:
|
||||
# bible = self.web_bible_list[WebDownload.BibleGateway][bible_version]
|
||||
# importer = self.manager.import_bible(
|
||||
# BibleFormat.WebDownload,
|
||||
# name=license_version,
|
||||
# download_source=WebDownload.get_name(download_location),
|
||||
# download_name=bible,
|
||||
# proxy_server=variant_to_unicode(self.field(u'proxy_server')),
|
||||
# proxy_username=variant_to_unicode(self.field(u'proxy_username')),
|
||||
# proxy_password=variant_to_unicode(self.field(u'proxy_password'))
|
||||
# )
|
||||
# success = importer.do_import()
|
||||
# if success:
|
||||
# self.manager.save_meta_data(license_version, license_version,
|
||||
# license_copyright, license_permission)
|
||||
# self.manager.reload_bibles()
|
||||
# self.ImportProgressLabel.setText(self.trUtf8('Finished import.'))
|
||||
# else:
|
||||
# self.ImportProgressLabel.setText(
|
||||
# self.trUtf8('Your Bible import failed.'))
|
||||
# importer.delete()
|
||||
|
||||
def postImport(self):
|
||||
self.ImportProgressBar.setValue(self.ImportProgressBar.maximum())
|
||||
self.finishButton.setVisible(True)
|
||||
self.cancelButton.setVisible(False)
|
||||
Receiver.send_message(u'process_events')
|
213
openlp/plugins/songs/forms/songimportwizard.py
Normal file
213
openlp/plugins/songs/forms/songimportwizard.py
Normal file
@ -0,0 +1,213 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2010 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
|
||||
# Thompson, Jon Tibble, Carsten Tinggaard #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# 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
|
||||
|
||||
class Ui_SongImportWizard(object):
|
||||
def setupUi(self, SongImportWizard):
|
||||
SongImportWizard.setObjectName(u'SongImportWizard')
|
||||
SongImportWizard.resize(550, 386)
|
||||
SongImportWizard.setMinimumSize(QtCore.QSize(166, 386))
|
||||
SongImportWizard.setModal(True)
|
||||
SongImportWizard.setWizardStyle(QtGui.QWizard.ModernStyle)
|
||||
SongImportWizard.setOptions(QtGui.QWizard.NoBackButtonOnLastPage |
|
||||
QtGui.QWizard.NoBackButtonOnStartPage)
|
||||
self.WelcomePage = QtGui.QWizardPage()
|
||||
self.WelcomePage.setObjectName(u'WelcomePage')
|
||||
self.WelcomeLayout = QtGui.QHBoxLayout(self.WelcomePage)
|
||||
self.WelcomeLayout.setSpacing(8)
|
||||
self.WelcomeLayout.setMargin(0)
|
||||
self.WelcomeLayout.setObjectName(u'WelcomeLayout')
|
||||
self.ImportSongImage = QtGui.QLabel(self.WelcomePage)
|
||||
self.ImportSongImage.setMinimumSize(QtCore.QSize(163, 0))
|
||||
self.ImportSongImage.setMaximumSize(QtCore.QSize(163, 16777215))
|
||||
self.ImportSongImage.setPixmap(
|
||||
QtGui.QPixmap(u':/wizards/wizard_importsong.bmp'))
|
||||
self.ImportSongImage.setObjectName(u'ImportSongImage')
|
||||
self.WelcomeLayout.addWidget(self.ImportSongImage)
|
||||
self.WelcomeTextLayout = QtGui.QVBoxLayout()
|
||||
self.WelcomeTextLayout.setSpacing(8)
|
||||
self.WelcomeTextLayout.setObjectName(u'WelcomeTextLayout')
|
||||
self.TitleLabel = QtGui.QLabel(self.WelcomePage)
|
||||
self.TitleLabel.setObjectName(u'TitleLabel')
|
||||
self.WelcomeTextLayout.addWidget(self.TitleLabel)
|
||||
self.WelcomeTopSpacer = QtGui.QSpacerItem(20, 40,
|
||||
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
|
||||
self.WelcomeTextLayout.addItem(self.WelcomeTopSpacer)
|
||||
self.InformationLabel = QtGui.QLabel(self.WelcomePage)
|
||||
self.InformationLabel.setWordWrap(True)
|
||||
self.InformationLabel.setMargin(10)
|
||||
self.InformationLabel.setObjectName(u'InformationLabel')
|
||||
self.WelcomeTextLayout.addWidget(self.InformationLabel)
|
||||
self.WelcomeBottomSpacer = QtGui.QSpacerItem(20, 40,
|
||||
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.WelcomeTextLayout.addItem(self.WelcomeBottomSpacer)
|
||||
self.WelcomeLayout.addLayout(self.WelcomeTextLayout)
|
||||
SongImportWizard.addPage(self.WelcomePage)
|
||||
self.SourcePage = QtGui.QWizardPage()
|
||||
self.SourcePage.setObjectName(u'SourcePage')
|
||||
self.SourceLayout = QtGui.QVBoxLayout(self.SourcePage)
|
||||
self.SourceLayout.setSpacing(8)
|
||||
self.SourceLayout.setMargin(20)
|
||||
self.SourceLayout.setObjectName(u'SourceLayout')
|
||||
self.FormatLayout = QtGui.QHBoxLayout()
|
||||
self.FormatLayout.setSpacing(8)
|
||||
self.FormatLayout.setObjectName(u'FormatLayout')
|
||||
self.FormatLabel = QtGui.QLabel(self.SourcePage)
|
||||
self.FormatLabel.setObjectName(u'FormatLabel')
|
||||
self.FormatLayout.addWidget(self.FormatLabel)
|
||||
self.FormatComboBox = QtGui.QComboBox(self.SourcePage)
|
||||
sizePolicy = QtGui.QSizePolicy(
|
||||
QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.FormatComboBox.sizePolicy().hasHeightForWidth())
|
||||
self.FormatComboBox.setSizePolicy(sizePolicy)
|
||||
self.FormatComboBox.setObjectName(u'FormatComboBox')
|
||||
self.FormatComboBox.addItem(u'')
|
||||
self.FormatComboBox.addItem(u'')
|
||||
self.FormatLayout.addWidget(self.FormatComboBox)
|
||||
self.FormatSpacer = QtGui.QSpacerItem(40, 20,
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.FormatLayout.addItem(self.FormatSpacer)
|
||||
self.SourceLayout.addLayout(self.FormatLayout)
|
||||
self.FormatStackedWidget = QtGui.QStackedWidget(self.SourcePage)
|
||||
self.FormatStackedWidget.setObjectName(u'FormatStackedWidget')
|
||||
self.OpenSongFilePage = QtGui.QWidget()
|
||||
self.OpenSongFilePage.setObjectName(u'OpenSongFilePage')
|
||||
self.OpenSongFileLayout = QtGui.QFormLayout(self.OpenSongFilePage)
|
||||
self.OpenSongFileLayout.setMargin(0)
|
||||
self.OpenSongFileLayout.setSpacing(8)
|
||||
self.OpenSongFileLayout.setObjectName(u'OpenSongFileLayout')
|
||||
self.OpenSongFileLabel = QtGui.QLabel(self.OpenSongFilePage)
|
||||
self.OpenSongFileLabel.setObjectName(u'OpenSongFileLabel')
|
||||
self.OpenSongFileLayout.setWidget(0,
|
||||
QtGui.QFormLayout.LabelRole, self.OpenSongFileLabel)
|
||||
self.OpenSongFilenameLayout = QtGui.QHBoxLayout()
|
||||
self.OpenSongFilenameLayout.setSpacing(8)
|
||||
self.OpenSongFilenameLayout.setObjectName(u'OpenSongFilenameLayout')
|
||||
self.OpenSongFilenameLineEdit = QtGui.QLineEdit(self.OpenSongFilePage)
|
||||
self.OpenSongFilenameLineEdit.setObjectName(u'OpenSongFilenameLineEdit')
|
||||
self.OpenSongFilenameLayout.addWidget(self.OpenSongFilenameLineEdit)
|
||||
self.OpenSongFilenameButton = QtGui.QToolButton(self.OpenSongFilePage)
|
||||
icon = QtGui.QIcon()
|
||||
icon.addPixmap(QtGui.QPixmap(u':/imports/import_load.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.OpenSongFilenameButton.setIcon(icon)
|
||||
self.OpenSongFilenameButton.setObjectName(u'OpenSongFilenameButton')
|
||||
self.OpenSongFilenameLayout.addWidget(self.OpenSongFilenameButton)
|
||||
self.OpenSongFileLayout.setLayout(0,
|
||||
QtGui.QFormLayout.FieldRole, self.OpenSongFilenameLayout)
|
||||
self.FormatStackedWidget.addWidget(self.OpenSongFilePage)
|
||||
self.OpenSongDirectoryPage = QtGui.QWidget()
|
||||
self.OpenSongDirectoryPage.setObjectName(u'OpenSongDirectoryPage')
|
||||
self.OpenSongDirectoryLayout = QtGui.QFormLayout(self.OpenSongDirectoryPage)
|
||||
self.OpenSongDirectoryLayout.setMargin(0)
|
||||
self.OpenSongDirectoryLayout.setSpacing(8)
|
||||
self.OpenSongDirectoryLayout.setObjectName(u'OpenSongDirectoryLayout')
|
||||
self.OpenSongDirectoryLabel = QtGui.QLabel(self.OpenSongDirectoryPage)
|
||||
self.OpenSongDirectoryLabel.setObjectName(u'OpenSongDirectoryLabel')
|
||||
self.OpenSongDirectoryLayout.setWidget(0,
|
||||
QtGui.QFormLayout.LabelRole, self.OpenSongDirectoryLabel)
|
||||
self.OpenSongDirLayout = QtGui.QHBoxLayout()
|
||||
self.OpenSongDirLayout.setSpacing(8)
|
||||
self.OpenSongDirLayout.setObjectName(u'OpenSongDirLayout')
|
||||
self.OpenSongDirectoryLineEdit = QtGui.QLineEdit(self.OpenSongDirectoryPage)
|
||||
self.OpenSongDirectoryLineEdit.setObjectName(u'OpenSongDirectoryLineEdit')
|
||||
self.OpenSongDirLayout.addWidget(self.OpenSongDirectoryLineEdit)
|
||||
self.OpenSongDirectoryButton = QtGui.QToolButton(self.OpenSongDirectoryPage)
|
||||
icon1 = QtGui.QIcon()
|
||||
icon1.addPixmap(QtGui.QPixmap(u':/exports/export_load.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.OpenSongDirectoryButton.setIcon(icon1)
|
||||
self.OpenSongDirectoryButton.setObjectName(u'OpenSongDirectoryButton')
|
||||
self.OpenSongDirLayout.addWidget(self.OpenSongDirectoryButton)
|
||||
self.OpenSongDirectoryLayout.setLayout(0,
|
||||
QtGui.QFormLayout.FieldRole, self.OpenSongDirLayout)
|
||||
self.FormatStackedWidget.addWidget(self.OpenSongDirectoryPage)
|
||||
self.SourceLayout.addWidget(self.FormatStackedWidget)
|
||||
SongImportWizard.addPage(self.SourcePage)
|
||||
self.ImportPage = QtGui.QWizardPage()
|
||||
self.ImportPage.setObjectName(u'ImportPage')
|
||||
self.ImportLayout = QtGui.QVBoxLayout(self.ImportPage)
|
||||
self.ImportLayout.setSpacing(8)
|
||||
self.ImportLayout.setMargin(50)
|
||||
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.setProperty(u'value', 0)
|
||||
self.ImportProgressBar.setInvertedAppearance(False)
|
||||
self.ImportProgressBar.setObjectName(u'ImportProgressBar')
|
||||
self.ImportLayout.addWidget(self.ImportProgressBar)
|
||||
SongImportWizard.addPage(self.ImportPage)
|
||||
self.OpenSongFileLabel.setBuddy(self.OpenSongFilenameLineEdit)
|
||||
|
||||
self.retranslateUi(SongImportWizard)
|
||||
self.FormatStackedWidget.setCurrentIndex(0)
|
||||
QtCore.QObject.connect(
|
||||
self.FormatComboBox,
|
||||
QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
||||
self.FormatStackedWidget.setCurrentIndex
|
||||
)
|
||||
QtCore.QMetaObject.connectSlotsByName(SongImportWizard)
|
||||
|
||||
def retranslateUi(self, SongImportWizard):
|
||||
SongImportWizard.setWindowTitle(self.trUtf8('Song Import Wizard'))
|
||||
self.TitleLabel.setText(self.trUtf8(
|
||||
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" \n'
|
||||
' "http://www.w3.org/TR/REC-html40/strict.dtd">\n'
|
||||
'<html>\n'
|
||||
' <head>\n'
|
||||
' <meta name="qrichtext" content="1" />\n'
|
||||
' <style type="text/css">p, li { white-space: pre-wrap; }</style>\n'
|
||||
' </head>\n'
|
||||
' <body style="font-family: Lucida Grande; font-size:10pt; font-weight:400; font-style:normal;">\n'
|
||||
' <p style="margin: 0; -qt-block-indent:0; text-indent:0px;">\n'
|
||||
' <span style="font-size:14pt; font-weight:600;">\n'
|
||||
' Welcome to the Song Import Wizard\n'
|
||||
' </span>\n'
|
||||
' </p>\n'
|
||||
' </body>\n'
|
||||
'</html>'
|
||||
))
|
||||
self.InformationLabel.setText(self.trUtf8('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(self.trUtf8('Select Import Source'))
|
||||
self.SourcePage.setSubTitle(self.trUtf8('Select the import format, '
|
||||
'and where to import from.'))
|
||||
self.FormatLabel.setText(self.trUtf8('Format:'))
|
||||
self.FormatComboBox.setItemText(0, self.trUtf8('OpenSong (Single File)'))
|
||||
self.FormatComboBox.setItemText(1, self.trUtf8('OpenSong (Directory of Files)'))
|
||||
self.OpenSongFileLabel.setText(self.trUtf8('Filename:'))
|
||||
self.OpenSongDirectoryLabel.setText(self.trUtf8('Directory:'))
|
||||
self.ImportPage.setTitle(self.trUtf8('Importing'))
|
||||
self.ImportPage.setSubTitle(self.trUtf8('Please wait while your songs '
|
||||
'are imported.'))
|
||||
self.ImportProgressLabel.setText(self.trUtf8('Ready.'))
|
||||
self.ImportProgressBar.setFormat(self.trUtf8('%p%'))
|
||||
|
@ -29,7 +29,8 @@ from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import MediaManagerItem, SongXMLParser, \
|
||||
BaseListWithDnD, Receiver, str_to_bool
|
||||
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm
|
||||
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
|
||||
ImportWizardForm
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -51,9 +52,9 @@ class SongMediaItem(MediaManagerItem):
|
||||
self.ListViewWithDnD_class = SongListView
|
||||
self.servicePath = None
|
||||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
self.edit_song_form = EditSongForm(self.parent.songmanager, self)
|
||||
self.edit_song_form = EditSongForm(self.parent.manager, self)
|
||||
self.song_maintenance_form = SongMaintenanceForm(
|
||||
self.parent.songmanager, self)
|
||||
self.parent.manager, self)
|
||||
# Holds information about whether the edit is remotly triggered and
|
||||
# which Song is required.
|
||||
self.remoteSong = -1
|
||||
@ -154,17 +155,17 @@ class SongMediaItem(MediaManagerItem):
|
||||
search_type = self.SearchTypeComboBox.currentIndex()
|
||||
if search_type == 0:
|
||||
log.debug(u'Titles Search')
|
||||
search_results = self.parent.songmanager.search_song_title(
|
||||
search_results = self.parent.manager.search_song_title(
|
||||
search_keywords)
|
||||
self.displayResultsSong(search_results)
|
||||
elif search_type == 1:
|
||||
log.debug(u'Lyrics Search')
|
||||
search_results = self.parent.songmanager.search_song_lyrics(
|
||||
search_results = self.parent.manager.search_song_lyrics(
|
||||
search_keywords)
|
||||
self.displayResultsSong(search_results)
|
||||
elif search_type == 2:
|
||||
log.debug(u'Authors Search')
|
||||
search_results = self.parent.songmanager.get_song_from_author(
|
||||
search_results = self.parent.manager.get_song_from_author(
|
||||
search_keywords)
|
||||
self.displayResultsAuthor(search_results)
|
||||
#Called to redisplay the song list screen edith from a search
|
||||
@ -226,6 +227,11 @@ class SongMediaItem(MediaManagerItem):
|
||||
if len(text) > search_length:
|
||||
self.onSearchTextButtonClick()
|
||||
|
||||
def onImportClick(self):
|
||||
songimportform = ImportWizardForm(self, self.parent.config,
|
||||
self.parent.manager, self.parent)
|
||||
songimportform.exec_()
|
||||
|
||||
def onNewClick(self):
|
||||
self.edit_song_form.newSong()
|
||||
self.edit_song_form.exec_()
|
||||
@ -256,7 +262,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
type of display is required.
|
||||
"""
|
||||
fields = songid.split(u':')
|
||||
valid = self.parent.songmanager.get_song(fields[1])
|
||||
valid = self.parent.manager.get_song(fields[1])
|
||||
if valid:
|
||||
self.remoteSong = fields[1]
|
||||
self.remoteTriggered = fields[0]
|
||||
@ -274,7 +280,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
item = self.ListView.currentItem()
|
||||
if item:
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
self.parent.songmanager.delete_song(item_id)
|
||||
self.parent.manager.delete_song(item_id)
|
||||
row = self.ListView.row(item)
|
||||
self.ListView.takeItem(row)
|
||||
|
||||
@ -291,7 +297,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
else:
|
||||
item_id = self.remoteSong
|
||||
service_item.auto_preview_allowed = True
|
||||
song = self.parent.songmanager.get_song(item_id)
|
||||
song = self.parent.manager.get_song(item_id)
|
||||
service_item.theme = song.theme_name
|
||||
service_item.edit_enabled = True
|
||||
service_item.editId = item_id
|
||||
@ -345,4 +351,4 @@ class SongMediaItem(MediaManagerItem):
|
||||
service_item.audit = [
|
||||
song.title, author_audit, song.copyright, song.ccli_number
|
||||
]
|
||||
return True
|
||||
return True
|
||||
|
@ -29,8 +29,9 @@ from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Plugin, build_icon, PluginStatus
|
||||
from openlp.plugins.songs.lib import SongManager, SongMediaItem, SongsTab
|
||||
from openlp.plugins.songs.forms import OpenLPImportForm, OpenSongExportForm, \
|
||||
OpenSongImportForm, OpenLPExportForm
|
||||
#from openlp.plugins.songs.forms import ImportWizardForm
|
||||
#OpenLPImportForm, OpenSongExportForm, \
|
||||
# OpenSongImportForm, OpenLPExportForm
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -50,11 +51,12 @@ class SongsPlugin(Plugin):
|
||||
"""
|
||||
Plugin.__init__(self, u'Songs', u'1.9.1', plugin_helpers)
|
||||
self.weight = -10
|
||||
self.songmanager = SongManager(self.config)
|
||||
self.openlp_import_form = OpenLPImportForm()
|
||||
self.opensong_import_form = OpenSongImportForm()
|
||||
self.openlp_export_form = OpenLPExportForm()
|
||||
self.opensong_export_form = OpenSongExportForm()
|
||||
self.manager = SongManager(self.config)
|
||||
#self.openlp_import_form = OpenLPImportForm()
|
||||
#self.opensong_import_form = OpenSongImportForm()
|
||||
#self.openlp_export_form = OpenLPExportForm()
|
||||
#self.opensong_export_form = OpenSongExportForm()
|
||||
#self.import_wizard = ImportWizardForm()
|
||||
self.icon = build_icon(u':/media/media_song.png')
|
||||
self.status = PluginStatus.Active
|
||||
|
||||
@ -67,16 +69,16 @@ class SongsPlugin(Plugin):
|
||||
# self.songmanager = SongManager(self.config)
|
||||
Plugin.initialise(self)
|
||||
self.insert_toolbox_item()
|
||||
self.ImportSongMenu.menuAction().setVisible(True)
|
||||
self.ExportSongMenu.menuAction().setVisible(True)
|
||||
self.media_item.displayResultsSong(self.songmanager.get_songs())
|
||||
#self.ImportSongMenu.menuAction().setVisible(True)
|
||||
#self.ExportSongMenu.menuAction().setVisible(True)
|
||||
self.media_item.displayResultsSong(self.manager.get_songs())
|
||||
|
||||
def finalise(self):
|
||||
log.info(u'Plugin Finalise')
|
||||
Plugin.finalise(self)
|
||||
self.remove_toolbox_item()
|
||||
self.ImportSongMenu.menuAction().setVisible(False)
|
||||
self.ExportSongMenu.menuAction().setVisible(False)
|
||||
#self.ImportSongMenu.menuAction().setVisible(False)
|
||||
#self.ExportSongMenu.menuAction().setVisible(False)
|
||||
|
||||
def get_media_manager_item(self):
|
||||
"""
|
||||
@ -94,86 +96,99 @@ class SongsPlugin(Plugin):
|
||||
The actual **Import** menu item, so that your actions can
|
||||
use it as their parent.
|
||||
"""
|
||||
self.ImportSongMenu = QtGui.QMenu(import_menu)
|
||||
self.ImportSongMenu.setObjectName(u'ImportSongMenu')
|
||||
self.ImportOpenSongItem = QtGui.QAction(import_menu)
|
||||
self.ImportOpenSongItem.setObjectName(u'ImportOpenSongItem')
|
||||
self.ImportOpenlp1Item = QtGui.QAction(import_menu)
|
||||
self.ImportOpenlp1Item.setObjectName(u'ImportOpenlp1Item')
|
||||
self.ImportOpenlp2Item = QtGui.QAction(import_menu)
|
||||
self.ImportOpenlp2Item.setObjectName(u'ImportOpenlp2Item')
|
||||
# Add to menus
|
||||
self.ImportSongMenu.addAction(self.ImportOpenlp1Item)
|
||||
self.ImportSongMenu.addAction(self.ImportOpenlp2Item)
|
||||
self.ImportSongMenu.addAction(self.ImportOpenSongItem)
|
||||
import_menu.addAction(self.ImportSongMenu.menuAction())
|
||||
# Translations...
|
||||
self.ImportSongMenu.setTitle(import_menu.trUtf8('&Song'))
|
||||
self.ImportOpenSongItem.setText(import_menu.trUtf8('OpenSong'))
|
||||
self.ImportOpenlp1Item.setText(import_menu.trUtf8('openlp.org 1.0'))
|
||||
self.ImportOpenlp1Item.setToolTip(
|
||||
import_menu.trUtf8('Export songs in openlp.org 1.0 format'))
|
||||
self.ImportOpenlp1Item.setStatusTip(
|
||||
import_menu.trUtf8('Export songs in openlp.org 1.0 format'))
|
||||
self.ImportOpenlp2Item.setText(import_menu.trUtf8('OpenLP 2.0'))
|
||||
self.ImportOpenlp2Item.setToolTip(
|
||||
import_menu.trUtf8('Export songs in OpenLP 2.0 format'))
|
||||
self.ImportOpenlp2Item.setStatusTip(
|
||||
import_menu.trUtf8('Export songs in OpenLP 2.0 format'))
|
||||
# Signals and slots
|
||||
QtCore.QObject.connect(self.ImportOpenlp1Item,
|
||||
QtCore.SIGNAL(u'triggered()'), self.onImportOpenlp1ItemClick)
|
||||
QtCore.QObject.connect(self.ImportOpenlp2Item,
|
||||
QtCore.SIGNAL(u'triggered()'), self.onImportOpenlp1ItemClick)
|
||||
QtCore.QObject.connect(self.ImportOpenSongItem,
|
||||
QtCore.SIGNAL(u'triggered()'), self.onImportOpenSongItemClick)
|
||||
self.ImportSongMenu.menuAction().setVisible(False)
|
||||
self.SongImportItem = QtGui.QAction(import_menu)
|
||||
self.SongImportItem.setObjectName(u'SongImportItem')
|
||||
self.SongImportItem.setText(import_menu.trUtf8('&Song'))
|
||||
self.SongImportItem.setToolTip(
|
||||
import_menu.trUtf8('Import songs using the import wizard.'))
|
||||
import_menu.addAction(self.SongImportItem)
|
||||
QtCore.QObject.connect(self.SongImportItem,
|
||||
QtCore.SIGNAL(u'triggered()'), self.onSongImportItemClicked)
|
||||
|
||||
def add_export_menu_item(self, export_menu):
|
||||
"""
|
||||
Give the Songs plugin the opportunity to add items to the
|
||||
**Export** menu.
|
||||
# self.ImportSongMenu = QtGui.QMenu(import_menu)
|
||||
# self.ImportSongMenu.setObjectName(u'ImportSongMenu')
|
||||
# self.ImportOpenSongItem = QtGui.QAction(import_menu)
|
||||
# self.ImportOpenSongItem.setObjectName(u'ImportOpenSongItem')
|
||||
# self.ImportOpenlp1Item = QtGui.QAction(import_menu)
|
||||
# self.ImportOpenlp1Item.setObjectName(u'ImportOpenlp1Item')
|
||||
# self.ImportOpenlp2Item = QtGui.QAction(import_menu)
|
||||
# self.ImportOpenlp2Item.setObjectName(u'ImportOpenlp2Item')
|
||||
# # Add to menus
|
||||
# self.ImportSongMenu.addAction(self.ImportOpenlp1Item)
|
||||
# self.ImportSongMenu.addAction(self.ImportOpenlp2Item)
|
||||
# self.ImportSongMenu.addAction(self.ImportOpenSongItem)
|
||||
# import_menu.addAction(self.ImportSongMenu.menuAction())
|
||||
# # Translations...
|
||||
# self.ImportSongMenu.setTitle(import_menu.trUtf8('&Song'))
|
||||
# self.ImportOpenSongItem.setText(import_menu.trUtf8('OpenSong'))
|
||||
# self.ImportOpenlp1Item.setText(import_menu.trUtf8('openlp.org 1.0'))
|
||||
# self.ImportOpenlp1Item.setToolTip(
|
||||
# import_menu.trUtf8('Export songs in openlp.org 1.0 format'))
|
||||
# self.ImportOpenlp1Item.setStatusTip(
|
||||
# import_menu.trUtf8('Export songs in openlp.org 1.0 format'))
|
||||
# self.ImportOpenlp2Item.setText(import_menu.trUtf8('OpenLP 2.0'))
|
||||
# self.ImportOpenlp2Item.setToolTip(
|
||||
# import_menu.trUtf8('Export songs in OpenLP 2.0 format'))
|
||||
# self.ImportOpenlp2Item.setStatusTip(
|
||||
# import_menu.trUtf8('Export songs in OpenLP 2.0 format'))
|
||||
# # Signals and slots
|
||||
# QtCore.QObject.connect(self.ImportOpenlp1Item,
|
||||
# QtCore.SIGNAL(u'triggered()'), self.onImportOpenlp1ItemClick)
|
||||
# QtCore.QObject.connect(self.ImportOpenlp2Item,
|
||||
# QtCore.SIGNAL(u'triggered()'), self.onImportOpenlp1ItemClick)
|
||||
# QtCore.QObject.connect(self.ImportOpenSongItem,
|
||||
# QtCore.SIGNAL(u'triggered()'), self.onImportOpenSongItemClick)
|
||||
# self.ImportSongMenu.menuAction().setVisible(False)
|
||||
|
||||
``export_menu``
|
||||
The actual **Export** menu item, so that your actions can
|
||||
use it as their parent.
|
||||
"""
|
||||
self.ExportSongMenu = QtGui.QMenu(export_menu)
|
||||
self.ExportSongMenu.setObjectName(u'ExportSongMenu')
|
||||
self.ExportOpenSongItem = QtGui.QAction(export_menu)
|
||||
self.ExportOpenSongItem.setObjectName(u'ExportOpenSongItem')
|
||||
self.ExportOpenlp1Item = QtGui.QAction(export_menu)
|
||||
self.ExportOpenlp1Item.setObjectName(u'ExportOpenlp1Item')
|
||||
self.ExportOpenlp2Item = QtGui.QAction(export_menu)
|
||||
self.ExportOpenlp2Item.setObjectName(u'ExportOpenlp2Item')
|
||||
# Add to menus
|
||||
self.ExportSongMenu.addAction(self.ExportOpenlp1Item)
|
||||
self.ExportSongMenu.addAction(self.ExportOpenlp2Item)
|
||||
self.ExportSongMenu.addAction(self.ExportOpenSongItem)
|
||||
export_menu.addAction(self.ExportSongMenu.menuAction())
|
||||
# Translations...
|
||||
self.ExportSongMenu.setTitle(export_menu.trUtf8('&Song'))
|
||||
self.ExportOpenSongItem.setText(export_menu.trUtf8('OpenSong'))
|
||||
self.ExportOpenlp1Item.setText(export_menu.trUtf8('openlp.org 1.0'))
|
||||
self.ExportOpenlp2Item.setText(export_menu.trUtf8('OpenLP 2.0'))
|
||||
# Signals and slots
|
||||
QtCore.QObject.connect(self.ExportOpenlp1Item,
|
||||
QtCore.SIGNAL(u'triggered()'), self.onExportOpenlp1ItemClicked)
|
||||
QtCore.QObject.connect(self.ExportOpenSongItem,
|
||||
QtCore.SIGNAL(u'triggered()'), self.onExportOpenSongItemClicked)
|
||||
self.ExportSongMenu.menuAction().setVisible(False)
|
||||
# def add_export_menu_item(self, export_menu):
|
||||
# """
|
||||
# Give the Songs plugin the opportunity to add items to the
|
||||
# **Export** menu.
|
||||
#
|
||||
# ``export_menu``
|
||||
# The actual **Export** menu item, so that your actions can
|
||||
# use it as their parent.
|
||||
# """
|
||||
# self.ExportSongMenu = QtGui.QMenu(export_menu)
|
||||
# self.ExportSongMenu.setObjectName(u'ExportSongMenu')
|
||||
# self.ExportOpenSongItem = QtGui.QAction(export_menu)
|
||||
# self.ExportOpenSongItem.setObjectName(u'ExportOpenSongItem')
|
||||
# self.ExportOpenlp1Item = QtGui.QAction(export_menu)
|
||||
# self.ExportOpenlp1Item.setObjectName(u'ExportOpenlp1Item')
|
||||
# self.ExportOpenlp2Item = QtGui.QAction(export_menu)
|
||||
# self.ExportOpenlp2Item.setObjectName(u'ExportOpenlp2Item')
|
||||
# # Add to menus
|
||||
# self.ExportSongMenu.addAction(self.ExportOpenlp1Item)
|
||||
# self.ExportSongMenu.addAction(self.ExportOpenlp2Item)
|
||||
# self.ExportSongMenu.addAction(self.ExportOpenSongItem)
|
||||
# export_menu.addAction(self.ExportSongMenu.menuAction())
|
||||
# # Translations...
|
||||
# self.ExportSongMenu.setTitle(export_menu.trUtf8('&Song'))
|
||||
# self.ExportOpenSongItem.setText(export_menu.trUtf8('OpenSong'))
|
||||
# self.ExportOpenlp1Item.setText(export_menu.trUtf8('openlp.org 1.0'))
|
||||
# self.ExportOpenlp2Item.setText(export_menu.trUtf8('OpenLP 2.0'))
|
||||
# # Signals and slots
|
||||
# QtCore.QObject.connect(self.ExportOpenlp1Item,
|
||||
# QtCore.SIGNAL(u'triggered()'), self.onExportOpenlp1ItemClicked)
|
||||
# QtCore.QObject.connect(self.ExportOpenSongItem,
|
||||
# QtCore.SIGNAL(u'triggered()'), self.onExportOpenSongItemClicked)
|
||||
# self.ExportSongMenu.menuAction().setVisible(False)
|
||||
|
||||
def onImportOpenlp1ItemClick(self):
|
||||
self.openlp_import_form.show()
|
||||
def onSongImportItemClicked(self):
|
||||
if self.media_item:
|
||||
self.media_item.onImportClick()
|
||||
|
||||
def onImportOpenSongItemClick(self):
|
||||
self.opensong_import_form.show()
|
||||
|
||||
def onExportOpenlp1ItemClicked(self):
|
||||
self.openlp_export_form.show()
|
||||
|
||||
def onExportOpenSongItemClicked(self):
|
||||
self.opensong_export_form.show()
|
||||
# def onImportOpenlp1ItemClick(self):
|
||||
# self.openlp_import_form.show()
|
||||
#
|
||||
# def onImportOpenSongItemClick(self):
|
||||
# self.opensong_import_form.show()
|
||||
#
|
||||
# def onExportOpenlp1ItemClicked(self):
|
||||
# self.openlp_export_form.show()
|
||||
#
|
||||
# def onExportOpenSongItemClicked(self):
|
||||
# self.opensong_export_form.show()
|
||||
|
||||
def about(self):
|
||||
about_text = self.trUtf8('<b>Song Plugin</b> <br>This plugin allows '
|
||||
@ -181,6 +196,6 @@ class SongsPlugin(Plugin):
|
||||
return about_text
|
||||
|
||||
def can_delete_theme(self, theme):
|
||||
if len(self.songmanager.get_songs_for_theme(theme)) == 0:
|
||||
if len(self.manager.get_songs_for_theme(theme)) == 0:
|
||||
return True
|
||||
return False
|
||||
|
@ -69,8 +69,8 @@
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body >
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; font-weight:600;">Welcome to the Bible Import Wizard</span></p></body></html></string>
|
||||
</style></head><body style=" font-family:'Lucida Grande'; font-size:10pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; font-weight:600;">Welcome to the Song Import Wizard</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -93,7 +93,7 @@ p, li { white-space: pre-wrap; }
|
||||
<item>
|
||||
<widget class="QLabel" name="InformationLabel">
|
||||
<property name="text">
|
||||
<string>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.</string>
|
||||
<string>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.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
@ -135,7 +135,10 @@ p, li { white-space: pre-wrap; }
|
||||
<number>20</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QHBoxLayout" name="FormatLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="FormatLabel">
|
||||
<property name="text">
|
||||
@ -144,10 +147,27 @@ p, li { white-space: pre-wrap; }
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox"/>
|
||||
<widget class="QComboBox" name="FormatComboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>OpenSong (Single File)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>OpenSong (Directory of Files)</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<spacer name="FormatSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@ -162,9 +182,131 @@ p, li { white-space: pre-wrap; }
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<widget class="QWidget" name="page"/>
|
||||
<widget class="QWidget" name="page_2"/>
|
||||
<widget class="QStackedWidget" name="FormatStackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="OpenSongFilePage">
|
||||
<layout class="QFormLayout" name="OpenSongFileLayout">
|
||||
<property name="horizontalSpacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="OpenSongFileLabel">
|
||||
<property name="text">
|
||||
<string>Filename:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>OpenSongFilenameLineEdit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="OpenSongFilenameLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="OpenSongFilenameLineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="OpenSongFilenameButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images/openlp-2.qrc">
|
||||
<normaloff>:/imports/import_load.png</normaloff>:/imports/import_load.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="OpenSongDirectoryPage">
|
||||
<layout class="QFormLayout" name="OpenSongDirectoryLayout">
|
||||
<property name="horizontalSpacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="OpenSongDirectoryLabel">
|
||||
<property name="text">
|
||||
<string>Directory:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="OpenSongDirLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="OpenSongDirectoryLineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="OpenSongDirectoryButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images/openlp-2.qrc">
|
||||
<normaloff>:/exports/export_load.png</normaloff>:/exports/export_load.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWizardPage" name="ImportPage">
|
||||
<property name="title">
|
||||
<string>Importing</string>
|
||||
</property>
|
||||
<property name="subTitle">
|
||||
<string>Please wait while your songs are imported.</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="ImportLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>50</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="ImportProgressLabel">
|
||||
<property name="text">
|
||||
<string>Ready.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QProgressBar" name="ImportProgressBar">
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="invertedAppearance">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="format">
|
||||
<string>%p</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -173,5 +315,22 @@ p, li { white-space: pre-wrap; }
|
||||
<resources>
|
||||
<include location="../images/openlp-2.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>FormatComboBox</sender>
|
||||
<signal>currentIndexChanged(int)</signal>
|
||||
<receiver>FormatStackedWidget</receiver>
|
||||
<slot>setCurrentIndex(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>122</x>
|
||||
<y>92</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>274</x>
|
||||
<y>222</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
Loading…
Reference in New Issue
Block a user