forked from openlp/openlp
Fixed the couple of issues Jon T. pointed out.
This commit is contained in:
parent
78889633f6
commit
8b141b0942
@ -43,19 +43,13 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
|
|||||||
"""
|
"""
|
||||||
log.info(u'SongImportForm loaded')
|
log.info(u'SongImportForm loaded')
|
||||||
|
|
||||||
def __init__(self, parent, manager, plugin):
|
def __init__(self, parent, plugin):
|
||||||
"""
|
"""
|
||||||
Instantiate the wizard, and run any extra setup we need to.
|
Instantiate the wizard, and run any extra setup we need to.
|
||||||
|
|
||||||
``parent``
|
``parent``
|
||||||
The QWidget-derived parent of the wizard.
|
The QWidget-derived parent of the wizard.
|
||||||
|
|
||||||
``config``
|
|
||||||
The configuration object for storing and retrieving settings.
|
|
||||||
|
|
||||||
``manager``
|
|
||||||
The songs manager.
|
|
||||||
|
|
||||||
``plugin``
|
``plugin``
|
||||||
The songs plugin.
|
The songs plugin.
|
||||||
"""
|
"""
|
||||||
@ -64,9 +58,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
|
|||||||
self.registerFields()
|
self.registerFields()
|
||||||
self.finishButton = self.button(QtGui.QWizard.FinishButton)
|
self.finishButton = self.button(QtGui.QWizard.FinishButton)
|
||||||
self.cancelButton = self.button(QtGui.QWizard.CancelButton)
|
self.cancelButton = self.button(QtGui.QWizard.CancelButton)
|
||||||
self.manager = manager
|
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
#self.manager.set_process_dialog(self)
|
|
||||||
QtCore.QObject.connect(self.openLP2BrowseButton,
|
QtCore.QObject.connect(self.openLP2BrowseButton,
|
||||||
QtCore.SIGNAL(u'clicked()'),
|
QtCore.SIGNAL(u'clicked()'),
|
||||||
self.onOpenLP2BrowseButtonClicked)
|
self.onOpenLP2BrowseButtonClicked)
|
||||||
@ -383,7 +375,8 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
|
|||||||
elif source_format == SongFormat.WordsOfWorship:
|
elif source_format == SongFormat.WordsOfWorship:
|
||||||
# Import Words Of Worship songs
|
# Import Words Of Worship songs
|
||||||
importer = self.plugin.importSongs(SongFormat.WordsOfWorship,
|
importer = self.plugin.importSongs(SongFormat.WordsOfWorship,
|
||||||
filenames=self.getListOfFiles(self.wordsOfWorshipFileListWidget)
|
filenames=self.getListOfFiles(
|
||||||
|
self.wordsOfWorshipFileListWidget)
|
||||||
)
|
)
|
||||||
elif source_format == SongFormat.CCLI:
|
elif source_format == SongFormat.CCLI:
|
||||||
# Import Words Of Worship songs
|
# Import Words Of Worship songs
|
||||||
@ -393,7 +386,8 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
|
|||||||
elif source_format == SongFormat.SongsOfFellowship:
|
elif source_format == SongFormat.SongsOfFellowship:
|
||||||
# Import a Songs of Fellowship RTF file
|
# Import a Songs of Fellowship RTF file
|
||||||
importer = self.plugin.importSongs(SongFormat.SongsOfFellowship,
|
importer = self.plugin.importSongs(SongFormat.SongsOfFellowship,
|
||||||
filenames=self.getListOfFiles(self.songsOfFellowshipFileListWidget)
|
filenames=self.getListOfFiles(
|
||||||
|
self.songsOfFellowshipFileListWidget)
|
||||||
)
|
)
|
||||||
elif source_format == SongFormat.Generic:
|
elif source_format == SongFormat.Generic:
|
||||||
# Import a generic document or presentatoin
|
# Import a generic document or presentatoin
|
||||||
@ -403,10 +397,10 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
|
|||||||
success = importer.do_import()
|
success = importer.do_import()
|
||||||
if success:
|
if success:
|
||||||
# reload songs
|
# reload songs
|
||||||
self.ImportProgressLabel.setText(
|
self.importProgressLabel.setText(
|
||||||
translate('SongsPlugin.SongImportForm', 'Finished import.'))
|
translate('SongsPlugin.SongImportForm', 'Finished import.'))
|
||||||
else:
|
else:
|
||||||
self.ImportProgressLabel.setText(
|
self.importProgressLabel.setText(
|
||||||
translate('SongsPlugin.SongImportForm',
|
translate('SongsPlugin.SongImportForm',
|
||||||
'Your song import failed.'))
|
'Your song import failed.'))
|
||||||
|
|
||||||
|
@ -237,9 +237,9 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
|
|
||||||
def onImportClick(self):
|
def onImportClick(self):
|
||||||
if not hasattr(self, u'import_wizard'):
|
if not hasattr(self, u'import_wizard'):
|
||||||
self.import_wizard = ImportWizardForm(self, self.parent.manager,
|
self.import_wizard = ImportWizardForm(self, self.parent)
|
||||||
self.parent)
|
|
||||||
self.import_wizard.exec_()
|
self.import_wizard.exec_()
|
||||||
|
Receiver.send_message(u'songs_load_list')
|
||||||
|
|
||||||
def onNewClick(self):
|
def onNewClick(self):
|
||||||
self.edit_song_form.newSong()
|
self.edit_song_form.newSong()
|
||||||
|
@ -28,19 +28,12 @@ import logging
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Plugin, build_icon, Receiver, translate
|
from openlp.core.lib import Plugin, build_icon, translate
|
||||||
from openlp.core.lib.db import Manager
|
from openlp.core.lib.db import Manager
|
||||||
from openlp.plugins.songs.lib import SongMediaItem, SongsTab
|
from openlp.plugins.songs.lib import SongMediaItem, SongsTab
|
||||||
from openlp.plugins.songs.lib.db import init_schema, Song
|
from openlp.plugins.songs.lib.db import init_schema, Song
|
||||||
from openlp.plugins.songs.lib.importer import SongFormat
|
from openlp.plugins.songs.lib.importer import SongFormat
|
||||||
|
|
||||||
#try:
|
|
||||||
# from openlp.plugins.songs.lib import SofImport, OooImport
|
|
||||||
# OOo_available = True
|
|
||||||
#except ImportError:
|
|
||||||
# OOo_available = False
|
|
||||||
#from openlp.plugins.songs.lib import OpenSongImport
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
class SongsPlugin(Plugin):
|
class SongsPlugin(Plugin):
|
||||||
@ -99,76 +92,6 @@ class SongsPlugin(Plugin):
|
|||||||
# Signals and slots
|
# Signals and slots
|
||||||
QtCore.QObject.connect(self.SongImportItem,
|
QtCore.QObject.connect(self.SongImportItem,
|
||||||
QtCore.SIGNAL(u'triggered()'), self.onSongImportItemClicked)
|
QtCore.SIGNAL(u'triggered()'), self.onSongImportItemClicked)
|
||||||
# if OOo_available:
|
|
||||||
# # Songs of Fellowship import menu item - will be removed and the
|
|
||||||
# # functionality will be contained within the import wizard
|
|
||||||
# self.ImportSofItem = QtGui.QAction(import_menu)
|
|
||||||
# self.ImportSofItem.setObjectName(u'ImportSofItem')
|
|
||||||
# self.ImportSofItem.setText(
|
|
||||||
# translate('SongsPlugin',
|
|
||||||
# 'Songs of Fellowship (temp menu item)'))
|
|
||||||
# self.ImportSofItem.setToolTip(
|
|
||||||
# translate('SongsPlugin',
|
|
||||||
# 'Import songs from the VOLS1_2.RTF, sof3words' \
|
|
||||||
# + '.rtf and sof4words.rtf supplied with the music books'))
|
|
||||||
# self.ImportSofItem.setStatusTip(
|
|
||||||
# translate('SongsPlugin',
|
|
||||||
# 'Import songs from the VOLS1_2.RTF, sof3words' \
|
|
||||||
# + '.rtf and sof4words.rtf supplied with the music books'))
|
|
||||||
# import_menu.addAction(self.ImportSofItem)
|
|
||||||
# # OpenOffice.org import menu item - will be removed and the
|
|
||||||
# # functionality will be contained within the import wizard
|
|
||||||
# self.ImportOooItem = QtGui.QAction(import_menu)
|
|
||||||
# self.ImportOooItem.setObjectName(u'ImportOooItem')
|
|
||||||
# self.ImportOooItem.setText(
|
|
||||||
# translate('SongsPlugin',
|
|
||||||
# 'Generic Document/Presentation Import '
|
|
||||||
# '(temp menu item)'))
|
|
||||||
# self.ImportOooItem.setToolTip(
|
|
||||||
# translate('SongsPlugin',
|
|
||||||
# 'Import songs from '
|
|
||||||
# 'Word/Writer/Powerpoint/Impress'))
|
|
||||||
# self.ImportOooItem.setStatusTip(
|
|
||||||
# translate('SongsPlugin',
|
|
||||||
# 'Import songs from '
|
|
||||||
# 'Word/Writer/Powerpoint/Impress'))
|
|
||||||
# import_menu.addAction(self.ImportOooItem)
|
|
||||||
# # Signals and slots
|
|
||||||
# QtCore.QObject.connect(self.ImportSofItem,
|
|
||||||
# QtCore.SIGNAL(u'triggered()'), self.onImportSofItemClick)
|
|
||||||
# QtCore.QObject.connect(self.ImportOooItem,
|
|
||||||
# QtCore.SIGNAL(u'triggered()'), self.onImportOooItemClick)
|
|
||||||
# # OpenSong import menu item - will be removed and the
|
|
||||||
# # functionality will be contained within the import wizard
|
|
||||||
# self.ImportOpenSongItem = QtGui.QAction(import_menu)
|
|
||||||
# self.ImportOpenSongItem.setObjectName(u'ImportOpenSongItem')
|
|
||||||
# self.ImportOpenSongItem.setText(
|
|
||||||
# translate('SongsPlugin',
|
|
||||||
# 'OpenSong (temp menu item)'))
|
|
||||||
# self.ImportOpenSongItem.setToolTip(
|
|
||||||
# translate('SongsPlugin',
|
|
||||||
# 'Import songs from OpenSong files' +
|
|
||||||
# '(either raw text or ZIPfiles)'))
|
|
||||||
# self.ImportOpenSongItem.setStatusTip(
|
|
||||||
# translate('SongsPlugin',
|
|
||||||
# 'Import songs from OpenSong files' +
|
|
||||||
# '(either raw text or ZIPfiles)'))
|
|
||||||
# import_menu.addAction(self.ImportOpenSongItem)
|
|
||||||
# QtCore.QObject.connect(self.ImportOpenSongItem,
|
|
||||||
# QtCore.SIGNAL(u'triggered()'), self.onImportOpenSongItemClick)
|
|
||||||
# # OpenLP v2 import menu item - ditto above regarding refactoring into
|
|
||||||
# # an import wizard
|
|
||||||
# self.ImportOpenLPSongItem = QtGui.QAction(import_menu)
|
|
||||||
# self.ImportOpenLPSongItem.setObjectName(u'ImportOpenLPSongItem')
|
|
||||||
# self.ImportOpenLPSongItem.setText(translate('SongsPlugin',
|
|
||||||
# 'OpenLP v2 Songs (temporary)'))
|
|
||||||
# self.ImportOpenLPSongItem.setToolTip(translate('SongsPlugin',
|
|
||||||
# 'Import an OpenLP v2 song database'))
|
|
||||||
# self.ImportOpenLPSongItem.setStatusTip(translate('SongsPlugin',
|
|
||||||
# 'Import an OpenLP v2 song database'))
|
|
||||||
# import_menu.addAction(self.ImportOpenLPSongItem)
|
|
||||||
# QtCore.QObject.connect(self.ImportOpenLPSongItem,
|
|
||||||
# QtCore.SIGNAL(u'triggered()'), self.onImportOpenLPSongItemClick)
|
|
||||||
|
|
||||||
def addExportMenuItem(self, export_menu):
|
def addExportMenuItem(self, export_menu):
|
||||||
"""
|
"""
|
||||||
@ -186,68 +109,6 @@ class SongsPlugin(Plugin):
|
|||||||
if self.mediaItem:
|
if self.mediaItem:
|
||||||
self.mediaItem.onImportClick()
|
self.mediaItem.onImportClick()
|
||||||
|
|
||||||
# def onImportSofItemClick(self):
|
|
||||||
# filenames = QtGui.QFileDialog.getOpenFileNames(
|
|
||||||
# None, translate('SongsPlugin',
|
|
||||||
# 'Open Songs of Fellowship file'),
|
|
||||||
# u'', u'Songs of Fellowship file (*.rtf *.RTF)')
|
|
||||||
# try:
|
|
||||||
# for filename in filenames:
|
|
||||||
# sofimport = SofImport(self.manager)
|
|
||||||
# sofimport.import_sof(unicode(filename))
|
|
||||||
# except:
|
|
||||||
# log.exception('Could not import SoF file')
|
|
||||||
# QtGui.QMessageBox.critical(None,
|
|
||||||
# translate('SongsPlugin', 'Import Error'),
|
|
||||||
# translate('SongsPlugin', 'Error importing Songs of '
|
|
||||||
# 'Fellowship file.\nOpenOffice.org must be installed'
|
|
||||||
# ' and you must be using an unedited copy of the RTF'
|
|
||||||
# ' included with the Songs of Fellowship Music Editions'))
|
|
||||||
# Receiver.send_message(u'songs_load_list')
|
|
||||||
#
|
|
||||||
# def onImportOpenSongItemClick(self):
|
|
||||||
# filenames = QtGui.QFileDialog.getOpenFileNames(
|
|
||||||
# None, translate('SongsPlugin',
|
|
||||||
# 'Open OpenSong file'),
|
|
||||||
# u'', u'All files (*.*)')
|
|
||||||
# try:
|
|
||||||
# for filename in filenames:
|
|
||||||
# importer = OpenSongImport(self.manager)
|
|
||||||
# importer.do_import(unicode(filename))
|
|
||||||
# except:
|
|
||||||
# log.exception('Could not import OpenSong file')
|
|
||||||
# QtGui.QMessageBox.critical(None,
|
|
||||||
# translate('SongsPlugin', 'Import Error'),
|
|
||||||
# translate('SongsPlugin', 'Error importing OpenSong file'))
|
|
||||||
# Receiver.send_message(u'songs_load_list')
|
|
||||||
#
|
|
||||||
# def onImportOpenLPSongItemClick(self):
|
|
||||||
# filenames = QtGui.QFileDialog.getOpenFileNames(None,
|
|
||||||
# translate('SongsPlugin', 'Select OpenLP database(s) to import...'),
|
|
||||||
# u'', u'OpenLP databases (*.sqlite);;All Files (*)')
|
|
||||||
# try:
|
|
||||||
# for filename in filenames:
|
|
||||||
# db_url = u'sqlite:///%s' % filename
|
|
||||||
# importer = OpenLPSongImport(self.manager, db_url)
|
|
||||||
# importer.import_source_v2_db()
|
|
||||||
# QtGui.QMessageBox.information(None, translate('SongsPlugin',
|
|
||||||
# 'Database(s) imported'), translate('SongsPlugin', 'Your '
|
|
||||||
# 'OpenLP v2 song databases have been successfully imported'))
|
|
||||||
# except:
|
|
||||||
# log.exception(u'Failed to import OpenLP v2 database(s)')
|
|
||||||
# QtGui.QMessageBox.critical(None, translate('SongsPlugin',
|
|
||||||
# 'Import Error'), translate('SongsPlugin',
|
|
||||||
# 'Error importing OpenLP v2 database(s)'))
|
|
||||||
# Receiver.send_message(u'songs_load_list')
|
|
||||||
#
|
|
||||||
# def onImportOooItemClick(self):
|
|
||||||
# filenames = QtGui.QFileDialog.getOpenFileNames(
|
|
||||||
# None, translate('SongsPlugin', 'Open documents or presentations'),
|
|
||||||
# '', u'All Files(*.*)')
|
|
||||||
# oooimport = OooImport(self.manager)
|
|
||||||
# oooimport.import_docs(filenames)
|
|
||||||
# Receiver.send_message(u'songs_load_list')
|
|
||||||
|
|
||||||
def about(self):
|
def about(self):
|
||||||
about_text = translate('SongsPlugin', '<strong>Songs Plugin</strong>'
|
about_text = translate('SongsPlugin', '<strong>Songs Plugin</strong>'
|
||||||
'<br />The songs plugin provides the ability to display and '
|
'<br />The songs plugin provides the ability to display and '
|
||||||
|
Loading…
Reference in New Issue
Block a user