forked from openlp/openlp
Merge trunk
This commit is contained in:
commit
2296be7418
@ -59,7 +59,6 @@ class Renderer(OpenLPMixin, RegistryMixin, RegistryProperties):
|
|||||||
"""
|
"""
|
||||||
super(Renderer, self).__init__(None)
|
super(Renderer, self).__init__(None)
|
||||||
# Need live behaviour if this is also working as a pseudo MainDisplay.
|
# Need live behaviour if this is also working as a pseudo MainDisplay.
|
||||||
self.is_live = True
|
|
||||||
self.screens = ScreenList()
|
self.screens = ScreenList()
|
||||||
self.theme_level = ThemeLevel.Global
|
self.theme_level = ThemeLevel.Global
|
||||||
self.global_theme_name = ''
|
self.global_theme_name = ''
|
||||||
|
@ -66,11 +66,8 @@ class Display(QtGui.QGraphicsView):
|
|||||||
if hasattr(parent, 'is_live') and parent.is_live:
|
if hasattr(parent, 'is_live') and parent.is_live:
|
||||||
self.is_live = True
|
self.is_live = True
|
||||||
if self.is_live:
|
if self.is_live:
|
||||||
super(Display, self).__init__()
|
|
||||||
# Overwrite the parent() method.
|
|
||||||
self.parent = lambda: parent
|
self.parent = lambda: parent
|
||||||
else:
|
super(Display, self).__init__()
|
||||||
super(Display, self).__init__(parent)
|
|
||||||
self.controller = parent
|
self.controller = parent
|
||||||
self.screen = {}
|
self.screen = {}
|
||||||
# FIXME: On Mac OS X (tested on 10.7) the display screen is corrupt with
|
# FIXME: On Mac OS X (tested on 10.7) the display screen is corrupt with
|
||||||
|
@ -149,9 +149,9 @@ def get_application_version():
|
|||||||
# If they are equal, then this tree is tarball with the source for the release. We do not want the revision
|
# If they are equal, then this tree is tarball with the source for the release. We do not want the revision
|
||||||
# number in the full version.
|
# number in the full version.
|
||||||
if tree_revision == tag_revision:
|
if tree_revision == tag_revision:
|
||||||
full_version = tag_version
|
full_version = tag_version.decode('utf-8')
|
||||||
else:
|
else:
|
||||||
full_version = '%s-bzr%s' % (tag_version, tree_revision)
|
full_version = '%s-bzr%s' % (tag_version.decode('utf-8'), tree_revision.decode('utf-8'))
|
||||||
else:
|
else:
|
||||||
# We're not running the development version, let's use the file.
|
# We're not running the development version, let's use the file.
|
||||||
filepath = AppLocation.get_directory(AppLocation.VersionDir)
|
filepath = AppLocation.get_directory(AppLocation.VersionDir)
|
||||||
|
@ -40,6 +40,8 @@ if os.name == 'nt':
|
|||||||
import pywintypes
|
import pywintypes
|
||||||
|
|
||||||
from openlp.core.lib import ScreenList
|
from openlp.core.lib import ScreenList
|
||||||
|
from openlp.core.lib.ui import UiStrings, critical_error_message_box, translate
|
||||||
|
from openlp.core.common import trace_error_handler
|
||||||
from .presentationcontroller import PresentationController, PresentationDocument
|
from .presentationcontroller import PresentationController, PresentationDocument
|
||||||
|
|
||||||
|
|
||||||
@ -99,7 +101,7 @@ class PowerpointController(PresentationController):
|
|||||||
if self.process.Presentations.Count > 0:
|
if self.process.Presentations.Count > 0:
|
||||||
return
|
return
|
||||||
self.process.Quit()
|
self.process.Quit()
|
||||||
except pywintypes.com_error:
|
except (AttributeError, pywintypes.com_error):
|
||||||
pass
|
pass
|
||||||
self.process = None
|
self.process = None
|
||||||
|
|
||||||
@ -126,16 +128,24 @@ class PowerpointDocument(PresentationDocument):
|
|||||||
earlier.
|
earlier.
|
||||||
"""
|
"""
|
||||||
log.debug('load_presentation')
|
log.debug('load_presentation')
|
||||||
if not self.controller.process or not self.controller.process.Visible:
|
|
||||||
self.controller.start_process()
|
|
||||||
try:
|
try:
|
||||||
|
if not self.controller.process or not self.controller.process.Visible:
|
||||||
|
self.controller.start_process()
|
||||||
self.controller.process.Presentations.Open(self.file_path, False, False, True)
|
self.controller.process.Presentations.Open(self.file_path, False, False, True)
|
||||||
|
self.presentation = self.controller.process.Presentations(self.controller.process.Presentations.Count)
|
||||||
|
self.create_thumbnails()
|
||||||
|
# Powerpoint 2013 pops up when loading a file, so we minimize it again
|
||||||
|
if self.presentation.Application.Version == u'15.0':
|
||||||
|
try:
|
||||||
|
self.presentation.Application.WindowState = 2
|
||||||
|
except:
|
||||||
|
log.error('Failed to minimize main powerpoint window')
|
||||||
|
trace_error_handler(log)
|
||||||
|
return True
|
||||||
except pywintypes.com_error:
|
except pywintypes.com_error:
|
||||||
log.debug('PPT open failed')
|
log.error('PPT open failed')
|
||||||
|
trace_error_handler(log)
|
||||||
return False
|
return False
|
||||||
self.presentation = self.controller.process.Presentations(self.controller.process.Presentations.Count)
|
|
||||||
self.create_thumbnails()
|
|
||||||
return True
|
|
||||||
|
|
||||||
def create_thumbnails(self):
|
def create_thumbnails(self):
|
||||||
"""
|
"""
|
||||||
@ -206,23 +216,33 @@ class PowerpointDocument(PresentationDocument):
|
|||||||
Unblanks (restores) the presentation.
|
Unblanks (restores) the presentation.
|
||||||
"""
|
"""
|
||||||
log.debug('unblank_screen')
|
log.debug('unblank_screen')
|
||||||
self.presentation.SlideShowSettings.Run()
|
try:
|
||||||
self.presentation.SlideShowWindow.View.State = 1
|
self.presentation.SlideShowSettings.Run()
|
||||||
self.presentation.SlideShowWindow.Activate()
|
self.presentation.SlideShowWindow.View.State = 1
|
||||||
if self.presentation.Application.Version == '14.0':
|
self.presentation.SlideShowWindow.Activate()
|
||||||
# Unblanking is broken in PowerPoint 2010, need to redisplay
|
if self.presentation.Application.Version == '14.0':
|
||||||
slide = self.presentation.SlideShowWindow.View.CurrentShowPosition
|
# Unblanking is broken in PowerPoint 2010, need to redisplay
|
||||||
click = self.presentation.SlideShowWindow.View.GetClickIndex()
|
slide = self.presentation.SlideShowWindow.View.CurrentShowPosition
|
||||||
self.presentation.SlideShowWindow.View.GotoSlide(slide)
|
click = self.presentation.SlideShowWindow.View.GetClickIndex()
|
||||||
if click:
|
self.presentation.SlideShowWindow.View.GotoSlide(slide)
|
||||||
self.presentation.SlideShowWindow.View.GotoClick(click)
|
if click:
|
||||||
|
self.presentation.SlideShowWindow.View.GotoClick(click)
|
||||||
|
except pywintypes.com_error:
|
||||||
|
log.error('COM error while in unblank_screen')
|
||||||
|
trace_error_handler(log)
|
||||||
|
self.show_error_msg()
|
||||||
|
|
||||||
def blank_screen(self):
|
def blank_screen(self):
|
||||||
"""
|
"""
|
||||||
Blanks the screen.
|
Blanks the screen.
|
||||||
"""
|
"""
|
||||||
log.debug('blank_screen')
|
log.debug('blank_screen')
|
||||||
self.presentation.SlideShowWindow.View.State = 3
|
try:
|
||||||
|
self.presentation.SlideShowWindow.View.State = 3
|
||||||
|
except pywintypes.com_error:
|
||||||
|
log.error('COM error while in blank_screen')
|
||||||
|
trace_error_handler(log)
|
||||||
|
self.show_error_msg()
|
||||||
|
|
||||||
def is_blank(self):
|
def is_blank(self):
|
||||||
"""
|
"""
|
||||||
@ -230,7 +250,12 @@ class PowerpointDocument(PresentationDocument):
|
|||||||
"""
|
"""
|
||||||
log.debug('is_blank')
|
log.debug('is_blank')
|
||||||
if self.is_active():
|
if self.is_active():
|
||||||
return self.presentation.SlideShowWindow.View.State == 3
|
try:
|
||||||
|
return self.presentation.SlideShowWindow.View.State == 3
|
||||||
|
except pywintypes.com_error:
|
||||||
|
log.error('COM error while in is_blank')
|
||||||
|
trace_error_handler(log)
|
||||||
|
self.show_error_msg()
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -239,7 +264,12 @@ class PowerpointDocument(PresentationDocument):
|
|||||||
Stops the current presentation and hides the output.
|
Stops the current presentation and hides the output.
|
||||||
"""
|
"""
|
||||||
log.debug('stop_presentation')
|
log.debug('stop_presentation')
|
||||||
self.presentation.SlideShowWindow.View.Exit()
|
try:
|
||||||
|
self.presentation.SlideShowWindow.View.Exit()
|
||||||
|
except pywintypes.com_error:
|
||||||
|
log.error('COM error while in stop_presentation')
|
||||||
|
trace_error_handler(log)
|
||||||
|
self.show_error_msg()
|
||||||
|
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
def start_presentation(self):
|
def start_presentation(self):
|
||||||
@ -259,24 +289,49 @@ class PowerpointDocument(PresentationDocument):
|
|||||||
ppt_window = self.presentation.SlideShowSettings.Run()
|
ppt_window = self.presentation.SlideShowSettings.Run()
|
||||||
if not ppt_window:
|
if not ppt_window:
|
||||||
return
|
return
|
||||||
ppt_window.Top = size.y() * 72 / dpi
|
try:
|
||||||
ppt_window.Height = size.height() * 72 / dpi
|
ppt_window.Top = size.y() * 72 / dpi
|
||||||
ppt_window.Left = size.x() * 72 / dpi
|
ppt_window.Height = size.height() * 72 / dpi
|
||||||
ppt_window.Width = size.width() * 72 / dpi
|
ppt_window.Left = size.x() * 72 / dpi
|
||||||
|
ppt_window.Width = size.width() * 72 / dpi
|
||||||
|
except AttributeError as e:
|
||||||
|
log.error('AttributeError while in start_presentation')
|
||||||
|
log.error(e)
|
||||||
|
# Powerpoint 2013 pops up when starting a file, so we minimize it again
|
||||||
|
if self.presentation.Application.Version == u'15.0':
|
||||||
|
try:
|
||||||
|
self.presentation.Application.WindowState = 2
|
||||||
|
except:
|
||||||
|
log.error('Failed to minimize main powerpoint window')
|
||||||
|
trace_error_handler(log)
|
||||||
|
|
||||||
def get_slide_number(self):
|
def get_slide_number(self):
|
||||||
"""
|
"""
|
||||||
Returns the current slide number.
|
Returns the current slide number.
|
||||||
"""
|
"""
|
||||||
log.debug('get_slide_number')
|
log.debug('get_slide_number')
|
||||||
return self.presentation.SlideShowWindow.View.CurrentShowPosition
|
ret = 0
|
||||||
|
try:
|
||||||
|
ret = self.presentation.SlideShowWindow.View.CurrentShowPosition
|
||||||
|
except pywintypes.com_error:
|
||||||
|
log.error('COM error while in get_slide_number')
|
||||||
|
trace_error_handler(log)
|
||||||
|
self.show_error_msg()
|
||||||
|
return ret
|
||||||
|
|
||||||
def get_slide_count(self):
|
def get_slide_count(self):
|
||||||
"""
|
"""
|
||||||
Returns total number of slides.
|
Returns total number of slides.
|
||||||
"""
|
"""
|
||||||
log.debug('get_slide_count')
|
log.debug('get_slide_count')
|
||||||
return self.presentation.Slides.Count
|
ret = 0
|
||||||
|
try:
|
||||||
|
ret = self.presentation.Slides.Count
|
||||||
|
except pywintypes.com_error:
|
||||||
|
log.error('COM error while in get_slide_count')
|
||||||
|
trace_error_handler(log)
|
||||||
|
self.show_error_msg()
|
||||||
|
return ret
|
||||||
|
|
||||||
def goto_slide(self, slide_no):
|
def goto_slide(self, slide_no):
|
||||||
"""
|
"""
|
||||||
@ -285,14 +340,25 @@ class PowerpointDocument(PresentationDocument):
|
|||||||
:param slide_no: The slide the text is required for, starting at 1
|
:param slide_no: The slide the text is required for, starting at 1
|
||||||
"""
|
"""
|
||||||
log.debug('goto_slide')
|
log.debug('goto_slide')
|
||||||
self.presentation.SlideShowWindow.View.GotoSlide(slide_no)
|
try:
|
||||||
|
self.presentation.SlideShowWindow.View.GotoSlide(slide_no)
|
||||||
|
except pywintypes.com_error:
|
||||||
|
log.error('COM error while in goto_slide')
|
||||||
|
trace_error_handler(log)
|
||||||
|
self.show_error_msg()
|
||||||
|
|
||||||
def next_step(self):
|
def next_step(self):
|
||||||
"""
|
"""
|
||||||
Triggers the next effect of slide on the running presentation.
|
Triggers the next effect of slide on the running presentation.
|
||||||
"""
|
"""
|
||||||
log.debug('next_step')
|
log.debug('next_step')
|
||||||
self.presentation.SlideShowWindow.View.Next()
|
try:
|
||||||
|
self.presentation.SlideShowWindow.View.Next()
|
||||||
|
except pywintypes.com_error:
|
||||||
|
log.error('COM error while in next_step')
|
||||||
|
trace_error_handler(log)
|
||||||
|
self.show_error_msg()
|
||||||
|
return
|
||||||
if self.get_slide_number() > self.get_slide_count():
|
if self.get_slide_number() > self.get_slide_count():
|
||||||
self.previous_step()
|
self.previous_step()
|
||||||
|
|
||||||
@ -301,7 +367,12 @@ class PowerpointDocument(PresentationDocument):
|
|||||||
Triggers the previous slide on the running presentation.
|
Triggers the previous slide on the running presentation.
|
||||||
"""
|
"""
|
||||||
log.debug('previous_step')
|
log.debug('previous_step')
|
||||||
self.presentation.SlideShowWindow.View.Previous()
|
try:
|
||||||
|
self.presentation.SlideShowWindow.View.Previous()
|
||||||
|
except pywintypes.com_error:
|
||||||
|
log.error('COM error while in previous_step')
|
||||||
|
trace_error_handler(log)
|
||||||
|
self.show_error_msg()
|
||||||
|
|
||||||
def get_slide_text(self, slide_no):
|
def get_slide_text(self, slide_no):
|
||||||
"""
|
"""
|
||||||
@ -319,6 +390,16 @@ class PowerpointDocument(PresentationDocument):
|
|||||||
"""
|
"""
|
||||||
return _get_text_from_shapes(self.presentation.Slides(slide_no).NotesPage.Shapes)
|
return _get_text_from_shapes(self.presentation.Slides(slide_no).NotesPage.Shapes)
|
||||||
|
|
||||||
|
def show_error_msg(self):
|
||||||
|
"""
|
||||||
|
Stop presentation and display an error message.
|
||||||
|
"""
|
||||||
|
self.stop_presentation()
|
||||||
|
critical_error_message_box(UiStrings().Error, translate('PresentationPlugin.PowerpointDocument',
|
||||||
|
'An error occurred in the Powerpoint integration '
|
||||||
|
'and the presentation will be stopped. '
|
||||||
|
'Restart the presentation if you wish to present it.'))
|
||||||
|
|
||||||
|
|
||||||
def _get_text_from_shapes(shapes):
|
def _get_text_from_shapes(shapes):
|
||||||
"""
|
"""
|
||||||
|
@ -44,7 +44,7 @@ from openlp.core.lib.ui import set_case_insensitive_completer, critical_error_me
|
|||||||
from openlp.plugins.songs.lib import VerseType, clean_song
|
from openlp.plugins.songs.lib import VerseType, clean_song
|
||||||
from openlp.plugins.songs.lib.db import Book, Song, Author, AuthorType, Topic, MediaFile
|
from openlp.plugins.songs.lib.db import Book, Song, Author, AuthorType, Topic, MediaFile
|
||||||
from openlp.plugins.songs.lib.ui import SongStrings
|
from openlp.plugins.songs.lib.ui import SongStrings
|
||||||
from openlp.plugins.songs.lib.xml import SongXML
|
from openlp.plugins.songs.lib.openlyricsxml import SongXML
|
||||||
from openlp.plugins.songs.forms.editsongdialog import Ui_EditSongDialog
|
from openlp.plugins.songs.forms.editsongdialog import Ui_EditSongDialog
|
||||||
from openlp.plugins.songs.forms.editverseform import EditVerseForm
|
from openlp.plugins.songs.forms.editverseform import EditVerseForm
|
||||||
from openlp.plugins.songs.forms.mediafilesform import MediaFilesForm
|
from openlp.plugins.songs.forms.mediafilesform import MediaFilesForm
|
||||||
|
@ -33,7 +33,7 @@ from PyQt4 import QtCore, QtGui
|
|||||||
|
|
||||||
from openlp.core.lib import build_icon
|
from openlp.core.lib import build_icon
|
||||||
from openlp.plugins.songs.lib import VerseType
|
from openlp.plugins.songs.lib import VerseType
|
||||||
from openlp.plugins.songs.lib.xml import SongXML
|
from openlp.plugins.songs.lib.openlyricsxml import SongXML
|
||||||
|
|
||||||
|
|
||||||
class SongReviewWidget(QtGui.QWidget):
|
class SongReviewWidget(QtGui.QWidget):
|
||||||
|
@ -34,36 +34,38 @@ import logging
|
|||||||
|
|
||||||
from openlp.core.common import translate, UiStrings
|
from openlp.core.common import translate, UiStrings
|
||||||
from openlp.core.ui.wizard import WizardStrings
|
from openlp.core.ui.wizard import WizardStrings
|
||||||
from .opensongimport import OpenSongImport
|
|
||||||
from .easyslidesimport import EasySlidesImport
|
from .importers.opensong import OpenSongImport
|
||||||
from .olpimport import OpenLPSongImport
|
from .importers.easyslides import EasySlidesImport
|
||||||
from .openlyricsimport import OpenLyricsImport
|
from .importers.openlp import OpenLPSongImport
|
||||||
from .wowimport import WowImport
|
from .importers.openlyrics import OpenLyricsImport
|
||||||
from .cclifileimport import CCLIFileImport
|
from .importers.wordsofworship import WordsOfWorshipImport
|
||||||
from .dreambeamimport import DreamBeamImport
|
from .importers.cclifile import CCLIFileImport
|
||||||
from .powersongimport import PowerSongImport
|
from .importers.dreambeam import DreamBeamImport
|
||||||
from .ewimport import EasyWorshipSongImport
|
from .importers.powersong import PowerSongImport
|
||||||
from .songbeamerimport import SongBeamerImport
|
from .importers.easyworship import EasyWorshipSongImport
|
||||||
from .songshowplusimport import SongShowPlusImport
|
from .importers.songbeamer import SongBeamerImport
|
||||||
from .songproimport import SongProImport
|
from .importers.songshowplus import SongShowPlusImport
|
||||||
from .sundayplusimport import SundayPlusImport
|
from .importers.songpro import SongProImport
|
||||||
from .foilpresenterimport import FoilPresenterImport
|
from .importers.sundayplus import SundayPlusImport
|
||||||
from .zionworximport import ZionWorxImport
|
from .importers.foilpresenter import FoilPresenterImport
|
||||||
from .propresenterimport import ProPresenterImport
|
from .importers.zionworx import ZionWorxImport
|
||||||
from .worshipassistantimport import WorshipAssistantImport
|
from .importers.propresenter import ProPresenterImport
|
||||||
from .presentationmanagerimport import PresentationManagerImport
|
from .importers.worshipassistant import WorshipAssistantImport
|
||||||
|
from .importers.presentationmanager import PresentationManagerImport
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
# Imports that might fail
|
# Imports that might fail
|
||||||
try:
|
try:
|
||||||
from .sofimport import SofImport
|
from .importers.songsoffellowship import SongsOfFellowshipImport
|
||||||
HAS_SOF = True
|
HAS_SOF = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
log.exception('Error importing %s', 'SofImport')
|
log.exception('Error importing %s', 'SongsOfFellowshipImport')
|
||||||
HAS_SOF = False
|
HAS_SOF = False
|
||||||
try:
|
try:
|
||||||
from .oooimport import OooImport
|
from .importers.openoffice import OpenOfficeImport
|
||||||
HAS_OOO = True
|
HAS_OOO = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
log.exception('Error importing %s', 'OooImport')
|
log.exception('Error importing %s', 'OooImport')
|
||||||
@ -71,14 +73,14 @@ except ImportError:
|
|||||||
HAS_MEDIASHOUT = False
|
HAS_MEDIASHOUT = False
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
try:
|
try:
|
||||||
from .mediashoutimport import MediaShoutImport
|
from .importers.mediashout import MediaShoutImport
|
||||||
HAS_MEDIASHOUT = True
|
HAS_MEDIASHOUT = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
log.exception('Error importing %s', 'MediaShoutImport')
|
log.exception('Error importing %s', 'MediaShoutImport')
|
||||||
HAS_WORSHIPCENTERPRO = False
|
HAS_WORSHIPCENTERPRO = False
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
try:
|
try:
|
||||||
from .worshipcenterproimport import WorshipCenterProImport
|
from .importers.worshipcenterpro import WorshipCenterProImport
|
||||||
HAS_WORSHIPCENTERPRO = True
|
HAS_WORSHIPCENTERPRO = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
log.exception('Error importing %s', 'WorshipCenterProImport')
|
log.exception('Error importing %s', 'WorshipCenterProImport')
|
||||||
@ -108,7 +110,7 @@ class SongFormat(object):
|
|||||||
Name of the format, e.g. ``'OpenLyrics'``
|
Name of the format, e.g. ``'OpenLyrics'``
|
||||||
|
|
||||||
``'prefix'``
|
``'prefix'``
|
||||||
Prefix for Qt objects. Use mixedCase, e.g. ``'open_lyrics'``
|
Prefix for Qt objects. Use mixedCase, e.g. ``'openLyrics'``
|
||||||
See ``SongImportForm.add_file_select_item()``
|
See ``SongImportForm.add_file_select_item()``
|
||||||
|
|
||||||
Optional attributes for each song format:
|
Optional attributes for each song format:
|
||||||
@ -190,7 +192,7 @@ class SongFormat(object):
|
|||||||
OpenLyrics: {
|
OpenLyrics: {
|
||||||
'class': OpenLyricsImport,
|
'class': OpenLyricsImport,
|
||||||
'name': 'OpenLyrics',
|
'name': 'OpenLyrics',
|
||||||
'prefix': 'open_lyrics',
|
'prefix': 'openLyrics',
|
||||||
'filter': '%s (*.xml)' % translate('SongsPlugin.ImportWizardForm', 'OpenLyrics Files'),
|
'filter': '%s (*.xml)' % translate('SongsPlugin.ImportWizardForm', 'OpenLyrics Files'),
|
||||||
'comboBoxText': translate('SongsPlugin.ImportWizardForm', 'OpenLyrics or OpenLP 2.0 Exported Song')
|
'comboBoxText': translate('SongsPlugin.ImportWizardForm', 'OpenLyrics or OpenLP 2.0 Exported Song')
|
||||||
},
|
},
|
||||||
@ -324,7 +326,7 @@ class SongFormat(object):
|
|||||||
'filter': '%s (*.ptf)' % translate('SongsPlugin.ImportWizardForm', 'SundayPlus Song Files')
|
'filter': '%s (*.ptf)' % translate('SongsPlugin.ImportWizardForm', 'SundayPlus Song Files')
|
||||||
},
|
},
|
||||||
WordsOfWorship: {
|
WordsOfWorship: {
|
||||||
'class': WowImport,
|
'class': WordsOfWorshipImport,
|
||||||
'name': 'Words of Worship',
|
'name': 'Words of Worship',
|
||||||
'prefix': 'wordsOfWorship',
|
'prefix': 'wordsOfWorship',
|
||||||
'filter': '%s (*.wsg *.wow-song)' % translate('SongsPlugin.ImportWizardForm', 'Words Of Worship Song Files')
|
'filter': '%s (*.wsg *.wow-song)' % translate('SongsPlugin.ImportWizardForm', 'Words Of Worship Song Files')
|
||||||
@ -430,10 +432,10 @@ class SongFormat(object):
|
|||||||
|
|
||||||
SongFormat.set(SongFormat.SongsOfFellowship, 'availability', HAS_SOF)
|
SongFormat.set(SongFormat.SongsOfFellowship, 'availability', HAS_SOF)
|
||||||
if HAS_SOF:
|
if HAS_SOF:
|
||||||
SongFormat.set(SongFormat.SongsOfFellowship, 'class', SofImport)
|
SongFormat.set(SongFormat.SongsOfFellowship, 'class', SongsOfFellowshipImport)
|
||||||
SongFormat.set(SongFormat.Generic, 'availability', HAS_OOO)
|
SongFormat.set(SongFormat.Generic, 'availability', HAS_OOO)
|
||||||
if HAS_OOO:
|
if HAS_OOO:
|
||||||
SongFormat.set(SongFormat.Generic, 'class', OooImport)
|
SongFormat.set(SongFormat.Generic, 'class', OpenOfficeImport)
|
||||||
SongFormat.set(SongFormat.MediaShout, 'availability', HAS_MEDIASHOUT)
|
SongFormat.set(SongFormat.MediaShout, 'availability', HAS_MEDIASHOUT)
|
||||||
if HAS_MEDIASHOUT:
|
if HAS_MEDIASHOUT:
|
||||||
SongFormat.set(SongFormat.MediaShout, 'class', MediaShoutImport)
|
SongFormat.set(SongFormat.MediaShout, 'class', MediaShoutImport)
|
||||||
|
31
openlp/plugins/songs/lib/importers/__init__.py
Normal file
31
openlp/plugins/songs/lib/importers/__init__.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# Copyright (c) 2008-2014 Raoul Snyman #
|
||||||
|
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
|
||||||
|
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
|
||||||
|
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
|
||||||
|
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
|
||||||
|
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
|
||||||
|
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
|
||||||
|
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# 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:`~openlp.plugins.songs.lib.import` module contains importers for the Songs plugin.
|
||||||
|
"""
|
@ -27,15 +27,14 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
The :mod:`dreambeamimport` module provides the functionality for importing
|
The :mod:`dreambeam` module provides the functionality for importing DreamBeam songs into the OpenLP database.
|
||||||
DreamBeam songs into the OpenLP database.
|
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from lxml import etree, objectify
|
from lxml import etree, objectify
|
||||||
|
|
||||||
from openlp.core.lib import translate
|
from openlp.core.lib import translate
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.importers.songimport import SongImport
|
||||||
from openlp.plugins.songs.lib.ui import SongStrings
|
from openlp.plugins.songs.lib.ui import SongStrings
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
@ -33,7 +33,7 @@ import re
|
|||||||
from lxml import etree, objectify
|
from lxml import etree, objectify
|
||||||
|
|
||||||
from openlp.plugins.songs.lib import VerseType
|
from openlp.plugins.songs.lib import VerseType
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.importers.songimport import SongImport
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
@ -27,8 +27,7 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
The :mod:`ewimport` module provides the functionality for importing
|
The :mod:`easyworship` module provides the functionality for importing EasyWorship song databases into OpenLP.
|
||||||
EasyWorship song databases into the current installation database.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
@ -99,10 +99,10 @@ from lxml import etree, objectify
|
|||||||
from openlp.core.lib import translate
|
from openlp.core.lib import translate
|
||||||
from openlp.core.ui.wizard import WizardStrings
|
from openlp.core.ui.wizard import WizardStrings
|
||||||
from openlp.plugins.songs.lib import clean_song, VerseType
|
from openlp.plugins.songs.lib import clean_song, VerseType
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.importers.songimport import SongImport
|
||||||
from openlp.plugins.songs.lib.db import Author, Book, Song, Topic
|
from openlp.plugins.songs.lib.db import Author, Book, Song, Topic
|
||||||
from openlp.plugins.songs.lib.ui import SongStrings
|
from openlp.plugins.songs.lib.ui import SongStrings
|
||||||
from openlp.plugins.songs.lib.xml import SongXML
|
from openlp.plugins.songs.lib.openlyricsxml import SongXML
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
@ -27,13 +27,13 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
The :mod:`mediashoutimport` module provides the functionality for importing
|
The :mod:`mediashout` module provides the functionality for importing
|
||||||
a MediaShout database into the OpenLP database.
|
a MediaShout database into the OpenLP database.
|
||||||
"""
|
"""
|
||||||
import pyodbc
|
import pyodbc
|
||||||
|
|
||||||
from openlp.core.lib import translate
|
from openlp.core.lib import translate
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.importers.songimport import SongImport
|
||||||
|
|
||||||
VERSE_TAGS = ['V', 'C', 'B', 'O', 'P', 'I', 'E']
|
VERSE_TAGS = ['V', 'C', 'B', 'O', 'P', 'I', 'E']
|
||||||
|
|
@ -27,7 +27,7 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
The :mod:`olpimport` module provides the functionality for importing OpenLP
|
The :mod:`openlp` module provides the functionality for importing OpenLP
|
||||||
song databases into the current installation database.
|
song databases into the current installation database.
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
@ -27,7 +27,7 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
The :mod:`openlyricsimport` module provides the functionality for importing
|
The :mod:`openlyrics` module provides the functionality for importing
|
||||||
songs which are saved as OpenLyrics files.
|
songs which are saved as OpenLyrics files.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -37,9 +37,9 @@ import os
|
|||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
from openlp.core.ui.wizard import WizardStrings
|
from openlp.core.ui.wizard import WizardStrings
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.importers.songimport import SongImport
|
||||||
from openlp.plugins.songs.lib.ui import SongStrings
|
from openlp.plugins.songs.lib.ui import SongStrings
|
||||||
from openlp.plugins.songs.lib.xml import OpenLyrics, OpenLyricsError
|
from openlp.plugins.songs.lib.openlyricsxml import OpenLyrics, OpenLyricsError
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
@ -52,7 +52,7 @@ except ImportError:
|
|||||||
PAGE_BOTH = 6
|
PAGE_BOTH = 6
|
||||||
|
|
||||||
|
|
||||||
class OooImport(SongImport):
|
class OpenOfficeImport(SongImport):
|
||||||
"""
|
"""
|
||||||
Import songs from Impress/Powerpoint docs using Impress
|
Import songs from Impress/Powerpoint docs using Impress
|
||||||
"""
|
"""
|
@ -35,7 +35,7 @@ from lxml.etree import Error, LxmlError
|
|||||||
|
|
||||||
from openlp.core.common import translate
|
from openlp.core.common import translate
|
||||||
from openlp.plugins.songs.lib import VerseType
|
from openlp.plugins.songs.lib import VerseType
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.importers.songimport import SongImport
|
||||||
from openlp.plugins.songs.lib.ui import SongStrings
|
from openlp.plugins.songs.lib.ui import SongStrings
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
@ -27,7 +27,7 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
The :mod:`powersongimport` module provides the functionality for importing
|
The :mod:`powersong` module provides the functionality for importing
|
||||||
PowerSong songs into the OpenLP database.
|
PowerSong songs into the OpenLP database.
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
@ -35,7 +35,7 @@ import fnmatch
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from openlp.core.common import translate
|
from openlp.core.common import translate
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.importers.songimport import SongImport
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ class PowerSongImport(SongImport):
|
|||||||
"""
|
"""
|
||||||
Receive either a list of files or a folder (unicode) to import.
|
Receive either a list of files or a folder (unicode) to import.
|
||||||
"""
|
"""
|
||||||
from .importer import SongFormat
|
from openlp.plugins.songs.lib.importer import SongFormat
|
||||||
ps_string = SongFormat.get(SongFormat.PowerSong, 'name')
|
ps_string = SongFormat.get(SongFormat.PowerSong, 'name')
|
||||||
if isinstance(self.import_source, str):
|
if isinstance(self.import_source, str):
|
||||||
if os.path.isdir(self.import_source):
|
if os.path.isdir(self.import_source):
|
@ -27,7 +27,7 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
The :mod:`presentationmanagerimport` module provides the functionality for importing
|
The :mod:`presentationmanager` module provides the functionality for importing
|
||||||
Presentationmanager song files into the current database.
|
Presentationmanager song files into the current database.
|
||||||
"""
|
"""
|
||||||
|
|
@ -27,7 +27,7 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
The :mod:`propresenterimport` module provides the functionality for importing
|
The :mod:`propresenter` module provides the functionality for importing
|
||||||
ProPresenter song files into the current installation database.
|
ProPresenter song files into the current installation database.
|
||||||
"""
|
"""
|
||||||
|
|
@ -27,7 +27,7 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
The :mod:`songbeamerimport` module provides the functionality for importing SongBeamer songs into the OpenLP database.
|
The :mod:`songbeamer` module provides the functionality for importing SongBeamer songs into the OpenLP database.
|
||||||
"""
|
"""
|
||||||
import chardet
|
import chardet
|
||||||
import codecs
|
import codecs
|
||||||
@ -36,7 +36,7 @@ import os
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from openlp.plugins.songs.lib import VerseType
|
from openlp.plugins.songs.lib import VerseType
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.importers.songimport import SongImport
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
@ -39,7 +39,7 @@ from openlp.core.ui.wizard import WizardStrings
|
|||||||
from openlp.plugins.songs.lib import clean_song, VerseType
|
from openlp.plugins.songs.lib import clean_song, VerseType
|
||||||
from openlp.plugins.songs.lib.db import Song, Author, Topic, Book, MediaFile
|
from openlp.plugins.songs.lib.db import Song, Author, Topic, Book, MediaFile
|
||||||
from openlp.plugins.songs.lib.ui import SongStrings
|
from openlp.plugins.songs.lib.ui import SongStrings
|
||||||
from openlp.plugins.songs.lib.xml import SongXML
|
from openlp.plugins.songs.lib.openlyricsxml import SongXML
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
@ -27,13 +27,13 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
The :mod:`songproimport` module provides the functionality for importing SongPro
|
The :mod:`songpro` module provides the functionality for importing SongPro
|
||||||
songs into the OpenLP database.
|
songs into the OpenLP database.
|
||||||
"""
|
"""
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from openlp.plugins.songs.lib import strip_rtf
|
from openlp.plugins.songs.lib import strip_rtf
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.importers.songimport import SongImport
|
||||||
|
|
||||||
|
|
||||||
class SongProImport(SongImport):
|
class SongProImport(SongImport):
|
@ -27,7 +27,7 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
The :mod:`songshowplusimport` module provides the functionality for importing SongShow Plus songs into the OpenLP
|
The :mod:`songshowplus` module provides the functionality for importing SongShow Plus songs into the OpenLP
|
||||||
database.
|
database.
|
||||||
"""
|
"""
|
||||||
import chardet
|
import chardet
|
||||||
@ -38,7 +38,7 @@ import struct
|
|||||||
|
|
||||||
from openlp.core.ui.wizard import WizardStrings
|
from openlp.core.ui.wizard import WizardStrings
|
||||||
from openlp.plugins.songs.lib import VerseType, retrieve_windows_encoding
|
from openlp.plugins.songs.lib import VerseType, retrieve_windows_encoding
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.importers.songimport import SongImport
|
||||||
|
|
||||||
TITLE = 1
|
TITLE = 1
|
||||||
AUTHOR = 2
|
AUTHOR = 2
|
@ -37,13 +37,13 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .oooimport import OooImport
|
from .openoffice import OpenOfficeImport
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
from .oooimport import PAGE_BEFORE, PAGE_AFTER, PAGE_BOTH
|
from .openoffice import PAGE_BEFORE, PAGE_AFTER, PAGE_BOTH
|
||||||
RuntimeException = Exception
|
RuntimeException = Exception
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
@ -62,7 +62,7 @@ except ImportError:
|
|||||||
ITALIC = 2
|
ITALIC = 2
|
||||||
|
|
||||||
|
|
||||||
class SofImport(OooImport):
|
class SongsOfFellowshipImport(OpenOfficeImport):
|
||||||
"""
|
"""
|
||||||
Import songs provided on disks with the Songs of Fellowship music books
|
Import songs provided on disks with the Songs of Fellowship music books
|
||||||
VOLS1_2.RTF, sof3words.rtf and sof4words.rtf
|
VOLS1_2.RTF, sof3words.rtf and sof4words.rtf
|
||||||
@ -83,7 +83,7 @@ class SofImport(OooImport):
|
|||||||
Initialise the class. Requires a songmanager class which is passed
|
Initialise the class. Requires a songmanager class which is passed
|
||||||
to SongImport for writing song to disk
|
to SongImport for writing song to disk
|
||||||
"""
|
"""
|
||||||
OooImport.__init__(self, manager, **kwargs)
|
OpenOfficeImport.__init__(self, manager, **kwargs)
|
||||||
self.song = False
|
self.song = False
|
||||||
|
|
||||||
def process_ooo_document(self):
|
def process_ooo_document(self):
|
@ -32,7 +32,7 @@ import re
|
|||||||
|
|
||||||
from openlp.plugins.songs.lib import VerseType, retrieve_windows_encoding
|
from openlp.plugins.songs.lib import VerseType, retrieve_windows_encoding
|
||||||
from openlp.plugins.songs.lib import strip_rtf
|
from openlp.plugins.songs.lib import strip_rtf
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.importers.songimport import SongImport
|
||||||
|
|
||||||
HOTKEY_TO_VERSE_TYPE = {
|
HOTKEY_TO_VERSE_TYPE = {
|
||||||
'1': 'v1',
|
'1': 'v1',
|
@ -27,24 +27,23 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
The :mod:`wowimport` module provides the functionality for importing Words of
|
The :mod:`wordsofworship` module provides the functionality for importing Words of
|
||||||
Worship songs into the OpenLP database.
|
Worship songs into the OpenLP database.
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from openlp.core.common import translate
|
from openlp.core.common import translate
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.importers.songimport import SongImport
|
||||||
|
|
||||||
BLOCK_TYPES = ('V', 'C', 'B')
|
BLOCK_TYPES = ('V', 'C', 'B')
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class WowImport(SongImport):
|
class WordsOfWorshipImport(SongImport):
|
||||||
"""
|
"""
|
||||||
The :class:`WowImport` class provides the ability to import song files from
|
The :class:`WordsOfWorshipImport` class provides the ability to import song files from Words of Worship.
|
||||||
Words of Worship.
|
|
||||||
|
|
||||||
**Words Of Worship Song File Format:**
|
**Words Of Worship Song File Format:**
|
||||||
|
|
@ -27,7 +27,7 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
The :mod:`worshipassistantimport` module provides the functionality for importing
|
The :mod:`worshipassistant` module provides the functionality for importing
|
||||||
Worship Assistant songs into the OpenLP database.
|
Worship Assistant songs into the OpenLP database.
|
||||||
"""
|
"""
|
||||||
import chardet
|
import chardet
|
||||||
@ -37,7 +37,7 @@ import re
|
|||||||
|
|
||||||
from openlp.core.common import translate
|
from openlp.core.common import translate
|
||||||
from openlp.plugins.songs.lib import VerseType
|
from openlp.plugins.songs.lib import VerseType
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.importers.songimport import SongImport
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
@ -35,7 +35,7 @@ import logging
|
|||||||
import pyodbc
|
import pyodbc
|
||||||
|
|
||||||
from openlp.core.common import translate
|
from openlp.core.common import translate
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.importers.songimport import SongImport
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
@ -27,14 +27,13 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
The :mod:`zionworximport` module provides the functionality for importing
|
The :mod:`zionworx` module provides the functionality for importing ZionWorx songs into the OpenLP database.
|
||||||
ZionWorx songs into the OpenLP database.
|
|
||||||
"""
|
"""
|
||||||
import csv
|
import csv
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from openlp.core.common import translate
|
from openlp.core.common import translate
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.importers.songimport import SongImport
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
@ -46,7 +46,7 @@ from openlp.plugins.songs.forms.songexportform import SongExportForm
|
|||||||
from openlp.plugins.songs.lib import VerseType, clean_string, delete_song
|
from openlp.plugins.songs.lib import VerseType, clean_string, delete_song
|
||||||
from openlp.plugins.songs.lib.db import Author, AuthorType, Song, Book, MediaFile
|
from openlp.plugins.songs.lib.db import Author, AuthorType, Song, Book, MediaFile
|
||||||
from openlp.plugins.songs.lib.ui import SongStrings
|
from openlp.plugins.songs.lib.ui import SongStrings
|
||||||
from openlp.plugins.songs.lib.xml import OpenLyrics, SongXML
|
from openlp.plugins.songs.lib.openlyricsxml import OpenLyrics, SongXML
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ from lxml import etree
|
|||||||
|
|
||||||
from openlp.core.common import RegistryProperties, check_directory_exists, translate
|
from openlp.core.common import RegistryProperties, check_directory_exists, translate
|
||||||
from openlp.core.utils import clean_filename
|
from openlp.core.utils import clean_filename
|
||||||
from openlp.plugins.songs.lib.xml import OpenLyrics
|
from openlp.plugins.songs.lib.openlyricsxml import OpenLyrics
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ from html.parser import HTMLParser
|
|||||||
from bs4 import BeautifulSoup, NavigableString
|
from bs4 import BeautifulSoup, NavigableString
|
||||||
|
|
||||||
from openlp.plugins.songs.lib import Song, VerseType, clean_song, Author
|
from openlp.plugins.songs.lib import Song, VerseType, clean_song, Author
|
||||||
from openlp.plugins.songs.lib.xml import SongXML
|
from openlp.plugins.songs.lib.openlyricsxml import SongXML
|
||||||
|
|
||||||
USER_AGENT = 'Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; GT-I9000 ' \
|
USER_AGENT = 'Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; GT-I9000 ' \
|
||||||
'Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 ' \
|
'Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 ' \
|
||||||
|
@ -49,7 +49,7 @@ from openlp.plugins.songs.lib import clean_song, upgrade
|
|||||||
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.mediaitem import SongSearch
|
from openlp.plugins.songs.lib.mediaitem import SongSearch
|
||||||
from openlp.plugins.songs.lib.importer import SongFormat
|
from openlp.plugins.songs.lib.importer import SongFormat
|
||||||
from openlp.plugins.songs.lib.olpimport import OpenLPSongImport
|
from openlp.plugins.songs.lib.importers.openlp import OpenLPSongImport
|
||||||
from openlp.plugins.songs.lib.mediaitem import SongMediaItem
|
from openlp.plugins.songs.lib.mediaitem import SongMediaItem
|
||||||
from openlp.plugins.songs.lib.songstab import SongsTab
|
from openlp.plugins.songs.lib.songstab import SongsTab
|
||||||
|
|
||||||
|
@ -1,19 +1,11 @@
|
|||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Categories=AudioVideo;
|
Categories=AudioVideo;
|
||||||
Comment[de]=
|
|
||||||
Comment=
|
|
||||||
Exec=openlp %F
|
Exec=openlp %F
|
||||||
GenericName[de]=Church lyrics projection
|
|
||||||
GenericName=Church lyrics projection
|
GenericName=Church lyrics projection
|
||||||
Icon=openlp
|
Icon=openlp
|
||||||
MimeType=application/x-openlp-service;
|
MimeType=application/x-openlp-service;
|
||||||
Name[de]=OpenLP
|
|
||||||
Name=OpenLP
|
Name=OpenLP
|
||||||
Path=
|
|
||||||
StartupNotify=true
|
StartupNotify=true
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Type=Application
|
Type=Application
|
||||||
X-DBUS-ServiceName=
|
|
||||||
X-DBUS-StartupType=
|
|
||||||
X-KDE-SubstituteUID=false
|
X-KDE-SubstituteUID=false
|
||||||
X-KDE-Username=
|
|
||||||
|
8
setup.py
8
setup.py
@ -105,10 +105,12 @@ try:
|
|||||||
tag_version, tag_revision = tags[-1].split()
|
tag_version, tag_revision = tags[-1].split()
|
||||||
# If they are equal, then this tree is tarball with the source for the release. We do not want the revision number
|
# If they are equal, then this tree is tarball with the source for the release. We do not want the revision number
|
||||||
# in the version string.
|
# in the version string.
|
||||||
|
tree_revision = tree_revision.strip()
|
||||||
|
tag_revision = tag_revision.strip()
|
||||||
if tree_revision == tag_revision:
|
if tree_revision == tag_revision:
|
||||||
version_string = tag_version
|
version_string = tag_version.decode('utf-8')
|
||||||
else:
|
else:
|
||||||
version_string = '%s-bzr%s' % (tag_version, tree_revision)
|
version_string = '%s-bzr%s' % (tag_version.decode('utf-8'), tree_revision.decode('utf-8'))
|
||||||
ver_file = open(VERSION_FILE, 'w')
|
ver_file = open(VERSION_FILE, 'w')
|
||||||
ver_file.write(version_string)
|
ver_file.write(version_string)
|
||||||
except:
|
except:
|
||||||
@ -152,7 +154,7 @@ using a computer and a data projector.""",
|
|||||||
'Operating System :: POSIX :: BSD :: FreeBSD',
|
'Operating System :: POSIX :: BSD :: FreeBSD',
|
||||||
'Operating System :: POSIX :: Linux',
|
'Operating System :: POSIX :: Linux',
|
||||||
'Programming Language :: Python',
|
'Programming Language :: Python',
|
||||||
'Programming Language :: Python :: 2',
|
'Programming Language :: Python :: 3',
|
||||||
'Topic :: Desktop Environment :: Gnome',
|
'Topic :: Desktop Environment :: Gnome',
|
||||||
'Topic :: Desktop Environment :: K Desktop Environment (KDE)',
|
'Topic :: Desktop Environment :: K Desktop Environment (KDE)',
|
||||||
'Topic :: Multimedia',
|
'Topic :: Multimedia',
|
||||||
|
76
tests/functional/openlp_core_common/test_registrymixin.py
Normal file
76
tests/functional/openlp_core_common/test_registrymixin.py
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# Copyright (c) 2008-2014 Raoul Snyman #
|
||||||
|
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
|
||||||
|
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
|
||||||
|
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
|
||||||
|
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
|
||||||
|
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
|
||||||
|
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
|
||||||
|
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# 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 #
|
||||||
|
###############################################################################
|
||||||
|
"""
|
||||||
|
Package to test the openlp.core.common package.
|
||||||
|
"""
|
||||||
|
import os
|
||||||
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from openlp.core.common import RegistryMixin, Registry
|
||||||
|
|
||||||
|
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '../', '..', 'resources'))
|
||||||
|
|
||||||
|
|
||||||
|
class TestRegistryMixin(TestCase):
|
||||||
|
|
||||||
|
def registry_mixin_missing_test(self):
|
||||||
|
"""
|
||||||
|
Test the registry creation and its usage
|
||||||
|
"""
|
||||||
|
# GIVEN: A new registry
|
||||||
|
Registry.create()
|
||||||
|
|
||||||
|
# WHEN: I create a new class
|
||||||
|
mock_1 = Test1()
|
||||||
|
|
||||||
|
# THEN: The following methods are missing
|
||||||
|
self.assertEqual(len(Registry().functions_list), 0), 'The function should not be in the dict anymore.'
|
||||||
|
|
||||||
|
def registry_mixin_present_test(self):
|
||||||
|
"""
|
||||||
|
Test the registry creation and its usage
|
||||||
|
"""
|
||||||
|
# GIVEN: A new registry
|
||||||
|
Registry.create()
|
||||||
|
|
||||||
|
# WHEN: I create a new class
|
||||||
|
mock_2 = Test2()
|
||||||
|
|
||||||
|
# THEN: The following bootstrap methods should be present
|
||||||
|
self.assertEqual(len(Registry().functions_list), 2), 'The bootstrap functions should be in the dict.'
|
||||||
|
|
||||||
|
|
||||||
|
class Test1(object):
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class Test2(RegistryMixin):
|
||||||
|
def __init__(self):
|
||||||
|
super(Test2, self).__init__(None)
|
@ -65,16 +65,6 @@ class TestRenderer(TestCase):
|
|||||||
"""
|
"""
|
||||||
del self.screens
|
del self.screens
|
||||||
|
|
||||||
def initial_renderer_test(self):
|
|
||||||
"""
|
|
||||||
Test the initial renderer state
|
|
||||||
"""
|
|
||||||
# GIVEN: A new renderer instance.
|
|
||||||
renderer = Renderer()
|
|
||||||
# WHEN: the default renderer is built.
|
|
||||||
# THEN: The renderer should be a live controller.
|
|
||||||
self.assertEqual(renderer.is_live, True, 'The base renderer should be a live controller')
|
|
||||||
|
|
||||||
def default_screen_layout_test(self):
|
def default_screen_layout_test(self):
|
||||||
"""
|
"""
|
||||||
Test the default layout calculations
|
Test the default layout calculations
|
||||||
|
@ -0,0 +1,131 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# Copyright (c) 2008-2014 Raoul Snyman #
|
||||||
|
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
|
||||||
|
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
|
||||||
|
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
|
||||||
|
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
|
||||||
|
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
|
||||||
|
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
|
||||||
|
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# 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 #
|
||||||
|
###############################################################################
|
||||||
|
"""
|
||||||
|
Functional tests to test the PowerPointController class and related methods.
|
||||||
|
"""
|
||||||
|
import os
|
||||||
|
if os.name == 'nt':
|
||||||
|
import pywintypes
|
||||||
|
import shutil
|
||||||
|
from unittest import TestCase
|
||||||
|
from tempfile import mkdtemp
|
||||||
|
|
||||||
|
from tests.functional import patch, MagicMock
|
||||||
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
from openlp.plugins.presentations.lib.powerpointcontroller import PowerpointController, PowerpointDocument
|
||||||
|
|
||||||
|
|
||||||
|
class TestPowerpointController(TestCase, TestMixin):
|
||||||
|
"""
|
||||||
|
Test the PowerpointController Class
|
||||||
|
"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
"""
|
||||||
|
Set up the patches and mocks need for all tests.
|
||||||
|
"""
|
||||||
|
self.get_application()
|
||||||
|
self.build_settings()
|
||||||
|
self.mock_plugin = MagicMock()
|
||||||
|
self.temp_folder = mkdtemp()
|
||||||
|
self.mock_plugin.settings_section = self.temp_folder
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
"""
|
||||||
|
Stop the patches
|
||||||
|
"""
|
||||||
|
self.destroy_settings()
|
||||||
|
shutil.rmtree(self.temp_folder)
|
||||||
|
|
||||||
|
def constructor_test(self):
|
||||||
|
"""
|
||||||
|
Test the Constructor from the PowerpointController
|
||||||
|
"""
|
||||||
|
# GIVEN: No presentation controller
|
||||||
|
controller = None
|
||||||
|
|
||||||
|
# WHEN: The presentation controller object is created
|
||||||
|
controller = PowerpointController(plugin=self.mock_plugin)
|
||||||
|
|
||||||
|
# THEN: The name of the presentation controller should be correct
|
||||||
|
self.assertEqual('Powerpoint', controller.name,
|
||||||
|
'The name of the presentation controller should be correct')
|
||||||
|
|
||||||
|
|
||||||
|
class TestPowerpointDocument(TestCase):
|
||||||
|
"""
|
||||||
|
Test the PowerpointDocument Class
|
||||||
|
"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
"""
|
||||||
|
Set up the patches and mocks need for all tests.
|
||||||
|
"""
|
||||||
|
self.powerpoint_document_stop_presentation_patcher = patch(
|
||||||
|
'openlp.plugins.presentations.lib.powerpointcontroller.PowerpointDocument.stop_presentation')
|
||||||
|
self.presentation_document_get_temp_folder_patcher = patch(
|
||||||
|
'openlp.plugins.presentations.lib.powerpointcontroller.PresentationDocument.get_temp_folder')
|
||||||
|
self.presentation_document_setup_patcher = patch(
|
||||||
|
'openlp.plugins.presentations.lib.powerpointcontroller.PresentationDocument._setup')
|
||||||
|
self.mock_powerpoint_document_stop_presentation = self.powerpoint_document_stop_presentation_patcher.start()
|
||||||
|
self.mock_presentation_document_get_temp_folder = self.presentation_document_get_temp_folder_patcher.start()
|
||||||
|
self.mock_presentation_document_setup = self.presentation_document_setup_patcher.start()
|
||||||
|
self.mock_controller = MagicMock()
|
||||||
|
self.mock_presentation = MagicMock()
|
||||||
|
self.mock_presentation_document_get_temp_folder.return_value = 'temp folder'
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
"""
|
||||||
|
Stop the patches
|
||||||
|
"""
|
||||||
|
self.powerpoint_document_stop_presentation_patcher.stop()
|
||||||
|
self.presentation_document_get_temp_folder_patcher.stop()
|
||||||
|
self.presentation_document_setup_patcher.stop()
|
||||||
|
|
||||||
|
def show_error_msg_test(self):
|
||||||
|
"""
|
||||||
|
Test the PowerpointDocument.show_error_msg() method gets called on com exception
|
||||||
|
"""
|
||||||
|
if os.name == 'nt':
|
||||||
|
# GIVEN: A PowerpointDocument with mocked controller and presentation
|
||||||
|
with patch('openlp.plugins.presentations.lib.powerpointcontroller.critical_error_message_box') as \
|
||||||
|
mocked_critical_error_message_box:
|
||||||
|
instance = PowerpointDocument(self.mock_controller, self.mock_presentation)
|
||||||
|
instance.presentation = MagicMock()
|
||||||
|
instance.presentation.SlideShowWindow.View.GotoSlide = MagicMock(side_effect=pywintypes.com_error('1'))
|
||||||
|
|
||||||
|
# WHEN: Calling goto_slide which will throw an exception
|
||||||
|
instance.goto_slide(42)
|
||||||
|
|
||||||
|
# THEN: mocked_critical_error_message_box should have been called
|
||||||
|
mocked_critical_error_message_box.assert_called_with('Error', 'An error occurred in the Powerpoint '
|
||||||
|
'integration and the presentation will be stopped.'
|
||||||
|
' Restart the presentation if you wish to '
|
||||||
|
'present it.')
|
@ -35,7 +35,7 @@ from unittest import TestCase
|
|||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
from tests.functional import MagicMock, patch
|
||||||
|
|
||||||
from openlp.plugins.songs.lib.ewimport import EasyWorshipSongImport, FieldDescEntry, FieldType
|
from openlp.plugins.songs.lib.importers.easyworship import EasyWorshipSongImport, FieldDescEntry, FieldType
|
||||||
|
|
||||||
TEST_PATH = os.path.abspath(
|
TEST_PATH = os.path.abspath(
|
||||||
os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'easyworshipsongs'))
|
os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'easyworshipsongs'))
|
||||||
@ -178,7 +178,7 @@ class TestEasyWorshipSongImport(TestCase):
|
|||||||
Test creating an instance of the EasyWorship file importer
|
Test creating an instance of the EasyWorship file importer
|
||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
||||||
with patch('openlp.plugins.songs.lib.ewimport.SongImport'):
|
with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'):
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
|
|
||||||
# WHEN: An importer object is created
|
# WHEN: An importer object is created
|
||||||
@ -192,7 +192,7 @@ class TestEasyWorshipSongImport(TestCase):
|
|||||||
Test finding an existing field in a given list using the :mod:`find_field`
|
Test finding an existing field in a given list using the :mod:`find_field`
|
||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, a mocked out "manager" and a list of field descriptions.
|
# GIVEN: A mocked out SongImport class, a mocked out "manager" and a list of field descriptions.
|
||||||
with patch('openlp.plugins.songs.lib.ewimport.SongImport'):
|
with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'):
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
|
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
|
||||||
importer.field_descriptions = TEST_FIELD_DESCS
|
importer.field_descriptions = TEST_FIELD_DESCS
|
||||||
@ -210,7 +210,7 @@ class TestEasyWorshipSongImport(TestCase):
|
|||||||
Test finding an non-existing field in a given list using the :mod:`find_field`
|
Test finding an non-existing field in a given list using the :mod:`find_field`
|
||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, a mocked out "manager" and a list of field descriptions
|
# GIVEN: A mocked out SongImport class, a mocked out "manager" and a list of field descriptions
|
||||||
with patch('openlp.plugins.songs.lib.ewimport.SongImport'):
|
with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'):
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
|
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
|
||||||
importer.field_descriptions = TEST_FIELD_DESCS
|
importer.field_descriptions = TEST_FIELD_DESCS
|
||||||
@ -228,8 +228,8 @@ class TestEasyWorshipSongImport(TestCase):
|
|||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, a mocked out struct class, and a mocked out "manager" and a list of
|
# GIVEN: A mocked out SongImport class, a mocked out struct class, and a mocked out "manager" and a list of
|
||||||
# field descriptions
|
# field descriptions
|
||||||
with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \
|
with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'), \
|
||||||
patch('openlp.plugins.songs.lib.ewimport.struct') as mocked_struct:
|
patch('openlp.plugins.songs.lib.importers.easyworship.struct') as mocked_struct:
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
|
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ class TestEasyWorshipSongImport(TestCase):
|
|||||||
Test the :mod:`get_field` module
|
Test the :mod:`get_field` module
|
||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, a mocked out "manager", an encoding and some test data and known results
|
# GIVEN: A mocked out SongImport class, a mocked out "manager", an encoding and some test data and known results
|
||||||
with patch('openlp.plugins.songs.lib.ewimport.SongImport'):
|
with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'):
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
|
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
|
||||||
importer.encoding = TEST_DATA_ENCODING
|
importer.encoding = TEST_DATA_ENCODING
|
||||||
@ -269,7 +269,7 @@ class TestEasyWorshipSongImport(TestCase):
|
|||||||
"""
|
"""
|
||||||
for test_results in GET_MEMO_FIELD_TEST_RESULTS:
|
for test_results in GET_MEMO_FIELD_TEST_RESULTS:
|
||||||
# GIVEN: A mocked out SongImport class, a mocked out "manager", a mocked out memo_file and an encoding
|
# GIVEN: A mocked out SongImport class, a mocked out "manager", a mocked out memo_file and an encoding
|
||||||
with patch('openlp.plugins.songs.lib.ewimport.SongImport'):
|
with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'):
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
mocked_memo_file = MagicMock()
|
mocked_memo_file = MagicMock()
|
||||||
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
|
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
|
||||||
@ -300,8 +300,8 @@ class TestEasyWorshipSongImport(TestCase):
|
|||||||
Test the :mod:`do_import` module opens the correct files
|
Test the :mod:`do_import` module opens the correct files
|
||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, a mocked out "manager"
|
# GIVEN: A mocked out SongImport class, a mocked out "manager"
|
||||||
with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \
|
with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'), \
|
||||||
patch('openlp.plugins.songs.lib.ewimport.os.path') as mocked_os_path:
|
patch('openlp.plugins.songs.lib.importers.easyworship.os.path') as mocked_os_path:
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
|
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
|
||||||
mocked_os_path.isfile.side_effect = [True, False]
|
mocked_os_path.isfile.side_effect = [True, False]
|
||||||
@ -319,8 +319,8 @@ class TestEasyWorshipSongImport(TestCase):
|
|||||||
Test the :mod:`do_import` module produces an error when Songs.MB not found.
|
Test the :mod:`do_import` module produces an error when Songs.MB not found.
|
||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, a mocked out "manager"
|
# GIVEN: A mocked out SongImport class, a mocked out "manager"
|
||||||
with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \
|
with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'), \
|
||||||
patch('openlp.plugins.songs.lib.ewimport.os.path') as mocked_os_path:
|
patch('openlp.plugins.songs.lib.importers.easyworship.os.path') as mocked_os_path:
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
|
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
|
||||||
importer.log_error = MagicMock()
|
importer.log_error = MagicMock()
|
||||||
@ -339,8 +339,8 @@ class TestEasyWorshipSongImport(TestCase):
|
|||||||
Test the :mod:`do_import` module handles invalid database files correctly
|
Test the :mod:`do_import` module handles invalid database files correctly
|
||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, os.path and a mocked out "manager"
|
# GIVEN: A mocked out SongImport class, os.path and a mocked out "manager"
|
||||||
with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \
|
with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'), \
|
||||||
patch('openlp.plugins.songs.lib.ewimport.os.path') as mocked_os_path:
|
patch('openlp.plugins.songs.lib.importers.easyworship.os.path') as mocked_os_path:
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
|
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
|
||||||
mocked_os_path.isfile.return_value = True
|
mocked_os_path.isfile.return_value = True
|
||||||
@ -358,10 +358,10 @@ class TestEasyWorshipSongImport(TestCase):
|
|||||||
Test the :mod:`do_import` module handles invalid memo files correctly
|
Test the :mod:`do_import` module handles invalid memo files correctly
|
||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, a mocked out "manager"
|
# GIVEN: A mocked out SongImport class, a mocked out "manager"
|
||||||
with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \
|
with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'), \
|
||||||
patch('openlp.plugins.songs.lib.ewimport.os.path') as mocked_os_path, \
|
patch('openlp.plugins.songs.lib.importers.easyworship.os.path') as mocked_os_path, \
|
||||||
patch('builtins.open') as mocked_open, \
|
patch('builtins.open') as mocked_open, \
|
||||||
patch('openlp.plugins.songs.lib.ewimport.struct') as mocked_struct:
|
patch('openlp.plugins.songs.lib.importers.easyworship.struct') as mocked_struct:
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
|
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
|
||||||
mocked_os_path.isfile.return_value = True
|
mocked_os_path.isfile.return_value = True
|
||||||
@ -385,10 +385,10 @@ class TestEasyWorshipSongImport(TestCase):
|
|||||||
Test the :mod:`do_import` converts the code page to the encoding correctly
|
Test the :mod:`do_import` converts the code page to the encoding correctly
|
||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, a mocked out "manager"
|
# GIVEN: A mocked out SongImport class, a mocked out "manager"
|
||||||
with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \
|
with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'), \
|
||||||
patch('openlp.plugins.songs.lib.ewimport.os.path') as mocked_os_path, \
|
patch('openlp.plugins.songs.lib.importers.easyworship.os.path') as mocked_os_path, \
|
||||||
patch('builtins.open'), patch('openlp.plugins.songs.lib.ewimport.struct') as mocked_struct, \
|
patch('builtins.open'), patch('openlp.plugins.songs.lib.importers.easyworship.struct') as mocked_struct, \
|
||||||
patch('openlp.plugins.songs.lib.ewimport.retrieve_windows_encoding') as \
|
patch('openlp.plugins.songs.lib.importers.easyworship.retrieve_windows_encoding') as \
|
||||||
mocked_retrieve_windows_encoding:
|
mocked_retrieve_windows_encoding:
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
|
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
|
||||||
@ -413,8 +413,8 @@ class TestEasyWorshipSongImport(TestCase):
|
|||||||
|
|
||||||
# GIVEN: Test files with a mocked out SongImport class, a mocked out "manager", a mocked out "import_wizard",
|
# GIVEN: Test files with a mocked out SongImport class, a mocked out "manager", a mocked out "import_wizard",
|
||||||
# and mocked out "author", "add_copyright", "add_verse", "finish" methods.
|
# and mocked out "author", "add_copyright", "add_verse", "finish" methods.
|
||||||
with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \
|
with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'), \
|
||||||
patch('openlp.plugins.songs.lib.ewimport.retrieve_windows_encoding') as \
|
patch('openlp.plugins.songs.lib.importers.easyworship.retrieve_windows_encoding') as \
|
||||||
mocked_retrieve_windows_encoding:
|
mocked_retrieve_windows_encoding:
|
||||||
mocked_retrieve_windows_encoding.return_value = 'cp1252'
|
mocked_retrieve_windows_encoding.return_value = 'cp1252'
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
@ -469,8 +469,8 @@ class TestEasyWorshipSongImport(TestCase):
|
|||||||
|
|
||||||
# GIVEN: Test files with a mocked out SongImport class, a mocked out "manager", a mocked out "import_wizard",
|
# GIVEN: Test files with a mocked out SongImport class, a mocked out "manager", a mocked out "import_wizard",
|
||||||
# and mocked out "author", "add_copyright", "add_verse", "finish" methods.
|
# and mocked out "author", "add_copyright", "add_verse", "finish" methods.
|
||||||
with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \
|
with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'), \
|
||||||
patch('openlp.plugins.songs.lib.ewimport.retrieve_windows_encoding') \
|
patch('openlp.plugins.songs.lib.importers.easyworship.retrieve_windows_encoding') \
|
||||||
as mocked_retrieve_windows_encoding:
|
as mocked_retrieve_windows_encoding:
|
||||||
mocked_retrieve_windows_encoding.return_value = 'cp1252'
|
mocked_retrieve_windows_encoding.return_value = 'cp1252'
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
@ -509,7 +509,7 @@ class TestEasyWorshipSongImport(TestCase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# GIVEN: A mocked out SongImport class, a mocked out "manager" and mocked out "author" method.
|
# GIVEN: A mocked out SongImport class, a mocked out "manager" and mocked out "author" method.
|
||||||
with patch('openlp.plugins.songs.lib.ewimport.SongImport'):
|
with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'):
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
mocked_add_author = MagicMock()
|
mocked_add_author = MagicMock()
|
||||||
importer = EasyWorshipSongImportLogger(mocked_manager)
|
importer = EasyWorshipSongImportLogger(mocked_manager)
|
||||||
|
@ -34,7 +34,7 @@ import os
|
|||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
from tests.functional import patch, MagicMock
|
from tests.functional import patch, MagicMock
|
||||||
|
|
||||||
from openlp.plugins.songs.lib.foilpresenterimport import FoilPresenter
|
from openlp.plugins.songs.lib.importers.foilpresenter import FoilPresenter
|
||||||
|
|
||||||
TEST_PATH = os.path.abspath(
|
TEST_PATH = os.path.abspath(
|
||||||
os.path.join(os.path.dirname(__file__), '..', '..', '..', '/resources/foilpresentersongs'))
|
os.path.join(os.path.dirname(__file__), '..', '..', '..', '/resources/foilpresentersongs'))
|
||||||
@ -57,27 +57,27 @@ class TestFoilPresenter(TestCase):
|
|||||||
# _process_topics
|
# _process_topics
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.child_patcher = patch('openlp.plugins.songs.lib.foilpresenterimport.FoilPresenter._child')
|
self.child_patcher = patch('openlp.plugins.songs.lib.importers.foilpresenter.FoilPresenter._child')
|
||||||
self.clean_song_patcher = patch('openlp.plugins.songs.lib.foilpresenterimport.clean_song')
|
self.clean_song_patcher = patch('openlp.plugins.songs.lib.importers.foilpresenter.clean_song')
|
||||||
self.objectify_patcher = patch('openlp.plugins.songs.lib.foilpresenterimport.objectify')
|
self.objectify_patcher = patch('openlp.plugins.songs.lib.importers.foilpresenter.objectify')
|
||||||
self.process_authors_patcher = \
|
self.process_authors_patcher = \
|
||||||
patch('openlp.plugins.songs.lib.foilpresenterimport.FoilPresenter._process_authors')
|
patch('openlp.plugins.songs.lib.importers.foilpresenter.FoilPresenter._process_authors')
|
||||||
self.process_cclinumber_patcher = \
|
self.process_cclinumber_patcher = \
|
||||||
patch('openlp.plugins.songs.lib.foilpresenterimport.FoilPresenter._process_cclinumber')
|
patch('openlp.plugins.songs.lib.importers.foilpresenter.FoilPresenter._process_cclinumber')
|
||||||
self.process_comments_patcher = \
|
self.process_comments_patcher = \
|
||||||
patch('openlp.plugins.songs.lib.foilpresenterimport.FoilPresenter._process_comments')
|
patch('openlp.plugins.songs.lib.importers.foilpresenter.FoilPresenter._process_comments')
|
||||||
self.process_lyrics_patcher = \
|
self.process_lyrics_patcher = \
|
||||||
patch('openlp.plugins.songs.lib.foilpresenterimport.FoilPresenter._process_lyrics')
|
patch('openlp.plugins.songs.lib.importers.foilpresenter.FoilPresenter._process_lyrics')
|
||||||
self.process_songbooks_patcher = \
|
self.process_songbooks_patcher = \
|
||||||
patch('openlp.plugins.songs.lib.foilpresenterimport.FoilPresenter._process_songbooks')
|
patch('openlp.plugins.songs.lib.importers.foilpresenter.FoilPresenter._process_songbooks')
|
||||||
self.process_titles_patcher = \
|
self.process_titles_patcher = \
|
||||||
patch('openlp.plugins.songs.lib.foilpresenterimport.FoilPresenter._process_titles')
|
patch('openlp.plugins.songs.lib.importers.foilpresenter.FoilPresenter._process_titles')
|
||||||
self.process_topics_patcher = \
|
self.process_topics_patcher = \
|
||||||
patch('openlp.plugins.songs.lib.foilpresenterimport.FoilPresenter._process_topics')
|
patch('openlp.plugins.songs.lib.importers.foilpresenter.FoilPresenter._process_topics')
|
||||||
self.re_patcher = patch('openlp.plugins.songs.lib.foilpresenterimport.re')
|
self.re_patcher = patch('openlp.plugins.songs.lib.importers.foilpresenter.re')
|
||||||
self.song_patcher = patch('openlp.plugins.songs.lib.foilpresenterimport.Song')
|
self.song_patcher = patch('openlp.plugins.songs.lib.importers.foilpresenter.Song')
|
||||||
self.song_xml_patcher = patch('openlp.plugins.songs.lib.foilpresenterimport.SongXML')
|
self.song_xml_patcher = patch('openlp.plugins.songs.lib.importers.foilpresenter.SongXML')
|
||||||
self.translate_patcher = patch('openlp.plugins.songs.lib.foilpresenterimport.translate')
|
self.translate_patcher = patch('openlp.plugins.songs.lib.importers.foilpresenter.translate')
|
||||||
|
|
||||||
self.mocked_child = self.child_patcher.start()
|
self.mocked_child = self.child_patcher.start()
|
||||||
self.mocked_clean_song = self.clean_song_patcher.start()
|
self.mocked_clean_song = self.clean_song_patcher.start()
|
||||||
|
@ -34,8 +34,8 @@ import os
|
|||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
from tests.functional import MagicMock, patch
|
||||||
from openlp.plugins.songs.lib.openlyricsimport import OpenLyricsImport
|
from openlp.plugins.songs.lib.importers.openlyrics import OpenLyricsImport
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.importers.songimport import SongImport
|
||||||
|
|
||||||
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__),
|
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__),
|
||||||
'..', '..', '..', 'resources', 'openlyricssongs'))
|
'..', '..', '..', 'resources', 'openlyricssongs'))
|
||||||
@ -69,7 +69,7 @@ class TestOpenLyricsImport(TestCase):
|
|||||||
Test creating an instance of the OpenLyrics file importer
|
Test creating an instance of the OpenLyrics file importer
|
||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
||||||
with patch('openlp.plugins.songs.lib.songbeamerimport.SongImport'):
|
with patch('openlp.plugins.songs.lib.importers.openlyrics.SongImport'):
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
|
|
||||||
# WHEN: An importer object is created
|
# WHEN: An importer object is created
|
||||||
|
@ -34,7 +34,7 @@ import os
|
|||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
from tests.helpers.songfileimport import SongImportTestHelper
|
from tests.helpers.songfileimport import SongImportTestHelper
|
||||||
from openlp.plugins.songs.lib.opensongimport import OpenSongImport
|
from openlp.plugins.songs.lib.importers.opensong import OpenSongImport
|
||||||
from tests.functional import patch, MagicMock
|
from tests.functional import patch, MagicMock
|
||||||
|
|
||||||
TEST_PATH = os.path.abspath(
|
TEST_PATH = os.path.abspath(
|
||||||
@ -45,7 +45,7 @@ class TestOpenSongFileImport(SongImportTestHelper):
|
|||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.importer_class_name = 'OpenSongImport'
|
self.importer_class_name = 'OpenSongImport'
|
||||||
self.importer_module_name = 'opensongimport'
|
self.importer_module_name = 'opensong'
|
||||||
super(TestOpenSongFileImport, self).__init__(*args, **kwargs)
|
super(TestOpenSongFileImport, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
def test_song_import(self):
|
def test_song_import(self):
|
||||||
@ -69,7 +69,7 @@ class TestOpenSongImport(TestCase):
|
|||||||
Test creating an instance of the OpenSong file importer
|
Test creating an instance of the OpenSong file importer
|
||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
||||||
with patch('openlp.plugins.songs.lib.opensongimport.SongImport'):
|
with patch('openlp.plugins.songs.lib.importers.opensong.SongImport'):
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
|
|
||||||
# WHEN: An importer object is created
|
# WHEN: An importer object is created
|
||||||
@ -83,7 +83,7 @@ class TestOpenSongImport(TestCase):
|
|||||||
Test OpenSongImport.do_import handles different invalid import_source values
|
Test OpenSongImport.do_import handles different invalid import_source values
|
||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
||||||
with patch('openlp.plugins.songs.lib.opensongimport.SongImport'):
|
with patch('openlp.plugins.songs.lib.importers.opensong.SongImport'):
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
mocked_import_wizard = MagicMock()
|
mocked_import_wizard = MagicMock()
|
||||||
importer = OpenSongImport(mocked_manager, filenames=[])
|
importer = OpenSongImport(mocked_manager, filenames=[])
|
||||||
@ -104,7 +104,7 @@ class TestOpenSongImport(TestCase):
|
|||||||
Test OpenSongImport.do_import handles different invalid import_source values
|
Test OpenSongImport.do_import handles different invalid import_source values
|
||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
||||||
with patch('openlp.plugins.songs.lib.opensongimport.SongImport'):
|
with patch('openlp.plugins.songs.lib.importers.opensong.SongImport'):
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
mocked_import_wizard = MagicMock()
|
mocked_import_wizard = MagicMock()
|
||||||
importer = OpenSongImport(mocked_manager, filenames=[])
|
importer = OpenSongImport(mocked_manager, filenames=[])
|
||||||
|
@ -42,7 +42,7 @@ class TestSongShowPlusFileImport(SongImportTestHelper):
|
|||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.importer_class_name = 'PresentationManagerImport'
|
self.importer_class_name = 'PresentationManagerImport'
|
||||||
self.importer_module_name = 'presentationmanagerimport'
|
self.importer_module_name = 'presentationmanager'
|
||||||
super(TestSongShowPlusFileImport, self).__init__(*args, **kwargs)
|
super(TestSongShowPlusFileImport, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
def test_song_import(self):
|
def test_song_import(self):
|
||||||
|
@ -43,7 +43,7 @@ class TestProPresenterFileImport(SongImportTestHelper):
|
|||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.importer_class_name = 'ProPresenterImport'
|
self.importer_class_name = 'ProPresenterImport'
|
||||||
self.importer_module_name = 'propresenterimport'
|
self.importer_module_name = 'propresenter'
|
||||||
super(TestProPresenterFileImport, self).__init__(*args, **kwargs)
|
super(TestProPresenterFileImport, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
def test_song_import(self):
|
def test_song_import(self):
|
||||||
|
@ -34,7 +34,7 @@ import os
|
|||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
from tests.functional import MagicMock, patch
|
||||||
from openlp.plugins.songs.lib.songbeamerimport import SongBeamerImport
|
from openlp.plugins.songs.lib.importers.songbeamer import SongBeamerImport
|
||||||
from openlp.plugins.songs.lib import VerseType
|
from openlp.plugins.songs.lib import VerseType
|
||||||
|
|
||||||
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__),
|
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__),
|
||||||
@ -64,7 +64,7 @@ class TestSongBeamerImport(TestCase):
|
|||||||
Test creating an instance of the SongBeamer file importer
|
Test creating an instance of the SongBeamer file importer
|
||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
||||||
with patch('openlp.plugins.songs.lib.songbeamerimport.SongImport'):
|
with patch('openlp.plugins.songs.lib.importers.songbeamer.SongImport'):
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
|
|
||||||
# WHEN: An importer object is created
|
# WHEN: An importer object is created
|
||||||
@ -78,7 +78,7 @@ class TestSongBeamerImport(TestCase):
|
|||||||
Test SongBeamerImport.do_import handles different invalid import_source values
|
Test SongBeamerImport.do_import handles different invalid import_source values
|
||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
||||||
with patch('openlp.plugins.songs.lib.songbeamerimport.SongImport'):
|
with patch('openlp.plugins.songs.lib.importers.songbeamer.SongImport'):
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
mocked_import_wizard = MagicMock()
|
mocked_import_wizard = MagicMock()
|
||||||
importer = SongBeamerImport(mocked_manager, filenames=[])
|
importer = SongBeamerImport(mocked_manager, filenames=[])
|
||||||
@ -99,7 +99,7 @@ class TestSongBeamerImport(TestCase):
|
|||||||
Test SongBeamerImport.do_import handles different invalid import_source values
|
Test SongBeamerImport.do_import handles different invalid import_source values
|
||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
||||||
with patch('openlp.plugins.songs.lib.songbeamerimport.SongImport'):
|
with patch('openlp.plugins.songs.lib.importers.songbeamer.SongImport'):
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
mocked_import_wizard = MagicMock()
|
mocked_import_wizard = MagicMock()
|
||||||
importer = SongBeamerImport(mocked_manager, filenames=[])
|
importer = SongBeamerImport(mocked_manager, filenames=[])
|
||||||
@ -122,7 +122,7 @@ class TestSongBeamerImport(TestCase):
|
|||||||
|
|
||||||
# GIVEN: Test files with a mocked out SongImport class, a mocked out "manager", a mocked out "import_wizard",
|
# GIVEN: Test files with a mocked out SongImport class, a mocked out "manager", a mocked out "import_wizard",
|
||||||
# and mocked out "author", "add_copyright", "add_verse", "finish" methods.
|
# and mocked out "author", "add_copyright", "add_verse", "finish" methods.
|
||||||
with patch('openlp.plugins.songs.lib.songbeamerimport.SongImport'):
|
with patch('openlp.plugins.songs.lib.importers.songbeamer.SongImport'):
|
||||||
for song_file in SONG_TEST_DATA:
|
for song_file in SONG_TEST_DATA:
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
mocked_import_wizard = MagicMock()
|
mocked_import_wizard = MagicMock()
|
||||||
|
@ -35,7 +35,7 @@ from unittest import TestCase
|
|||||||
|
|
||||||
from tests.helpers.songfileimport import SongImportTestHelper
|
from tests.helpers.songfileimport import SongImportTestHelper
|
||||||
from openlp.plugins.songs.lib import VerseType
|
from openlp.plugins.songs.lib import VerseType
|
||||||
from openlp.plugins.songs.lib.songshowplusimport import SongShowPlusImport
|
from openlp.plugins.songs.lib.importers.songshowplus import SongShowPlusImport
|
||||||
from tests.functional import patch, MagicMock
|
from tests.functional import patch, MagicMock
|
||||||
|
|
||||||
TEST_PATH = os.path.abspath(
|
TEST_PATH = os.path.abspath(
|
||||||
@ -46,7 +46,7 @@ class TestSongShowPlusFileImport(SongImportTestHelper):
|
|||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.importer_class_name = 'SongShowPlusImport'
|
self.importer_class_name = 'SongShowPlusImport'
|
||||||
self.importer_module_name = 'songshowplusimport'
|
self.importer_module_name = 'songshowplus'
|
||||||
super(TestSongShowPlusFileImport, self).__init__(*args, **kwargs)
|
super(TestSongShowPlusFileImport, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
def test_song_import(self):
|
def test_song_import(self):
|
||||||
@ -70,7 +70,7 @@ class TestSongShowPlusImport(TestCase):
|
|||||||
Test creating an instance of the SongShow Plus file importer
|
Test creating an instance of the SongShow Plus file importer
|
||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
||||||
with patch('openlp.plugins.songs.lib.songshowplusimport.SongImport'):
|
with patch('openlp.plugins.songs.lib.importers.songshowplus.SongImport'):
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
|
|
||||||
# WHEN: An importer object is created
|
# WHEN: An importer object is created
|
||||||
@ -84,7 +84,7 @@ class TestSongShowPlusImport(TestCase):
|
|||||||
Test SongShowPlusImport.do_import handles different invalid import_source values
|
Test SongShowPlusImport.do_import handles different invalid import_source values
|
||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
||||||
with patch('openlp.plugins.songs.lib.songshowplusimport.SongImport'):
|
with patch('openlp.plugins.songs.lib.importers.songshowplus.SongImport'):
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
mocked_import_wizard = MagicMock()
|
mocked_import_wizard = MagicMock()
|
||||||
importer = SongShowPlusImport(mocked_manager, filenames=[])
|
importer = SongShowPlusImport(mocked_manager, filenames=[])
|
||||||
@ -105,7 +105,7 @@ class TestSongShowPlusImport(TestCase):
|
|||||||
Test SongShowPlusImport.do_import handles different invalid import_source values
|
Test SongShowPlusImport.do_import handles different invalid import_source values
|
||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
||||||
with patch('openlp.plugins.songs.lib.songshowplusimport.SongImport'):
|
with patch('openlp.plugins.songs.lib.importers.songshowplus.SongImport'):
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
mocked_import_wizard = MagicMock()
|
mocked_import_wizard = MagicMock()
|
||||||
importer = SongShowPlusImport(mocked_manager, filenames=[])
|
importer = SongShowPlusImport(mocked_manager, filenames=[])
|
||||||
@ -126,7 +126,7 @@ class TestSongShowPlusImport(TestCase):
|
|||||||
Test to_openlp_verse_tag method by simulating adding a verse
|
Test to_openlp_verse_tag method by simulating adding a verse
|
||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
||||||
with patch('openlp.plugins.songs.lib.songshowplusimport.SongImport'):
|
with patch('openlp.plugins.songs.lib.importers.songshowplus.SongImport'):
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
importer = SongShowPlusImport(mocked_manager, filenames=[])
|
importer = SongShowPlusImport(mocked_manager, filenames=[])
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ class TestSongShowPlusImport(TestCase):
|
|||||||
Test to_openlp_verse_tag method by simulating adding a verse to the verse order
|
Test to_openlp_verse_tag method by simulating adding a verse to the verse order
|
||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
||||||
with patch('openlp.plugins.songs.lib.songshowplusimport.SongImport'):
|
with patch('openlp.plugins.songs.lib.importers.songshowplus.SongImport'):
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
importer = SongShowPlusImport(mocked_manager, filenames=[])
|
importer = SongShowPlusImport(mocked_manager, filenames=[])
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ class TestWorshipAssistantFileImport(SongImportTestHelper):
|
|||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.importer_class_name = 'WorshipAssistantImport'
|
self.importer_class_name = 'WorshipAssistantImport'
|
||||||
self.importer_module_name = 'worshipassistantimport'
|
self.importer_module_name = 'worshipassistant'
|
||||||
super(TestWorshipAssistantFileImport, self).__init__(*args, **kwargs)
|
super(TestWorshipAssistantFileImport, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
def test_song_import(self):
|
def test_song_import(self):
|
||||||
|
@ -37,7 +37,7 @@ if os.name != 'nt':
|
|||||||
|
|
||||||
import pyodbc
|
import pyodbc
|
||||||
|
|
||||||
from openlp.plugins.songs.lib.worshipcenterproimport import WorshipCenterProImport
|
from openlp.plugins.songs.lib.importers.worshipcenterpro import WorshipCenterProImport
|
||||||
from tests.functional import patch, MagicMock
|
from tests.functional import patch, MagicMock
|
||||||
|
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ class TestWorshipCenterProSongImport(TestCase):
|
|||||||
Test creating an instance of the WorshipCenter Pro file importer
|
Test creating an instance of the WorshipCenter Pro file importer
|
||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
||||||
with patch('openlp.plugins.songs.lib.worshipcenterproimport.SongImport'):
|
with patch('openlp.plugins.songs.lib.importers.worshipcenterpro.SongImport'):
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
|
|
||||||
# WHEN: An importer object is created
|
# WHEN: An importer object is created
|
||||||
@ -156,9 +156,10 @@ class TestWorshipCenterProSongImport(TestCase):
|
|||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, a mocked out pyodbc module, a mocked out translate method,
|
# GIVEN: A mocked out SongImport class, a mocked out pyodbc module, a mocked out translate method,
|
||||||
# a mocked "manager" and a mocked out log_error method.
|
# a mocked "manager" and a mocked out log_error method.
|
||||||
with patch('openlp.plugins.songs.lib.worshipcenterproimport.SongImport'), \
|
with patch('openlp.plugins.songs.lib.importers.worshipcenterpro.SongImport'), \
|
||||||
patch('openlp.plugins.songs.lib.worshipcenterproimport.pyodbc.connect') as mocked_pyodbc_connect, \
|
patch('openlp.plugins.songs.lib.importers.worshipcenterpro.pyodbc.connect') \
|
||||||
patch('openlp.plugins.songs.lib.worshipcenterproimport.translate') as mocked_translate:
|
as mocked_pyodbc_connect, \
|
||||||
|
patch('openlp.plugins.songs.lib.importers.worshipcenterpro.translate') as mocked_translate:
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
mocked_log_error = MagicMock()
|
mocked_log_error = MagicMock()
|
||||||
mocked_translate.return_value = 'Translated Text'
|
mocked_translate.return_value = 'Translated Text'
|
||||||
@ -185,9 +186,9 @@ class TestWorshipCenterProSongImport(TestCase):
|
|||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, a mocked out pyodbc module with a simulated recordset, a mocked out
|
# GIVEN: A mocked out SongImport class, a mocked out pyodbc module with a simulated recordset, a mocked out
|
||||||
# translate method, a mocked "manager", add_verse method & mocked_finish method.
|
# translate method, a mocked "manager", add_verse method & mocked_finish method.
|
||||||
with patch('openlp.plugins.songs.lib.worshipcenterproimport.SongImport'), \
|
with patch('openlp.plugins.songs.lib.importers.worshipcenterpro.SongImport'), \
|
||||||
patch('openlp.plugins.songs.lib.worshipcenterproimport.pyodbc') as mocked_pyodbc, \
|
patch('openlp.plugins.songs.lib.importers.worshipcenterpro.pyodbc') as mocked_pyodbc, \
|
||||||
patch('openlp.plugins.songs.lib.worshipcenterproimport.translate') as mocked_translate:
|
patch('openlp.plugins.songs.lib.importers.worshipcenterpro.translate') as mocked_translate:
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
mocked_import_wizard = MagicMock()
|
mocked_import_wizard = MagicMock()
|
||||||
mocked_add_verse = MagicMock()
|
mocked_add_verse = MagicMock()
|
||||||
|
@ -33,8 +33,8 @@ This module contains tests for the ZionWorx song importer.
|
|||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
from tests.functional import MagicMock, patch
|
||||||
from openlp.plugins.songs.lib.zionworximport import ZionWorxImport
|
from openlp.plugins.songs.lib.importers.zionworx import ZionWorxImport
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.importers.songimport import SongImport
|
||||||
|
|
||||||
|
|
||||||
class TestZionWorxImport(TestCase):
|
class TestZionWorxImport(TestCase):
|
||||||
@ -46,7 +46,7 @@ class TestZionWorxImport(TestCase):
|
|||||||
Test creating an instance of the ZionWorx file importer
|
Test creating an instance of the ZionWorx file importer
|
||||||
"""
|
"""
|
||||||
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
||||||
with patch('openlp.plugins.songs.lib.zionworximport.SongImport'):
|
with patch('openlp.plugins.songs.lib.importers.zionworx.SongImport'):
|
||||||
mocked_manager = MagicMock()
|
mocked_manager = MagicMock()
|
||||||
|
|
||||||
# WHEN: An importer object is created
|
# WHEN: An importer object is created
|
||||||
|
@ -42,23 +42,24 @@ class SongImportTestHelper(TestCase):
|
|||||||
"""
|
"""
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(SongImportTestHelper, self).__init__(*args, **kwargs)
|
super(SongImportTestHelper, self).__init__(*args, **kwargs)
|
||||||
self.importer_module = __import__(
|
self.importer_module = __import__('openlp.plugins.songs.lib.importers.%s' %
|
||||||
'openlp.plugins.songs.lib.%s' % self.importer_module_name, fromlist=[self.importer_class_name])
|
self.importer_module_name, fromlist=[self.importer_class_name])
|
||||||
self.importer_class = getattr(self.importer_module, self.importer_class_name)
|
self.importer_class = getattr(self.importer_module, self.importer_class_name)
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""
|
"""
|
||||||
Patch and set up the mocks required.
|
Patch and set up the mocks required.
|
||||||
"""
|
"""
|
||||||
self.add_copyright_patcher = patch(
|
self.add_copyright_patcher = patch('openlp.plugins.songs.lib.importers.%s.%s.add_copyright' %
|
||||||
'openlp.plugins.songs.lib.%s.%s.add_copyright' % (self.importer_module_name, self.importer_class_name))
|
(self.importer_module_name, self.importer_class_name))
|
||||||
self.add_verse_patcher = patch(
|
self.add_verse_patcher = patch('openlp.plugins.songs.lib.importers.%s.%s.add_verse' %
|
||||||
'openlp.plugins.songs.lib.%s.%s.add_verse' % (self.importer_module_name, self.importer_class_name))
|
(self.importer_module_name, self.importer_class_name))
|
||||||
self.finish_patcher = patch(
|
self.finish_patcher = patch('openlp.plugins.songs.lib.importers.%s.%s.finish' %
|
||||||
'openlp.plugins.songs.lib.%s.%s.finish' % (self.importer_module_name, self.importer_class_name))
|
(self.importer_module_name, self.importer_class_name))
|
||||||
self.add_author_patcher = patch(
|
self.add_author_patcher = patch('openlp.plugins.songs.lib.importers.%s.%s.add_author' %
|
||||||
'openlp.plugins.songs.lib.%s.%s.add_author' % (self.importer_module_name, self.importer_class_name))
|
(self.importer_module_name, self.importer_class_name))
|
||||||
self.song_import_patcher = patch('openlp.plugins.songs.lib.%s.SongImport' % self.importer_module_name)
|
self.song_import_patcher = patch('openlp.plugins.songs.lib.importers.%s.SongImport' %
|
||||||
|
self.importer_module_name)
|
||||||
self.mocked_add_copyright = self.add_copyright_patcher.start()
|
self.mocked_add_copyright = self.add_copyright_patcher.start()
|
||||||
self.mocked_add_verse = self.add_verse_patcher.start()
|
self.mocked_add_verse = self.add_verse_patcher.start()
|
||||||
self.mocked_finish = self.finish_patcher.start()
|
self.mocked_finish = self.finish_patcher.start()
|
||||||
|
Loading…
Reference in New Issue
Block a user