forked from openlp/openlp
r1315
This commit is contained in:
commit
921480fe77
20
README.txt
Normal file
20
README.txt
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
OpenLP 2.0
|
||||||
|
==========
|
||||||
|
|
||||||
|
You're probably reading this because you've just downloaded the source code for
|
||||||
|
OpenLP 2.0. If you are looking for the installer file, please go to the download
|
||||||
|
page on the web site::
|
||||||
|
|
||||||
|
http://openlp.org/en/download.html
|
||||||
|
|
||||||
|
If you're looking for how to contribute to OpenLP, then please look at the
|
||||||
|
contribution page on the web site::
|
||||||
|
|
||||||
|
http://openlp.org/en/documentation/introduction/contributing.html
|
||||||
|
|
||||||
|
If you've looked at that page, and are wanting to help develop, test or
|
||||||
|
translate OpenLP, have a look at the OpenLP wiki::
|
||||||
|
|
||||||
|
http://wiki.openlp.org/
|
||||||
|
|
||||||
|
Thanks for downloading OpenLP 2.0!
|
@ -13,7 +13,7 @@ Object Library
|
|||||||
:members:
|
:members:
|
||||||
|
|
||||||
:mod:`ListWidgetWithDnD`
|
:mod:`ListWidgetWithDnD`
|
||||||
----------------------
|
------------------------
|
||||||
|
|
||||||
.. autoclass:: openlp.core.lib.listwidgetwithdnd.ListWidgetWithDnD
|
.. autoclass:: openlp.core.lib.listwidgetwithdnd.ListWidgetWithDnD
|
||||||
:members:
|
:members:
|
||||||
|
@ -54,9 +54,6 @@ Helper Classes & Functions
|
|||||||
.. automodule:: openlp.plugins.songs.lib.mediaitem
|
.. automodule:: openlp.plugins.songs.lib.mediaitem
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: openlp.plugins.songs.lib.mediaitem.SongListView
|
|
||||||
:members:
|
|
||||||
|
|
||||||
.. automodule:: openlp.plugins.songs.lib.songimport
|
.. automodule:: openlp.plugins.songs.lib.songimport
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
|
@ -239,7 +239,8 @@ def resize_image(image, width, height, background=QtCore.Qt.black):
|
|||||||
Resize an image to fit on the current screen.
|
Resize an image to fit on the current screen.
|
||||||
|
|
||||||
``image``
|
``image``
|
||||||
The image to resize.
|
The image to resize. It has to be either a ``QImage`` instance or the
|
||||||
|
path to the image.
|
||||||
|
|
||||||
``width``
|
``width``
|
||||||
The new image width.
|
The new image width.
|
||||||
@ -320,8 +321,6 @@ def check_directory_exists(dir):
|
|||||||
os.makedirs(dir)
|
os.makedirs(dir)
|
||||||
|
|
||||||
from listwidgetwithdnd import ListWidgetWithDnD
|
from listwidgetwithdnd import ListWidgetWithDnD
|
||||||
from theme import ThemeLevel, ThemeXML, BackgroundGradientType, \
|
|
||||||
BackgroundType, HorizontalType, VerticalType
|
|
||||||
from displaytags import DisplayTags
|
from displaytags import DisplayTags
|
||||||
from spelltextedit import SpellTextEdit
|
from spelltextedit import SpellTextEdit
|
||||||
from eventreceiver import Receiver
|
from eventreceiver import Receiver
|
||||||
|
@ -28,8 +28,8 @@ import logging
|
|||||||
|
|
||||||
from PyQt4 import QtWebKit
|
from PyQt4 import QtWebKit
|
||||||
|
|
||||||
from openlp.core.lib import BackgroundType, BackgroundGradientType, \
|
from openlp.core.lib.theme import BackgroundType, BackgroundGradientType, \
|
||||||
VerticalType
|
VerticalType, HorizontalType
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -531,13 +531,8 @@ def build_lyrics_format_css(theme, width, height):
|
|||||||
Height of the lyrics block
|
Height of the lyrics block
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if theme.display_horizontal_align == 2:
|
align = HorizontalType.Names[theme.display_horizontal_align]
|
||||||
align = u'center'
|
valign = VerticalType.Names[theme.display_vertical_align]
|
||||||
elif theme.display_horizontal_align == 1:
|
|
||||||
align = u'right'
|
|
||||||
else:
|
|
||||||
align = u'left'
|
|
||||||
valign = VerticalType.to_string(theme.display_vertical_align)
|
|
||||||
if theme.font_main_outline:
|
if theme.font_main_outline:
|
||||||
left_margin = int(theme.font_main_outline_size) * 2
|
left_margin = int(theme.font_main_outline_size) * 2
|
||||||
else:
|
else:
|
||||||
@ -630,7 +625,7 @@ def build_alert_css(alertTab, width):
|
|||||||
"""
|
"""
|
||||||
if not alertTab:
|
if not alertTab:
|
||||||
return u''
|
return u''
|
||||||
align = VerticalType.to_string(alertTab.location)
|
align = VerticalType.Names[alertTab.location]
|
||||||
alert = style % (width, align, alertTab.font_face, alertTab.font_size,
|
alert = style % (width, align, alertTab.font_face, alertTab.font_size,
|
||||||
alertTab.font_color, alertTab.bg_color)
|
alertTab.font_color, alertTab.bg_color)
|
||||||
return alert
|
return alert
|
||||||
|
@ -85,8 +85,7 @@ class ImageManager(QtCore.QObject):
|
|||||||
for key in self._cache.keys():
|
for key in self._cache.keys():
|
||||||
image = self._cache[key]
|
image = self._cache[key]
|
||||||
image.dirty = True
|
image.dirty = True
|
||||||
image.image = resize_image(image.path,
|
image.image = resize_image(image.path, self.width, self.height)
|
||||||
self.width, self.height)
|
|
||||||
self._cache_dirty = True
|
self._cache_dirty = True
|
||||||
# only one thread please
|
# only one thread please
|
||||||
if not self._thread_running:
|
if not self._thread_running:
|
||||||
@ -128,8 +127,7 @@ class ImageManager(QtCore.QObject):
|
|||||||
image = Image()
|
image = Image()
|
||||||
image.name = name
|
image.name = name
|
||||||
image.path = path
|
image.path = path
|
||||||
image.image = resize_image(path,
|
image.image = resize_image(path, self.width, self.height)
|
||||||
self.width, self.height)
|
|
||||||
self._cache[name] = image
|
self._cache[name] = image
|
||||||
else:
|
else:
|
||||||
log.debug(u'Image in cache %s:%s' % (name, path))
|
log.debug(u'Image in cache %s:%s' % (name, path))
|
||||||
|
@ -34,6 +34,7 @@ from PyQt4 import QtCore, QtGui
|
|||||||
from openlp.core.lib import context_menu_action, context_menu_separator, \
|
from openlp.core.lib import context_menu_action, context_menu_separator, \
|
||||||
SettingsManager, OpenLPToolbar, ServiceItem, StringContent, build_icon, \
|
SettingsManager, OpenLPToolbar, ServiceItem, StringContent, build_icon, \
|
||||||
translate, Receiver, ListWidgetWithDnD
|
translate, Receiver, ListWidgetWithDnD
|
||||||
|
from openlp.core.lib.ui import UiStrings
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -65,10 +66,11 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
When creating a descendant class from this class for your plugin,
|
When creating a descendant class from this class for your plugin,
|
||||||
the following member variables should be set.
|
the following member variables should be set.
|
||||||
|
|
||||||
``self.OnNewPrompt``
|
``self.onNewPrompt``
|
||||||
|
|
||||||
Defaults to *'Select Image(s)'*.
|
Defaults to *'Select Image(s)'*.
|
||||||
|
|
||||||
``self.OnNewFileMasks``
|
``self.onNewFileMasks``
|
||||||
Defaults to *'Images (*.jpg *jpeg *.gif *.png *.bmp)'*. This
|
Defaults to *'Images (*.jpg *jpeg *.gif *.png *.bmp)'*. This
|
||||||
assumes that the new action is to load a file. If not, you
|
assumes that the new action is to load a file. If not, you
|
||||||
need to override the ``OnNew`` method.
|
need to override the ``OnNew`` method.
|
||||||
@ -240,7 +242,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
Creates the main widget for listing items the media item is tracking
|
Creates the main widget for listing items the media item is tracking
|
||||||
"""
|
"""
|
||||||
# Add the List widget
|
# Add the List widget
|
||||||
self.listView = ListWidgetWithDnD(self, self.title)
|
self.listView = ListWidgetWithDnD(self, self.plugin.name)
|
||||||
self.listView.uniformItemSizes = True
|
self.listView.uniformItemSizes = True
|
||||||
self.listView.setSpacing(1)
|
self.listView.setSpacing(1)
|
||||||
self.listView.setSelectionMode(
|
self.listView.setSelectionMode(
|
||||||
@ -316,9 +318,9 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
Add a file to the list widget to make it available for showing
|
Add a file to the list widget to make it available for showing
|
||||||
"""
|
"""
|
||||||
files = QtGui.QFileDialog.getOpenFileNames(
|
files = QtGui.QFileDialog.getOpenFileNames(
|
||||||
self, self.OnNewPrompt,
|
self, self.onNewPrompt,
|
||||||
SettingsManager.get_last_dir(self.settingsSection),
|
SettingsManager.get_last_dir(self.settingsSection),
|
||||||
self.OnNewFileMasks)
|
self.onNewFileMasks)
|
||||||
log.info(u'New files(s) %s', unicode(files))
|
log.info(u'New files(s) %s', unicode(files))
|
||||||
if files:
|
if files:
|
||||||
Receiver.send_message(u'cursor_busy')
|
Receiver.send_message(u'cursor_busy')
|
||||||
@ -415,8 +417,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
item to the preview slide controller.
|
item to the preview slide controller.
|
||||||
"""
|
"""
|
||||||
if not self.listView.selectedIndexes() and not self.remoteTriggered:
|
if not self.listView.selectedIndexes() and not self.remoteTriggered:
|
||||||
QtGui.QMessageBox.information(self,
|
QtGui.QMessageBox.information(self, UiStrings.NISp,
|
||||||
translate('OpenLP.MediaManagerItem', 'No Items Selected'),
|
|
||||||
translate('OpenLP.MediaManagerItem',
|
translate('OpenLP.MediaManagerItem',
|
||||||
'You must select one or more items to preview.'))
|
'You must select one or more items to preview.'))
|
||||||
else:
|
else:
|
||||||
@ -432,8 +433,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
item to the live slide controller.
|
item to the live slide controller.
|
||||||
"""
|
"""
|
||||||
if not self.listView.selectedIndexes():
|
if not self.listView.selectedIndexes():
|
||||||
QtGui.QMessageBox.information(self,
|
QtGui.QMessageBox.information(self, UiStrings.NISp,
|
||||||
translate('OpenLP.MediaManagerItem', 'No Items Selected'),
|
|
||||||
translate('OpenLP.MediaManagerItem',
|
translate('OpenLP.MediaManagerItem',
|
||||||
'You must select one or more items to send live.'))
|
'You must select one or more items to send live.'))
|
||||||
else:
|
else:
|
||||||
@ -448,8 +448,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
Add a selected item to the current service
|
Add a selected item to the current service
|
||||||
"""
|
"""
|
||||||
if not self.listView.selectedIndexes() and not self.remoteTriggered:
|
if not self.listView.selectedIndexes() and not self.remoteTriggered:
|
||||||
QtGui.QMessageBox.information(self,
|
QtGui.QMessageBox.information(self, UiStrings.NISp,
|
||||||
translate('OpenLP.MediaManagerItem', 'No Items Selected'),
|
|
||||||
translate('OpenLP.MediaManagerItem',
|
translate('OpenLP.MediaManagerItem',
|
||||||
'You must select one or more items.'))
|
'You must select one or more items.'))
|
||||||
else:
|
else:
|
||||||
@ -475,17 +474,14 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
Add a selected item to an existing item in the current service.
|
Add a selected item to an existing item in the current service.
|
||||||
"""
|
"""
|
||||||
if not self.listView.selectedIndexes() and not self.remoteTriggered:
|
if not self.listView.selectedIndexes() and not self.remoteTriggered:
|
||||||
QtGui.QMessageBox.information(self,
|
QtGui.QMessageBox.information(self, UiStrings.NISp,
|
||||||
translate('OpenLP.MediaManagerItem', 'No Items Selected'),
|
|
||||||
translate('OpenLP.MediaManagerItem',
|
translate('OpenLP.MediaManagerItem',
|
||||||
'You must select one or more items'))
|
'You must select one or more items.'))
|
||||||
else:
|
else:
|
||||||
log.debug(u'%s Add requested', self.plugin.name)
|
log.debug(u'%s Add requested', self.plugin.name)
|
||||||
serviceItem = self.parent.serviceManager.getServiceItem()
|
serviceItem = self.parent.serviceManager.getServiceItem()
|
||||||
if not serviceItem:
|
if not serviceItem:
|
||||||
QtGui.QMessageBox.information(self,
|
QtGui.QMessageBox.information(self, UiStrings.NISs,
|
||||||
translate('OpenLP.MediaManagerItem',
|
|
||||||
'No Service Item Selected'),
|
|
||||||
translate('OpenLP.MediaManagerItem',
|
translate('OpenLP.MediaManagerItem',
|
||||||
'You must select an existing service item to add to.'))
|
'You must select an existing service item to add to.'))
|
||||||
elif self.plugin.name.lower() == serviceItem.name.lower():
|
elif self.plugin.name.lower() == serviceItem.name.lower():
|
||||||
|
@ -144,6 +144,7 @@ class Plugin(QtCore.QObject):
|
|||||||
self.name = name
|
self.name = name
|
||||||
self.textStrings = {}
|
self.textStrings = {}
|
||||||
self.setPluginTextStrings()
|
self.setPluginTextStrings()
|
||||||
|
self.nameStrings = self.textStrings[StringContent.Name]
|
||||||
if version:
|
if version:
|
||||||
self.version = version
|
self.version = version
|
||||||
self.settingsSection = self.name.lower()
|
self.settingsSection = self.name.lower()
|
||||||
|
@ -28,7 +28,8 @@ import logging
|
|||||||
|
|
||||||
from PyQt4 import QtCore
|
from PyQt4 import QtCore
|
||||||
|
|
||||||
from openlp.core.lib import Renderer, ThemeLevel, ServiceItem, ImageManager
|
from openlp.core.lib import Renderer, ServiceItem, ImageManager
|
||||||
|
from openlp.core.lib.theme import ThemeLevel
|
||||||
from openlp.core.ui import MainDisplay
|
from openlp.core.ui import MainDisplay
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -173,14 +174,13 @@ class RenderManager(object):
|
|||||||
main_rect = None
|
main_rect = None
|
||||||
footer_rect = None
|
footer_rect = None
|
||||||
if not theme.font_main_override:
|
if not theme.font_main_override:
|
||||||
main_rect = QtCore.QRect(10, 0,
|
main_rect = QtCore.QRect(10, 0, self.width - 20, self.footer_start)
|
||||||
self.width - 20, self.footer_start)
|
|
||||||
else:
|
else:
|
||||||
main_rect = QtCore.QRect(theme.font_main_x, theme.font_main_y,
|
main_rect = QtCore.QRect(theme.font_main_x, theme.font_main_y,
|
||||||
theme.font_main_width - 1, theme.font_main_height - 1)
|
theme.font_main_width - 1, theme.font_main_height - 1)
|
||||||
if not theme.font_footer_override:
|
if not theme.font_footer_override:
|
||||||
footer_rect = QtCore.QRect(10, self.footer_start,
|
footer_rect = QtCore.QRect(10, self.footer_start, self.width - 20,
|
||||||
self.width - 20, self.height - self.footer_start)
|
self.height - self.footer_start)
|
||||||
else:
|
else:
|
||||||
footer_rect = QtCore.QRect(theme.font_footer_x,
|
footer_rect = QtCore.QRect(theme.font_footer_x,
|
||||||
theme.font_footer_y, theme.font_footer_width - 1,
|
theme.font_footer_y, theme.font_footer_width - 1,
|
||||||
@ -203,19 +203,19 @@ class RenderManager(object):
|
|||||||
# set the default image size for previews
|
# set the default image size for previews
|
||||||
self.calculate_default(self.screens.preview[u'size'])
|
self.calculate_default(self.screens.preview[u'size'])
|
||||||
verse = u'The Lord said to {r}Noah{/r}: \n' \
|
verse = u'The Lord said to {r}Noah{/r}: \n' \
|
||||||
'There\'s gonna be a {su}floody{/su}, {sb}floody{/sb}\n' \
|
'There\'s gonna be a {su}floody{/su}, {sb}floody{/sb}\n' \
|
||||||
'The Lord said to {g}Noah{/g}:\n' \
|
'The Lord said to {g}Noah{/g}:\n' \
|
||||||
'There\'s gonna be a {st}floody{/st}, {it}floody{/it}\n' \
|
'There\'s gonna be a {st}floody{/st}, {it}floody{/it}\n' \
|
||||||
'Get those children out of the muddy, muddy \n' \
|
'Get those children out of the muddy, muddy \n' \
|
||||||
'{r}C{/r}{b}h{/b}{bl}i{/bl}{y}l{/y}{g}d{/g}{pk}' \
|
'{r}C{/r}{b}h{/b}{bl}i{/bl}{y}l{/y}{g}d{/g}{pk}' \
|
||||||
'r{/pk}{o}e{/o}{pp}n{/pp} of the Lord\n'
|
'r{/pk}{o}e{/o}{pp}n{/pp} of the Lord\n'
|
||||||
# make big page for theme edit dialog to get line count
|
# make big page for theme edit dialog to get line count
|
||||||
if self.force_page:
|
if self.force_page:
|
||||||
verse = verse + verse + verse
|
verse = verse + verse + verse
|
||||||
else:
|
else:
|
||||||
self.image_manager.del_image(theme_data.theme_name)
|
self.image_manager.del_image(theme_data.theme_name)
|
||||||
footer = []
|
footer = []
|
||||||
footer.append(u'Arky Arky (Unknown)' )
|
footer.append(u'Arky Arky (Unknown)')
|
||||||
footer.append(u'Public Domain')
|
footer.append(u'Public Domain')
|
||||||
footer.append(u'CCLI 123456')
|
footer.append(u'CCLI 123456')
|
||||||
# build a service item to generate preview
|
# build a service item to generate preview
|
||||||
@ -258,6 +258,6 @@ class RenderManager(object):
|
|||||||
self.height = screen.height()
|
self.height = screen.height()
|
||||||
self.screen_ratio = float(self.height) / float(self.width)
|
self.screen_ratio = float(self.height) / float(self.width)
|
||||||
log.debug(u'calculate default %d, %d, %f',
|
log.debug(u'calculate default %d, %d, %f',
|
||||||
self.width, self.height, self.screen_ratio )
|
self.width, self.height, self.screen_ratio)
|
||||||
# 90% is start of footer
|
# 90% is start of footer
|
||||||
self.footer_start = int(self.height * 0.90)
|
self.footer_start = int(self.height * 0.90)
|
||||||
|
@ -323,7 +323,7 @@ class ServiceItem(object):
|
|||||||
for text_image in serviceitem[u'serviceitem'][u'data']:
|
for text_image in serviceitem[u'serviceitem'][u'data']:
|
||||||
filename = os.path.join(path, text_image[u'title'])
|
filename = os.path.join(path, text_image[u'title'])
|
||||||
self.add_from_command(
|
self.add_from_command(
|
||||||
path, text_image[u'title'], text_image[u'image'] )
|
path, text_image[u'title'], text_image[u'image'])
|
||||||
self._new_item()
|
self._new_item()
|
||||||
|
|
||||||
def get_display_title(self):
|
def get_display_title(self):
|
||||||
|
@ -33,7 +33,8 @@ import logging
|
|||||||
from xml.dom.minidom import Document
|
from xml.dom.minidom import Document
|
||||||
from lxml import etree, objectify
|
from lxml import etree, objectify
|
||||||
|
|
||||||
from openlp.core.lib import str_to_bool
|
from openlp.core.lib import str_to_bool, translate
|
||||||
|
from openlp.core.lib.ui import UiStrings
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -170,20 +171,14 @@ class HorizontalType(object):
|
|||||||
Type enumeration for horizontal alignment.
|
Type enumeration for horizontal alignment.
|
||||||
"""
|
"""
|
||||||
Left = 0
|
Left = 0
|
||||||
Center = 2
|
|
||||||
Right = 1
|
Right = 1
|
||||||
|
Center = 2
|
||||||
|
|
||||||
@staticmethod
|
Names = [u'left', u'right', u'center']
|
||||||
def to_string(horizontal_type):
|
TranslatedNames = [
|
||||||
"""
|
translate('OpenLP.ThemeWizard', 'Left'),
|
||||||
Return a string representation of a horizontal type.
|
translate('OpenLP.ThemeWizard', 'Right'),
|
||||||
"""
|
translate('OpenLP.ThemeWizard', 'Center')]
|
||||||
if horizontal_type == HorizontalType.Right:
|
|
||||||
return u'right'
|
|
||||||
elif horizontal_type == HorizontalType.Center:
|
|
||||||
return u'center'
|
|
||||||
else:
|
|
||||||
return u'left'
|
|
||||||
|
|
||||||
|
|
||||||
class VerticalType(object):
|
class VerticalType(object):
|
||||||
@ -194,17 +189,8 @@ class VerticalType(object):
|
|||||||
Middle = 1
|
Middle = 1
|
||||||
Bottom = 2
|
Bottom = 2
|
||||||
|
|
||||||
@staticmethod
|
Names = [u'top', u'middle', u'bottom']
|
||||||
def to_string(vertical_type):
|
TranslatedNames = [UiStrings.Top, UiStrings.Middle, UiStrings.Bottom]
|
||||||
"""
|
|
||||||
Return a string representation of a vertical type.
|
|
||||||
"""
|
|
||||||
if vertical_type == VerticalType.Bottom:
|
|
||||||
return u'bottom'
|
|
||||||
elif vertical_type == VerticalType.Middle:
|
|
||||||
return u'middle'
|
|
||||||
else:
|
|
||||||
return u'top'
|
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN_LIST = [u'bold', u'italics', u'override', u'outline', u'shadow',
|
BOOLEAN_LIST = [u'bold', u'italics', u'override', u'outline', u'shadow',
|
||||||
|
@ -40,32 +40,59 @@ class UiStrings(object):
|
|||||||
"""
|
"""
|
||||||
# These strings should need a good reason to be retranslated elsewhere.
|
# These strings should need a good reason to be retranslated elsewhere.
|
||||||
# Should some/more/less of these have an & attached?
|
# Should some/more/less of these have an & attached?
|
||||||
|
About = translate('OpenLP.Ui', 'About')
|
||||||
Add = translate('OpenLP.Ui', '&Add')
|
Add = translate('OpenLP.Ui', '&Add')
|
||||||
Advanced = translate('OpenLP.Ui', 'Advanced')
|
Advanced = translate('OpenLP.Ui', 'Advanced')
|
||||||
AllFiles = translate('OpenLP.Ui', 'All Files')
|
AllFiles = translate('OpenLP.Ui', 'All Files')
|
||||||
Authors = translate('OpenLP.Ui', 'Authors')
|
Bottom = translate('OpenLP.Ui', 'Bottom')
|
||||||
|
Browse = translate('OpenLP.Ui', 'Browse...')
|
||||||
|
Cancel = translate('OpenLP.Ui', 'Cancel')
|
||||||
|
CCLINumberLabel = translate('OpenLP.Ui', 'CCLI number:')
|
||||||
CreateService = translate('OpenLP.Ui', 'Create a new service.')
|
CreateService = translate('OpenLP.Ui', 'Create a new service.')
|
||||||
Delete = translate('OpenLP.Ui', '&Delete')
|
Delete = translate('OpenLP.Ui', '&Delete')
|
||||||
Edit = translate('OpenLP.Ui', '&Edit')
|
Edit = translate('OpenLP.Ui', '&Edit')
|
||||||
|
EmptyField = translate('OpenLP.Ui', 'Empty Field')
|
||||||
Error = translate('OpenLP.Ui', 'Error')
|
Error = translate('OpenLP.Ui', 'Error')
|
||||||
|
Export = translate('OpenLP.Ui', 'Export')
|
||||||
|
FontSizePtUnit = translate('OpenLP.Ui', 'pt',
|
||||||
|
'Abbreviated font pointsize unit')
|
||||||
|
Image = translate('OpenLP.Ui', 'Image')
|
||||||
Import = translate('OpenLP.Ui', 'Import')
|
Import = translate('OpenLP.Ui', 'Import')
|
||||||
LengthTime = unicode(translate('OpenLP.Ui', 'Length %s'))
|
LengthTime = unicode(translate('OpenLP.Ui', 'Length %s'))
|
||||||
Live = translate('OpenLP.Ui', 'Live')
|
Live = translate('OpenLP.Ui', 'Live')
|
||||||
|
LiveBGError = translate('OpenLP.Ui', 'Live Background Error')
|
||||||
|
LivePanel = translate('OpenLP.Ui', 'Live Panel')
|
||||||
Load = translate('OpenLP.Ui', 'Load')
|
Load = translate('OpenLP.Ui', 'Load')
|
||||||
|
Middle = translate('OpenLP.Ui', 'Middle')
|
||||||
New = translate('OpenLP.Ui', 'New')
|
New = translate('OpenLP.Ui', 'New')
|
||||||
NewService = translate('OpenLP.Ui', 'New Service')
|
NewService = translate('OpenLP.Ui', 'New Service')
|
||||||
|
NewTheme = translate('OpenLP.Ui', 'New Theme')
|
||||||
|
NFSs = translate('OpenLP.Ui', 'No File Selected', 'Singular')
|
||||||
|
NFSp = translate('OpenLP.Ui', 'No Files Selected', 'Plural')
|
||||||
|
NISs = translate('OpenLP.Ui', 'No Item Selected', 'Singular')
|
||||||
|
NISp = translate('OpenLP.Ui', 'No Items Selected', 'Plural')
|
||||||
|
OLPV1 = translate('OpenLP.Ui', 'openlp.org 1.x')
|
||||||
OLPV2 = translate('OpenLP.Ui', 'OpenLP 2.0')
|
OLPV2 = translate('OpenLP.Ui', 'OpenLP 2.0')
|
||||||
OpenService = translate('OpenLP.Ui', 'Open Service')
|
OpenService = translate('OpenLP.Ui', 'Open Service')
|
||||||
Preview = translate('OpenLP.Ui', 'Preview')
|
Preview = translate('OpenLP.Ui', 'Preview')
|
||||||
|
PreviewPanel = translate('OpenLP.Ui', 'Preview Panel')
|
||||||
|
PrintServiceOrder = translate('OpenLP.Ui', 'Print Service Order')
|
||||||
ReplaceBG = translate('OpenLP.Ui', 'Replace Background')
|
ReplaceBG = translate('OpenLP.Ui', 'Replace Background')
|
||||||
ReplaceLiveBG = translate('OpenLP.Ui', 'Replace Live Background')
|
ReplaceLiveBG = translate('OpenLP.Ui', 'Replace Live Background')
|
||||||
ResetBG = translate('OpenLP.Ui', 'Reset Background')
|
ResetBG = translate('OpenLP.Ui', 'Reset Background')
|
||||||
ResetLiveBG = translate('OpenLP.Ui', 'Reset Live Background')
|
ResetLiveBG = translate('OpenLP.Ui', 'Reset Live Background')
|
||||||
|
S = translate('OpenLP.Ui', 's', 'The abbreviated unit for seconds')
|
||||||
|
SaveAndPreview = translate('OpenLP.Ui', 'Save && Preview')
|
||||||
|
Search = translate('OpenLP.Ui', 'Search')
|
||||||
|
SelectDelete = translate('OpenLP.Ui', 'You must select an item to delete.')
|
||||||
|
SelectEdit = translate('OpenLP.Ui', 'You must select an item to edit.')
|
||||||
SaveService = translate('OpenLP.Ui', 'Save Service')
|
SaveService = translate('OpenLP.Ui', 'Save Service')
|
||||||
Service = translate('OpenLP.Ui', 'Service')
|
Service = translate('OpenLP.Ui', 'Service')
|
||||||
StartTimeCode = unicode(translate('OpenLP.Ui', 'Start %s'))
|
StartTimeCode = unicode(translate('OpenLP.Ui', 'Start %s'))
|
||||||
Theme = translate('OpenLP.Ui', 'Theme')
|
Theme = translate('OpenLP.Ui', 'Theme', 'Singular')
|
||||||
Themes = translate('OpenLP.Ui', 'Themes')
|
Themes = translate('OpenLP.Ui', 'Themes', 'Plural')
|
||||||
|
Top = translate('OpenLP.Ui', 'Top')
|
||||||
|
Version = translate('OpenLP.Ui', 'Version')
|
||||||
|
|
||||||
def add_welcome_page(parent, image):
|
def add_welcome_page(parent, image):
|
||||||
"""
|
"""
|
||||||
@ -278,8 +305,8 @@ def create_valign_combo(form, parent, layout):
|
|||||||
verticalLabel.setText(translate('OpenLP.Ui', '&Vertical Align:'))
|
verticalLabel.setText(translate('OpenLP.Ui', '&Vertical Align:'))
|
||||||
form.verticalComboBox = QtGui.QComboBox(parent)
|
form.verticalComboBox = QtGui.QComboBox(parent)
|
||||||
form.verticalComboBox.setObjectName(u'VerticalComboBox')
|
form.verticalComboBox.setObjectName(u'VerticalComboBox')
|
||||||
form.verticalComboBox.addItem(translate('OpenLP.Ui', 'Top'))
|
form.verticalComboBox.addItem(UiStrings.Top)
|
||||||
form.verticalComboBox.addItem(translate('OpenLP.Ui', 'Middle'))
|
form.verticalComboBox.addItem(UiStrings.Middle)
|
||||||
form.verticalComboBox.addItem(translate('OpenLP.Ui', 'Bottom'))
|
form.verticalComboBox.addItem(UiStrings.Bottom)
|
||||||
verticalLabel.setBuddy(form.verticalComboBox)
|
verticalLabel.setBuddy(form.verticalComboBox)
|
||||||
layout.addRow(verticalLabel, form.verticalComboBox)
|
layout.addRow(verticalLabel, form.verticalComboBox)
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import build_icon, translate
|
from openlp.core.lib import build_icon, translate
|
||||||
|
from openlp.core.lib.ui import UiStrings
|
||||||
|
|
||||||
class Ui_AboutDialog(object):
|
class Ui_AboutDialog(object):
|
||||||
def setupUi(self, aboutDialog):
|
def setupUi(self, aboutDialog):
|
||||||
@ -86,8 +87,7 @@ class Ui_AboutDialog(object):
|
|||||||
QtCore.QMetaObject.connectSlotsByName(aboutDialog)
|
QtCore.QMetaObject.connectSlotsByName(aboutDialog)
|
||||||
|
|
||||||
def retranslateUi(self, aboutDialog):
|
def retranslateUi(self, aboutDialog):
|
||||||
aboutDialog.setWindowTitle(translate('OpenLP.AboutForm',
|
aboutDialog.setWindowTitle(u'%s OpenLP' % UiStrings.About)
|
||||||
'About OpenLP'))
|
|
||||||
self.aboutTextEdit.setPlainText(translate('OpenLP.AboutForm',
|
self.aboutTextEdit.setPlainText(translate('OpenLP.AboutForm',
|
||||||
'OpenLP <version><revision> - Open Source Lyrics '
|
'OpenLP <version><revision> - Open Source Lyrics '
|
||||||
'Projection\n'
|
'Projection\n'
|
||||||
@ -105,8 +105,7 @@ class Ui_AboutDialog(object):
|
|||||||
'consider contributing by using the button below.'
|
'consider contributing by using the button below.'
|
||||||
))
|
))
|
||||||
self.aboutNotebook.setTabText(
|
self.aboutNotebook.setTabText(
|
||||||
self.aboutNotebook.indexOf(self.aboutTab),
|
self.aboutNotebook.indexOf(self.aboutTab), UiStrings.About)
|
||||||
translate('OpenLP.AboutForm', 'About'))
|
|
||||||
self.creditsTextEdit.setPlainText(translate('OpenLP.AboutForm',
|
self.creditsTextEdit.setPlainText(translate('OpenLP.AboutForm',
|
||||||
'Project Lead\n'
|
'Project Lead\n'
|
||||||
' Raoul "superfly" Snyman\n'
|
' Raoul "superfly" Snyman\n'
|
||||||
|
@ -135,7 +135,7 @@ class AdvancedTab(SettingsTab):
|
|||||||
# self.sharedCheckBox.setText(
|
# self.sharedCheckBox.setText(
|
||||||
# translate('AdvancedTab', 'Enable a shared data location'))
|
# translate('AdvancedTab', 'Enable a shared data location'))
|
||||||
# self.sharedLabel.setText(translate('AdvancedTab', 'Store location:'))
|
# self.sharedLabel.setText(translate('AdvancedTab', 'Store location:'))
|
||||||
# self.sharedPushButton.setText(translate('AdvancedTab', 'Browse...'))
|
# self.sharedPushButton.setText(UiStrings.Browse)
|
||||||
# self.databaseGroupBox.setTitle(translate('AdvancedTab', 'Databases'))
|
# self.databaseGroupBox.setTitle(translate('AdvancedTab', 'Databases'))
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
|
@ -167,7 +167,7 @@ class DisplayTagTab(SettingsTab):
|
|||||||
self.deletePushButton.setText(UiStrings.Delete)
|
self.deletePushButton.setText(UiStrings.Delete)
|
||||||
self.defaultPushButton.setText(
|
self.defaultPushButton.setText(
|
||||||
translate('OpenLP.DisplayTagTab', 'Default'))
|
translate('OpenLP.DisplayTagTab', 'Default'))
|
||||||
self.newPushButton.setText(translate('OpenLP.DisplayTagTab', 'New'))
|
self.newPushButton.setText(UiStrings.New)
|
||||||
self.tagTableWidget.horizontalHeaderItem(0)\
|
self.tagTableWidget.horizontalHeaderItem(0)\
|
||||||
.setText(translate('OpenLP.DisplayTagTab', 'Description'))
|
.setText(translate('OpenLP.DisplayTagTab', 'Description'))
|
||||||
self.tagTableWidget.horizontalHeaderItem(1)\
|
self.tagTableWidget.horizontalHeaderItem(1)\
|
||||||
|
@ -35,24 +35,24 @@ from PyQt4 import Qt, QtCore, QtGui
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
from PyQt4.phonon import Phonon
|
from PyQt4.phonon import Phonon
|
||||||
phonon_version = Phonon.phononVersion()
|
PHONON_VERSION = Phonon.phononVersion()
|
||||||
except ImportError:
|
except ImportError:
|
||||||
phonon_version = u'-'
|
PHONON_VERSION = u'-'
|
||||||
try:
|
try:
|
||||||
import chardet
|
import chardet
|
||||||
chardet_version = chardet.__version__
|
CHARDET_VERSION = chardet.__version__
|
||||||
except ImportError:
|
except ImportError:
|
||||||
chardet_version = u'-'
|
CHARDET_VERSION = u'-'
|
||||||
try:
|
try:
|
||||||
import enchant
|
import enchant
|
||||||
enchant_version = enchant.__version__
|
ENCHANT_VERSION = enchant.__version__
|
||||||
except ImportError:
|
except ImportError:
|
||||||
enchant_version = u'-'
|
ENCHANT_VERSION = u'-'
|
||||||
try:
|
try:
|
||||||
import sqlite
|
import sqlite
|
||||||
sqlite_version = sqlite.version
|
SQLITE_VERSION = sqlite.version
|
||||||
except ImportError:
|
except ImportError:
|
||||||
sqlite_version = u'-'
|
SQLITE_VERSION = u'-'
|
||||||
|
|
||||||
from openlp.core.lib import translate, SettingsManager
|
from openlp.core.lib import translate, SettingsManager
|
||||||
from openlp.core.lib.mailto import mailto
|
from openlp.core.lib.mailto import mailto
|
||||||
@ -85,14 +85,14 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
|
|||||||
'Platform: %s\n')) % platform.platform()
|
'Platform: %s\n')) % platform.platform()
|
||||||
libraries = u'Python: %s\n' % platform.python_version() + \
|
libraries = u'Python: %s\n' % platform.python_version() + \
|
||||||
u'Qt4: %s\n' % Qt.qVersion() + \
|
u'Qt4: %s\n' % Qt.qVersion() + \
|
||||||
u'Phonon: %s\n' % phonon_version + \
|
u'Phonon: %s\n' % PHONON_VERSION + \
|
||||||
u'PyQt4: %s\n' % Qt.PYQT_VERSION_STR + \
|
u'PyQt4: %s\n' % Qt.PYQT_VERSION_STR + \
|
||||||
u'SQLAlchemy: %s\n' % sqlalchemy.__version__ + \
|
u'SQLAlchemy: %s\n' % sqlalchemy.__version__ + \
|
||||||
u'BeautifulSoup: %s\n' % BeautifulSoup.__version__ + \
|
u'BeautifulSoup: %s\n' % BeautifulSoup.__version__ + \
|
||||||
u'lxml: %s\n' % etree.__version__ + \
|
u'lxml: %s\n' % etree.__version__ + \
|
||||||
u'Chardet: %s\n' % chardet_version + \
|
u'Chardet: %s\n' % CHARDET_VERSION + \
|
||||||
u'PyEnchant: %s\n' % enchant_version + \
|
u'PyEnchant: %s\n' % ENCHANT_VERSION + \
|
||||||
u'PySQLite: %s\n' % sqlite_version
|
u'PySQLite: %s\n' % SQLITE_VERSION
|
||||||
if platform.system() == u'Linux':
|
if platform.system() == u'Linux':
|
||||||
if os.environ.get(u'KDE_FULL_SESSION') == u'true':
|
if os.environ.get(u'KDE_FULL_SESSION') == u'true':
|
||||||
system = system + u'Desktop: KDE SC\n'
|
system = system + u'Desktop: KDE SC\n'
|
||||||
@ -170,7 +170,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
|
|||||||
self.__buttonState(False)
|
self.__buttonState(False)
|
||||||
self.descriptionWordCount.setText(
|
self.descriptionWordCount.setText(
|
||||||
unicode(translate('OpenLP.ExceptionDialog',
|
unicode(translate('OpenLP.ExceptionDialog',
|
||||||
'Description characters to enter : %s')) % count )
|
'Description characters to enter : %s')) % count)
|
||||||
|
|
||||||
def onAttachFileButtonPressed(self):
|
def onAttachFileButtonPressed(self):
|
||||||
files = QtGui.QFileDialog.getOpenFileName(
|
files = QtGui.QFileDialog.getOpenFileName(
|
||||||
|
@ -28,6 +28,7 @@ import logging
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import SettingsTab, Receiver, translate
|
from openlp.core.lib import SettingsTab, Receiver, translate
|
||||||
|
from openlp.core.lib.ui import UiStrings
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -267,8 +268,7 @@ class GeneralTab(SettingsTab):
|
|||||||
translate('OpenLP.GeneralTab', ' sec'))
|
translate('OpenLP.GeneralTab', ' sec'))
|
||||||
self.ccliGroupBox.setTitle(
|
self.ccliGroupBox.setTitle(
|
||||||
translate('OpenLP.GeneralTab', 'CCLI Details'))
|
translate('OpenLP.GeneralTab', 'CCLI Details'))
|
||||||
self.numberLabel.setText(
|
self.numberLabel.setText(UiStrings.CCLINumberLabel)
|
||||||
translate('OpenLP.GeneralTab', 'CCLI number:'))
|
|
||||||
self.usernameLabel.setText(
|
self.usernameLabel.setText(
|
||||||
translate('OpenLP.GeneralTab', 'SongSelect username:'))
|
translate('OpenLP.GeneralTab', 'SongSelect username:'))
|
||||||
self.passwordLabel.setText(
|
self.passwordLabel.setText(
|
||||||
|
@ -73,15 +73,15 @@ class Ui_MainWindow(object):
|
|||||||
# Set up the main container, which contains all the other form widgets.
|
# Set up the main container, which contains all the other form widgets.
|
||||||
self.MainContent = QtGui.QWidget(mainWindow)
|
self.MainContent = QtGui.QWidget(mainWindow)
|
||||||
self.MainContent.setObjectName(u'MainContent')
|
self.MainContent.setObjectName(u'MainContent')
|
||||||
self.MainContentLayout = QtGui.QHBoxLayout(self.MainContent)
|
self.mainContentLayout = QtGui.QHBoxLayout(self.MainContent)
|
||||||
self.MainContentLayout.setSpacing(0)
|
self.mainContentLayout.setSpacing(0)
|
||||||
self.MainContentLayout.setMargin(0)
|
self.mainContentLayout.setMargin(0)
|
||||||
self.MainContentLayout.setObjectName(u'MainContentLayout')
|
self.mainContentLayout.setObjectName(u'mainContentLayout')
|
||||||
mainWindow.setCentralWidget(self.MainContent)
|
mainWindow.setCentralWidget(self.MainContent)
|
||||||
self.controlSplitter = QtGui.QSplitter(self.MainContent)
|
self.controlSplitter = QtGui.QSplitter(self.MainContent)
|
||||||
self.controlSplitter.setOrientation(QtCore.Qt.Horizontal)
|
self.controlSplitter.setOrientation(QtCore.Qt.Horizontal)
|
||||||
self.controlSplitter.setObjectName(u'controlSplitter')
|
self.controlSplitter.setObjectName(u'controlSplitter')
|
||||||
self.MainContentLayout.addWidget(self.controlSplitter)
|
self.mainContentLayout.addWidget(self.controlSplitter)
|
||||||
# Create slide controllers
|
# Create slide controllers
|
||||||
self.previewController = SlideController(self, self.settingsmanager,
|
self.previewController = SlideController(self, self.settingsmanager,
|
||||||
self.screens)
|
self.screens)
|
||||||
@ -152,10 +152,10 @@ class Ui_MainWindow(object):
|
|||||||
u'themeManagerDock', u':/system/system_thememanager.png')
|
u'themeManagerDock', u':/system/system_thememanager.png')
|
||||||
self.themeManagerDock.setMinimumWidth(
|
self.themeManagerDock.setMinimumWidth(
|
||||||
self.settingsmanager.mainwindow_right)
|
self.settingsmanager.mainwindow_right)
|
||||||
self.ThemeManagerContents = ThemeManager(mainWindow,
|
self.themeManagerContents = ThemeManager(mainWindow,
|
||||||
self.themeManagerDock)
|
self.themeManagerDock)
|
||||||
self.ThemeManagerContents.setObjectName(u'ThemeManagerContents')
|
self.themeManagerContents.setObjectName(u'themeManagerContents')
|
||||||
self.themeManagerDock.setWidget(self.ThemeManagerContents)
|
self.themeManagerDock.setWidget(self.themeManagerContents)
|
||||||
mainWindow.addDockWidget(QtCore.Qt.RightDockWidgetArea,
|
mainWindow.addDockWidget(QtCore.Qt.RightDockWidgetArea,
|
||||||
self.themeManagerDock)
|
self.themeManagerDock)
|
||||||
# Create the menu items
|
# Create the menu items
|
||||||
@ -256,8 +256,8 @@ class Ui_MainWindow(object):
|
|||||||
self.HelpOnlineHelpItem = base_action(mainWindow, u'HelpOnlineHelpItem')
|
self.HelpOnlineHelpItem = base_action(mainWindow, u'HelpOnlineHelpItem')
|
||||||
self.HelpOnlineHelpItem.setEnabled(False)
|
self.HelpOnlineHelpItem.setEnabled(False)
|
||||||
mainWindow.actionList.add_action(self.HelpOnlineHelpItem, u'Help')
|
mainWindow.actionList.add_action(self.HelpOnlineHelpItem, u'Help')
|
||||||
self.HelpWebSiteItem = base_action(mainWindow, u'HelpWebSiteItem')
|
self.helpWebSiteItem = base_action(mainWindow, u'helpWebSiteItem')
|
||||||
mainWindow.actionList.add_action(self.HelpWebSiteItem, u'Help')
|
mainWindow.actionList.add_action(self.helpWebSiteItem, u'Help')
|
||||||
add_actions(self.FileImportMenu,
|
add_actions(self.FileImportMenu,
|
||||||
(self.ImportThemeItem, self.ImportLanguageItem))
|
(self.ImportThemeItem, self.ImportLanguageItem))
|
||||||
add_actions(self.FileExportMenu,
|
add_actions(self.FileExportMenu,
|
||||||
@ -281,7 +281,7 @@ class Ui_MainWindow(object):
|
|||||||
add_actions(self.ToolsMenu, (self.ToolsAddToolItem, None))
|
add_actions(self.ToolsMenu, (self.ToolsAddToolItem, None))
|
||||||
add_actions(self.ToolsMenu, (self.ToolsOpenDataFolder, None))
|
add_actions(self.ToolsMenu, (self.ToolsOpenDataFolder, None))
|
||||||
add_actions(self.HelpMenu, (self.HelpDocumentationItem,
|
add_actions(self.HelpMenu, (self.HelpDocumentationItem,
|
||||||
self.HelpOnlineHelpItem, None, self.HelpWebSiteItem,
|
self.HelpOnlineHelpItem, None, self.helpWebSiteItem,
|
||||||
self.HelpAboutItem))
|
self.HelpAboutItem))
|
||||||
add_actions(self.MenuBar, (self.FileMenu.menuAction(),
|
add_actions(self.MenuBar, (self.FileMenu.menuAction(),
|
||||||
self.viewMenu.menuAction(), self.ToolsMenu.menuAction(),
|
self.viewMenu.menuAction(), self.ToolsMenu.menuAction(),
|
||||||
@ -340,8 +340,7 @@ class Ui_MainWindow(object):
|
|||||||
'Save the current service under a new name.'))
|
'Save the current service under a new name.'))
|
||||||
self.FileSaveAsItem.setShortcut(
|
self.FileSaveAsItem.setShortcut(
|
||||||
translate('OpenLP.MainWindow', 'Ctrl+Shift+S'))
|
translate('OpenLP.MainWindow', 'Ctrl+Shift+S'))
|
||||||
self.printServiceOrderItem.setText(
|
self.printServiceOrderItem.setText(UiStrings.PrintServiceOrder)
|
||||||
translate('OpenLP.MainWindow', 'Print Service Order'))
|
|
||||||
self.printServiceOrderItem.setStatusTip(translate('OpenLP.MainWindow',
|
self.printServiceOrderItem.setStatusTip(translate('OpenLP.MainWindow',
|
||||||
'Print the current Service Order.'))
|
'Print the current Service Order.'))
|
||||||
self.printServiceOrderItem.setShortcut(
|
self.printServiceOrderItem.setShortcut(
|
||||||
@ -419,7 +418,7 @@ class Ui_MainWindow(object):
|
|||||||
translate('OpenLP.MainWindow', 'Ctrl+F1'))
|
translate('OpenLP.MainWindow', 'Ctrl+F1'))
|
||||||
self.HelpOnlineHelpItem.setText(
|
self.HelpOnlineHelpItem.setText(
|
||||||
translate('OpenLP.MainWindow', '&Online Help'))
|
translate('OpenLP.MainWindow', '&Online Help'))
|
||||||
self.HelpWebSiteItem.setText(
|
self.helpWebSiteItem.setText(
|
||||||
translate('OpenLP.MainWindow', '&Web Site'))
|
translate('OpenLP.MainWindow', '&Web Site'))
|
||||||
self.AutoLanguageItem.setText(
|
self.AutoLanguageItem.setText(
|
||||||
translate('OpenLP.MainWindow', '&Auto Detect'))
|
translate('OpenLP.MainWindow', '&Auto Detect'))
|
||||||
@ -492,10 +491,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
# Set up signals and slots
|
# Set up signals and slots
|
||||||
QtCore.QObject.connect(self.ImportThemeItem,
|
QtCore.QObject.connect(self.ImportThemeItem,
|
||||||
QtCore.SIGNAL(u'triggered()'),
|
QtCore.SIGNAL(u'triggered()'),
|
||||||
self.ThemeManagerContents.onImportTheme)
|
self.themeManagerContents.onImportTheme)
|
||||||
QtCore.QObject.connect(self.ExportThemeItem,
|
QtCore.QObject.connect(self.ExportThemeItem,
|
||||||
QtCore.SIGNAL(u'triggered()'),
|
QtCore.SIGNAL(u'triggered()'),
|
||||||
self.ThemeManagerContents.onExportTheme)
|
self.themeManagerContents.onExportTheme)
|
||||||
QtCore.QObject.connect(self.ViewMediaManagerItem,
|
QtCore.QObject.connect(self.ViewMediaManagerItem,
|
||||||
QtCore.SIGNAL(u'triggered(bool)'), self.toggleMediaManager)
|
QtCore.SIGNAL(u'triggered(bool)'), self.toggleMediaManager)
|
||||||
QtCore.QObject.connect(self.ViewServiceManagerItem,
|
QtCore.QObject.connect(self.ViewServiceManagerItem,
|
||||||
@ -515,7 +514,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
QtCore.QObject.connect(self.themeManagerDock,
|
QtCore.QObject.connect(self.themeManagerDock,
|
||||||
QtCore.SIGNAL(u'visibilityChanged(bool)'),
|
QtCore.SIGNAL(u'visibilityChanged(bool)'),
|
||||||
self.ViewThemeManagerItem.setChecked)
|
self.ViewThemeManagerItem.setChecked)
|
||||||
QtCore.QObject.connect(self.HelpWebSiteItem,
|
QtCore.QObject.connect(self.helpWebSiteItem,
|
||||||
QtCore.SIGNAL(u'triggered()'), self.onHelpWebSiteClicked)
|
QtCore.SIGNAL(u'triggered()'), self.onHelpWebSiteClicked)
|
||||||
QtCore.QObject.connect(self.HelpAboutItem,
|
QtCore.QObject.connect(self.HelpAboutItem,
|
||||||
QtCore.SIGNAL(u'triggered()'), self.onHelpAboutItemClicked)
|
QtCore.SIGNAL(u'triggered()'), self.onHelpAboutItemClicked)
|
||||||
@ -574,7 +573,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
# RenderManager needs to call ThemeManager and
|
# RenderManager needs to call ThemeManager and
|
||||||
# ThemeManager needs to call RenderManager
|
# ThemeManager needs to call RenderManager
|
||||||
self.renderManager = RenderManager(
|
self.renderManager = RenderManager(
|
||||||
self.ThemeManagerContents, self.screens)
|
self.themeManagerContents, self.screens)
|
||||||
# Define the media Dock Manager
|
# Define the media Dock Manager
|
||||||
self.mediaDockManager = MediaDockManager(self.MediaToolBox)
|
self.mediaDockManager = MediaDockManager(self.MediaToolBox)
|
||||||
log.info(u'Load Plugins')
|
log.info(u'Load Plugins')
|
||||||
@ -608,7 +607,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
self.pluginManager.initialise_plugins()
|
self.pluginManager.initialise_plugins()
|
||||||
# Once all components are initialised load the Themes
|
# Once all components are initialised load the Themes
|
||||||
log.info(u'Load Themes')
|
log.info(u'Load Themes')
|
||||||
self.ThemeManagerContents.loadThemes()
|
self.themeManagerContents.loadThemes()
|
||||||
log.info(u'Load data from Settings')
|
log.info(u'Load data from Settings')
|
||||||
if QtCore.QSettings().value(u'advanced/save current plugin',
|
if QtCore.QSettings().value(u'advanced/save current plugin',
|
||||||
QtCore.QVariant(False)).toBool():
|
QtCore.QVariant(False)).toBool():
|
||||||
|
@ -25,7 +25,9 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import translate
|
from openlp.core.lib import translate
|
||||||
|
from openlp.core.lib.ui import UiStrings
|
||||||
|
|
||||||
class Ui_PluginViewDialog(object):
|
class Ui_PluginViewDialog(object):
|
||||||
def setupUi(self, pluginViewDialog):
|
def setupUi(self, pluginViewDialog):
|
||||||
@ -76,10 +78,8 @@ class Ui_PluginViewDialog(object):
|
|||||||
translate('OpenLP.PluginForm', 'Plugin List'))
|
translate('OpenLP.PluginForm', 'Plugin List'))
|
||||||
self.pluginInfoGroupBox.setTitle(
|
self.pluginInfoGroupBox.setTitle(
|
||||||
translate('OpenLP.PluginForm', 'Plugin Details'))
|
translate('OpenLP.PluginForm', 'Plugin Details'))
|
||||||
self.versionLabel.setText(
|
self.versionLabel.setText(u'%s:' % UiStrings.Version)
|
||||||
translate('OpenLP.PluginForm', 'Version:'))
|
self.aboutLabel.setText(u'%s:' % UiStrings.About)
|
||||||
self.aboutLabel.setText(
|
|
||||||
translate('OpenLP.PluginForm', 'About:'))
|
|
||||||
self.statusLabel.setText(
|
self.statusLabel.setText(
|
||||||
translate('OpenLP.PluginForm', 'Status:'))
|
translate('OpenLP.PluginForm', 'Status:'))
|
||||||
self.statusComboBox.setItemText(0,
|
self.statusComboBox.setItemText(0,
|
||||||
|
@ -28,7 +28,7 @@ import logging
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import PluginStatus, Receiver, StringContent, translate
|
from openlp.core.lib import PluginStatus, Receiver, translate
|
||||||
from plugindialog import Ui_PluginViewDialog
|
from plugindialog import Ui_PluginViewDialog
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -80,15 +80,14 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
|
|||||||
# PluginStatus.Inactive
|
# PluginStatus.Inactive
|
||||||
status_text = unicode(
|
status_text = unicode(
|
||||||
translate('OpenLP.PluginForm', '%s (Inactive)'))
|
translate('OpenLP.PluginForm', '%s (Inactive)'))
|
||||||
name_string = plugin.getString(StringContent.Name)
|
item.setText(status_text % plugin.nameStrings[u'singular'])
|
||||||
item.setText(status_text % name_string[u'singular'])
|
|
||||||
# If the plugin has an icon, set it!
|
# If the plugin has an icon, set it!
|
||||||
if plugin.icon:
|
if plugin.icon:
|
||||||
item.setIcon(plugin.icon)
|
item.setIcon(plugin.icon)
|
||||||
self.pluginListWidget.addItem(item)
|
self.pluginListWidget.addItem(item)
|
||||||
pluginListWidth = max(pluginListWidth, self.fontMetrics().width(
|
pluginListWidth = max(pluginListWidth, self.fontMetrics().width(
|
||||||
unicode(translate('OpenLP.PluginForm', '%s (Inactive)')) %
|
unicode(translate('OpenLP.PluginForm', '%s (Inactive)')) %
|
||||||
name_string[u'singular']))
|
plugin.nameStrings[u'singular']))
|
||||||
self.pluginListWidget.setFixedWidth(pluginListWidth +
|
self.pluginListWidget.setFixedWidth(pluginListWidth +
|
||||||
self.pluginListWidget.iconSize().width() + 48)
|
self.pluginListWidget.iconSize().width() + 48)
|
||||||
|
|
||||||
@ -118,8 +117,7 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
|
|||||||
self.pluginListWidget.currentItem().text().split(u' ')[0]
|
self.pluginListWidget.currentItem().text().split(u' ')[0]
|
||||||
self.activePlugin = None
|
self.activePlugin = None
|
||||||
for plugin in self.parent.pluginManager.plugins:
|
for plugin in self.parent.pluginManager.plugins:
|
||||||
name_string = plugin.getString(StringContent.Name)
|
if plugin.nameStrings[u'singular'] == plugin_name_singular:
|
||||||
if name_string[u'singular'] == plugin_name_singular:
|
|
||||||
self.activePlugin = plugin
|
self.activePlugin = plugin
|
||||||
break
|
break
|
||||||
if self.activePlugin:
|
if self.activePlugin:
|
||||||
@ -147,6 +145,5 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
|
|||||||
elif self.activePlugin.status == PluginStatus.Disabled:
|
elif self.activePlugin.status == PluginStatus.Disabled:
|
||||||
status_text = unicode(
|
status_text = unicode(
|
||||||
translate('OpenLP.PluginForm', '%s (Disabled)'))
|
translate('OpenLP.PluginForm', '%s (Disabled)'))
|
||||||
name_string = self.activePlugin.getString(StringContent.Name)
|
|
||||||
self.pluginListWidget.currentItem().setText(
|
self.pluginListWidget.currentItem().setText(
|
||||||
status_text % name_string[u'singular'])
|
status_text % self.activePlugin.nameStrings[u'singular'])
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import build_icon, translate, SpellTextEdit
|
from openlp.core.lib import build_icon, translate, SpellTextEdit
|
||||||
|
from openlp.core.lib.ui import UiStrings
|
||||||
|
|
||||||
class Ui_PrintServiceOrderDialog(object):
|
class Ui_PrintServiceOrderDialog(object):
|
||||||
def setupUi(self, printServiceOrderDialog):
|
def setupUi(self, printServiceOrderDialog):
|
||||||
@ -116,8 +117,7 @@ class Ui_PrintServiceOrderDialog(object):
|
|||||||
QtCore.QMetaObject.connectSlotsByName(printServiceOrderDialog)
|
QtCore.QMetaObject.connectSlotsByName(printServiceOrderDialog)
|
||||||
|
|
||||||
def retranslateUi(self, printServiceOrderDialog):
|
def retranslateUi(self, printServiceOrderDialog):
|
||||||
printServiceOrderDialog.setWindowTitle(
|
printServiceOrderDialog.setWindowTitle(UiStrings.PrintServiceOrder)
|
||||||
translate('OpenLP.PrintServiceOrderForm', 'Print Service Order'))
|
|
||||||
self.previewLabel.setText(
|
self.previewLabel.setText(
|
||||||
translate('OpenLP.ServiceManager', '<b>Preview:</b>'))
|
translate('OpenLP.ServiceManager', '<b>Preview:</b>'))
|
||||||
self.printSlideTextCheckBox.setText(translate(
|
self.printSlideTextCheckBox.setText(translate(
|
||||||
@ -132,6 +132,6 @@ class Ui_PrintServiceOrderDialog(object):
|
|||||||
self.serviceTitleLineEdit.setText(translate('OpenLP.ServiceManager',
|
self.serviceTitleLineEdit.setText(translate('OpenLP.ServiceManager',
|
||||||
'Service Order Sheet'))
|
'Service Order Sheet'))
|
||||||
self.printButton.setText(translate('OpenLP.ServiceManager', 'Print'))
|
self.printButton.setText(translate('OpenLP.ServiceManager', 'Print'))
|
||||||
self.cancelButton.setText(translate('OpenLP.ServiceManager', 'Cancel'))
|
self.cancelButton.setText(UiStrings.Cancel)
|
||||||
self.customNotesLabel.setText(
|
self.customNotesLabel.setText(
|
||||||
translate('OpenLP.ServiceManager', '<b>Custom Service Notes:</b>'))
|
translate('OpenLP.ServiceManager', '<b>Custom Service Notes:</b>'))
|
||||||
|
@ -71,7 +71,7 @@ class ScreenList(object):
|
|||||||
"""
|
"""
|
||||||
Set up the current screen dimensions
|
Set up the current screen dimensions
|
||||||
"""
|
"""
|
||||||
log.debug(u'set_current_display %s', number, )
|
log.debug(u'set_current_display %s', number)
|
||||||
if number + 1 > self.display_count:
|
if number + 1 > self.display_count:
|
||||||
self.current = self.screen_list[0]
|
self.current = self.screen_list[0]
|
||||||
self.override = copy.deepcopy(self.current)
|
self.override = copy.deepcopy(self.current)
|
||||||
@ -99,4 +99,4 @@ class ScreenList(object):
|
|||||||
user wants to use the correct screen attributes
|
user wants to use the correct screen attributes
|
||||||
"""
|
"""
|
||||||
log.debug(u'reset_current_display')
|
log.debug(u'reset_current_display')
|
||||||
self.set_current_display(self.current_display)
|
self.set_current_display(self.current_display)
|
||||||
|
@ -33,8 +33,8 @@ log = logging.getLogger(__name__)
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import OpenLPToolbar, ServiceItem, context_menu_action, \
|
from openlp.core.lib import OpenLPToolbar, ServiceItem, context_menu_action, \
|
||||||
Receiver, build_icon, ItemCapabilities, SettingsManager, translate, \
|
Receiver, build_icon, ItemCapabilities, SettingsManager, translate
|
||||||
ThemeLevel
|
from openlp.core.lib.theme import ThemeLevel
|
||||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||||
from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm, StartTimeForm
|
from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm, StartTimeForm
|
||||||
from openlp.core.ui.printserviceorderform import PrintServiceOrderForm
|
from openlp.core.ui.printserviceorderform import PrintServiceOrderForm
|
||||||
@ -107,8 +107,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
translate('OpenLP.ServiceManager', 'Save this service'),
|
translate('OpenLP.ServiceManager', 'Save this service'),
|
||||||
self.saveFile)
|
self.saveFile)
|
||||||
self.toolbar.addSeparator()
|
self.toolbar.addSeparator()
|
||||||
self.themeLabel = QtGui.QLabel(translate('OpenLP.ServiceManager',
|
self.themeLabel = QtGui.QLabel(u'%s:' % UiStrings.Theme, self)
|
||||||
'Theme:'), self)
|
|
||||||
self.themeLabel.setMargin(3)
|
self.themeLabel.setMargin(3)
|
||||||
self.themeLabel.setObjectName(u'themeLabel')
|
self.themeLabel.setObjectName(u'themeLabel')
|
||||||
self.toolbar.addToolbarWidget(u'ThemeLabel', self.themeLabel)
|
self.toolbar.addToolbarWidget(u'ThemeLabel', self.themeLabel)
|
||||||
@ -1062,8 +1061,8 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
if self.serviceItems[item][u'service_item']\
|
if self.serviceItems[item][u'service_item']\
|
||||||
.is_capable(ItemCapabilities.AllowsEdit):
|
.is_capable(ItemCapabilities.AllowsEdit):
|
||||||
Receiver.send_message(u'%s_edit' %
|
Receiver.send_message(u'%s_edit' %
|
||||||
self.serviceItems[item][u'service_item'].name.lower(), u'L:%s' %
|
self.serviceItems[item][u'service_item'].name.lower(),
|
||||||
self.serviceItems[item][u'service_item'].edit_id )
|
u'L:%s' % self.serviceItems[item][u'service_item'].edit_id)
|
||||||
|
|
||||||
def findServiceItem(self):
|
def findServiceItem(self):
|
||||||
"""
|
"""
|
||||||
|
@ -101,7 +101,8 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
else:
|
else:
|
||||||
shortcutText = action.shortcut().toString()
|
shortcutText = action.shortcut().toString()
|
||||||
alternateText = u''
|
alternateText = u''
|
||||||
actionItem = QtGui.QTreeWidgetItem([actionText, shortcutText, alternateText])
|
actionItem = QtGui.QTreeWidgetItem(
|
||||||
|
[actionText, shortcutText, alternateText])
|
||||||
actionItem.setIcon(0, action.icon())
|
actionItem.setIcon(0, action.icon())
|
||||||
item.addChild(actionItem)
|
item.addChild(actionItem)
|
||||||
item.setExpanded(True)
|
item.setExpanded(True)
|
||||||
|
@ -191,8 +191,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.delaySpinBox.setMinimum(1)
|
self.delaySpinBox.setMinimum(1)
|
||||||
self.delaySpinBox.setMaximum(180)
|
self.delaySpinBox.setMaximum(180)
|
||||||
self.toolbar.addToolbarWidget(u'Image SpinBox', self.delaySpinBox)
|
self.toolbar.addToolbarWidget(u'Image SpinBox', self.delaySpinBox)
|
||||||
self.delaySpinBox.setSuffix(translate('OpenLP.SlideController',
|
self.delaySpinBox.setSuffix(UiStrings.S)
|
||||||
's'))
|
|
||||||
self.delaySpinBox.setToolTip(translate('OpenLP.SlideController',
|
self.delaySpinBox.setToolTip(translate('OpenLP.SlideController',
|
||||||
'Delay between slides in seconds'))
|
'Delay between slides in seconds'))
|
||||||
else:
|
else:
|
||||||
@ -603,14 +602,15 @@ class SlideController(QtGui.QWidget):
|
|||||||
slideHeight = 0
|
slideHeight = 0
|
||||||
if self.serviceItem.is_text():
|
if self.serviceItem.is_text():
|
||||||
if frame[u'verseTag']:
|
if frame[u'verseTag']:
|
||||||
bits = frame[u'verseTag'].split(u':')
|
# These tags are already translated.
|
||||||
tag = u'%s\n%s' % (bits[0][0], bits[1][0:] )
|
verse_def = frame[u'verseTag']
|
||||||
tag1 = u'%s%s' % (bits[0][0], bits[1][0:] )
|
verse_def = u'%s%s' % (verse_def[0].upper(), verse_def[1:])
|
||||||
row = tag
|
two_line_def = u'%s\n%s' % (verse_def[0], verse_def[1:])
|
||||||
|
row = two_line_def
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
if tag1 not in self.slideList:
|
if verse_def not in self.slideList:
|
||||||
self.slideList[tag1] = framenumber
|
self.slideList[verse_def] = framenumber
|
||||||
self.songMenu.menu().addAction(tag1,
|
self.songMenu.menu().addAction(verse_def,
|
||||||
self.onSongBarHandler)
|
self.onSongBarHandler)
|
||||||
else:
|
else:
|
||||||
row += 1
|
row += 1
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import translate
|
from openlp.core.lib import translate
|
||||||
from openlp.core.lib.ui import create_accept_reject_button_box
|
from openlp.core.lib.ui import UiStrings, create_accept_reject_button_box
|
||||||
|
|
||||||
class Ui_StartTimeDialog(object):
|
class Ui_StartTimeDialog(object):
|
||||||
def setupUi(self, StartTimeDialog):
|
def setupUi(self, StartTimeDialog):
|
||||||
@ -65,6 +65,6 @@ class Ui_StartTimeDialog(object):
|
|||||||
self.hourLabel.setText(translate('OpenLP.StartTimeForm', 'Hours:'))
|
self.hourLabel.setText(translate('OpenLP.StartTimeForm', 'Hours:'))
|
||||||
self.hourSpinBox.setSuffix(translate('OpenLP.StartTimeForm', 'h'))
|
self.hourSpinBox.setSuffix(translate('OpenLP.StartTimeForm', 'h'))
|
||||||
self.minuteSpinBox.setSuffix(translate('OpenLP.StartTimeForm', 'm'))
|
self.minuteSpinBox.setSuffix(translate('OpenLP.StartTimeForm', 'm'))
|
||||||
self.secondSpinBox.setSuffix(translate('OpenLP.StartTimeForm', 's'))
|
self.secondSpinBox.setSuffix(UiStrings.S)
|
||||||
self.minuteLabel.setText(translate('OpenLP.StartTimeForm', 'Minutes:'))
|
self.minuteLabel.setText(translate('OpenLP.StartTimeForm', 'Minutes:'))
|
||||||
self.secondLabel.setText(translate('OpenLP.StartTimeForm', 'Seconds:'))
|
self.secondLabel.setText(translate('OpenLP.StartTimeForm', 'Seconds:'))
|
||||||
|
@ -29,8 +29,8 @@ import os
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import translate, BackgroundType, BackgroundGradientType, \
|
from openlp.core.lib import Receiver, translate
|
||||||
Receiver
|
from openlp.core.lib.theme import BackgroundType, BackgroundGradientType
|
||||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||||
from openlp.core.utils import get_images_filter
|
from openlp.core.utils import get_images_filter
|
||||||
from themewizard import Ui_ThemeWizard
|
from themewizard import Ui_ThemeWizard
|
||||||
@ -204,7 +204,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||||||
# Do not trigger on start up
|
# Do not trigger on start up
|
||||||
if self.currentPage != self.welcomePage:
|
if self.currentPage != self.welcomePage:
|
||||||
self.updateTheme()
|
self.updateTheme()
|
||||||
frame = self.thememanager.generateImage(self.theme, True)
|
self.thememanager.generateImage(self.theme, True)
|
||||||
|
|
||||||
def updateLinesText(self, lines):
|
def updateLinesText(self, lines):
|
||||||
"""
|
"""
|
||||||
@ -301,7 +301,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||||||
'Edit Theme - %s')) % self.theme.theme_name)
|
'Edit Theme - %s')) % self.theme.theme_name)
|
||||||
self.next()
|
self.next()
|
||||||
else:
|
else:
|
||||||
self.setWindowTitle(translate('OpenLP.ThemeWizard', 'New Theme'))
|
self.setWindowTitle(UiStrings.NewTheme)
|
||||||
return QtGui.QWizard.exec_(self)
|
return QtGui.QWizard.exec_(self)
|
||||||
|
|
||||||
def initializePage(self, id):
|
def initializePage(self, id):
|
||||||
|
@ -32,10 +32,11 @@ import logging
|
|||||||
from xml.etree.ElementTree import ElementTree, XML
|
from xml.etree.ElementTree import ElementTree, XML
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import OpenLPToolbar, ThemeXML, get_text_file_string, \
|
from openlp.core.lib import OpenLPToolbar, get_text_file_string, build_icon, \
|
||||||
build_icon, Receiver, SettingsManager, translate, check_item_selected, \
|
Receiver, SettingsManager, translate, check_item_selected, \
|
||||||
BackgroundType, BackgroundGradientType, check_directory_exists, \
|
check_directory_exists
|
||||||
VerticalType
|
from openlp.core.lib.theme import ThemeXML, BackgroundType, VerticalType, \
|
||||||
|
BackgroundGradientType
|
||||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||||
from openlp.core.theme import Theme
|
from openlp.core.theme import Theme
|
||||||
from openlp.core.ui import FileRenameForm, ThemeForm
|
from openlp.core.ui import FileRenameForm, ThemeForm
|
||||||
@ -62,8 +63,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
self.layout.setMargin(0)
|
self.layout.setMargin(0)
|
||||||
self.layout.setObjectName(u'layout')
|
self.layout.setObjectName(u'layout')
|
||||||
self.toolbar = OpenLPToolbar(self)
|
self.toolbar = OpenLPToolbar(self)
|
||||||
self.toolbar.addToolbarButton(
|
self.toolbar.addToolbarButton(UiStrings.NewTheme,
|
||||||
translate('OpenLP.ThemeManager', 'New Theme'),
|
|
||||||
u':/themes/theme_new.png',
|
u':/themes/theme_new.png',
|
||||||
translate('OpenLP.ThemeManager', 'Create a new theme.'),
|
translate('OpenLP.ThemeManager', 'Create a new theme.'),
|
||||||
self.onAddTheme)
|
self.onAddTheme)
|
||||||
@ -529,6 +529,18 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
else:
|
else:
|
||||||
outfile = open(fullpath, u'wb')
|
outfile = open(fullpath, u'wb')
|
||||||
outfile.write(zip.read(file))
|
outfile.write(zip.read(file))
|
||||||
|
except (IOError, NameError):
|
||||||
|
critical_error_message_box(
|
||||||
|
translate('OpenLP.ThemeManager', 'Validation Error'),
|
||||||
|
translate('OpenLP.ThemeManager', 'File is not a valid theme.'))
|
||||||
|
log.exception(u'Importing theme from zip failed %s' % filename)
|
||||||
|
finally:
|
||||||
|
# Close the files, to be able to continue creating the theme.
|
||||||
|
if zip:
|
||||||
|
zip.close()
|
||||||
|
if outfile:
|
||||||
|
outfile.close()
|
||||||
|
# As all files are closed, we can create the Theme.
|
||||||
if filexml:
|
if filexml:
|
||||||
theme = self._createThemeFromXml(filexml, self.path)
|
theme = self._createThemeFromXml(filexml, self.path)
|
||||||
self.generateAndSaveImage(dir, themename, theme)
|
self.generateAndSaveImage(dir, themename, theme)
|
||||||
@ -539,17 +551,6 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
'File is not a valid theme.'))
|
'File is not a valid theme.'))
|
||||||
log.exception(u'Theme file does not contain XML data %s' %
|
log.exception(u'Theme file does not contain XML data %s' %
|
||||||
filename)
|
filename)
|
||||||
except (IOError, NameError):
|
|
||||||
critical_error_message_box(
|
|
||||||
translate('OpenLP.ThemeManager', 'Validation Error'),
|
|
||||||
translate('OpenLP.ThemeManager',
|
|
||||||
'File is not a valid theme.'))
|
|
||||||
log.exception(u'Importing theme from zip failed %s' % filename)
|
|
||||||
finally:
|
|
||||||
if zip:
|
|
||||||
zip.close()
|
|
||||||
if outfile:
|
|
||||||
outfile.close()
|
|
||||||
|
|
||||||
def checkIfThemeExists(self, themeName):
|
def checkIfThemeExists(self, themeName):
|
||||||
"""
|
"""
|
||||||
|
@ -26,7 +26,8 @@
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import SettingsTab, Receiver, ThemeLevel, translate
|
from openlp.core.lib import SettingsTab, Receiver, translate
|
||||||
|
from openlp.core.lib.theme import ThemeLevel
|
||||||
from openlp.core.lib.ui import UiStrings
|
from openlp.core.lib.ui import UiStrings
|
||||||
|
|
||||||
class ThemesTab(SettingsTab):
|
class ThemesTab(SettingsTab):
|
||||||
@ -199,7 +200,7 @@ class ThemesTab(SettingsTab):
|
|||||||
"""
|
"""
|
||||||
Utility method to update the global theme preview image.
|
Utility method to update the global theme preview image.
|
||||||
"""
|
"""
|
||||||
image = self.parent.ThemeManagerContents.getPreviewImage(
|
image = self.parent.themeManagerContents.getPreviewImage(
|
||||||
self.global_theme)
|
self.global_theme)
|
||||||
preview = QtGui.QPixmap(unicode(image))
|
preview = QtGui.QPixmap(unicode(image))
|
||||||
if not preview.isNull():
|
if not preview.isNull():
|
||||||
|
@ -27,7 +27,9 @@
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import translate, build_icon
|
from openlp.core.lib import translate, build_icon
|
||||||
from openlp.core.lib.ui import add_welcome_page, create_valign_combo
|
from openlp.core.lib.theme import HorizontalType, BackgroundType, \
|
||||||
|
BackgroundGradientType
|
||||||
|
from openlp.core.lib.ui import UiStrings, add_welcome_page, create_valign_combo
|
||||||
|
|
||||||
class Ui_ThemeWizard(object):
|
class Ui_ThemeWizard(object):
|
||||||
def setupUi(self, themeWizard):
|
def setupUi(self, themeWizard):
|
||||||
@ -417,12 +419,12 @@ class Ui_ThemeWizard(object):
|
|||||||
'according to the parameters below.'))
|
'according to the parameters below.'))
|
||||||
self.backgroundLabel.setText(
|
self.backgroundLabel.setText(
|
||||||
translate('OpenLP.ThemeWizard', 'Background type:'))
|
translate('OpenLP.ThemeWizard', 'Background type:'))
|
||||||
self.backgroundComboBox.setItemText(0,
|
self.backgroundComboBox.setItemText(BackgroundType.Solid,
|
||||||
translate('OpenLP.ThemeWizard', 'Solid Color'))
|
translate('OpenLP.ThemeWizard', 'Solid Color'))
|
||||||
self.backgroundComboBox.setItemText(1,
|
self.backgroundComboBox.setItemText(BackgroundType.Gradient,
|
||||||
translate('OpenLP.ThemeWizard', 'Gradient'))
|
translate('OpenLP.ThemeWizard', 'Gradient'))
|
||||||
self.backgroundComboBox.setItemText(2,
|
self.backgroundComboBox.setItemText(
|
||||||
translate('OpenLP.ThemeWizard', 'Image'))
|
BackgroundType.Image, UiStrings.Image)
|
||||||
self.colorLabel.setText(translate('OpenLP.ThemeWizard', 'Color:'))
|
self.colorLabel.setText(translate('OpenLP.ThemeWizard', 'Color:'))
|
||||||
self.gradientStartLabel.setText(
|
self.gradientStartLabel.setText(
|
||||||
translate(u'OpenLP.ThemeWizard', 'Starting color:'))
|
translate(u'OpenLP.ThemeWizard', 'Starting color:'))
|
||||||
@ -430,17 +432,17 @@ class Ui_ThemeWizard(object):
|
|||||||
translate(u'OpenLP.ThemeWizard', 'Ending color:'))
|
translate(u'OpenLP.ThemeWizard', 'Ending color:'))
|
||||||
self.gradientTypeLabel.setText(
|
self.gradientTypeLabel.setText(
|
||||||
translate('OpenLP.ThemeWizard', 'Gradient:'))
|
translate('OpenLP.ThemeWizard', 'Gradient:'))
|
||||||
self.gradientComboBox.setItemText(0,
|
self.gradientComboBox.setItemText(BackgroundGradientType.Horizontal,
|
||||||
translate('OpenLP.ThemeWizard', 'Horizontal'))
|
translate('OpenLP.ThemeWizard', 'Horizontal'))
|
||||||
self.gradientComboBox.setItemText(1,
|
self.gradientComboBox.setItemText(BackgroundGradientType.Vertical,
|
||||||
translate('OpenLP.ThemeWizard', 'Vertical'))
|
translate('OpenLP.ThemeWizard', 'Vertical'))
|
||||||
self.gradientComboBox.setItemText(2,
|
self.gradientComboBox.setItemText(BackgroundGradientType.Circular,
|
||||||
translate('OpenLP.ThemeWizard', 'Circular'))
|
translate('OpenLP.ThemeWizard', 'Circular'))
|
||||||
self.gradientComboBox.setItemText(3,
|
self.gradientComboBox.setItemText(BackgroundGradientType.LeftTop,
|
||||||
translate('OpenLP.ThemeWizard', 'Top Left - Bottom Right'))
|
translate('OpenLP.ThemeWizard', 'Top Left - Bottom Right'))
|
||||||
self.gradientComboBox.setItemText(4,
|
self.gradientComboBox.setItemText(BackgroundGradientType.LeftBottom,
|
||||||
translate('OpenLP.ThemeWizard', 'Bottom Left - Top Right'))
|
translate('OpenLP.ThemeWizard', 'Bottom Left - Top Right'))
|
||||||
self.imageLabel.setText(translate('OpenLP.ThemeWizard', 'Image:'))
|
self.imageLabel.setText(u'%s:' % UiStrings.Image)
|
||||||
self.mainAreaPage.setTitle(
|
self.mainAreaPage.setTitle(
|
||||||
translate('OpenLP.ThemeWizard', 'Main Area Font Details'))
|
translate('OpenLP.ThemeWizard', 'Main Area Font Details'))
|
||||||
self.mainAreaPage.setSubTitle(
|
self.mainAreaPage.setSubTitle(
|
||||||
@ -449,17 +451,17 @@ class Ui_ThemeWizard(object):
|
|||||||
self.mainFontLabel.setText(translate('OpenLP.ThemeWizard', 'Font:'))
|
self.mainFontLabel.setText(translate('OpenLP.ThemeWizard', 'Font:'))
|
||||||
self.mainColorLabel.setText(translate('OpenLP.ThemeWizard', 'Color:'))
|
self.mainColorLabel.setText(translate('OpenLP.ThemeWizard', 'Color:'))
|
||||||
self.mainSizeLabel.setText(translate('OpenLP.ThemeWizard', 'Size:'))
|
self.mainSizeLabel.setText(translate('OpenLP.ThemeWizard', 'Size:'))
|
||||||
self.mainSizeSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'pt'))
|
self.mainSizeSpinBox.setSuffix(UiStrings.FontSizePtUnit)
|
||||||
self.lineSpacingLabel.setText(
|
self.lineSpacingLabel.setText(
|
||||||
translate('OpenLP.ThemeWizard', 'Line Spacing:'))
|
translate('OpenLP.ThemeWizard', 'Line Spacing:'))
|
||||||
self.lineSpacingSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'pt'))
|
self.lineSpacingSpinBox.setSuffix(UiStrings.FontSizePtUnit)
|
||||||
self.outlineCheckBox.setText(
|
self.outlineCheckBox.setText(
|
||||||
translate('OpenLP.ThemeWizard', '&Outline:'))
|
translate('OpenLP.ThemeWizard', '&Outline:'))
|
||||||
self.outlineSizeLabel.setText(translate('OpenLP.ThemeWizard', 'Size:'))
|
self.outlineSizeLabel.setText(translate('OpenLP.ThemeWizard', 'Size:'))
|
||||||
self.outlineSizeSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'pt'))
|
self.outlineSizeSpinBox.setSuffix(UiStrings.FontSizePtUnit)
|
||||||
self.shadowCheckBox.setText(translate('OpenLP.ThemeWizard', '&Shadow:'))
|
self.shadowCheckBox.setText(translate('OpenLP.ThemeWizard', '&Shadow:'))
|
||||||
self.shadowSizeLabel.setText(translate('OpenLP.ThemeWizard', 'Size:'))
|
self.shadowSizeLabel.setText(translate('OpenLP.ThemeWizard', 'Size:'))
|
||||||
self.shadowSizeSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'pt'))
|
self.shadowSizeSpinBox.setSuffix(UiStrings.FontSizePtUnit)
|
||||||
self.mainBoldCheckBox.setText(translate('OpenLP.ThemeWizard', 'Bold'))
|
self.mainBoldCheckBox.setText(translate('OpenLP.ThemeWizard', 'Bold'))
|
||||||
self.mainItalicsCheckBox.setText(
|
self.mainItalicsCheckBox.setText(
|
||||||
translate('OpenLP.ThemeWizard', 'Italic'))
|
translate('OpenLP.ThemeWizard', 'Italic'))
|
||||||
@ -471,7 +473,7 @@ class Ui_ThemeWizard(object):
|
|||||||
self.footerFontLabel.setText(translate('OpenLP.ThemeWizard', 'Font:'))
|
self.footerFontLabel.setText(translate('OpenLP.ThemeWizard', 'Font:'))
|
||||||
self.footerColorLabel.setText(translate('OpenLP.ThemeWizard', 'Color:'))
|
self.footerColorLabel.setText(translate('OpenLP.ThemeWizard', 'Color:'))
|
||||||
self.footerSizeLabel.setText(translate('OpenLP.ThemeWizard', 'Size:'))
|
self.footerSizeLabel.setText(translate('OpenLP.ThemeWizard', 'Size:'))
|
||||||
self.footerSizeSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'pt'))
|
self.footerSizeSpinBox.setSuffix(UiStrings.FontSizePtUnit)
|
||||||
self.alignmentPage.setTitle(
|
self.alignmentPage.setTitle(
|
||||||
translate('OpenLP.ThemeWizard', 'Text Formatting Details'))
|
translate('OpenLP.ThemeWizard', 'Text Formatting Details'))
|
||||||
self.alignmentPage.setSubTitle(
|
self.alignmentPage.setSubTitle(
|
||||||
@ -479,11 +481,11 @@ class Ui_ThemeWizard(object):
|
|||||||
'formatting information to be defined'))
|
'formatting information to be defined'))
|
||||||
self.horizontalLabel.setText(
|
self.horizontalLabel.setText(
|
||||||
translate('OpenLP.ThemeWizard', 'Horizontal Align:'))
|
translate('OpenLP.ThemeWizard', 'Horizontal Align:'))
|
||||||
self.horizontalComboBox.setItemText(0,
|
self.horizontalComboBox.setItemText(HorizontalType.Left,
|
||||||
translate('OpenLP.ThemeWizard', 'Left'))
|
translate('OpenLP.ThemeWizard', 'Left'))
|
||||||
self.horizontalComboBox.setItemText(1,
|
self.horizontalComboBox.setItemText(HorizontalType.Right,
|
||||||
translate('OpenLP.ThemeWizard', 'Right'))
|
translate('OpenLP.ThemeWizard', 'Right'))
|
||||||
self.horizontalComboBox.setItemText(2,
|
self.horizontalComboBox.setItemText(HorizontalType.Center,
|
||||||
translate('OpenLP.ThemeWizard', 'Center'))
|
translate('OpenLP.ThemeWizard', 'Center'))
|
||||||
self.transitionsLabel.setText(
|
self.transitionsLabel.setText(
|
||||||
translate('OpenLP.ThemeWizard', 'Transitions:'))
|
translate('OpenLP.ThemeWizard', 'Transitions:'))
|
||||||
|
@ -31,11 +31,50 @@ import os
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import build_icon, Receiver, SettingsManager
|
from openlp.core.lib import build_icon, Receiver, SettingsManager, translate
|
||||||
from openlp.core.lib.ui import UiStrings, add_welcome_page
|
from openlp.core.lib.ui import UiStrings, add_welcome_page
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
class WizardStrings(object):
|
||||||
|
"""
|
||||||
|
Provide standard strings for wizards to use.
|
||||||
|
"""
|
||||||
|
# Applications/Formats we import from or export to. These get used in
|
||||||
|
# multiple places but do not need translating unless you find evidence of
|
||||||
|
# the writers translating their own product name.
|
||||||
|
CCLI = u'CCLI/SongSelect'
|
||||||
|
CSV = u'CSV'
|
||||||
|
EW = u'EasyWorship'
|
||||||
|
ES = u'EasiSlides'
|
||||||
|
OL = u'OpenLyrics'
|
||||||
|
OS = u'OpenSong'
|
||||||
|
OSIS = u'OSIS'
|
||||||
|
SB = u'SongBeamer'
|
||||||
|
SoF = u'Songs of Fellowship'
|
||||||
|
SSP = u'SongShow Plus'
|
||||||
|
WoW = u'Words of Worship'
|
||||||
|
# These strings should need a good reason to be retranslated elsewhere.
|
||||||
|
FinishedImport = translate('OpenLP.Ui', 'Finished import.')
|
||||||
|
FormatLabel = translate('OpenLP.Ui', 'Format:')
|
||||||
|
HeaderStyle = u'<span style="font-size:14pt; font-weight:600;">%s</span>'
|
||||||
|
Importing = translate('OpenLP.Ui', 'Importing')
|
||||||
|
ImportingType = unicode(translate('OpenLP.Ui', 'Importing "%s"...'))
|
||||||
|
ImportSelect = translate('OpenLP.Ui', 'Select Import Source')
|
||||||
|
ImportSelectLong = unicode(translate('OpenLP.Ui',
|
||||||
|
'Select the import format and the location to import from.'))
|
||||||
|
NoSqlite = translate('OpenLP.Ui', 'The openlp.org 1.x importer has been '
|
||||||
|
'disabled due to a missing Python module. If you want to use this '
|
||||||
|
'importer, you will need to install the "python-sqlite" '
|
||||||
|
'module.')
|
||||||
|
OpenTypeFile = unicode(translate('OpenLP.Ui', 'Open %s File'))
|
||||||
|
PercentSymbolFormat = unicode(translate('OpenLP.Ui', '%p%'))
|
||||||
|
Ready = translate('OpenLP.Ui', 'Ready.')
|
||||||
|
StartingImport = translate('OpenLP.Ui', 'Starting import...')
|
||||||
|
YouSpecifyFile = unicode(translate('OpenLP.Ui', 'You need to specify at '
|
||||||
|
'least one %s file to import from.', 'A file type e.g. OpenSong'))
|
||||||
|
|
||||||
|
|
||||||
class OpenLPWizard(QtGui.QWizard):
|
class OpenLPWizard(QtGui.QWizard):
|
||||||
"""
|
"""
|
||||||
Generic OpenLP wizard to provide generic functionality and a unified look
|
Generic OpenLP wizard to provide generic functionality and a unified look
|
||||||
@ -43,6 +82,7 @@ class OpenLPWizard(QtGui.QWizard):
|
|||||||
"""
|
"""
|
||||||
def __init__(self, parent, plugin, name, image):
|
def __init__(self, parent, plugin, name, image):
|
||||||
QtGui.QWizard.__init__(self, parent)
|
QtGui.QWizard.__init__(self, parent)
|
||||||
|
self.plugin = plugin
|
||||||
self.setObjectName(name)
|
self.setObjectName(name)
|
||||||
self.openIcon = build_icon(u':/general/general_open.png')
|
self.openIcon = build_icon(u':/general/general_open.png')
|
||||||
self.deleteIcon = build_icon(u':/general/general_delete.png')
|
self.deleteIcon = build_icon(u':/general/general_delete.png')
|
||||||
@ -50,7 +90,6 @@ class OpenLPWizard(QtGui.QWizard):
|
|||||||
self.cancelButton = self.button(QtGui.QWizard.CancelButton)
|
self.cancelButton = self.button(QtGui.QWizard.CancelButton)
|
||||||
self.setupUi(image)
|
self.setupUi(image)
|
||||||
self.registerFields()
|
self.registerFields()
|
||||||
self.plugin = plugin
|
|
||||||
self.customInit()
|
self.customInit()
|
||||||
self.customSignals()
|
self.customSignals()
|
||||||
QtCore.QObject.connect(self, QtCore.SIGNAL(u'currentIdChanged(int)'),
|
QtCore.QObject.connect(self, QtCore.SIGNAL(u'currentIdChanged(int)'),
|
||||||
|
@ -109,12 +109,10 @@ class AlertsTab(SettingsTab):
|
|||||||
translate('AlertsPlugin.AlertsTab', 'Background color:'))
|
translate('AlertsPlugin.AlertsTab', 'Background color:'))
|
||||||
self.FontSizeLabel.setText(
|
self.FontSizeLabel.setText(
|
||||||
translate('AlertsPlugin.AlertsTab', 'Font size:'))
|
translate('AlertsPlugin.AlertsTab', 'Font size:'))
|
||||||
self.FontSizeSpinBox.setSuffix(
|
self.FontSizeSpinBox.setSuffix(UiStrings.FontSizePtUnit)
|
||||||
translate('AlertsPlugin.AlertsTab', 'pt'))
|
|
||||||
self.TimeoutLabel.setText(
|
self.TimeoutLabel.setText(
|
||||||
translate('AlertsPlugin.AlertsTab', 'Alert timeout:'))
|
translate('AlertsPlugin.AlertsTab', 'Alert timeout:'))
|
||||||
self.TimeoutSpinBox.setSuffix(
|
self.TimeoutSpinBox.setSuffix(UiStrings.S)
|
||||||
translate('AlertsPlugin.AlertsTab', 's'))
|
|
||||||
self.PreviewGroupBox.setTitle(UiStrings.Preview)
|
self.PreviewGroupBox.setTitle(UiStrings.Preview)
|
||||||
self.FontPreview.setText(UiStrings.OLPV2)
|
self.FontPreview.setText(UiStrings.OLPV2)
|
||||||
|
|
||||||
|
@ -35,8 +35,8 @@ from PyQt4 import QtCore, QtGui
|
|||||||
|
|
||||||
from openlp.core.lib import Receiver, translate
|
from openlp.core.lib import Receiver, translate
|
||||||
from openlp.core.lib.db import delete_database
|
from openlp.core.lib.db import delete_database
|
||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||||
from openlp.core.ui.wizard import OpenLPWizard
|
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
|
||||||
from openlp.core.utils import AppLocation, string_is_unicode
|
from openlp.core.utils import AppLocation, string_is_unicode
|
||||||
from openlp.plugins.bibles.lib.manager import BibleFormat
|
from openlp.plugins.bibles.lib.manager import BibleFormat
|
||||||
|
|
||||||
@ -51,18 +51,7 @@ class WebDownload(object):
|
|||||||
BibleGateway = 1
|
BibleGateway = 1
|
||||||
Bibleserver = 2
|
Bibleserver = 2
|
||||||
|
|
||||||
Names = {
|
Names = [u'Crosswalk', u'BibleGateway', u'Bibleserver']
|
||||||
0: u'Crosswalk',
|
|
||||||
1: u'BibleGateway',
|
|
||||||
2: u'Bibleserver'
|
|
||||||
}
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def get_name(cls, name):
|
|
||||||
"""
|
|
||||||
Get the web bible type name.
|
|
||||||
"""
|
|
||||||
return cls.Names[name]
|
|
||||||
|
|
||||||
|
|
||||||
class BibleImportForm(OpenLPWizard):
|
class BibleImportForm(OpenLPWizard):
|
||||||
@ -363,32 +352,22 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
self.setWindowTitle(
|
self.setWindowTitle(
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Bible Import Wizard'))
|
translate('BiblesPlugin.ImportWizardForm', 'Bible Import Wizard'))
|
||||||
self.titleLabel.setText(
|
self.titleLabel.setText(WizardStrings.HeaderStyle %
|
||||||
u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
|
translate('OpenLP.Ui', 'Welcome to the Bible Import Wizard'))
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
|
||||||
'Welcome to the Bible Import Wizard'))
|
|
||||||
self.informationLabel.setText(
|
self.informationLabel.setText(
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
'This wizard will help you to import Bibles from a '
|
'This wizard will help you to import Bibles from a variety of '
|
||||||
'variety of formats. Click the next button below to start the '
|
'formats. Click the next button below to start the process by '
|
||||||
'process by selecting a format to import from.'))
|
'selecting a format to import from.'))
|
||||||
self.selectPage.setTitle(translate('BiblesPlugin.ImportWizardForm',
|
self.selectPage.setTitle(WizardStrings.ImportSelect)
|
||||||
'Select Import Source'))
|
self.selectPage.setSubTitle(WizardStrings.ImportSelectLong)
|
||||||
self.selectPage.setSubTitle(
|
self.formatLabel.setText(WizardStrings.FormatLabel)
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
self.formatComboBox.setItemText(BibleFormat.OSIS, WizardStrings.OSIS)
|
||||||
'Select the import format, and where to import from.'))
|
self.formatComboBox.setItemText(BibleFormat.CSV, WizardStrings.CSV)
|
||||||
self.formatLabel.setText(
|
self.formatComboBox.setItemText(BibleFormat.OpenSong, WizardStrings.OS)
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Format:'))
|
self.formatComboBox.setItemText(BibleFormat.WebDownload,
|
||||||
self.formatComboBox.setItemText(0,
|
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'OSIS'))
|
|
||||||
self.formatComboBox.setItemText(1,
|
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'CSV'))
|
|
||||||
self.formatComboBox.setItemText(2,
|
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'OpenSong'))
|
|
||||||
self.formatComboBox.setItemText(3,
|
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Web Download'))
|
translate('BiblesPlugin.ImportWizardForm', 'Web Download'))
|
||||||
self.formatComboBox.setItemText(4,
|
self.formatComboBox.setItemText(BibleFormat.OpenLP1, UiStrings.OLPV1)
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'openlp.org 1.x'))
|
|
||||||
self.openlp1FileLabel.setText(
|
self.openlp1FileLabel.setText(
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
|
translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
|
||||||
self.osisFileLabel.setText(
|
self.osisFileLabel.setText(
|
||||||
@ -403,11 +382,11 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
|
translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
|
||||||
self.webSourceLabel.setText(
|
self.webSourceLabel.setText(
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Location:'))
|
translate('BiblesPlugin.ImportWizardForm', 'Location:'))
|
||||||
self.webSourceComboBox.setItemText(0,
|
self.webSourceComboBox.setItemText(WebDownload.Crosswalk,
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Crosswalk'))
|
translate('BiblesPlugin.ImportWizardForm', 'Crosswalk'))
|
||||||
self.webSourceComboBox.setItemText(1,
|
self.webSourceComboBox.setItemText(WebDownload.BibleGateway,
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'BibleGateway'))
|
translate('BiblesPlugin.ImportWizardForm', 'BibleGateway'))
|
||||||
self.webSourceComboBox.setItemText(2,
|
self.webSourceComboBox.setItemText(WebDownload.Bibleserver,
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Bibleserver'))
|
translate('BiblesPlugin.ImportWizardForm', 'Bibleserver'))
|
||||||
self.webTranslationLabel.setText(
|
self.webTranslationLabel.setText(
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Bible:'))
|
translate('BiblesPlugin.ImportWizardForm', 'Bible:'))
|
||||||
@ -435,19 +414,13 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
translate('BiblesPlugin.ImportWizardForm', 'Copyright:'))
|
translate('BiblesPlugin.ImportWizardForm', 'Copyright:'))
|
||||||
self.permissionsLabel.setText(
|
self.permissionsLabel.setText(
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Permissions:'))
|
translate('BiblesPlugin.ImportWizardForm', 'Permissions:'))
|
||||||
self.progressPage.setTitle(
|
self.progressPage.setTitle(WizardStrings.Importing)
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Importing'))
|
|
||||||
self.progressPage.setSubTitle(
|
self.progressPage.setSubTitle(
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
'Please wait while your Bible is imported.'))
|
'Please wait while your Bible is imported.'))
|
||||||
self.progressLabel.setText(
|
self.progressLabel.setText(WizardStrings.Ready)
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Ready.'))
|
|
||||||
self.progressBar.setFormat(u'%p%')
|
self.progressBar.setFormat(u'%p%')
|
||||||
self.openlp1DisabledLabel.setText(
|
self.openlp1DisabledLabel.setText(WizardStrings.NoSqlite)
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'The openlp.org 1.x '
|
|
||||||
'importer has been disabled due to a missing Python module. If '
|
|
||||||
'you want to use this importer, you will need to install the '
|
|
||||||
'"python-sqlite" module.'))
|
|
||||||
# Align all QFormLayouts towards each other.
|
# Align all QFormLayouts towards each other.
|
||||||
labelWidth = max(self.formatLabel.minimumSizeHint().width(),
|
labelWidth = max(self.formatLabel.minimumSizeHint().width(),
|
||||||
self.osisFileLabel.minimumSizeHint().width(),
|
self.osisFileLabel.minimumSizeHint().width(),
|
||||||
@ -468,37 +441,28 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
elif self.currentPage() == self.selectPage:
|
elif self.currentPage() == self.selectPage:
|
||||||
if self.field(u'source_format').toInt()[0] == BibleFormat.OSIS:
|
if self.field(u'source_format').toInt()[0] == BibleFormat.OSIS:
|
||||||
if not self.field(u'osis_location').toString():
|
if not self.field(u'osis_location').toString():
|
||||||
critical_error_message_box(
|
critical_error_message_box(UiStrings.NFSs,
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
WizardStrings.YouSpecifyFile % WizardStrings.OSIS)
|
||||||
'Invalid Bible Location'),
|
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
|
||||||
'You need to specify a file to import your '
|
|
||||||
'Bible from.'))
|
|
||||||
self.osisFileEdit.setFocus()
|
self.osisFileEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV:
|
elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV:
|
||||||
if not self.field(u'csv_testamentsfile').toString():
|
if not self.field(u'csv_testamentsfile').toString():
|
||||||
answer = critical_error_message_box(translate(
|
answer = critical_error_message_box(UiStrings.NFSs,
|
||||||
'BiblesPlugin.ImportWizardForm', 'No Testaments File'),
|
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
'You have not specified a testaments file. Do you '
|
'You have not specified a testaments file. Do you '
|
||||||
'want to proceed with the import?'), question=True)
|
'want to proceed with the import?'), question=True)
|
||||||
if answer == QtGui.QMessageBox.No:
|
if answer == QtGui.QMessageBox.No:
|
||||||
self.csvTestamentsEdit.setFocus()
|
self.csvTestamentsEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif not self.field(u'csv_booksfile').toString():
|
if not self.field(u'csv_booksfile').toString():
|
||||||
critical_error_message_box(
|
critical_error_message_box(UiStrings.NFSs,
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
|
||||||
'Invalid Books File'),
|
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
'You need to specify a file with books of '
|
'You need to specify a file with books of '
|
||||||
'the Bible to use in the import.'))
|
'the Bible to use in the import.'))
|
||||||
self.csvBooksEdit.setFocus()
|
self.csvBooksEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif not self.field(u'csv_versefile').toString():
|
elif not self.field(u'csv_versefile').toString():
|
||||||
critical_error_message_box(
|
critical_error_message_box(UiStrings.NFSs,
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
|
||||||
'Invalid Verse File'),
|
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
'You need to specify a file of Bible '
|
'You need to specify a file of Bible '
|
||||||
'verses to import.'))
|
'verses to import.'))
|
||||||
@ -507,22 +471,14 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
elif self.field(u'source_format').toInt()[0] == \
|
elif self.field(u'source_format').toInt()[0] == \
|
||||||
BibleFormat.OpenSong:
|
BibleFormat.OpenSong:
|
||||||
if not self.field(u'opensong_file').toString():
|
if not self.field(u'opensong_file').toString():
|
||||||
critical_error_message_box(
|
critical_error_message_box(UiStrings.NFSs,
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
WizardStrings.YouSpecifyFile % WizardStrings.OS)
|
||||||
'Invalid OpenSong Bible'),
|
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
|
||||||
'You need to specify an OpenSong Bible '
|
|
||||||
'file to import.'))
|
|
||||||
self.openSongFileEdit.setFocus()
|
self.openSongFileEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif self.field(u'source_format').toInt()[0] == BibleFormat.OpenLP1:
|
elif self.field(u'source_format').toInt()[0] == BibleFormat.OpenLP1:
|
||||||
if not self.field(u'openlp1_location').toString():
|
if not self.field(u'openlp1_location').toString():
|
||||||
critical_error_message_box(
|
critical_error_message_box(UiStrings.NFSs,
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
WizardStrings.YouSpecifyFile % UiStrings.OLPV1)
|
||||||
'Invalid Bible Location'),
|
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
|
||||||
'You need to specify a file to import your '
|
|
||||||
'Bible from.'))
|
|
||||||
self.openlp1FileEdit.setFocus()
|
self.openlp1FileEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
@ -531,17 +487,13 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
license_copyright = \
|
license_copyright = \
|
||||||
unicode(self.field(u'license_copyright').toString())
|
unicode(self.field(u'license_copyright').toString())
|
||||||
if not license_version:
|
if not license_version:
|
||||||
critical_error_message_box(
|
critical_error_message_box(UiStrings.EmptyField,
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
|
||||||
'Empty Version Name'),
|
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
'You need to specify a version name for your Bible.'))
|
'You need to specify a version name for your Bible.'))
|
||||||
self.versionNameEdit.setFocus()
|
self.versionNameEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif not license_copyright:
|
elif not license_copyright:
|
||||||
critical_error_message_box(
|
critical_error_message_box(UiStrings.EmptyField,
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
|
||||||
'Empty Copyright'),
|
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
'You need to set a copyright for your Bible. '
|
'You need to set a copyright for your Bible. '
|
||||||
'Bibles in the Public Domain need to be marked as such.'))
|
'Bibles in the Public Domain need to be marked as such.'))
|
||||||
@ -576,24 +528,22 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
Show the file open dialog for the OSIS file.
|
Show the file open dialog for the OSIS file.
|
||||||
"""
|
"""
|
||||||
self.getFileName(
|
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.OSIS,
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Open OSIS File'),
|
|
||||||
self.osisFileEdit)
|
self.osisFileEdit)
|
||||||
|
|
||||||
def onCsvTestamentsBrowseButtonClicked(self):
|
def onCsvTestamentsBrowseButtonClicked(self):
|
||||||
"""
|
"""
|
||||||
Show the file open dialog for the testaments CSV file.
|
Show the file open dialog for the testaments CSV file.
|
||||||
"""
|
"""
|
||||||
self.getFileName(translate('BiblesPlugin.ImportWizardForm',
|
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.CSV,
|
||||||
'Open Testaments CSV File'), self.csvTestamentsEdit, u'%s (*.csv)'
|
self.csvTestamentsEdit, u'%s (*.csv)'
|
||||||
% translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
|
% translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
|
||||||
|
|
||||||
def onCsvBooksBrowseButtonClicked(self):
|
def onCsvBooksBrowseButtonClicked(self):
|
||||||
"""
|
"""
|
||||||
Show the file open dialog for the books CSV file.
|
Show the file open dialog for the books CSV file.
|
||||||
"""
|
"""
|
||||||
self.getFileName(
|
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.CSV,
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Open Books CSV File'),
|
|
||||||
self.csvBooksEdit, u'%s (*.csv)'
|
self.csvBooksEdit, u'%s (*.csv)'
|
||||||
% translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
|
% translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
|
||||||
|
|
||||||
@ -601,27 +551,24 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
Show the file open dialog for the verses CSV file.
|
Show the file open dialog for the verses CSV file.
|
||||||
"""
|
"""
|
||||||
self.getFileName(translate('BiblesPlugin.ImportWizardForm',
|
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.CSV,
|
||||||
'Open Verses CSV File'), self.csvVersesEdit, u'%s (*.csv)'
|
self.csvVersesEdit, u'%s (*.csv)'
|
||||||
% translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
|
% translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
|
||||||
|
|
||||||
def onOpenSongBrowseButtonClicked(self):
|
def onOpenSongBrowseButtonClicked(self):
|
||||||
"""
|
"""
|
||||||
Show the file open dialog for the OpenSong file.
|
Show the file open dialog for the OpenSong file.
|
||||||
"""
|
"""
|
||||||
self.getFileName(
|
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.OS,
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Open OpenSong Bible'),
|
|
||||||
self.openSongFileEdit)
|
self.openSongFileEdit)
|
||||||
|
|
||||||
def onOpenlp1BrowseButtonClicked(self):
|
def onOpenlp1BrowseButtonClicked(self):
|
||||||
"""
|
"""
|
||||||
Show the file open dialog for the openlp.org 1.x file.
|
Show the file open dialog for the openlp.org 1.x file.
|
||||||
"""
|
"""
|
||||||
self.getFileName(
|
self.getFileName(WizardStrings.OpenTypeFile % UiStrings.OLPV1,
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
self.openlp1FileEdit, u'%s (*.bible)' %
|
||||||
'Open openlp.org 1.x Bible'), self.openlp1FileEdit,
|
translate('BiblesPlugin.ImportWizardForm', 'openlp.org 1.x bible'))
|
||||||
u'%s (*.bible)' % translate('BiblesPlugin.ImportWizardForm',
|
|
||||||
'openlp.org 1.x bible'))
|
|
||||||
|
|
||||||
def registerFields(self):
|
def registerFields(self):
|
||||||
"""
|
"""
|
||||||
@ -722,7 +669,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.web_bible_list[download_type][ver] = name.strip()
|
self.web_bible_list[download_type][ver] = name.strip()
|
||||||
except IOError:
|
except IOError:
|
||||||
log.exception(u'%s resources missing' %
|
log.exception(u'%s resources missing' %
|
||||||
WebDownload.get_name(download_type))
|
WebDownload.Names[download_type])
|
||||||
finally:
|
finally:
|
||||||
if books_file:
|
if books_file:
|
||||||
books_file.close()
|
books_file.close()
|
||||||
@ -738,8 +685,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
'BiblesPlugin.ImportWizardForm',
|
'BiblesPlugin.ImportWizardForm',
|
||||||
'Starting Registering bible...'))
|
'Starting Registering bible...'))
|
||||||
else:
|
else:
|
||||||
self.progressLabel.setText(translate(
|
self.progressLabel.setText(WizardStrings.StartingImport)
|
||||||
'BiblesPlugin.ImportWizardForm', 'Starting import...'))
|
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
|
|
||||||
def performWizard(self):
|
def performWizard(self):
|
||||||
@ -777,18 +723,10 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.progressBar.setMaximum(1)
|
self.progressBar.setMaximum(1)
|
||||||
download_location = self.field(u'web_location').toInt()[0]
|
download_location = self.field(u'web_location').toInt()[0]
|
||||||
bible_version = unicode(self.webTranslationComboBox.currentText())
|
bible_version = unicode(self.webTranslationComboBox.currentText())
|
||||||
if download_location == WebDownload.Crosswalk:
|
bible = self.web_bible_list[download_location][bible_version]
|
||||||
bible = \
|
|
||||||
self.web_bible_list[WebDownload.Crosswalk][bible_version]
|
|
||||||
elif download_location == WebDownload.BibleGateway:
|
|
||||||
bible = \
|
|
||||||
self.web_bible_list[WebDownload.BibleGateway][bible_version]
|
|
||||||
elif download_location == WebDownload.Bibleserver:
|
|
||||||
bible = \
|
|
||||||
self.web_bible_list[WebDownload.Bibleserver][bible_version]
|
|
||||||
importer = self.manager.import_bible(
|
importer = self.manager.import_bible(
|
||||||
BibleFormat.WebDownload, name=license_version,
|
BibleFormat.WebDownload, name=license_version,
|
||||||
download_source=WebDownload.get_name(download_location),
|
download_source=WebDownload.Names[download_location],
|
||||||
download_name=bible,
|
download_name=bible,
|
||||||
proxy_server=unicode(self.field(u'proxy_server').toString()),
|
proxy_server=unicode(self.field(u'proxy_server').toString()),
|
||||||
proxy_username=\
|
proxy_username=\
|
||||||
@ -811,8 +749,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
'bible. Please note, that verses will be downloaded on\n'
|
'bible. Please note, that verses will be downloaded on\n'
|
||||||
'demand and thus an internet connection is required.'))
|
'demand and thus an internet connection is required.'))
|
||||||
else:
|
else:
|
||||||
self.progressLabel.setText(translate(
|
self.progressLabel.setText(WizardStrings.FinishedImport)
|
||||||
'BiblesPlugin.ImportWizardForm', 'Finished import.'))
|
|
||||||
else:
|
else:
|
||||||
self.progressLabel.setText(translate(
|
self.progressLabel.setText(translate(
|
||||||
'BiblesPlugin.ImportWizardForm', 'Your Bible import failed.'))
|
'BiblesPlugin.ImportWizardForm', 'Your Bible import failed.'))
|
||||||
|
@ -32,6 +32,25 @@ import re
|
|||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
class LayoutStyle(object):
|
||||||
|
"""
|
||||||
|
An enumeration for bible screen layout styles.
|
||||||
|
"""
|
||||||
|
VersePerSlide = 0
|
||||||
|
VersePerLine = 1
|
||||||
|
Continuous = 2
|
||||||
|
|
||||||
|
|
||||||
|
class DisplayStyle(object):
|
||||||
|
"""
|
||||||
|
An enumeration for bible text bracket display styles.
|
||||||
|
"""
|
||||||
|
NoBrackets = 0
|
||||||
|
Round = 1
|
||||||
|
Curly = 2
|
||||||
|
Square = 3
|
||||||
|
|
||||||
|
|
||||||
def get_reference_match(match_type):
|
def get_reference_match(match_type):
|
||||||
"""
|
"""
|
||||||
Provides the regexes and matches to use while parsing strings for bible
|
Provides the regexes and matches to use while parsing strings for bible
|
||||||
|
@ -29,6 +29,7 @@ import logging
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, SettingsTab, translate
|
from openlp.core.lib import Receiver, SettingsTab, translate
|
||||||
|
from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -122,19 +123,19 @@ class BiblesTab(SettingsTab):
|
|||||||
translate('BiblesPlugin.BiblesTab', 'Display style:'))
|
translate('BiblesPlugin.BiblesTab', 'Display style:'))
|
||||||
self.BibleThemeLabel.setText(
|
self.BibleThemeLabel.setText(
|
||||||
translate('BiblesPlugin.BiblesTab', 'Bible theme:'))
|
translate('BiblesPlugin.BiblesTab', 'Bible theme:'))
|
||||||
self.LayoutStyleComboBox.setItemText(0,
|
self.LayoutStyleComboBox.setItemText(LayoutStyle.VersePerSlide,
|
||||||
translate('BiblesPlugin.BiblesTab', 'Verse Per Slide'))
|
translate('BiblesPlugin.BiblesTab', 'Verse Per Slide'))
|
||||||
self.LayoutStyleComboBox.setItemText(1,
|
self.LayoutStyleComboBox.setItemText(LayoutStyle.VersePerLine,
|
||||||
translate('BiblesPlugin.BiblesTab', 'Verse Per Line'))
|
translate('BiblesPlugin.BiblesTab', 'Verse Per Line'))
|
||||||
self.LayoutStyleComboBox.setItemText(2,
|
self.LayoutStyleComboBox.setItemText(LayoutStyle.Continuous,
|
||||||
translate('BiblesPlugin.BiblesTab', 'Continuous'))
|
translate('BiblesPlugin.BiblesTab', 'Continuous'))
|
||||||
self.DisplayStyleComboBox.setItemText(0,
|
self.DisplayStyleComboBox.setItemText(DisplayStyle.NoBrackets,
|
||||||
translate('BiblesPlugin.BiblesTab', 'No Brackets'))
|
translate('BiblesPlugin.BiblesTab', 'No Brackets'))
|
||||||
self.DisplayStyleComboBox.setItemText(1,
|
self.DisplayStyleComboBox.setItemText(DisplayStyle.Round,
|
||||||
translate('BiblesPlugin.BiblesTab', '( And )'))
|
translate('BiblesPlugin.BiblesTab', '( And )'))
|
||||||
self.DisplayStyleComboBox.setItemText(2,
|
self.DisplayStyleComboBox.setItemText(DisplayStyle.Curly,
|
||||||
translate('BiblesPlugin.BiblesTab', '{ And }'))
|
translate('BiblesPlugin.BiblesTab', '{ And }'))
|
||||||
self.DisplayStyleComboBox.setItemText(3,
|
self.DisplayStyleComboBox.setItemText(DisplayStyle.Square,
|
||||||
translate('BiblesPlugin.BiblesTab', '[ And ]'))
|
translate('BiblesPlugin.BiblesTab', '[ And ]'))
|
||||||
self.ChangeNoteLabel.setText(translate('BiblesPlugin.BiblesTab',
|
self.ChangeNoteLabel.setText(translate('BiblesPlugin.BiblesTab',
|
||||||
'Note:\nChanges do not affect verses already in the service.'))
|
'Note:\nChanges do not affect verses already in the service.'))
|
||||||
|
@ -34,7 +34,8 @@ from openlp.core.lib.searchedit import SearchEdit
|
|||||||
from openlp.core.lib.ui import UiStrings, add_widget_completer, \
|
from openlp.core.lib.ui import UiStrings, add_widget_completer, \
|
||||||
media_item_combo_box, critical_error_message_box
|
media_item_combo_box, critical_error_message_box
|
||||||
from openlp.plugins.bibles.forms import BibleImportForm
|
from openlp.plugins.bibles.forms import BibleImportForm
|
||||||
from openlp.plugins.bibles.lib import get_reference_match
|
from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, \
|
||||||
|
get_reference_match
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -56,6 +57,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.IconPath = u'songs/song'
|
self.IconPath = u'songs/song'
|
||||||
MediaManagerItem.__init__(self, parent, plugin, icon)
|
MediaManagerItem.__init__(self, parent, plugin, icon)
|
||||||
# Place to store the search results for both bibles.
|
# Place to store the search results for both bibles.
|
||||||
|
self.settings = self.parent.settings_tab
|
||||||
self.search_results = {}
|
self.search_results = {}
|
||||||
self.second_search_results = {}
|
self.second_search_results = {}
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
@ -235,18 +237,15 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
log.debug(u'retranslateUi')
|
log.debug(u'retranslateUi')
|
||||||
self.quickVersionLabel.setText(
|
self.quickVersionLabel.setText(u'%s:' % UiStrings.Version)
|
||||||
translate('BiblesPlugin.MediaItem', 'Version:'))
|
|
||||||
self.quickSecondLabel.setText(
|
self.quickSecondLabel.setText(
|
||||||
translate('BiblesPlugin.MediaItem', 'Second:'))
|
translate('BiblesPlugin.MediaItem', 'Second:'))
|
||||||
self.quickSearchLabel.setText(
|
self.quickSearchLabel.setText(
|
||||||
translate('BiblesPlugin.MediaItem', 'Find:'))
|
translate('BiblesPlugin.MediaItem', 'Find:'))
|
||||||
self.quickSearchButton.setText(
|
self.quickSearchButton.setText(UiStrings.Search)
|
||||||
translate('BiblesPlugin.MediaItem', 'Search'))
|
|
||||||
self.quickClearLabel.setText(
|
self.quickClearLabel.setText(
|
||||||
translate('BiblesPlugin.MediaItem', 'Results:'))
|
translate('BiblesPlugin.MediaItem', 'Results:'))
|
||||||
self.advancedVersionLabel.setText(
|
self.advancedVersionLabel.setText(u'%s:' % UiStrings.Version)
|
||||||
translate('BiblesPlugin.MediaItem', 'Version:'))
|
|
||||||
self.advancedSecondLabel.setText(
|
self.advancedSecondLabel.setText(
|
||||||
translate('BiblesPlugin.MediaItem', 'Second:'))
|
translate('BiblesPlugin.MediaItem', 'Second:'))
|
||||||
self.advancedBookLabel.setText(
|
self.advancedBookLabel.setText(
|
||||||
@ -261,8 +260,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
translate('BiblesPlugin.MediaItem', 'To:'))
|
translate('BiblesPlugin.MediaItem', 'To:'))
|
||||||
self.advancedClearLabel.setText(
|
self.advancedClearLabel.setText(
|
||||||
translate('BiblesPlugin.MediaItem', 'Results:'))
|
translate('BiblesPlugin.MediaItem', 'Results:'))
|
||||||
self.advancedSearchButton.setText(
|
self.advancedSearchButton.setText(UiStrings.Search)
|
||||||
translate('BiblesPlugin.MediaItem', 'Search'))
|
|
||||||
self.quickClearComboBox.addItem(
|
self.quickClearComboBox.addItem(
|
||||||
translate('BiblesPlugin.MediaItem', 'Clear'))
|
translate('BiblesPlugin.MediaItem', 'Clear'))
|
||||||
self.quickClearComboBox.addItem(
|
self.quickClearComboBox.addItem(
|
||||||
@ -670,12 +668,12 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
raw_slides.append(bible_text.rstrip())
|
raw_slides.append(bible_text.rstrip())
|
||||||
bible_text = u''
|
bible_text = u''
|
||||||
# If we are 'Verse Per Slide' then create a new slide.
|
# If we are 'Verse Per Slide' then create a new slide.
|
||||||
elif self.parent.settings_tab.layout_style == 0:
|
elif self.settings.layout_style == LayoutStyle.VersePerSlide:
|
||||||
bible_text = u'%s %s' % (verse_text, text)
|
bible_text = u'%s %s' % (verse_text, text)
|
||||||
raw_slides.append(bible_text.rstrip())
|
raw_slides.append(bible_text.rstrip())
|
||||||
bible_text = u''
|
bible_text = u''
|
||||||
# If we are 'Verse Per Line' then force a new line.
|
# If we are 'Verse Per Line' then force a new line.
|
||||||
elif self.parent.settings_tab.layout_style == 1:
|
elif self.settings.layout_style == LayoutStyle.VersePerLine:
|
||||||
bible_text = u'%s %s %s\n' % (bible_text, verse_text, text)
|
bible_text = u'%s %s %s\n' % (bible_text, verse_text, text)
|
||||||
# We have to be 'Continuous'.
|
# We have to be 'Continuous'.
|
||||||
else:
|
else:
|
||||||
@ -693,7 +691,8 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
raw_slides.append(bible_text.lstrip())
|
raw_slides.append(bible_text.lstrip())
|
||||||
bible_text = u''
|
bible_text = u''
|
||||||
# Service Item: Capabilities
|
# Service Item: Capabilities
|
||||||
if self.parent.settings_tab.layout_style == 2 and not second_bible:
|
if self.settings.layout_style == LayoutStyle.Continuous and \
|
||||||
|
not second_bible:
|
||||||
# Split the line but do not replace line breaks in renderer.
|
# Split the line but do not replace line breaks in renderer.
|
||||||
service_item.add_capability(ItemCapabilities.NoLineBreaks)
|
service_item.add_capability(ItemCapabilities.NoLineBreaks)
|
||||||
service_item.add_capability(ItemCapabilities.AllowsPreview)
|
service_item.add_capability(ItemCapabilities.AllowsPreview)
|
||||||
@ -705,10 +704,10 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
else:
|
else:
|
||||||
service_item.title += u', ' + title
|
service_item.title += u', ' + title
|
||||||
# Service Item: Theme
|
# Service Item: Theme
|
||||||
if len(self.parent.settings_tab.bible_theme) == 0:
|
if len(self.settings.bible_theme) == 0:
|
||||||
service_item.theme = None
|
service_item.theme = None
|
||||||
else:
|
else:
|
||||||
service_item.theme = self.parent.settings_tab.bible_theme
|
service_item.theme = self.settings.bible_theme
|
||||||
for slide in raw_slides:
|
for slide in raw_slides:
|
||||||
service_item.add_from_text(slide[:30], slide)
|
service_item.add_from_text(slide[:30], slide)
|
||||||
if service_item.raw_footer:
|
if service_item.raw_footer:
|
||||||
@ -817,16 +816,15 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
The verse number (int).
|
The verse number (int).
|
||||||
"""
|
"""
|
||||||
verse_separator = get_reference_match(u'sep_v_display')
|
verse_separator = get_reference_match(u'sep_v_display')
|
||||||
if not self.parent.settings_tab.show_new_chapters or \
|
if not self.settings.show_new_chapters or old_chapter != chapter:
|
||||||
old_chapter != chapter:
|
|
||||||
verse_text = unicode(chapter) + verse_separator + unicode(verse)
|
verse_text = unicode(chapter) + verse_separator + unicode(verse)
|
||||||
else:
|
else:
|
||||||
verse_text = unicode(verse)
|
verse_text = unicode(verse)
|
||||||
if self.parent.settings_tab.display_style == 1:
|
if self.settings.display_style == DisplayStyle.Round:
|
||||||
verse_text = u'{su}(' + verse_text + u'){/su}'
|
verse_text = u'{su}(' + verse_text + u'){/su}'
|
||||||
elif self.parent.settings_tab.display_style == 2:
|
elif self.settings.display_style == DisplayStyle.Curly:
|
||||||
verse_text = u'{su}{' + verse_text + u'}{/su}'
|
verse_text = u'{su}{' + verse_text + u'}{/su}'
|
||||||
elif self.parent.settings_tab.display_style == 3:
|
elif self.settings.display_style == DisplayStyle.Square:
|
||||||
verse_text = u'{su}[' + verse_text + u']{/su}'
|
verse_text = u'{su}[' + verse_text + u']{/su}'
|
||||||
else:
|
else:
|
||||||
verse_text = u'{su}' + verse_text + u'{/su}'
|
verse_text = u'{su}' + verse_text + u'{/su}'
|
||||||
|
@ -29,7 +29,8 @@ import sqlite
|
|||||||
|
|
||||||
from PyQt4 import QtCore
|
from PyQt4 import QtCore
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, translate
|
from openlp.core.lib import Receiver
|
||||||
|
from openlp.core.ui.wizard import WizardStrings
|
||||||
from openlp.plugins.bibles.lib.db import BibleDB
|
from openlp.plugins.bibles.lib.db import BibleDB
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -73,8 +74,7 @@ class OpenLP1Bible(BibleDB):
|
|||||||
abbreviation = unicode(book[3], u'cp1252')
|
abbreviation = unicode(book[3], u'cp1252')
|
||||||
self.create_book(name, abbreviation, testament_id)
|
self.create_book(name, abbreviation, testament_id)
|
||||||
# Update the progess bar.
|
# Update the progess bar.
|
||||||
self.wizard.incrementProgressBar(unicode(translate(
|
self.wizard.incrementProgressBar(WizardStrings.ImportingType % name)
|
||||||
'BiblesPlugin.OpenLP1Import', 'Importing %s...')) % name)
|
|
||||||
# Import the verses for this book.
|
# Import the verses for this book.
|
||||||
cursor.execute(u'SELECT chapter, verse, text || \'\' AS text FROM '
|
cursor.execute(u'SELECT chapter, verse, text || \'\' AS text FROM '
|
||||||
'verse WHERE book_id=%s' % book_id)
|
'verse WHERE book_id=%s' % book_id)
|
||||||
|
@ -69,7 +69,7 @@ class OSISBible(BibleDB):
|
|||||||
self.q1_regex = re.compile(r'<q(.*?)level="1"(.*?)>')
|
self.q1_regex = re.compile(r'<q(.*?)level="1"(.*?)>')
|
||||||
self.q2_regex = re.compile(r'<q(.*?)level="2"(.*?)>')
|
self.q2_regex = re.compile(r'<q(.*?)level="2"(.*?)>')
|
||||||
self.trans_regex = re.compile(r'<transChange(.*?)>(.*?)</transChange>')
|
self.trans_regex = re.compile(r'<transChange(.*?)>(.*?)</transChange>')
|
||||||
self.divineName_regex = re.compile(
|
self.divine_name_regex = re.compile(
|
||||||
r'<divineName(.*?)>(.*?)</divineName>')
|
r'<divineName(.*?)>(.*?)</divineName>')
|
||||||
self.spaces_regex = re.compile(r'([ ]{2,})')
|
self.spaces_regex = re.compile(r'([ ]{2,})')
|
||||||
filepath = os.path.join(
|
filepath = os.path.join(
|
||||||
@ -161,7 +161,7 @@ class OSISBible(BibleDB):
|
|||||||
verse_text = self.q1_regex.sub(u'"', verse_text)
|
verse_text = self.q1_regex.sub(u'"', verse_text)
|
||||||
verse_text = self.q2_regex.sub(u'\'', verse_text)
|
verse_text = self.q2_regex.sub(u'\'', verse_text)
|
||||||
verse_text = self.trans_regex.sub(u'', verse_text)
|
verse_text = self.trans_regex.sub(u'', verse_text)
|
||||||
verse_text = self.divineName_regex.sub(u'', verse_text)
|
verse_text = self.divine_name_regex.sub(u'', verse_text)
|
||||||
verse_text = verse_text.replace(u'</lb>', u'')\
|
verse_text = verse_text.replace(u'</lb>', u'')\
|
||||||
.replace(u'</l>', u'').replace(u'<lg>', u'')\
|
.replace(u'</l>', u'').replace(u'<lg>', u'')\
|
||||||
.replace(u'</lg>', u'').replace(u'</q>', u'')\
|
.replace(u'</lg>', u'').replace(u'</q>', u'')\
|
||||||
|
@ -51,7 +51,7 @@ class CustomPlugin(Plugin):
|
|||||||
CustomMediaItem, CustomTab)
|
CustomMediaItem, CustomTab)
|
||||||
self.weight = -5
|
self.weight = -5
|
||||||
self.manager = Manager(u'custom', init_schema)
|
self.manager = Manager(u'custom', init_schema)
|
||||||
self.edit_custom_form = EditCustomForm(self.manager)
|
self.edit_custom_form = EditCustomForm(self)
|
||||||
self.icon_path = u':/plugins/plugin_custom.png'
|
self.icon_path = u':/plugins/plugin_custom.png'
|
||||||
self.icon = build_icon(self.icon_path)
|
self.icon = build_icon(self.icon_path)
|
||||||
|
|
||||||
|
@ -124,5 +124,4 @@ class Ui_CustomEditDialog(object):
|
|||||||
translate('CustomPlugin.EditCustomForm', 'The&me:'))
|
translate('CustomPlugin.EditCustomForm', 'The&me:'))
|
||||||
self.creditLabel.setText(
|
self.creditLabel.setText(
|
||||||
translate('CustomPlugin.EditCustomForm', '&Credits:'))
|
translate('CustomPlugin.EditCustomForm', '&Credits:'))
|
||||||
self.previewButton.setText(
|
self.previewButton.setText(UiStrings.SaveAndPreview)
|
||||||
translate('CustomPlugin.EditCustomForm', 'Save && Preview'))
|
|
||||||
|
@ -42,14 +42,15 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
|||||||
Class documentation goes here.
|
Class documentation goes here.
|
||||||
"""
|
"""
|
||||||
log.info(u'Custom Editor loaded')
|
log.info(u'Custom Editor loaded')
|
||||||
def __init__(self, manager, parent=None):
|
def __init__(self, parent):
|
||||||
"""
|
"""
|
||||||
Constructor
|
Constructor
|
||||||
"""
|
"""
|
||||||
QtGui.QDialog.__init__(self, parent)
|
QtGui.QDialog.__init__(self)
|
||||||
|
self.parent = parent
|
||||||
|
self.manager = self.parent.manager
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
# Create other objects and forms.
|
# Create other objects and forms.
|
||||||
self.manager = manager
|
|
||||||
self.editSlideForm = EditCustomSlideForm(self)
|
self.editSlideForm = EditCustomSlideForm(self)
|
||||||
# Connecting signals and slots
|
# Connecting signals and slots
|
||||||
QtCore.QObject.connect(self.previewButton,
|
QtCore.QObject.connect(self.previewButton,
|
||||||
|
@ -71,5 +71,5 @@ class EditCustomSlideForm(QtGui.QDialog, Ui_CustomSlideEditDialog):
|
|||||||
"""
|
"""
|
||||||
if self.slideTextEdit.textCursor().columnNumber() != 0:
|
if self.slideTextEdit.textCursor().columnNumber() != 0:
|
||||||
self.slideTextEdit.insertPlainText(u'\n')
|
self.slideTextEdit.insertPlainText(u'\n')
|
||||||
self.slideTextEdit.insertPlainText(u'[---]\n' )
|
self.slideTextEdit.insertPlainText(u'[---]\n')
|
||||||
self.slideTextEdit.setFocus()
|
self.slideTextEdit.setFocus()
|
||||||
|
@ -29,7 +29,8 @@ import logging
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
|
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
|
||||||
translate, check_item_selected
|
check_item_selected
|
||||||
|
from openlp.core.lib.ui import UiStrings
|
||||||
from openlp.plugins.custom.lib import CustomXMLParser
|
from openlp.plugins.custom.lib import CustomXMLParser
|
||||||
from openlp.plugins.custom.lib.db import CustomSlide
|
from openlp.plugins.custom.lib.db import CustomSlide
|
||||||
|
|
||||||
@ -54,7 +55,7 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'custom_edit'), self.onRemoteEdit)
|
QtCore.SIGNAL(u'custom_edit'), self.onRemoteEdit)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'custom_edit_clear' ), self.onRemoteEditClear)
|
QtCore.SIGNAL(u'custom_edit_clear'), self.onRemoteEditClear)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'custom_load_list'), self.initialise)
|
QtCore.SIGNAL(u'custom_load_list'), self.initialise)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
@ -108,9 +109,7 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
Edit a custom item
|
Edit a custom item
|
||||||
"""
|
"""
|
||||||
if check_item_selected(self.listView,
|
if check_item_selected(self.listView, UiStrings.SelectEdit):
|
||||||
translate('CustomPlugin.MediaItem',
|
|
||||||
'You haven\'t selected an item to edit.')):
|
|
||||||
item = self.listView.currentItem()
|
item = self.listView.currentItem()
|
||||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
self.parent.edit_custom_form.loadCustom(item_id, False)
|
self.parent.edit_custom_form.loadCustom(item_id, False)
|
||||||
@ -121,9 +120,7 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
Remove a custom item from the list and database
|
Remove a custom item from the list and database
|
||||||
"""
|
"""
|
||||||
if check_item_selected(self.listView,
|
if check_item_selected(self.listView, UiStrings.SelectDelete):
|
||||||
translate('CustomPlugin.MediaItem',
|
|
||||||
'You haven\'t selected an item to delete.')):
|
|
||||||
row_list = [item.row() for item in self.listView.selectedIndexes()]
|
row_list = [item.row() for item in self.listView.selectedIndexes()]
|
||||||
row_list.sort(reverse=True)
|
row_list.sort(reverse=True)
|
||||||
id_list = [(item.data(QtCore.Qt.UserRole)).toInt()[0]
|
id_list = [(item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
|
@ -50,10 +50,10 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
QtCore.SIGNAL(u'live_theme_changed'), self.liveThemeChanged)
|
QtCore.SIGNAL(u'live_theme_changed'), self.liveThemeChanged)
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
self.OnNewPrompt = translate('ImagePlugin.MediaItem',
|
self.onNewPrompt = translate('ImagePlugin.MediaItem',
|
||||||
'Select Image(s)')
|
'Select Image(s)')
|
||||||
file_formats = get_images_filter()
|
file_formats = get_images_filter()
|
||||||
self.OnNewFileMasks = u'%s;;%s (*.*) (*)' % (file_formats,
|
self.onNewFileMasks = u'%s;;%s (*.*) (*)' % (file_formats,
|
||||||
UiStrings.AllFiles)
|
UiStrings.AllFiles)
|
||||||
self.replaceAction.setText(UiStrings.ReplaceBG)
|
self.replaceAction.setText(UiStrings.ReplaceBG)
|
||||||
self.replaceAction.setToolTip(UiStrings.ReplaceLiveBG)
|
self.replaceAction.setToolTip(UiStrings.ReplaceLiveBG)
|
||||||
@ -125,8 +125,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
def generateSlideData(self, service_item, item=None, xmlVersion=False):
|
def generateSlideData(self, service_item, item=None, xmlVersion=False):
|
||||||
items = self.listView.selectedIndexes()
|
items = self.listView.selectedIndexes()
|
||||||
if items:
|
if items:
|
||||||
service_item.title = unicode(
|
service_item.title = unicode(self.plugin.nameStrings[u'plural'])
|
||||||
translate('ImagePlugin.MediaItem', 'Images'))
|
|
||||||
service_item.add_capability(ItemCapabilities.AllowsMaintain)
|
service_item.add_capability(ItemCapabilities.AllowsMaintain)
|
||||||
service_item.add_capability(ItemCapabilities.AllowsPreview)
|
service_item.add_capability(ItemCapabilities.AllowsPreview)
|
||||||
service_item.add_capability(ItemCapabilities.AllowsLoop)
|
service_item.add_capability(ItemCapabilities.AllowsLoop)
|
||||||
@ -198,8 +197,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
self.parent.liveController.display.directImage(name, filename)
|
self.parent.liveController.display.directImage(name, filename)
|
||||||
self.resetAction.setVisible(True)
|
self.resetAction.setVisible(True)
|
||||||
else:
|
else:
|
||||||
critical_error_message_box(
|
critical_error_message_box(UiStrings.LiveBGError,
|
||||||
translate('ImagePlugin.MediaItem', 'Live Background Error'),
|
|
||||||
unicode(translate('ImagePlugin.MediaItem',
|
unicode(translate('ImagePlugin.MediaItem',
|
||||||
'There was a problem replacing your background, '
|
'There was a problem replacing your background, '
|
||||||
'the image file "%s" no longer exists.')) % filename)
|
'the image file "%s" no longer exists.')) % filename)
|
||||||
|
@ -58,8 +58,8 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
self.videoStart)
|
self.videoStart)
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
self.OnNewPrompt = translate('MediaPlugin.MediaItem', 'Select Media')
|
self.onNewPrompt = translate('MediaPlugin.MediaItem', 'Select Media')
|
||||||
self.OnNewFileMasks = unicode(translate('MediaPlugin.MediaItem',
|
self.onNewFileMasks = unicode(translate('MediaPlugin.MediaItem',
|
||||||
'Videos (%s);;Audio (%s);;%s (*)')) % (self.parent.video_list,
|
'Videos (%s);;Audio (%s);;%s (*)')) % (self.parent.video_list,
|
||||||
self.parent.audio_list, UiStrings.AllFiles)
|
self.parent.audio_list, UiStrings.AllFiles)
|
||||||
self.replaceAction.setText(UiStrings.ReplaceBG)
|
self.replaceAction.setText(UiStrings.ReplaceBG)
|
||||||
@ -112,8 +112,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
self.parent.liveController.display.video(filename, 0, True)
|
self.parent.liveController.display.video(filename, 0, True)
|
||||||
self.resetAction.setVisible(True)
|
self.resetAction.setVisible(True)
|
||||||
else:
|
else:
|
||||||
critical_error_message_box(translate('MediaPlugin.MediaItem',
|
critical_error_message_box(UiStrings.LiveBGError,
|
||||||
'Live Background Error'),
|
|
||||||
unicode(translate('MediaPlugin.MediaItem',
|
unicode(translate('MediaPlugin.MediaItem',
|
||||||
'There was a problem replacing your background, '
|
'There was a problem replacing your background, '
|
||||||
'the media file "%s" no longer exists.')) % filename)
|
'the media file "%s" no longer exists.')) % filename)
|
||||||
@ -125,20 +124,19 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
return False
|
return False
|
||||||
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
|
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
self.MediaState = None
|
self.mediaState = None
|
||||||
self.mediaObject.stop()
|
self.mediaObject.stop()
|
||||||
self.mediaObject.clearQueue()
|
self.mediaObject.clearQueue()
|
||||||
self.mediaObject.setCurrentSource(Phonon.MediaSource(filename))
|
self.mediaObject.setCurrentSource(Phonon.MediaSource(filename))
|
||||||
self.mediaObject.play()
|
self.mediaObject.play()
|
||||||
service_item.title = unicode(
|
service_item.title = unicode(self.plugin.nameStrings[u'singular'])
|
||||||
translate('MediaPlugin.MediaItem', 'Media'))
|
|
||||||
service_item.add_capability(ItemCapabilities.RequiresMedia)
|
service_item.add_capability(ItemCapabilities.RequiresMedia)
|
||||||
service_item.add_capability(ItemCapabilities.AllowsVarableStartTime)
|
service_item.add_capability(ItemCapabilities.AllowsVarableStartTime)
|
||||||
# force a nonexistent theme
|
# force a nonexistent theme
|
||||||
service_item.theme = -1
|
service_item.theme = -1
|
||||||
frame = u':/media/image_clapperboard.png'
|
frame = u':/media/image_clapperboard.png'
|
||||||
(path, name) = os.path.split(filename)
|
(path, name) = os.path.split(filename)
|
||||||
while not self.MediaState:
|
while not self.mediaState:
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
service_item.media_length = self.mediaLength
|
service_item.media_length = self.mediaLength
|
||||||
service_item.add_from_command(path, name, frame)
|
service_item.add_from_command(path, name, frame)
|
||||||
@ -184,6 +182,6 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
Start the video at a predetermined point.
|
Start the video at a predetermined point.
|
||||||
"""
|
"""
|
||||||
if newState == Phonon.PlayingState:
|
if newState == Phonon.PlayingState:
|
||||||
self.MediaState = newState
|
self.mediaState = newState
|
||||||
self.mediaLength = self.mediaObject.totalTime()/1000
|
self.mediaLength = self.mediaObject.totalTime()/1000
|
||||||
self.mediaObject.stop()
|
self.mediaObject.stop()
|
||||||
|
@ -31,7 +31,8 @@ from PyQt4 import QtCore, QtGui
|
|||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, build_icon, SettingsManager, \
|
from openlp.core.lib import MediaManagerItem, build_icon, SettingsManager, \
|
||||||
translate, check_item_selected, Receiver, ItemCapabilities
|
translate, check_item_selected, Receiver, ItemCapabilities
|
||||||
from openlp.core.lib.ui import critical_error_message_box, media_item_combo_box
|
from openlp.core.lib.ui import UiStrings, critical_error_message_box, \
|
||||||
|
media_item_combo_box
|
||||||
from openlp.plugins.presentations.lib import MessageListener
|
from openlp.plugins.presentations.lib import MessageListener
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -59,7 +60,7 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
The name of the plugin media displayed in UI
|
The name of the plugin media displayed in UI
|
||||||
"""
|
"""
|
||||||
self.OnNewPrompt = translate('PresentationPlugin.MediaItem',
|
self.onNewPrompt = translate('PresentationPlugin.MediaItem',
|
||||||
'Select Presentation(s)')
|
'Select Presentation(s)')
|
||||||
self.Automatic = translate('PresentationPlugin.MediaItem',
|
self.Automatic = translate('PresentationPlugin.MediaItem',
|
||||||
'Automatic')
|
'Automatic')
|
||||||
@ -79,7 +80,7 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
if fileType.find(type) == -1:
|
if fileType.find(type) == -1:
|
||||||
fileType += u'*.%s ' % type
|
fileType += u'*.%s ' % type
|
||||||
self.parent.serviceManager.supportedSuffixes(type)
|
self.parent.serviceManager.supportedSuffixes(type)
|
||||||
self.OnNewFileMasks = unicode(translate('PresentationPlugin.MediaItem',
|
self.onNewFileMasks = unicode(translate('PresentationPlugin.MediaItem',
|
||||||
'Presentations (%s)')) % fileType
|
'Presentations (%s)')) % fileType
|
||||||
|
|
||||||
def requiredIcons(self):
|
def requiredIcons(self):
|
||||||
@ -202,9 +203,7 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
Remove a presentation item from the list
|
Remove a presentation item from the list
|
||||||
"""
|
"""
|
||||||
if check_item_selected(self.listView,
|
if check_item_selected(self.listView, UiStrings.SelectDelete):
|
||||||
translate('PresentationPlugin.MediaItem',
|
|
||||||
'You must select an item to delete.')):
|
|
||||||
items = self.listView.selectedIndexes()
|
items = self.listView.selectedIndexes()
|
||||||
row_list = [item.row() for item in items]
|
row_list = [item.row() for item in items]
|
||||||
row_list.sort(reverse=True)
|
row_list.sort(reverse=True)
|
||||||
|
@ -85,7 +85,7 @@ class PresentationTab(SettingsTab):
|
|||||||
else:
|
else:
|
||||||
checkbox.setText(
|
checkbox.setText(
|
||||||
unicode(translate('PresentationPlugin.PresentationTab',
|
unicode(translate('PresentationPlugin.PresentationTab',
|
||||||
'%s (unvailable)')) % controller.name)
|
'%s (unavailable)')) % controller.name)
|
||||||
self.AdvancedGroupBox.setTitle(UiStrings.Advanced)
|
self.AdvancedGroupBox.setTitle(UiStrings.Advanced)
|
||||||
self.OverrideAppCheckBox.setText(
|
self.OverrideAppCheckBox.setText(
|
||||||
translate('PresentationPlugin.PresentationTab',
|
translate('PresentationPlugin.PresentationTab',
|
||||||
|
@ -28,6 +28,7 @@ from PyQt4 import QtCore, QtGui
|
|||||||
|
|
||||||
from openlp.core.lib import build_icon, translate
|
from openlp.core.lib import build_icon, translate
|
||||||
from openlp.core.lib.ui import UiStrings, create_accept_reject_button_box
|
from openlp.core.lib.ui import UiStrings, create_accept_reject_button_box
|
||||||
|
from openlp.plugins.songs.lib.ui import SongStrings
|
||||||
|
|
||||||
class Ui_EditSongDialog(object):
|
class Ui_EditSongDialog(object):
|
||||||
def setupUi(self, editSongDialog):
|
def setupUi(self, editSongDialog):
|
||||||
@ -265,21 +266,19 @@ class Ui_EditSongDialog(object):
|
|||||||
self.songTabWidget.setTabText(
|
self.songTabWidget.setTabText(
|
||||||
self.songTabWidget.indexOf(self.lyricsTab),
|
self.songTabWidget.indexOf(self.lyricsTab),
|
||||||
translate('SongsPlugin.EditSongForm', 'Title && Lyrics'))
|
translate('SongsPlugin.EditSongForm', 'Title && Lyrics'))
|
||||||
self.authorsGroupBox.setTitle(UiStrings.Authors)
|
self.authorsGroupBox.setTitle(SongStrings.Authors)
|
||||||
self.authorAddButton.setText(
|
self.authorAddButton.setText(
|
||||||
translate('SongsPlugin.EditSongForm', '&Add to Song'))
|
translate('SongsPlugin.EditSongForm', '&Add to Song'))
|
||||||
self.authorRemoveButton.setText(
|
self.authorRemoveButton.setText(
|
||||||
translate('SongsPlugin.EditSongForm', '&Remove'))
|
translate('SongsPlugin.EditSongForm', '&Remove'))
|
||||||
self.maintenanceButton.setText(translate('SongsPlugin.EditSongForm',
|
self.maintenanceButton.setText(translate('SongsPlugin.EditSongForm',
|
||||||
'&Manage Authors, Topics, Song Books'))
|
'&Manage Authors, Topics, Song Books'))
|
||||||
self.topicsGroupBox.setTitle(
|
self.topicsGroupBox.setTitle(SongStrings.Topic)
|
||||||
translate('SongsPlugin.EditSongForm', 'Topic'))
|
|
||||||
self.topicAddButton.setText(
|
self.topicAddButton.setText(
|
||||||
translate('SongsPlugin.EditSongForm', 'A&dd to Song'))
|
translate('SongsPlugin.EditSongForm', 'A&dd to Song'))
|
||||||
self.topicRemoveButton.setText(
|
self.topicRemoveButton.setText(
|
||||||
translate('SongsPlugin.EditSongForm', 'R&emove'))
|
translate('SongsPlugin.EditSongForm', 'R&emove'))
|
||||||
self.songBookGroupBox.setTitle(
|
self.songBookGroupBox.setTitle(SongStrings.SongBook)
|
||||||
translate('SongsPlugin.EditSongForm', 'Song Book'))
|
|
||||||
self.songBookNameLabel.setText(translate('SongsPlugin.EditSongForm',
|
self.songBookNameLabel.setText(translate('SongsPlugin.EditSongForm',
|
||||||
'Book:'))
|
'Book:'))
|
||||||
self.songBookNumberLabel.setText(translate('SongsPlugin.EditSongForm',
|
self.songBookNumberLabel.setText(translate('SongsPlugin.EditSongForm',
|
||||||
@ -293,10 +292,8 @@ class Ui_EditSongDialog(object):
|
|||||||
translate('SongsPlugin.EditSongForm', 'New &Theme'))
|
translate('SongsPlugin.EditSongForm', 'New &Theme'))
|
||||||
self.rightsGroupBox.setTitle(
|
self.rightsGroupBox.setTitle(
|
||||||
translate('SongsPlugin.EditSongForm', 'Copyright Information'))
|
translate('SongsPlugin.EditSongForm', 'Copyright Information'))
|
||||||
self.copyrightInsertButton.setText(
|
self.copyrightInsertButton.setText(SongStrings.CopyrightSymbol)
|
||||||
translate('SongsPlugin.EditSongForm', '\xa9'))
|
self.CCLILabel.setText(UiStrings.CCLINumberLabel)
|
||||||
self.CCLILabel.setText(
|
|
||||||
translate('SongsPlugin.EditSongForm', 'CCLI number:'))
|
|
||||||
self.commentsGroupBox.setTitle(
|
self.commentsGroupBox.setTitle(
|
||||||
translate('SongsPlugin.EditSongForm', 'Comments'))
|
translate('SongsPlugin.EditSongForm', 'Comments'))
|
||||||
self.songTabWidget.setTabText(
|
self.songTabWidget.setTabText(
|
||||||
|
@ -30,10 +30,12 @@ import re
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, translate
|
from openlp.core.lib import Receiver, translate
|
||||||
from openlp.core.lib.ui import add_widget_completer, critical_error_message_box
|
from openlp.core.lib.ui import UiStrings, add_widget_completer, \
|
||||||
|
critical_error_message_box
|
||||||
from openlp.plugins.songs.forms import EditVerseForm
|
from openlp.plugins.songs.forms import EditVerseForm
|
||||||
from openlp.plugins.songs.lib import SongXML, VerseType
|
from openlp.plugins.songs.lib import SongXML, VerseType
|
||||||
from openlp.plugins.songs.lib.db import Book, Song, Author, Topic
|
from openlp.plugins.songs.lib.db import Book, Song, Author, Topic
|
||||||
|
from openlp.plugins.songs.lib.ui import SongStrings
|
||||||
from editsongdialog import Ui_EditSongDialog
|
from editsongdialog import Ui_EditSongDialog
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -94,8 +96,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
QtCore.SIGNAL(u'theme_update_list'), self.loadThemes)
|
QtCore.SIGNAL(u'theme_update_list'), self.loadThemes)
|
||||||
self.previewButton = QtGui.QPushButton()
|
self.previewButton = QtGui.QPushButton()
|
||||||
self.previewButton.setObjectName(u'previewButton')
|
self.previewButton.setObjectName(u'previewButton')
|
||||||
self.previewButton.setText(
|
self.previewButton.setText(UiStrings.SaveAndPreview)
|
||||||
translate('SongsPlugin.EditSongForm', 'Save && Preview'))
|
|
||||||
self.buttonBox.addButton(
|
self.buttonBox.addButton(
|
||||||
self.previewButton, QtGui.QDialogButtonBox.ActionRole)
|
self.previewButton, QtGui.QDialogButtonBox.ActionRole)
|
||||||
QtCore.QObject.connect(self.buttonBox,
|
QtCore.QObject.connect(self.buttonBox,
|
||||||
@ -227,10 +228,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
self.copyrightEdit.setText(u'')
|
self.copyrightEdit.setText(u'')
|
||||||
self.verseListWidget.clear()
|
self.verseListWidget.clear()
|
||||||
self.verseListWidget.setRowCount(0)
|
self.verseListWidget.setRowCount(0)
|
||||||
if self.song.verse_order:
|
|
||||||
self.verseOrderEdit.setText(self.song.verse_order)
|
|
||||||
else:
|
|
||||||
self.verseOrderEdit.setText(u'')
|
|
||||||
if self.song.comments:
|
if self.song.comments:
|
||||||
self.commentsEdit.setPlainText(self.song.comments)
|
self.commentsEdit.setPlainText(self.song.comments)
|
||||||
else:
|
else:
|
||||||
@ -250,15 +247,31 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
# This is just because occasionally the lyrics come back as a "buffer"
|
# This is just because occasionally the lyrics come back as a "buffer"
|
||||||
if isinstance(self.song.lyrics, buffer):
|
if isinstance(self.song.lyrics, buffer):
|
||||||
self.song.lyrics = unicode(self.song.lyrics)
|
self.song.lyrics = unicode(self.song.lyrics)
|
||||||
|
verse_tags_translated = False
|
||||||
if self.song.lyrics.startswith(u'<?xml version='):
|
if self.song.lyrics.startswith(u'<?xml version='):
|
||||||
songXML = SongXML()
|
songXML = SongXML()
|
||||||
verseList = songXML.get_verses(self.song.lyrics)
|
verseList = songXML.get_verses(self.song.lyrics)
|
||||||
for count, verse in enumerate(verseList):
|
for count, verse in enumerate(verseList):
|
||||||
self.verseListWidget.setRowCount(
|
self.verseListWidget.setRowCount(
|
||||||
self.verseListWidget.rowCount() + 1)
|
self.verseListWidget.rowCount() + 1)
|
||||||
variant = u'%s:%s' % (verse[0][u'type'], verse[0][u'label'])
|
# This silently migrates from localized verse type markup.
|
||||||
|
# If we trusted the database, this would be unnecessary.
|
||||||
|
verse_tag = verse[0][u'type']
|
||||||
|
index = None
|
||||||
|
if len(verse_tag) > 1:
|
||||||
|
index = VerseType.from_translated_string(verse_tag)
|
||||||
|
if index is None:
|
||||||
|
index = VerseType.from_string(verse_tag)
|
||||||
|
else:
|
||||||
|
verse_tags_translated = True
|
||||||
|
if index is None:
|
||||||
|
index = VerseType.from_tag(verse_tag)
|
||||||
|
if index is None:
|
||||||
|
index = VerseType.Other
|
||||||
|
verse[0][u'type'] = VerseType.Tags[index]
|
||||||
|
verse_def = u'%s%s' % (verse[0][u'type'], verse[0][u'label'])
|
||||||
item = QtGui.QTableWidgetItem(verse[1])
|
item = QtGui.QTableWidgetItem(verse[1])
|
||||||
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(variant))
|
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(verse_def))
|
||||||
self.verseListWidget.setItem(count, 0, item)
|
self.verseListWidget.setItem(count, 0, item)
|
||||||
else:
|
else:
|
||||||
verses = self.song.lyrics.split(u'\n\n')
|
verses = self.song.lyrics.split(u'\n\n')
|
||||||
@ -266,10 +279,24 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
self.verseListWidget.setRowCount(
|
self.verseListWidget.setRowCount(
|
||||||
self.verseListWidget.rowCount() + 1)
|
self.verseListWidget.rowCount() + 1)
|
||||||
item = QtGui.QTableWidgetItem(verse)
|
item = QtGui.QTableWidgetItem(verse)
|
||||||
variant = u'%s:%s' % \
|
verse_def = u'%s%s' % \
|
||||||
(VerseType.to_string(VerseType.Verse), unicode(count + 1))
|
(VerseType.Tags[VerseType.Verse], unicode(count + 1))
|
||||||
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(variant))
|
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(verse_def))
|
||||||
self.verseListWidget.setItem(count, 0, item)
|
self.verseListWidget.setItem(count, 0, item)
|
||||||
|
if self.song.verse_order:
|
||||||
|
# we translate verse order
|
||||||
|
translated = []
|
||||||
|
for verse_def in self.song.verse_order.split():
|
||||||
|
verse_index = None
|
||||||
|
if verse_tags_translated:
|
||||||
|
verse_index = VerseType.from_translated_tag(verse_def[0])
|
||||||
|
if verse_index is None:
|
||||||
|
verse_index = VerseType.from_tag(verse_def[0])
|
||||||
|
verse_tag = VerseType.TranslatedTags[verse_index].upper()
|
||||||
|
translated.append(u'%s%s' % (verse_tag, verse_def[1:]))
|
||||||
|
self.verseOrderEdit.setText(u' '.join(translated))
|
||||||
|
else:
|
||||||
|
self.verseOrderEdit.setText(u'')
|
||||||
self.verseListWidget.resizeRowsToContents()
|
self.verseListWidget.resizeRowsToContents()
|
||||||
self.tagRows()
|
self.tagRows()
|
||||||
# clear the results
|
# clear the results
|
||||||
@ -294,14 +321,14 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
"""
|
"""
|
||||||
Tag the Song List rows based on the verse list
|
Tag the Song List rows based on the verse list
|
||||||
"""
|
"""
|
||||||
rowLabel = []
|
row_label = []
|
||||||
for row in range(0, self.verseListWidget.rowCount()):
|
for row in range(0, self.verseListWidget.rowCount()):
|
||||||
item = self.verseListWidget.item(row, 0)
|
item = self.verseListWidget.item(row, 0)
|
||||||
data = unicode(item.data(QtCore.Qt.UserRole).toString())
|
verse_def = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||||
bit = data.split(u':')
|
verse_tag = VerseType.translated_tag(verse_def[0])
|
||||||
rowTag = u'%s%s' % (bit[0][0:1], bit[1])
|
row_def = u'%s%s' % (verse_tag, verse_def[1:])
|
||||||
rowLabel.append(rowTag)
|
row_label.append(row_def)
|
||||||
self.verseListWidget.setVerticalHeaderLabels(rowLabel)
|
self.verseListWidget.setVerticalHeaderLabels(row_label)
|
||||||
|
|
||||||
def onAuthorAddButtonClicked(self):
|
def onAuthorAddButtonClicked(self):
|
||||||
item = int(self.authorsComboBox.currentIndex())
|
item = int(self.authorsComboBox.currentIndex())
|
||||||
@ -337,8 +364,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
self.__addAuthorToList(author)
|
self.__addAuthorToList(author)
|
||||||
self.authorsComboBox.setCurrentIndex(0)
|
self.authorsComboBox.setCurrentIndex(0)
|
||||||
else:
|
else:
|
||||||
QtGui.QMessageBox.warning(self,
|
QtGui.QMessageBox.warning(self, UiStrings.NISs,
|
||||||
translate('SongsPlugin.EditSongForm', 'No Author Selected'),
|
|
||||||
translate('SongsPlugin.EditSongForm', 'You have not selected '
|
translate('SongsPlugin.EditSongForm', 'You have not selected '
|
||||||
'a valid author. Either select an author from the list, '
|
'a valid author. Either select an author from the list, '
|
||||||
'or type in a new author and click the "Add Author to '
|
'or type in a new author and click the "Add Author to '
|
||||||
@ -397,8 +423,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
self.topicsListView.addItem(topic_item)
|
self.topicsListView.addItem(topic_item)
|
||||||
self.topicsComboBox.setCurrentIndex(0)
|
self.topicsComboBox.setCurrentIndex(0)
|
||||||
else:
|
else:
|
||||||
QtGui.QMessageBox.warning(self,
|
QtGui.QMessageBox.warning(self, UiStrings.NISs,
|
||||||
translate('SongsPlugin.EditSongForm', 'No Topic Selected'),
|
|
||||||
translate('SongsPlugin.EditSongForm', 'You have not selected '
|
translate('SongsPlugin.EditSongForm', 'You have not selected '
|
||||||
'a valid topic. Either select a topic from the list, or '
|
'a valid topic. Either select a topic from the list, or '
|
||||||
'type in a new topic and click the "Add Topic to Song" '
|
'type in a new topic and click the "Add Topic to Song" '
|
||||||
@ -420,11 +445,11 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
def onVerseAddButtonClicked(self):
|
def onVerseAddButtonClicked(self):
|
||||||
self.verse_form.setVerse(u'', True)
|
self.verse_form.setVerse(u'', True)
|
||||||
if self.verse_form.exec_():
|
if self.verse_form.exec_():
|
||||||
afterText, verse, subVerse = self.verse_form.getVerse()
|
after_text, verse_tag, verse_num = self.verse_form.getVerse()
|
||||||
data = u'%s:%s' % (verse, subVerse)
|
verse_def = u'%s%s' % (verse_tag, verse_num)
|
||||||
item = QtGui.QTableWidgetItem(afterText)
|
item = QtGui.QTableWidgetItem(after_text)
|
||||||
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(data))
|
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(verse_def))
|
||||||
item.setText(afterText)
|
item.setText(after_text)
|
||||||
self.verseListWidget.setRowCount(
|
self.verseListWidget.setRowCount(
|
||||||
self.verseListWidget.rowCount() + 1)
|
self.verseListWidget.rowCount() + 1)
|
||||||
self.verseListWidget.setItem(
|
self.verseListWidget.setItem(
|
||||||
@ -440,12 +465,12 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
verseId = unicode(item.data(QtCore.Qt.UserRole).toString())
|
verseId = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||||
self.verse_form.setVerse(tempText, True, verseId)
|
self.verse_form.setVerse(tempText, True, verseId)
|
||||||
if self.verse_form.exec_():
|
if self.verse_form.exec_():
|
||||||
afterText, verse, subVerse = self.verse_form.getVerse()
|
after_text, verse_tag, verse_num = self.verse_form.getVerse()
|
||||||
data = u'%s:%s' % (verse, subVerse)
|
verse_def = u'%s%s' % (verse_tag, verse_num)
|
||||||
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(data))
|
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(verse_def))
|
||||||
item.setText(afterText)
|
item.setText(after_text)
|
||||||
# number of lines has change so repaint the list moving the data
|
# number of lines has change so repaint the list moving the data
|
||||||
if len(tempText.split(u'\n')) != len(afterText.split(u'\n')):
|
if len(tempText.split(u'\n')) != len(after_text.split(u'\n')):
|
||||||
tempList = {}
|
tempList = {}
|
||||||
tempId = {}
|
tempId = {}
|
||||||
for row in range(0, self.verseListWidget.rowCount()):
|
for row in range(0, self.verseListWidget.rowCount()):
|
||||||
@ -467,7 +492,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
for row in range(0, self.verseListWidget.rowCount()):
|
for row in range(0, self.verseListWidget.rowCount()):
|
||||||
item = self.verseListWidget.item(row, 0)
|
item = self.verseListWidget.item(row, 0)
|
||||||
field = unicode(item.data(QtCore.Qt.UserRole).toString())
|
field = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||||
verse_list += u'---[%s]---\n' % field
|
verse_tag = VerseType.translated_name(field[0])
|
||||||
|
verse_num = field[1:]
|
||||||
|
verse_list += u'---[%s:%s]---\n' % (verse_tag, verse_num)
|
||||||
verse_list += item.text()
|
verse_list += item.text()
|
||||||
verse_list += u'\n'
|
verse_list += u'\n'
|
||||||
self.verse_form.setVerse(verse_list)
|
self.verse_form.setVerse(verse_list)
|
||||||
@ -483,15 +510,32 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
for count, parts in enumerate(match.split(u']---\n')):
|
for count, parts in enumerate(match.split(u']---\n')):
|
||||||
if len(parts) > 1:
|
if len(parts) > 1:
|
||||||
if count == 0:
|
if count == 0:
|
||||||
# make sure the tag is correctly cased
|
# handling carefully user inputted versetags
|
||||||
variant = u'%s%s' % \
|
separator = parts.find(u':')
|
||||||
(parts[0:1].upper(), parts[1:].lower())
|
if separator >= 0:
|
||||||
|
verse_name = parts[0:separator].strip()
|
||||||
|
verse_num = parts[separator+1:].strip()
|
||||||
|
else:
|
||||||
|
verse_name = parts
|
||||||
|
verse_num = u'1'
|
||||||
|
verse_index = \
|
||||||
|
VerseType.from_loose_input(verse_name)
|
||||||
|
verse_tag = VerseType.Tags[verse_index]
|
||||||
|
# Later we need to handle v1a as well.
|
||||||
|
#regex = re.compile(r'(\d+\w.)')
|
||||||
|
regex = re.compile(r'\D*(\d+)\D*')
|
||||||
|
match = regex.match(verse_num)
|
||||||
|
if match:
|
||||||
|
verse_num = match.group(1)
|
||||||
|
else:
|
||||||
|
verse_num = u'1'
|
||||||
|
verse_def = u'%s%s' % (verse_tag, verse_num)
|
||||||
else:
|
else:
|
||||||
if parts.endswith(u'\n'):
|
if parts.endswith(u'\n'):
|
||||||
parts = parts.rstrip(u'\n')
|
parts = parts.rstrip(u'\n')
|
||||||
item = QtGui.QTableWidgetItem(parts)
|
item = QtGui.QTableWidgetItem(parts)
|
||||||
item.setData(QtCore.Qt.UserRole,
|
item.setData(QtCore.Qt.UserRole,
|
||||||
QtCore.QVariant(variant))
|
QtCore.QVariant(verse_def))
|
||||||
self.verseListWidget.setRowCount(
|
self.verseListWidget.setRowCount(
|
||||||
self.verseListWidget.rowCount() + 1)
|
self.verseListWidget.rowCount() + 1)
|
||||||
self.verseListWidget.setItem(
|
self.verseListWidget.setItem(
|
||||||
@ -543,25 +587,31 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
order_names = unicode(self.verseOrderEdit.text()).split()
|
order_names = unicode(self.verseOrderEdit.text()).split()
|
||||||
for item in order_names:
|
for item in order_names:
|
||||||
if len(item) == 1:
|
if len(item) == 1:
|
||||||
order.append(item.lower() + u'1')
|
verse_index = VerseType.from_translated_tag(item)
|
||||||
|
if verse_index is not None:
|
||||||
|
order.append(VerseType.Tags[verse_index] + u'1')
|
||||||
|
else:
|
||||||
|
order.append(u'') # it matches no verses anyway
|
||||||
else:
|
else:
|
||||||
order.append(item.lower())
|
verse_index = VerseType.from_translated_tag(item[0])
|
||||||
|
if verse_index is None:
|
||||||
|
order.append(u'') # same as above
|
||||||
|
else:
|
||||||
|
verse_tag = VerseType.Tags[verse_index]
|
||||||
|
verse_num = item[1:].lower()
|
||||||
|
order.append(verse_tag + verse_num)
|
||||||
verses = []
|
verses = []
|
||||||
verse_names = []
|
verse_names = []
|
||||||
for index in range (0, self.verseListWidget.rowCount()):
|
for index in range(0, self.verseListWidget.rowCount()):
|
||||||
verse = self.verseListWidget.item(index, 0)
|
verse = self.verseListWidget.item(index, 0)
|
||||||
verse = unicode(verse.data(QtCore.Qt.UserRole).toString())
|
verse = unicode(verse.data(QtCore.Qt.UserRole).toString())
|
||||||
if verse not in verse_names:
|
if verse not in verse_names:
|
||||||
verses.append(
|
verses.append(verse)
|
||||||
re.sub(r'(.)[^:]*:(.*)', r'\1\2', verse.lower()))
|
verse_names.append(u'%s%s' % (
|
||||||
verse_names.append(verse)
|
VerseType.translated_tag(verse[0]), verse[1:]))
|
||||||
for count, item in enumerate(order):
|
for count, item in enumerate(order):
|
||||||
if item not in verses:
|
if item not in verses:
|
||||||
self.songTabWidget.setCurrentIndex(0)
|
valid = u', '.join(verse_names)
|
||||||
self.verseOrderEdit.setFocus()
|
|
||||||
valid = verses.pop(0)
|
|
||||||
for verse in verses:
|
|
||||||
valid = valid + u', ' + verse
|
|
||||||
critical_error_message_box(
|
critical_error_message_box(
|
||||||
message=unicode(translate('SongsPlugin.EditSongForm',
|
message=unicode(translate('SongsPlugin.EditSongForm',
|
||||||
'The verse order is invalid. There is no verse '
|
'The verse order is invalid. There is no verse '
|
||||||
@ -577,7 +627,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
unicode(translate('SongsPlugin.EditSongForm',
|
unicode(translate('SongsPlugin.EditSongForm',
|
||||||
'You have not used %s anywhere in the verse '
|
'You have not used %s anywhere in the verse '
|
||||||
'order. Are you sure you want to save the song '
|
'order. Are you sure you want to save the song '
|
||||||
'like this?')) % verse_names[count].replace(u':', u' '),
|
'like this?')) % verse_names[count],
|
||||||
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
|
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
|
||||||
if answer == QtGui.QMessageBox.No:
|
if answer == QtGui.QMessageBox.No:
|
||||||
return False
|
return False
|
||||||
@ -599,7 +649,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
def onCopyrightInsertButtonTriggered(self):
|
def onCopyrightInsertButtonTriggered(self):
|
||||||
text = self.copyrightEdit.text()
|
text = self.copyrightEdit.text()
|
||||||
pos = self.copyrightEdit.cursorPosition()
|
pos = self.copyrightEdit.cursorPosition()
|
||||||
sign = translate('SongsPlugin.EditSongForm', '\xa9')
|
sign = SongStrings.CopyrightSymbol
|
||||||
text = text[:pos] + sign + text[pos:]
|
text = text[:pos] + sign + text[pos:]
|
||||||
self.copyrightEdit.setText(text)
|
self.copyrightEdit.setText(text)
|
||||||
self.copyrightEdit.setFocus()
|
self.copyrightEdit.setFocus()
|
||||||
@ -684,7 +734,14 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
else:
|
else:
|
||||||
self.song.search_title = self.song.title
|
self.song.search_title = self.song.title
|
||||||
self.song.comments = unicode(self.commentsEdit.toPlainText())
|
self.song.comments = unicode(self.commentsEdit.toPlainText())
|
||||||
self.song.verse_order = unicode(self.verseOrderEdit.text())
|
ordertext = unicode(self.verseOrderEdit.text())
|
||||||
|
order = []
|
||||||
|
for item in ordertext.split():
|
||||||
|
verse_tag = VerseType.Tags[
|
||||||
|
VerseType.from_translated_tag(item[0])]
|
||||||
|
verse_num = item[1:].lower()
|
||||||
|
order.append(u'%s%s' % (verse_tag, verse_num))
|
||||||
|
self.song.verse_order = u' '.join(order)
|
||||||
self.song.ccli_number = unicode(self.CCLNumberEdit.text())
|
self.song.ccli_number = unicode(self.CCLNumberEdit.text())
|
||||||
self.song.song_number = unicode(self.songBookNumberEdit.text())
|
self.song.song_number = unicode(self.songBookNumberEdit.text())
|
||||||
book_name = unicode(self.songBookComboBox.currentText())
|
book_name = unicode(self.songBookComboBox.currentText())
|
||||||
@ -727,12 +784,14 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
for i in range(0, self.verseListWidget.rowCount()):
|
for i in range(0, self.verseListWidget.rowCount()):
|
||||||
item = self.verseListWidget.item(i, 0)
|
item = self.verseListWidget.item(i, 0)
|
||||||
verseId = unicode(item.data(QtCore.Qt.UserRole).toString())
|
verseId = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||||
bits = verseId.split(u':')
|
verse_tag = verseId[0]
|
||||||
sxml.add_verse_to_lyrics(bits[0], bits[1], unicode(item.text()))
|
verse_num = verseId[1:]
|
||||||
|
sxml.add_verse_to_lyrics(verse_tag, verse_num,
|
||||||
|
unicode(item.text()))
|
||||||
text = text + self.whitespace.sub(u' ',
|
text = text + self.whitespace.sub(u' ',
|
||||||
unicode(self.verseListWidget.item(i, 0).text())) + u' '
|
unicode(self.verseListWidget.item(i, 0).text())) + u' '
|
||||||
if (bits[1] > u'1') and (bits[0][0] not in multiple):
|
if (verse_num > u'1') and (verse_tag not in multiple):
|
||||||
multiple.append(bits[0][0])
|
multiple.append(verse_tag)
|
||||||
self.song.search_lyrics = text.lower()
|
self.song.search_lyrics = text.lower()
|
||||||
self.song.lyrics = unicode(sxml.extract_xml(), u'utf-8')
|
self.song.lyrics = unicode(sxml.extract_xml(), u'utf-8')
|
||||||
for verse in multiple:
|
for verse in multiple:
|
||||||
|
@ -70,19 +70,19 @@ class Ui_EditVerseDialog(object):
|
|||||||
translate('SongsPlugin.EditVerseForm', 'Edit Verse'))
|
translate('SongsPlugin.EditVerseForm', 'Edit Verse'))
|
||||||
self.verseTypeLabel.setText(
|
self.verseTypeLabel.setText(
|
||||||
translate('SongsPlugin.EditVerseForm', '&Verse type:'))
|
translate('SongsPlugin.EditVerseForm', '&Verse type:'))
|
||||||
self.verseTypeComboBox.setItemText(0,
|
self.verseTypeComboBox.setItemText(VerseType.Verse,
|
||||||
VerseType.to_string(VerseType.Verse))
|
VerseType.TranslatedNames[VerseType.Verse])
|
||||||
self.verseTypeComboBox.setItemText(1,
|
self.verseTypeComboBox.setItemText(VerseType.Chorus,
|
||||||
VerseType.to_string(VerseType.Chorus))
|
VerseType.TranslatedNames[VerseType.Chorus])
|
||||||
self.verseTypeComboBox.setItemText(2,
|
self.verseTypeComboBox.setItemText(VerseType.Bridge,
|
||||||
VerseType.to_string(VerseType.Bridge))
|
VerseType.TranslatedNames[VerseType.Bridge])
|
||||||
self.verseTypeComboBox.setItemText(3,
|
self.verseTypeComboBox.setItemText(VerseType.PreChorus,
|
||||||
VerseType.to_string(VerseType.PreChorus))
|
VerseType.TranslatedNames[VerseType.PreChorus])
|
||||||
self.verseTypeComboBox.setItemText(4,
|
self.verseTypeComboBox.setItemText(VerseType.Intro,
|
||||||
VerseType.to_string(VerseType.Intro))
|
VerseType.TranslatedNames[VerseType.Intro])
|
||||||
self.verseTypeComboBox.setItemText(5,
|
self.verseTypeComboBox.setItemText(VerseType.Ending,
|
||||||
VerseType.to_string(VerseType.Ending))
|
VerseType.TranslatedNames[VerseType.Ending])
|
||||||
self.verseTypeComboBox.setItemText(6,
|
self.verseTypeComboBox.setItemText(VerseType.Other,
|
||||||
VerseType.to_string(VerseType.Other))
|
VerseType.TranslatedNames[VerseType.Other])
|
||||||
self.insertButton.setText(
|
self.insertButton.setText(
|
||||||
translate('SongsPlugin.EditVerseForm', '&Insert'))
|
translate('SongsPlugin.EditVerseForm', '&Insert'))
|
||||||
|
@ -57,22 +57,23 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
|||||||
QtCore.QObject.connect(self.verseTypeComboBox,
|
QtCore.QObject.connect(self.verseTypeComboBox,
|
||||||
QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
||||||
self.onVerseTypeComboBoxChanged)
|
self.onVerseTypeComboBoxChanged)
|
||||||
self.verse_regex = re.compile(r'---\[([-\w]+):([\d]+)\]---')
|
self.verse_regex = re.compile(r'---\[(.+):\D*(\d*)\D*.*\]---')
|
||||||
|
|
||||||
def contextMenu(self, point):
|
def contextMenu(self, point):
|
||||||
item = self.serviceManagerList.itemAt(point)
|
item = self.serviceManagerList.itemAt(point)
|
||||||
|
|
||||||
def insertVerse(self, title, num=1):
|
def insertVerse(self, verse_tag, verse_num=1):
|
||||||
if self.verseTextEdit.textCursor().columnNumber() != 0:
|
if self.verseTextEdit.textCursor().columnNumber() != 0:
|
||||||
self.verseTextEdit.insertPlainText(u'\n')
|
self.verseTextEdit.insertPlainText(u'\n')
|
||||||
self.verseTextEdit.insertPlainText(u'---[%s:%s]---\n' % (title, num))
|
verse_tag = VerseType.translated_name(verse_tag)
|
||||||
|
self.verseTextEdit.insertPlainText(u'---[%s:%s]---\n' %
|
||||||
|
(verse_tag, verse_num))
|
||||||
self.verseTextEdit.setFocus()
|
self.verseTextEdit.setFocus()
|
||||||
|
|
||||||
def onInsertButtonClicked(self):
|
def onInsertButtonClicked(self):
|
||||||
verse_type = self.verseTypeComboBox.currentIndex()
|
verse_type_index = self.verseTypeComboBox.currentIndex()
|
||||||
if VerseType.to_string(verse_type) is not None:
|
self.insertVerse(VerseType.Tags[verse_type_index],
|
||||||
self.insertVerse(VerseType.to_string(verse_type),
|
self.verseNumberBox.value())
|
||||||
self.verseNumberBox.value())
|
|
||||||
|
|
||||||
def onVerseTypeComboBoxChanged(self):
|
def onVerseTypeComboBoxChanged(self):
|
||||||
"""
|
"""
|
||||||
@ -81,10 +82,11 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
|||||||
"""
|
"""
|
||||||
position = self.verseTextEdit.textCursor().position()
|
position = self.verseTextEdit.textCursor().position()
|
||||||
text = unicode(self.verseTextEdit.toPlainText())
|
text = unicode(self.verseTextEdit.toPlainText())
|
||||||
verse_type = VerseType.to_string(self.verseTypeComboBox.currentIndex())
|
verse_name = VerseType.TranslatedNames[
|
||||||
|
self.verseTypeComboBox.currentIndex()]
|
||||||
if not text:
|
if not text:
|
||||||
return
|
return
|
||||||
position = text.rfind(u'---[%s' % verse_type, 0, position)
|
position = text.rfind(u'---[%s' % verse_name, 0, position)
|
||||||
if position == -1:
|
if position == -1:
|
||||||
self.verseNumberBox.setValue(1)
|
self.verseNumberBox.setValue(1)
|
||||||
return
|
return
|
||||||
@ -95,11 +97,11 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
|||||||
text = text[:position + 4]
|
text = text[:position + 4]
|
||||||
match = self.verse_regex.match(text)
|
match = self.verse_regex.match(text)
|
||||||
if match:
|
if match:
|
||||||
verse_type = match.group(1)
|
verse_tag = match.group(1)
|
||||||
verse_number = int(match.group(2))
|
verse_num = int(match.group(2))
|
||||||
verse_type_index = VerseType.from_string(verse_type)
|
verse_type_index = VerseType.from_loose_input(verse_tag)
|
||||||
if verse_type_index is not None:
|
if verse_type_index is not None:
|
||||||
self.verseNumberBox.setValue(verse_number)
|
self.verseNumberBox.setValue(verse_num)
|
||||||
|
|
||||||
def onCursorPositionChanged(self):
|
def onCursorPositionChanged(self):
|
||||||
"""
|
"""
|
||||||
@ -124,25 +126,26 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
|||||||
match = self.verse_regex.match(text)
|
match = self.verse_regex.match(text)
|
||||||
if match:
|
if match:
|
||||||
verse_type = match.group(1)
|
verse_type = match.group(1)
|
||||||
|
verse_type_index = VerseType.from_loose_input(verse_type)
|
||||||
verse_number = int(match.group(2))
|
verse_number = int(match.group(2))
|
||||||
verse_type_index = VerseType.from_string(verse_type)
|
|
||||||
if verse_type_index is not None:
|
if verse_type_index is not None:
|
||||||
self.verseTypeComboBox.setCurrentIndex(verse_type_index)
|
self.verseTypeComboBox.setCurrentIndex(verse_type_index)
|
||||||
self.verseNumberBox.setValue(verse_number)
|
self.verseNumberBox.setValue(verse_number)
|
||||||
|
|
||||||
def setVerse(self, text, single=False,
|
def setVerse(self, text, single=False,
|
||||||
tag=u'%s:1' % VerseType.to_string(VerseType.Verse)):
|
tag=u'%s1' % VerseType.Tags[VerseType.Verse]):
|
||||||
self.hasSingleVerse = single
|
self.hasSingleVerse = single
|
||||||
if single:
|
if single:
|
||||||
verse_type, verse_number = tag.split(u':')
|
verse_type_index = VerseType.from_tag(tag[0])
|
||||||
verse_type_index = VerseType.from_string(verse_type)
|
verse_number = tag[1:]
|
||||||
if verse_type_index is not None:
|
if verse_type_index is not None:
|
||||||
self.verseTypeComboBox.setCurrentIndex(verse_type_index)
|
self.verseTypeComboBox.setCurrentIndex(verse_type_index)
|
||||||
self.verseNumberBox.setValue(int(verse_number))
|
self.verseNumberBox.setValue(int(verse_number))
|
||||||
self.insertButton.setVisible(False)
|
self.insertButton.setVisible(False)
|
||||||
else:
|
else:
|
||||||
if not text:
|
if not text:
|
||||||
text = u'---[%s:1]---\n' % VerseType.to_string(VerseType.Verse)
|
text = u'---[%s:1]---\n' % \
|
||||||
|
VerseType.TranslatedNames[VerseType.Verse]
|
||||||
self.verseTypeComboBox.setCurrentIndex(0)
|
self.verseTypeComboBox.setCurrentIndex(0)
|
||||||
self.verseNumberBox.setValue(1)
|
self.verseNumberBox.setValue(1)
|
||||||
self.insertButton.setVisible(True)
|
self.insertButton.setVisible(True)
|
||||||
@ -152,14 +155,14 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
|||||||
|
|
||||||
def getVerse(self):
|
def getVerse(self):
|
||||||
return self.verseTextEdit.toPlainText(), \
|
return self.verseTextEdit.toPlainText(), \
|
||||||
VerseType.to_string(self.verseTypeComboBox.currentIndex()), \
|
VerseType.Tags[self.verseTypeComboBox.currentIndex()], \
|
||||||
unicode(self.verseNumberBox.value())
|
unicode(self.verseNumberBox.value())
|
||||||
|
|
||||||
def getVerseAll(self):
|
def getVerseAll(self):
|
||||||
text = self.verseTextEdit.toPlainText()
|
text = self.verseTextEdit.toPlainText()
|
||||||
if not text.startsWith(u'---['):
|
if not text.startsWith(u'---['):
|
||||||
text = u'---[%s:1]---\n%s' % (VerseType.to_string(VerseType.Verse),
|
text = u'---[%s:1]---\n%s' % \
|
||||||
text)
|
(VerseType.TranslatedNames[VerseType.Verse], text)
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
|
@ -32,8 +32,8 @@ import logging
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import build_icon, Receiver, SettingsManager, translate
|
from openlp.core.lib import build_icon, Receiver, SettingsManager, translate
|
||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||||
from openlp.core.ui.wizard import OpenLPWizard
|
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
|
||||||
from openlp.plugins.songs.lib.db import Song
|
from openlp.plugins.songs.lib.db import Song
|
||||||
from openlp.plugins.songs.lib.openlyricsexport import OpenLyricsExport
|
from openlp.plugins.songs.lib.openlyricsexport import OpenLyricsExport
|
||||||
|
|
||||||
@ -56,7 +56,6 @@ class SongExportForm(OpenLPWizard):
|
|||||||
``plugin``
|
``plugin``
|
||||||
The songs plugin.
|
The songs plugin.
|
||||||
"""
|
"""
|
||||||
self.plugin = plugin
|
|
||||||
OpenLPWizard.__init__(self, parent, plugin, u'songExportWizard',
|
OpenLPWizard.__init__(self, parent, plugin, u'songExportWizard',
|
||||||
u':/wizards/wizard_exportsong.bmp')
|
u':/wizards/wizard_exportsong.bmp')
|
||||||
self.stop_export_flag = False
|
self.stop_export_flag = False
|
||||||
@ -165,10 +164,8 @@ class SongExportForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
self.setWindowTitle(
|
self.setWindowTitle(
|
||||||
translate('SongsPlugin.ExportWizardForm', 'Song Export Wizard'))
|
translate('SongsPlugin.ExportWizardForm', 'Song Export Wizard'))
|
||||||
self.titleLabel.setText(
|
self.titleLabel.setText(WizardStrings.HeaderStyle %
|
||||||
u'<span style="font-size:14pt; font-weight:600;">%s</span>' %
|
translate('OpenLP.Ui', 'Welcome to the Song Export Wizard'))
|
||||||
translate('SongsPlugin.ExportWizardForm',
|
|
||||||
'Welcome to the Song Export Wizard'))
|
|
||||||
self.informationLabel.setText(
|
self.informationLabel.setText(
|
||||||
translate('SongsPlugin.ExportWizardForm', 'This wizard will help to'
|
translate('SongsPlugin.ExportWizardForm', 'This wizard will help to'
|
||||||
' export your songs to the open and free OpenLyrics worship song '
|
' export your songs to the open and free OpenLyrics worship song '
|
||||||
@ -177,15 +174,14 @@ class SongExportForm(OpenLPWizard):
|
|||||||
translate('SongsPlugin.ExportWizardForm', 'Select Songs'))
|
translate('SongsPlugin.ExportWizardForm', 'Select Songs'))
|
||||||
self.availableSongsPage.setSubTitle(
|
self.availableSongsPage.setSubTitle(
|
||||||
translate('SongsPlugin.ExportWizardForm',
|
translate('SongsPlugin.ExportWizardForm',
|
||||||
'Check the songs, you want to export.'))
|
'Check the songs you want to export.'))
|
||||||
self.searchLabel.setText(
|
self.searchLabel.setText(u'%s:' % UiStrings.Search)
|
||||||
translate('SongsPlugin.ExportWizardForm', 'Search:'))
|
|
||||||
self.uncheckButton.setText(
|
self.uncheckButton.setText(
|
||||||
translate('SongsPlugin.ExportWizardForm', 'Uncheck All'))
|
translate('SongsPlugin.ExportWizardForm', 'Uncheck All'))
|
||||||
self.checkButton.setText(
|
self.checkButton.setText(
|
||||||
translate('SongsPlugin.ExportWizardForm', 'Check All'))
|
translate('SongsPlugin.ExportWizardForm', 'Check All'))
|
||||||
self.exportSongPage.setTitle(
|
self.exportSongPage.setTitle(
|
||||||
translate('SongsPlugin.ExportWizardForm', 'Select Directory'))
|
translate('SongsPlugin.ExportWizardForm', 'Select Directory'))
|
||||||
self.exportSongPage.setSubTitle(
|
self.exportSongPage.setSubTitle(
|
||||||
translate('SongsPlugin.ExportWizardForm',
|
translate('SongsPlugin.ExportWizardForm',
|
||||||
'Select the directory you want the songs to be saved.'))
|
'Select the directory you want the songs to be saved.'))
|
||||||
@ -196,10 +192,8 @@ class SongExportForm(OpenLPWizard):
|
|||||||
self.progressPage.setSubTitle(
|
self.progressPage.setSubTitle(
|
||||||
translate('SongsPlugin.ExportWizardForm',
|
translate('SongsPlugin.ExportWizardForm',
|
||||||
'Please wait while your songs are exported.'))
|
'Please wait while your songs are exported.'))
|
||||||
self.progressLabel.setText(
|
self.progressLabel.setText(WizardStrings.Ready)
|
||||||
translate('SongsPlugin.ExportWizardForm', 'Ready.'))
|
self.progressBar.setFormat(WizardStrings.PercentSymbolFormat)
|
||||||
self.progressBar.setFormat(
|
|
||||||
translate('SongsPlugin.ExportWizardForm', '%p%'))
|
|
||||||
|
|
||||||
def validateCurrentPage(self):
|
def validateCurrentPage(self):
|
||||||
"""
|
"""
|
||||||
@ -213,9 +207,7 @@ class SongExportForm(OpenLPWizard):
|
|||||||
self.availableListWidget) if item.checkState()
|
self.availableListWidget) if item.checkState()
|
||||||
]
|
]
|
||||||
if not items:
|
if not items:
|
||||||
critical_error_message_box(
|
critical_error_message_box(UiStrings.NISp,
|
||||||
translate('SongsPlugin.ExportWizardForm',
|
|
||||||
'No Song Selected'),
|
|
||||||
translate('SongsPlugin.ExportWizardForm',
|
translate('SongsPlugin.ExportWizardForm',
|
||||||
'You need to add at least one Song to export.'))
|
'You need to add at least one Song to export.'))
|
||||||
return False
|
return False
|
||||||
|
@ -33,7 +33,7 @@ from PyQt4 import QtCore, QtGui
|
|||||||
|
|
||||||
from openlp.core.lib import Receiver, SettingsManager, translate
|
from openlp.core.lib import Receiver, SettingsManager, translate
|
||||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||||
from openlp.core.ui.wizard import OpenLPWizard
|
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
|
||||||
from openlp.plugins.songs.lib.importer import SongFormat
|
from openlp.plugins.songs.lib.importer import SongFormat
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -207,61 +207,45 @@ class SongImportForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
self.setWindowTitle(
|
self.setWindowTitle(
|
||||||
translate('SongsPlugin.ImportWizardForm', 'Song Import Wizard'))
|
translate('SongsPlugin.ImportWizardForm', 'Song Import Wizard'))
|
||||||
self.titleLabel.setText(
|
self.titleLabel.setText(WizardStrings.HeaderStyle %
|
||||||
u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
|
translate('OpenLP.Ui', 'Welcome to the Song Import Wizard'))
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
|
||||||
'Welcome to the Song Import Wizard'))
|
|
||||||
self.informationLabel.setText(
|
self.informationLabel.setText(
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'This wizard will help you to import songs from a variety of '
|
'This wizard will help you to import songs from a variety of '
|
||||||
'formats. Click the next button below to start the process by '
|
'formats. Click the next button below to start the process by '
|
||||||
'selecting a format to import from.'))
|
'selecting a format to import from.'))
|
||||||
self.sourcePage.setTitle(
|
self.sourcePage.setTitle(WizardStrings.ImportSelect)
|
||||||
translate('SongsPlugin.ImportWizardForm', 'Select Import Source'))
|
self.sourcePage.setSubTitle(WizardStrings.ImportSelectLong)
|
||||||
self.sourcePage.setSubTitle(
|
self.formatLabel.setText(WizardStrings.FormatLabel)
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
self.formatComboBox.setItemText(SongFormat.OpenLP2, UiStrings.OLPV2)
|
||||||
'Select the import format, and where to import from.'))
|
self.formatComboBox.setItemText(SongFormat.OpenLP1, UiStrings.OLPV1)
|
||||||
self.formatLabel.setText(
|
self.formatComboBox.setItemText(
|
||||||
translate('SongsPlugin.ImportWizardForm', 'Format:'))
|
SongFormat.OpenLyrics, WizardStrings.OL)
|
||||||
self.formatComboBox.setItemText(0, UiStrings.OLPV2)
|
self.formatComboBox.setItemText(SongFormat.OpenSong, WizardStrings.OS)
|
||||||
self.formatComboBox.setItemText(1,
|
self.formatComboBox.setItemText(
|
||||||
translate('SongsPlugin.ImportWizardForm', 'openlp.org 1.x'))
|
SongFormat.WordsOfWorship, WizardStrings.WoW)
|
||||||
self.formatComboBox.setItemText(2,
|
self.formatComboBox.setItemText(SongFormat.CCLI, WizardStrings.CCLI)
|
||||||
translate('SongsPlugin.ImportWizardForm', 'OpenLyrics'))
|
self.formatComboBox.setItemText(
|
||||||
self.formatComboBox.setItemText(3,
|
SongFormat.SongsOfFellowship, WizardStrings.SoF)
|
||||||
translate('SongsPlugin.ImportWizardForm', 'OpenSong'))
|
self.formatComboBox.setItemText(SongFormat.Generic,
|
||||||
self.formatComboBox.setItemText(4,
|
|
||||||
translate('SongsPlugin.ImportWizardForm', 'Words of Worship'))
|
|
||||||
self.formatComboBox.setItemText(5,
|
|
||||||
translate('SongsPlugin.ImportWizardForm', 'CCLI/SongSelect'))
|
|
||||||
self.formatComboBox.setItemText(6,
|
|
||||||
translate('SongsPlugin.ImportWizardForm', 'Songs of Fellowship'))
|
|
||||||
self.formatComboBox.setItemText(7,
|
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'Generic Document/Presentation'))
|
'Generic Document/Presentation'))
|
||||||
self.formatComboBox.setItemText(8,
|
self.formatComboBox.setItemText(
|
||||||
translate('SongsPlugin.ImportWizardForm', 'EasiSlides'))
|
SongFormat.EasiSlides, WizardStrings.ES)
|
||||||
self.formatComboBox.setItemText(9,
|
self.formatComboBox.setItemText(
|
||||||
translate('SongsPlugin.ImportWizardForm', 'EasyWorship'))
|
SongFormat.EasyWorship, WizardStrings.EW)
|
||||||
self.formatComboBox.setItemText(10,
|
self.formatComboBox.setItemText(
|
||||||
translate('SongsPlugin.ImportWizardForm', 'SongBeamer'))
|
SongFormat.SongBeamer, WizardStrings.SB)
|
||||||
self.formatComboBox.setItemText(11,
|
self.formatComboBox.setItemText(
|
||||||
translate('SongsPlugin.ImportWizardForm', 'SongShow Plus'))
|
SongFormat.SongShowPlus, WizardStrings.SSP)
|
||||||
# self.formatComboBox.setItemText(11,
|
# self.formatComboBox.setItemText(SongFormat.CSV, WizardStrings.CSV)
|
||||||
# translate('SongsPlugin.ImportWizardForm', 'CSV'))
|
|
||||||
self.openLP2FilenameLabel.setText(
|
self.openLP2FilenameLabel.setText(
|
||||||
translate('SongsPlugin.ImportWizardForm', 'Filename:'))
|
translate('SongsPlugin.ImportWizardForm', 'Filename:'))
|
||||||
self.openLP2BrowseButton.setText(
|
self.openLP2BrowseButton.setText(UiStrings.Browse)
|
||||||
translate('SongsPlugin.ImportWizardForm', 'Browse...'))
|
|
||||||
self.openLP1FilenameLabel.setText(
|
self.openLP1FilenameLabel.setText(
|
||||||
translate('SongsPlugin.ImportWizardForm', 'Filename:'))
|
translate('SongsPlugin.ImportWizardForm', 'Filename:'))
|
||||||
self.openLP1BrowseButton.setText(
|
self.openLP1BrowseButton.setText(UiStrings.Browse)
|
||||||
translate('SongsPlugin.ImportWizardForm', 'Browse...'))
|
self.openLP1DisabledLabel.setText(WizardStrings.NoSqlite)
|
||||||
self.openLP1DisabledLabel.setText(
|
|
||||||
translate('SongsPlugin.ImportWizardForm', 'The openlp.org 1.x '
|
|
||||||
'importer has been disabled due to a missing Python module. If '
|
|
||||||
'you want to use this importer, you will need to install the '
|
|
||||||
'"python-sqlite" module.'))
|
|
||||||
self.openLyricsAddButton.setText(
|
self.openLyricsAddButton.setText(
|
||||||
translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
|
translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
|
||||||
self.openLyricsRemoveButton.setText(
|
self.openLyricsRemoveButton.setText(
|
||||||
@ -301,12 +285,10 @@ class SongImportForm(OpenLPWizard):
|
|||||||
'find OpenOffice.org on your computer.'))
|
'find OpenOffice.org on your computer.'))
|
||||||
self.easiSlidesFilenameLabel.setText(
|
self.easiSlidesFilenameLabel.setText(
|
||||||
translate('SongsPlugin.ImportWizardForm', 'Filename:'))
|
translate('SongsPlugin.ImportWizardForm', 'Filename:'))
|
||||||
self.easiSlidesBrowseButton.setText(
|
self.easiSlidesBrowseButton.setText(UiStrings.Browse)
|
||||||
translate('SongsPlugin.ImportWizardForm', 'Browse...'))
|
|
||||||
self.ewFilenameLabel.setText(
|
self.ewFilenameLabel.setText(
|
||||||
translate('SongsPlugin.ImportWizardForm', 'Filename:'))
|
translate('SongsPlugin.ImportWizardForm', 'Filename:'))
|
||||||
self.ewBrowseButton.setText(
|
self.ewBrowseButton.setText(UiStrings.Browse)
|
||||||
translate('SongsPlugin.ImportWizardForm', 'Browse...'))
|
|
||||||
self.songBeamerAddButton.setText(
|
self.songBeamerAddButton.setText(
|
||||||
translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
|
translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
|
||||||
self.songBeamerRemoveButton.setText(
|
self.songBeamerRemoveButton.setText(
|
||||||
@ -317,17 +299,13 @@ class SongImportForm(OpenLPWizard):
|
|||||||
translate('SongsPlugin.ImportWizardForm', 'Remove File(s)'))
|
translate('SongsPlugin.ImportWizardForm', 'Remove File(s)'))
|
||||||
# self.csvFilenameLabel.setText(
|
# self.csvFilenameLabel.setText(
|
||||||
# translate('SongsPlugin.ImportWizardForm', 'Filename:'))
|
# translate('SongsPlugin.ImportWizardForm', 'Filename:'))
|
||||||
# self.csvBrowseButton.setText(
|
# self.csvBrowseButton.setText(UiStrings.Browse)
|
||||||
# translate('SongsPlugin.ImportWizardForm', 'Browse...'))
|
self.progressPage.setTitle(WizardStrings.Importing)
|
||||||
self.progressPage.setTitle(
|
|
||||||
translate('SongsPlugin.ImportWizardForm', 'Importing'))
|
|
||||||
self.progressPage.setSubTitle(
|
self.progressPage.setSubTitle(
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'Please wait while your songs are imported.'))
|
'Please wait while your songs are imported.'))
|
||||||
self.progressLabel.setText(
|
self.progressLabel.setText(WizardStrings.Ready)
|
||||||
translate('SongsPlugin.ImportWizardForm', 'Ready.'))
|
self.progressBar.setFormat(WizardStrings.PercentSymbolFormat)
|
||||||
self.progressBar.setFormat(
|
|
||||||
translate('SongsPlugin.ImportWizardForm', '%p%'))
|
|
||||||
# Align all QFormLayouts towards each other.
|
# Align all QFormLayouts towards each other.
|
||||||
width = max(self.formatLabel.minimumSizeHint().width(),
|
width = max(self.formatLabel.minimumSizeHint().width(),
|
||||||
self.openLP2FilenameLabel.minimumSizeHint().width())
|
self.openLP2FilenameLabel.minimumSizeHint().width())
|
||||||
@ -344,122 +322,76 @@ class SongImportForm(OpenLPWizard):
|
|||||||
source_format = self.formatComboBox.currentIndex()
|
source_format = self.formatComboBox.currentIndex()
|
||||||
if source_format == SongFormat.OpenLP2:
|
if source_format == SongFormat.OpenLP2:
|
||||||
if self.openLP2FilenameEdit.text().isEmpty():
|
if self.openLP2FilenameEdit.text().isEmpty():
|
||||||
critical_error_message_box(
|
critical_error_message_box(UiStrings.NFSs,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
WizardStrings.YouSpecifyFile % UiStrings.OLPV2)
|
||||||
'No OpenLP 2.0 Song Database Selected'),
|
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
|
||||||
'You need to select an OpenLP 2.0 song database '
|
|
||||||
'file to import from.'))
|
|
||||||
self.openLP2BrowseButton.setFocus()
|
self.openLP2BrowseButton.setFocus()
|
||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.OpenLP1:
|
elif source_format == SongFormat.OpenLP1:
|
||||||
if self.openLP1FilenameEdit.text().isEmpty():
|
if self.openLP1FilenameEdit.text().isEmpty():
|
||||||
critical_error_message_box(
|
critical_error_message_box(UiStrings.NFSs,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
WizardStrings.YouSpecifyFile % UiStrings.OLPV1)
|
||||||
'No openlp.org 1.x Song Database Selected'),
|
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
|
||||||
'You need to select an openlp.org 1.x song '
|
|
||||||
'database file to import from.'))
|
|
||||||
self.openLP1BrowseButton.setFocus()
|
self.openLP1BrowseButton.setFocus()
|
||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.OpenLyrics:
|
elif source_format == SongFormat.OpenLyrics:
|
||||||
if self.openLyricsFileListWidget.count() == 0:
|
if self.openLyricsFileListWidget.count() == 0:
|
||||||
critical_error_message_box(
|
critical_error_message_box(UiStrings.NFSp,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
WizardStrings.YouSpecifyFile % WizardStrings.OL)
|
||||||
'No OpenLyrics Files Selected'),
|
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
|
||||||
'You need to add at least one OpenLyrics '
|
|
||||||
'song file to import from.'))
|
|
||||||
self.openLyricsAddButton.setFocus()
|
self.openLyricsAddButton.setFocus()
|
||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.OpenSong:
|
elif source_format == SongFormat.OpenSong:
|
||||||
if self.openSongFileListWidget.count() == 0:
|
if self.openSongFileListWidget.count() == 0:
|
||||||
critical_error_message_box(
|
critical_error_message_box(UiStrings.NFSp,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
WizardStrings.YouSpecifyFile % WizardStrings.OS)
|
||||||
'No OpenSong Files Selected'),
|
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
|
||||||
'You need to add at least one OpenSong '
|
|
||||||
'song file to import from.'))
|
|
||||||
self.openSongAddButton.setFocus()
|
self.openSongAddButton.setFocus()
|
||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.WordsOfWorship:
|
elif source_format == SongFormat.WordsOfWorship:
|
||||||
if self.wordsOfWorshipFileListWidget.count() == 0:
|
if self.wordsOfWorshipFileListWidget.count() == 0:
|
||||||
critical_error_message_box(
|
critical_error_message_box(UiStrings.NFSp,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
WizardStrings.YouSpecifyFile % WizardStrings.WoW)
|
||||||
'No Words of Worship Files Selected'),
|
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
|
||||||
'You need to add at least one Words of Worship '
|
|
||||||
'file to import from.'))
|
|
||||||
self.wordsOfWorshipAddButton.setFocus()
|
self.wordsOfWorshipAddButton.setFocus()
|
||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.CCLI:
|
elif source_format == SongFormat.CCLI:
|
||||||
if self.ccliFileListWidget.count() == 0:
|
if self.ccliFileListWidget.count() == 0:
|
||||||
critical_error_message_box(
|
critical_error_message_box(UiStrings.NFSp,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
WizardStrings.YouSpecifyFile % WizardStrings.CCLI)
|
||||||
'No CCLI Files Selected'),
|
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
|
||||||
'You need to add at least one CCLI file '
|
|
||||||
'to import from.'))
|
|
||||||
self.ccliAddButton.setFocus()
|
self.ccliAddButton.setFocus()
|
||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.SongsOfFellowship:
|
elif source_format == SongFormat.SongsOfFellowship:
|
||||||
if self.songsOfFellowshipFileListWidget.count() == 0:
|
if self.songsOfFellowshipFileListWidget.count() == 0:
|
||||||
critical_error_message_box(
|
critical_error_message_box(UiStrings.NFSp,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
WizardStrings.YouSpecifyFile % WizardStrings.SoF)
|
||||||
'No Songs of Fellowship File Selected'),
|
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
|
||||||
'You need to add at least one Songs of Fellowship '
|
|
||||||
'file to import from.'))
|
|
||||||
self.songsOfFellowshipAddButton.setFocus()
|
self.songsOfFellowshipAddButton.setFocus()
|
||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.Generic:
|
elif source_format == SongFormat.Generic:
|
||||||
if self.genericFileListWidget.count() == 0:
|
if self.genericFileListWidget.count() == 0:
|
||||||
critical_error_message_box(
|
critical_error_message_box(UiStrings.NFSp,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'No Document/Presentation Selected'),
|
'You need to specify at least one document or '
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
|
||||||
'You need to add at least one document or '
|
|
||||||
'presentation file to import from.'))
|
'presentation file to import from.'))
|
||||||
self.genericAddButton.setFocus()
|
self.genericAddButton.setFocus()
|
||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.EasiSlides:
|
elif source_format == SongFormat.EasiSlides:
|
||||||
if self.easiSlidesFilenameEdit.text().isEmpty():
|
if self.easiSlidesFilenameEdit.text().isEmpty():
|
||||||
critical_error_message_box(
|
critical_error_message_box(UiStrings.NFSp,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
WizardStrings.YouSpecifyFile % WizardStrings.ES)
|
||||||
'No Easislides Songs file selected'),
|
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
|
||||||
'You need to select an xml song file exported from '
|
|
||||||
'EasiSlides, to import from.'))
|
|
||||||
self.easiSlidesBrowseButton.setFocus()
|
self.easiSlidesBrowseButton.setFocus()
|
||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.EasyWorship:
|
elif source_format == SongFormat.EasyWorship:
|
||||||
if self.ewFilenameEdit.text().isEmpty():
|
if self.ewFilenameEdit.text().isEmpty():
|
||||||
critical_error_message_box(
|
critical_error_message_box(UiStrings.NFSs,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
WizardStrings.YouSpecifyFile % WizardStrings.EW)
|
||||||
'No EasyWorship Song Database Selected'),
|
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
|
||||||
'You need to select an EasyWorship song database '
|
|
||||||
'file to import from.'))
|
|
||||||
self.ewBrowseButton.setFocus()
|
self.ewBrowseButton.setFocus()
|
||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.SongBeamer:
|
elif source_format == SongFormat.SongBeamer:
|
||||||
if self.songBeamerFileListWidget.count() == 0:
|
if self.songBeamerFileListWidget.count() == 0:
|
||||||
critical_error_message_box(
|
critical_error_message_box(UiStrings.NFSp,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
WizardStrings.YouSpecifyFile % WizardStrings.SB)
|
||||||
'No SongBeamer File Selected'),
|
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
|
||||||
'You need to add at least one SongBeamer '
|
|
||||||
'file to import from.'))
|
|
||||||
self.songBeamerAddButton.setFocus()
|
self.songBeamerAddButton.setFocus()
|
||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.SongShowPlus:
|
elif source_format == SongFormat.SongShowPlus:
|
||||||
if self.songShowPlusFileListWidget.count() == 0:
|
if self.songShowPlusFileListWidget.count() == 0:
|
||||||
critical_error_message_box(
|
critical_error_message_box(UiStrings.NFSp,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
WizardStrings.YouSpecifyFile % WizardStrings.SSP)
|
||||||
'No SongShow Plus Files Selected'),
|
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
|
||||||
'You need to add at least one SongShow Plus '
|
|
||||||
'file to import from.'))
|
|
||||||
self.wordsOfWorshipAddButton.setFocus()
|
self.wordsOfWorshipAddButton.setFocus()
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
@ -490,8 +422,7 @@ class SongImportForm(OpenLPWizard):
|
|||||||
filters)
|
filters)
|
||||||
if filenames:
|
if filenames:
|
||||||
listbox.addItems(filenames)
|
listbox.addItems(filenames)
|
||||||
SettingsManager.set_last_dir(
|
SettingsManager.set_last_dir(self.plugin.settingsSection,
|
||||||
self.plugin.settingsSection,
|
|
||||||
os.path.split(unicode(filenames[0]))[0], 1)
|
os.path.split(unicode(filenames[0]))[0], 1)
|
||||||
|
|
||||||
def getListOfFiles(self, listbox):
|
def getListOfFiles(self, listbox):
|
||||||
@ -515,9 +446,7 @@ class SongImportForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
Get OpenLP v2 song database file
|
Get OpenLP v2 song database file
|
||||||
"""
|
"""
|
||||||
self.getFileName(
|
self.getFileName(WizardStrings.OpenTypeFile % UiStrings.OLPV2,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
|
||||||
'Select OpenLP 2.0 Database File'),
|
|
||||||
self.openLP2FilenameEdit, u'%s (*.sqlite)'
|
self.openLP2FilenameEdit, u'%s (*.sqlite)'
|
||||||
% (translate('SongsPlugin.ImportWizardForm',
|
% (translate('SongsPlugin.ImportWizardForm',
|
||||||
'OpenLP 2.0 Databases'))
|
'OpenLP 2.0 Databases'))
|
||||||
@ -527,9 +456,7 @@ class SongImportForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
Get OpenLP v1 song database file
|
Get OpenLP v1 song database file
|
||||||
"""
|
"""
|
||||||
self.getFileName(
|
self.getFileName(WizardStrings.OpenTypeFile % UiStrings.OLPV1,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
|
||||||
'Select openlp.org 1.x Database File'),
|
|
||||||
self.openLP1FilenameEdit, u'%s (*.olp)'
|
self.openLP1FilenameEdit, u'%s (*.olp)'
|
||||||
% translate('SongsPlugin.ImportWizardForm',
|
% translate('SongsPlugin.ImportWizardForm',
|
||||||
'openlp.org v1.x Databases')
|
'openlp.org v1.x Databases')
|
||||||
@ -539,11 +466,8 @@ class SongImportForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
Get OpenLyrics song database files
|
Get OpenLyrics song database files
|
||||||
"""
|
"""
|
||||||
self.getFiles(
|
self.getFiles(WizardStrings.OpenTypeFile % WizardStrings.OL,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
self.openLyricsFileListWidget)
|
||||||
'Select OpenLyrics Files'),
|
|
||||||
self.openLyricsFileListWidget
|
|
||||||
)
|
|
||||||
|
|
||||||
def onOpenLyricsRemoveButtonClicked(self):
|
def onOpenLyricsRemoveButtonClicked(self):
|
||||||
"""
|
"""
|
||||||
@ -555,10 +479,8 @@ class SongImportForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
Get OpenSong song database files
|
Get OpenSong song database files
|
||||||
"""
|
"""
|
||||||
self.getFiles(
|
self.getFiles(WizardStrings.OpenTypeFile % WizardStrings.OS,
|
||||||
translate('SongsPlugin.ImportWizardForm', 'Select Open Song Files'),
|
self.openSongFileListWidget)
|
||||||
self.openSongFileListWidget
|
|
||||||
)
|
|
||||||
|
|
||||||
def onOpenSongRemoveButtonClicked(self):
|
def onOpenSongRemoveButtonClicked(self):
|
||||||
"""
|
"""
|
||||||
@ -570,9 +492,7 @@ class SongImportForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
Get Words of Worship song database files
|
Get Words of Worship song database files
|
||||||
"""
|
"""
|
||||||
self.getFiles(
|
self.getFiles(WizardStrings.OpenTypeFile % WizardStrings.WoW,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
|
||||||
'Select Words of Worship Files'),
|
|
||||||
self.wordsOfWorshipFileListWidget, u'%s (*.wsg *.wow-song)'
|
self.wordsOfWorshipFileListWidget, u'%s (*.wsg *.wow-song)'
|
||||||
% translate('SongsPlugin.ImportWizardForm',
|
% translate('SongsPlugin.ImportWizardForm',
|
||||||
'Words Of Worship Song Files')
|
'Words Of Worship Song Files')
|
||||||
@ -588,11 +508,8 @@ class SongImportForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
Get CCLI song database files
|
Get CCLI song database files
|
||||||
"""
|
"""
|
||||||
self.getFiles(
|
self.getFiles(WizardStrings.OpenTypeFile % WizardStrings.CCLI,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
self.ccliFileListWidget)
|
||||||
'Select CCLI Files'),
|
|
||||||
self.ccliFileListWidget
|
|
||||||
)
|
|
||||||
|
|
||||||
def onCCLIRemoveButtonClicked(self):
|
def onCCLIRemoveButtonClicked(self):
|
||||||
"""
|
"""
|
||||||
@ -604,9 +521,7 @@ class SongImportForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
Get Songs of Fellowship song database files
|
Get Songs of Fellowship song database files
|
||||||
"""
|
"""
|
||||||
self.getFiles(
|
self.getFiles(WizardStrings.OpenTypeFile % WizardStrings.SoF,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
|
||||||
'Select Songs of Fellowship Files'),
|
|
||||||
self.songsOfFellowshipFileListWidget, u'%s (*.rtf)'
|
self.songsOfFellowshipFileListWidget, u'%s (*.rtf)'
|
||||||
% translate('SongsPlugin.ImportWizardForm',
|
% translate('SongsPlugin.ImportWizardForm',
|
||||||
'Songs Of Fellowship Song Files')
|
'Songs Of Fellowship Song Files')
|
||||||
@ -635,29 +550,21 @@ class SongImportForm(OpenLPWizard):
|
|||||||
self.removeSelectedItems(self.genericFileListWidget)
|
self.removeSelectedItems(self.genericFileListWidget)
|
||||||
|
|
||||||
def onEasiSlidesBrowseButtonClicked(self):
|
def onEasiSlidesBrowseButtonClicked(self):
|
||||||
self.getFileName(
|
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.ES,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
self.easiSlidesFilenameEdit)
|
||||||
'Select EasiSlides songfile'),
|
|
||||||
self.easiSlidesFilenameEdit
|
|
||||||
)
|
|
||||||
|
|
||||||
def onEWBrowseButtonClicked(self):
|
def onEWBrowseButtonClicked(self):
|
||||||
"""
|
"""
|
||||||
Get EasyWorship song database files
|
Get EasyWorship song database files
|
||||||
"""
|
"""
|
||||||
self.getFileName(
|
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.EW,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
self.ewFilenameEdit)
|
||||||
'Select EasyWorship Database File'),
|
|
||||||
self.ewFilenameEdit
|
|
||||||
)
|
|
||||||
|
|
||||||
def onSongBeamerAddButtonClicked(self):
|
def onSongBeamerAddButtonClicked(self):
|
||||||
"""
|
"""
|
||||||
Get SongBeamer song database files
|
Get SongBeamer song database files
|
||||||
"""
|
"""
|
||||||
self.getFiles(
|
self.getFiles(WizardStrings.OpenTypeFile % WizardStrings.SB,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
|
||||||
'Select SongBeamer Files'),
|
|
||||||
self.songBeamerFileListWidget, u'%s (*.sng)' %
|
self.songBeamerFileListWidget, u'%s (*.sng)' %
|
||||||
translate('SongsPlugin.ImportWizardForm', 'SongBeamer Files')
|
translate('SongsPlugin.ImportWizardForm', 'SongBeamer Files')
|
||||||
)
|
)
|
||||||
@ -672,9 +579,7 @@ class SongImportForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
Get SongShow Plus song database files
|
Get SongShow Plus song database files
|
||||||
"""
|
"""
|
||||||
self.getFiles(
|
self.getFiles(WizardStrings.OpenTypeFile % WizardStrings.SSP,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
|
||||||
'Select SongShow Plus Files'),
|
|
||||||
self.songShowPlusFileListWidget, u'%s (*.sbsong)'
|
self.songShowPlusFileListWidget, u'%s (*.sbsong)'
|
||||||
% translate('SongsPlugin.ImportWizardForm',
|
% translate('SongsPlugin.ImportWizardForm',
|
||||||
'SongShow Plus Song Files')
|
'SongShow Plus Song Files')
|
||||||
@ -713,8 +618,7 @@ class SongImportForm(OpenLPWizard):
|
|||||||
Perform pre import tasks
|
Perform pre import tasks
|
||||||
"""
|
"""
|
||||||
OpenLPWizard.preWizard(self)
|
OpenLPWizard.preWizard(self)
|
||||||
self.progressLabel.setText(
|
self.progressLabel.setText(WizardStrings.StartingImport)
|
||||||
translate('SongsPlugin.ImportWizardForm', 'Starting import...'))
|
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
|
|
||||||
def performWizard(self):
|
def performWizard(self):
|
||||||
@ -763,7 +667,7 @@ class SongImportForm(OpenLPWizard):
|
|||||||
self.songsOfFellowshipFileListWidget)
|
self.songsOfFellowshipFileListWidget)
|
||||||
)
|
)
|
||||||
elif source_format == SongFormat.Generic:
|
elif source_format == SongFormat.Generic:
|
||||||
# Import a generic document or presentatoin
|
# Import a generic document or presentation
|
||||||
importer = self.plugin.importSongs(SongFormat.Generic,
|
importer = self.plugin.importSongs(SongFormat.Generic,
|
||||||
filenames=self.getListOfFiles(self.genericFileListWidget)
|
filenames=self.getListOfFiles(self.genericFileListWidget)
|
||||||
)
|
)
|
||||||
@ -785,12 +689,10 @@ class SongImportForm(OpenLPWizard):
|
|||||||
elif source_format == SongFormat.SongShowPlus:
|
elif source_format == SongFormat.SongShowPlus:
|
||||||
# Import ShongShow Plus songs
|
# Import ShongShow Plus songs
|
||||||
importer = self.plugin.importSongs(SongFormat.SongShowPlus,
|
importer = self.plugin.importSongs(SongFormat.SongShowPlus,
|
||||||
filenames=self.getListOfFiles(
|
filenames=self.getListOfFiles(self.songShowPlusFileListWidget)
|
||||||
self.songShowPlusFileListWidget)
|
|
||||||
)
|
)
|
||||||
if importer.do_import():
|
if importer.do_import():
|
||||||
self.progressLabel.setText(
|
self.progressLabel.setText(WizardStrings.FinishedImport)
|
||||||
translate('SongsPlugin.SongImportForm', 'Finished import.'))
|
|
||||||
else:
|
else:
|
||||||
self.progressLabel.setText(
|
self.progressLabel.setText(
|
||||||
translate('SongsPlugin.SongImportForm',
|
translate('SongsPlugin.SongImportForm',
|
||||||
|
@ -26,8 +26,9 @@
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import build_icon, translate
|
from openlp.core.lib import build_icon
|
||||||
from openlp.core.lib.ui import UiStrings
|
from openlp.core.lib.ui import UiStrings
|
||||||
|
from openlp.plugins.songs.lib.ui import SongStrings
|
||||||
|
|
||||||
class Ui_SongMaintenanceDialog(object):
|
class Ui_SongMaintenanceDialog(object):
|
||||||
def setupUi(self, songMaintenanceDialog):
|
def setupUi(self, songMaintenanceDialog):
|
||||||
@ -144,14 +145,10 @@ class Ui_SongMaintenanceDialog(object):
|
|||||||
QtCore.QMetaObject.connectSlotsByName(songMaintenanceDialog)
|
QtCore.QMetaObject.connectSlotsByName(songMaintenanceDialog)
|
||||||
|
|
||||||
def retranslateUi(self, songMaintenanceDialog):
|
def retranslateUi(self, songMaintenanceDialog):
|
||||||
songMaintenanceDialog.setWindowTitle(
|
songMaintenanceDialog.setWindowTitle(SongStrings.SongMaintenance)
|
||||||
translate('SongsPlugin.SongMaintenanceForm', 'Song Maintenance'))
|
self.listItemAuthors.setText(SongStrings.Authors)
|
||||||
authorsString = UiStrings.Authors
|
self.listItemTopics.setText(SongStrings.Topics)
|
||||||
topicsString = translate('SongsPlugin.SongMaintenanceForm', 'Topics')
|
self.listItemBooks.setText(SongStrings.SongBooks)
|
||||||
booksString = translate('SongsPlugin.SongMaintenanceForm', 'Song Books')
|
|
||||||
self.listItemAuthors.setText(authorsString)
|
|
||||||
self.listItemTopics.setText(topicsString)
|
|
||||||
self.listItemBooks.setText(booksString)
|
|
||||||
self.authorsAddButton.setText(UiStrings.Add)
|
self.authorsAddButton.setText(UiStrings.Add)
|
||||||
self.authorsEditButton.setText(UiStrings.Edit)
|
self.authorsEditButton.setText(UiStrings.Edit)
|
||||||
self.authorsDeleteButton.setText(UiStrings.Delete)
|
self.authorsDeleteButton.setText(UiStrings.Delete)
|
||||||
@ -161,8 +158,8 @@ class Ui_SongMaintenanceDialog(object):
|
|||||||
self.booksAddButton.setText(UiStrings.Add)
|
self.booksAddButton.setText(UiStrings.Add)
|
||||||
self.booksEditButton.setText(UiStrings.Edit)
|
self.booksEditButton.setText(UiStrings.Edit)
|
||||||
self.booksDeleteButton.setText(UiStrings.Delete)
|
self.booksDeleteButton.setText(UiStrings.Delete)
|
||||||
typeListWidth = max(self.fontMetrics().width(authorsString),
|
typeListWidth = max(self.fontMetrics().width(SongStrings.Authors),
|
||||||
self.fontMetrics().width(topicsString),
|
self.fontMetrics().width(SongStrings.Topics),
|
||||||
self.fontMetrics().width(booksString))
|
self.fontMetrics().width(SongStrings.SongBooks))
|
||||||
self.typeListWidget.setFixedWidth(typeListWidth +
|
self.typeListWidget.setFixedWidth(typeListWidth +
|
||||||
self.typeListWidget.iconSize().width() + 32)
|
self.typeListWidget.iconSize().width() + 32)
|
||||||
|
@ -29,7 +29,7 @@ from PyQt4 import QtGui, QtCore
|
|||||||
from sqlalchemy.sql import and_
|
from sqlalchemy.sql import and_
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, translate
|
from openlp.core.lib import Receiver, translate
|
||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||||
from openlp.plugins.songs.forms import AuthorsForm, TopicsForm, SongBookForm
|
from openlp.plugins.songs.forms import AuthorsForm, TopicsForm, SongBookForm
|
||||||
from openlp.plugins.songs.lib.db import Author, Book, Topic, Song
|
from openlp.plugins.songs.lib.db import Author, Book, Topic, Song
|
||||||
from songmaintenancedialog import Ui_SongMaintenanceDialog
|
from songmaintenancedialog import Ui_SongMaintenanceDialog
|
||||||
@ -103,19 +103,19 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||||||
return -1
|
return -1
|
||||||
|
|
||||||
def _deleteItem(self, item_class, list_widget, reset_func, dlg_title,
|
def _deleteItem(self, item_class, list_widget, reset_func, dlg_title,
|
||||||
del_text, err_text, sel_text):
|
del_text, err_text):
|
||||||
item_id = self._getCurrentItemId(list_widget)
|
item_id = self._getCurrentItemId(list_widget)
|
||||||
if item_id != -1:
|
if item_id != -1:
|
||||||
item = self.manager.get_object(item_class, item_id)
|
item = self.manager.get_object(item_class, item_id)
|
||||||
if item and len(item.songs) == 0:
|
if item and len(item.songs) == 0:
|
||||||
if critical_error_message_box(title=dlg_title, message=del_text,
|
if critical_error_message_box(dlg_title, del_text, self,
|
||||||
parent=self, question=True) == QtGui.QMessageBox.Yes:
|
True) == QtGui.QMessageBox.Yes:
|
||||||
self.manager.delete_object(item_class, item.id)
|
self.manager.delete_object(item_class, item.id)
|
||||||
reset_func()
|
reset_func()
|
||||||
else:
|
else:
|
||||||
critical_error_message_box(dlg_title, err_text)
|
critical_error_message_box(dlg_title, err_text)
|
||||||
else:
|
else:
|
||||||
critical_error_message_box(dlg_title, sel_text)
|
critical_error_message_box(dlg_title, UiStrings.NISs)
|
||||||
|
|
||||||
def resetAuthors(self):
|
def resetAuthors(self):
|
||||||
"""
|
"""
|
||||||
@ -268,11 +268,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||||||
temp_last_name = author.last_name
|
temp_last_name = author.last_name
|
||||||
temp_display_name = author.display_name
|
temp_display_name = author.display_name
|
||||||
if self.authorform.exec_(False):
|
if self.authorform.exec_(False):
|
||||||
author.first_name = unicode(
|
author.first_name = unicode(self.authorform.firstNameEdit.text())
|
||||||
self.authorform.firstNameEdit.text())
|
|
||||||
author.last_name = unicode(self.authorform.lastNameEdit.text())
|
author.last_name = unicode(self.authorform.lastNameEdit.text())
|
||||||
author.display_name = unicode(
|
author.display_name = unicode(self.authorform.displayEdit.text())
|
||||||
self.authorform.displayEdit.text())
|
|
||||||
if self.checkAuthor(author, True):
|
if self.checkAuthor(author, True):
|
||||||
if self.manager.save_object(author):
|
if self.manager.save_object(author):
|
||||||
self.resetAuthors()
|
self.resetAuthors()
|
||||||
@ -449,11 +447,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||||||
self._deleteItem(Author, self.authorsListWidget, self.resetAuthors,
|
self._deleteItem(Author, self.authorsListWidget, self.resetAuthors,
|
||||||
translate('SongsPlugin.SongMaintenanceForm', 'Delete Author'),
|
translate('SongsPlugin.SongMaintenanceForm', 'Delete Author'),
|
||||||
translate('SongsPlugin.SongMaintenanceForm',
|
translate('SongsPlugin.SongMaintenanceForm',
|
||||||
'Are you sure you want to delete the selected author?'),
|
'Are you sure you want to delete the selected author?'),
|
||||||
translate('SongsPlugin.SongMaintenanceForm',
|
translate('SongsPlugin.SongMaintenanceForm', 'This author cannot '
|
||||||
'This author cannot be deleted, they are currently '
|
'be deleted, they are currently assigned to at least one song.'))
|
||||||
'assigned to at least one song.'),
|
|
||||||
translate('SongsPlugin.SongMaintenanceForm', 'No author selected!'))
|
|
||||||
|
|
||||||
def onTopicDeleteButtonClick(self):
|
def onTopicDeleteButtonClick(self):
|
||||||
"""
|
"""
|
||||||
@ -462,11 +458,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||||||
self._deleteItem(Topic, self.topicsListWidget, self.resetTopics,
|
self._deleteItem(Topic, self.topicsListWidget, self.resetTopics,
|
||||||
translate('SongsPlugin.SongMaintenanceForm', 'Delete Topic'),
|
translate('SongsPlugin.SongMaintenanceForm', 'Delete Topic'),
|
||||||
translate('SongsPlugin.SongMaintenanceForm',
|
translate('SongsPlugin.SongMaintenanceForm',
|
||||||
'Are you sure you want to delete the selected topic?'),
|
'Are you sure you want to delete the selected topic?'),
|
||||||
translate('SongsPlugin.SongMaintenanceForm',
|
translate('SongsPlugin.SongMaintenanceForm', 'This topic cannot '
|
||||||
'This topic cannot be deleted, it is currently '
|
'be deleted, it is currently assigned to at least one song.'))
|
||||||
'assigned to at least one song.'),
|
|
||||||
translate('SongsPlugin.SongMaintenanceForm', 'No topic selected!'))
|
|
||||||
|
|
||||||
def onBookDeleteButtonClick(self):
|
def onBookDeleteButtonClick(self):
|
||||||
"""
|
"""
|
||||||
@ -475,11 +469,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||||||
self._deleteItem(Book, self.booksListWidget, self.resetBooks,
|
self._deleteItem(Book, self.booksListWidget, self.resetBooks,
|
||||||
translate('SongsPlugin.SongMaintenanceForm', 'Delete Book'),
|
translate('SongsPlugin.SongMaintenanceForm', 'Delete Book'),
|
||||||
translate('SongsPlugin.SongMaintenanceForm',
|
translate('SongsPlugin.SongMaintenanceForm',
|
||||||
'Are you sure you want to delete the selected book?'),
|
'Are you sure you want to delete the selected book?'),
|
||||||
translate('SongsPlugin.SongMaintenanceForm',
|
translate('SongsPlugin.SongMaintenanceForm', 'This book cannot be '
|
||||||
'This book cannot be deleted, it is currently '
|
'deleted, it is currently assigned to at least one song.'))
|
||||||
'assigned to at least one song.'),
|
|
||||||
translate('SongsPlugin.SongMaintenanceForm', 'No book selected!'))
|
|
||||||
|
|
||||||
def onAuthorsListRowChanged(self, row):
|
def onAuthorsListRowChanged(self, row):
|
||||||
"""
|
"""
|
||||||
|
@ -40,68 +40,147 @@ class VerseType(object):
|
|||||||
Ending = 5
|
Ending = 5
|
||||||
Other = 6
|
Other = 6
|
||||||
|
|
||||||
@staticmethod
|
Names = [
|
||||||
def to_string(verse_type):
|
u'Verse',
|
||||||
"""
|
u'Chorus',
|
||||||
Return a string for a given VerseType
|
u'Bridge',
|
||||||
|
u'Pre-Chorus',
|
||||||
|
u'Intro',
|
||||||
|
u'Ending',
|
||||||
|
u'Other']
|
||||||
|
Tags = [name[0].lower() for name in Names]
|
||||||
|
|
||||||
``verse_type``
|
TranslatedNames = [
|
||||||
The type to return a string for
|
unicode(translate('SongsPlugin.VerseType', 'Verse')),
|
||||||
"""
|
unicode(translate('SongsPlugin.VerseType', 'Chorus')),
|
||||||
if not isinstance(verse_type, int):
|
unicode(translate('SongsPlugin.VerseType', 'Bridge')),
|
||||||
verse_type = verse_type.lower()
|
unicode(translate('SongsPlugin.VerseType', 'Pre-Chorus')),
|
||||||
if verse_type == VerseType.Verse or verse_type == \
|
unicode(translate('SongsPlugin.VerseType', 'Intro')),
|
||||||
unicode(VerseType.to_string(VerseType.Verse)).lower()[0]:
|
unicode(translate('SongsPlugin.VerseType', 'Ending')),
|
||||||
return translate('SongsPlugin.VerseType', 'Verse')
|
unicode(translate('SongsPlugin.VerseType', 'Other'))]
|
||||||
elif verse_type == VerseType.Chorus or verse_type == \
|
TranslatedTags = [name[0].lower() for name in TranslatedNames]
|
||||||
unicode(VerseType.to_string(VerseType.Chorus)).lower()[0]:
|
|
||||||
return translate('SongsPlugin.VerseType', 'Chorus')
|
|
||||||
elif verse_type == VerseType.Bridge or verse_type == \
|
|
||||||
unicode(VerseType.to_string(VerseType.Bridge)).lower()[0]:
|
|
||||||
return translate('SongsPlugin.VerseType', 'Bridge')
|
|
||||||
elif verse_type == VerseType.PreChorus or verse_type == \
|
|
||||||
unicode(VerseType.to_string(VerseType.PreChorus)).lower()[0]:
|
|
||||||
return translate('SongsPlugin.VerseType', 'Pre-Chorus')
|
|
||||||
elif verse_type == VerseType.Intro or verse_type == \
|
|
||||||
unicode(VerseType.to_string(VerseType.Intro)).lower()[0]:
|
|
||||||
return translate('SongsPlugin.VerseType', 'Intro')
|
|
||||||
elif verse_type == VerseType.Ending or verse_type == \
|
|
||||||
unicode(VerseType.to_string(VerseType.Ending)).lower()[0]:
|
|
||||||
return translate('SongsPlugin.VerseType', 'Ending')
|
|
||||||
elif verse_type == VerseType.Other or verse_type == \
|
|
||||||
unicode(VerseType.to_string(VerseType.Other)).lower()[0]:
|
|
||||||
return translate('SongsPlugin.VerseType', 'Other')
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_string(verse_type):
|
def translated_tag(verse_tag, strict=False):
|
||||||
|
"""
|
||||||
|
Return the translated UPPERCASE tag for a given tag,
|
||||||
|
used to show translated verse tags in UI
|
||||||
|
|
||||||
|
``verse_tag``
|
||||||
|
The string to return a VerseType for
|
||||||
|
|
||||||
|
``strict``
|
||||||
|
Determines if the default Other or None should be returned
|
||||||
|
"""
|
||||||
|
if strict:
|
||||||
|
not_found_value = None
|
||||||
|
else:
|
||||||
|
not_found_value = VerseType.TranslatedTags[VerseType.Other].upper()
|
||||||
|
verse_tag = verse_tag[0].lower()
|
||||||
|
for num, tag in enumerate(VerseType.Tags):
|
||||||
|
if verse_tag == tag:
|
||||||
|
return VerseType.TranslatedTags[num].upper()
|
||||||
|
return not_found_value
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def translated_name(verse_tag, strict=False):
|
||||||
|
"""
|
||||||
|
Return the translated name for a given tag
|
||||||
|
|
||||||
|
``verse_tag``
|
||||||
|
The string to return a VerseType for
|
||||||
|
|
||||||
|
``strict``
|
||||||
|
Determines if the default Other or None should be returned
|
||||||
|
"""
|
||||||
|
if strict:
|
||||||
|
not_found_value = None
|
||||||
|
else:
|
||||||
|
not_found_value = VerseType.TranslatedNames[VerseType.Other]
|
||||||
|
verse_tag = verse_tag[0].lower()
|
||||||
|
for num, tag in enumerate(VerseType.Tags):
|
||||||
|
if verse_tag == tag:
|
||||||
|
return VerseType.TranslatedNames[num]
|
||||||
|
return not_found_value
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def from_tag(verse_tag, strict=False):
|
||||||
|
"""
|
||||||
|
Return the VerseType for a given tag
|
||||||
|
|
||||||
|
``verse_tag``
|
||||||
|
The string to return a VerseType for
|
||||||
|
|
||||||
|
``strict``
|
||||||
|
Determines if the default Other or None should be returned
|
||||||
|
"""
|
||||||
|
if strict:
|
||||||
|
no_return_value = None
|
||||||
|
else:
|
||||||
|
no_return_value = VerseType.Other
|
||||||
|
verse_tag = verse_tag[0].lower()
|
||||||
|
for num, tag in enumerate(VerseType.Tags):
|
||||||
|
if verse_tag == tag:
|
||||||
|
return num
|
||||||
|
return no_return_value
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def from_translated_tag(verse_tag):
|
||||||
|
"""
|
||||||
|
Return the VerseType for a given tag
|
||||||
|
|
||||||
|
``verse_tag``
|
||||||
|
The string to return a VerseType for
|
||||||
|
"""
|
||||||
|
verse_tag = verse_tag[0].lower()
|
||||||
|
for num, tag in enumerate(VerseType.TranslatedTags):
|
||||||
|
if verse_tag == tag:
|
||||||
|
return num
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def from_string(verse_name):
|
||||||
"""
|
"""
|
||||||
Return the VerseType for a given string
|
Return the VerseType for a given string
|
||||||
|
|
||||||
``verse_type``
|
``verse_name``
|
||||||
The string to return a VerseType for
|
The string to return a VerseType for
|
||||||
"""
|
"""
|
||||||
verse_type = verse_type.lower()
|
verse_name = verse_name.lower()
|
||||||
if verse_type == unicode(VerseType.to_string(VerseType.Verse)).lower():
|
for num, name in enumerate(VerseType.Names):
|
||||||
return VerseType.Verse
|
if verse_name == name.lower():
|
||||||
elif verse_type == \
|
return num
|
||||||
unicode(VerseType.to_string(VerseType.Chorus)).lower():
|
|
||||||
return VerseType.Chorus
|
|
||||||
elif verse_type == \
|
|
||||||
unicode(VerseType.to_string(VerseType.Bridge)).lower():
|
|
||||||
return VerseType.Bridge
|
|
||||||
elif verse_type == \
|
|
||||||
unicode(VerseType.to_string(VerseType.PreChorus)).lower():
|
|
||||||
return VerseType.PreChorus
|
|
||||||
elif verse_type == \
|
|
||||||
unicode(VerseType.to_string(VerseType.Intro)).lower():
|
|
||||||
return VerseType.Intro
|
|
||||||
elif verse_type == \
|
|
||||||
unicode(VerseType.to_string(VerseType.Ending)).lower():
|
|
||||||
return VerseType.Ending
|
|
||||||
elif verse_type == \
|
|
||||||
unicode(VerseType.to_string(VerseType.Other)).lower():
|
|
||||||
return VerseType.Other
|
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def from_translated_string(verse_name):
|
||||||
|
"""
|
||||||
|
Return the VerseType for a given string
|
||||||
|
|
||||||
|
``verse_name``
|
||||||
|
The string to return a VerseType for
|
||||||
|
"""
|
||||||
|
verse_name = verse_name.lower()
|
||||||
|
for num, translation in enumerate(VerseType.TranslatedNames):
|
||||||
|
if verse_name == translation.lower():
|
||||||
|
return num
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def from_loose_input(verse_name):
|
||||||
|
"""
|
||||||
|
Return the VerseType for a given string, Other if not found
|
||||||
|
|
||||||
|
``verse_name``
|
||||||
|
The string to return a VerseType for
|
||||||
|
"""
|
||||||
|
verse_index = None
|
||||||
|
if len(verse_name) > 1:
|
||||||
|
verse_index = VerseType.from_translated_string(verse_name)
|
||||||
|
if verse_index is None:
|
||||||
|
verse_index = VerseType.from_string(verse_name)
|
||||||
|
if verse_index is None:
|
||||||
|
verse_index = VerseType.from_translated_tag(verse_name)
|
||||||
|
if verse_index is None:
|
||||||
|
verse_index = VerseType.from_tag(verse_name)
|
||||||
|
return verse_index
|
||||||
|
|
||||||
def retrieve_windows_encoding(recommendation=None):
|
def retrieve_windows_encoding(recommendation=None):
|
||||||
"""
|
"""
|
||||||
|
@ -51,22 +51,17 @@ class CCLIFileImport(SongImport):
|
|||||||
``filenames``
|
``filenames``
|
||||||
The files to be imported.
|
The files to be imported.
|
||||||
"""
|
"""
|
||||||
SongImport.__init__(self, manager)
|
SongImport.__init__(self, manager, **kwargs)
|
||||||
if u'filenames' in kwargs:
|
|
||||||
self.filenames = kwargs[u'filenames']
|
|
||||||
log.debug(self.filenames)
|
|
||||||
else:
|
|
||||||
raise KeyError(u'Keyword argument "filenames" not supplied.')
|
|
||||||
|
|
||||||
def do_import(self):
|
def do_import(self):
|
||||||
"""
|
"""
|
||||||
Import either a .usr or a .txt SongSelect file
|
Import either a .usr or a .txt SongSelect file
|
||||||
"""
|
"""
|
||||||
log.debug(u'Starting CCLI File Import')
|
log.debug(u'Starting CCLI File Import')
|
||||||
song_total = len(self.filenames)
|
song_total = len(self.import_source)
|
||||||
self.import_wizard.progressBar.setMaximum(song_total)
|
self.import_wizard.progressBar.setMaximum(song_total)
|
||||||
song_count = 1
|
song_count = 1
|
||||||
for filename in self.filenames:
|
for filename in self.import_source:
|
||||||
self.import_wizard.incrementProgressBar(unicode(translate(
|
self.import_wizard.incrementProgressBar(unicode(translate(
|
||||||
'SongsPlugin.CCLIFileImport', 'Importing song %d of %d')) %
|
'SongsPlugin.CCLIFileImport', 'Importing song %d of %d')) %
|
||||||
(song_count, song_total))
|
(song_count, song_total))
|
||||||
@ -187,7 +182,7 @@ class CCLIFileImport(SongImport):
|
|||||||
if check_first_verse_line:
|
if check_first_verse_line:
|
||||||
if verse_lines[0].startswith(u'(PRE-CHORUS'):
|
if verse_lines[0].startswith(u'(PRE-CHORUS'):
|
||||||
verse_type = u'P'
|
verse_type = u'P'
|
||||||
log.debug(u'USR verse PRE-CHORUS: %s', verse_lines[0] )
|
log.debug(u'USR verse PRE-CHORUS: %s', verse_lines[0])
|
||||||
verse_text = verse_lines[1]
|
verse_text = verse_lines[1]
|
||||||
elif verse_lines[0].startswith(u'(BRIDGE'):
|
elif verse_lines[0].startswith(u'(BRIDGE'):
|
||||||
verse_type = u'B'
|
verse_type = u'B'
|
||||||
@ -204,8 +199,11 @@ class CCLIFileImport(SongImport):
|
|||||||
if len(author_list) < 2:
|
if len(author_list) < 2:
|
||||||
author_list = song_author.split(u'|')
|
author_list = song_author.split(u'|')
|
||||||
for author in author_list:
|
for author in author_list:
|
||||||
seperated = author.split(u',')
|
separated = author.split(u',')
|
||||||
self.add_author(seperated[1].strip() + u' ' + seperated[0].strip())
|
if len(separated) > 1:
|
||||||
|
self.add_author(u' '.join(reversed(separated)))
|
||||||
|
else:
|
||||||
|
self.add_author(author)
|
||||||
self.title = song_name
|
self.title = song_name
|
||||||
self.copyright = song_copyright
|
self.copyright = song_copyright
|
||||||
self.ccli_number = song_ccli
|
self.ccli_number = song_ccli
|
||||||
|
@ -30,6 +30,7 @@ from lxml import etree, objectify
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from openlp.core.lib import translate
|
from openlp.core.lib import translate
|
||||||
|
from openlp.core.ui.wizard import WizardStrings
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.songimport import SongImport
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -45,33 +46,30 @@ class EasiSlidesImport(SongImport):
|
|||||||
"""
|
"""
|
||||||
Initialise the class.
|
Initialise the class.
|
||||||
"""
|
"""
|
||||||
SongImport.__init__(self, manager)
|
SongImport.__init__(self, manager, **kwargs)
|
||||||
self.filename = kwargs[u'filename']
|
|
||||||
self.song = None
|
|
||||||
self.commit = True
|
self.commit = True
|
||||||
|
|
||||||
def do_import(self):
|
def do_import(self):
|
||||||
"""
|
"""
|
||||||
Import either each of the files in self.filenames - each element of
|
Import either each of the files in self.import_sources - each element of
|
||||||
which can be either a single opensong file, or a zipfile containing
|
which can be either a single opensong file, or a zipfile containing
|
||||||
multiple opensong files. If `self.commit` is set False, the
|
multiple opensong files. If `self.commit` is set False, the
|
||||||
import will not be committed to the database (useful for test scripts).
|
import will not be committed to the database (useful for test scripts).
|
||||||
"""
|
"""
|
||||||
self.import_wizard.progressBar.setMaximum(1)
|
self.import_wizard.progressBar.setMaximum(1)
|
||||||
log.info(u'Importing EasiSlides XML file %s', self.filename)
|
log.info(u'Importing EasiSlides XML file %s', self.import_source)
|
||||||
parser = etree.XMLParser(remove_blank_text=True)
|
parser = etree.XMLParser(remove_blank_text=True)
|
||||||
file = etree.parse(self.filename, parser)
|
file = etree.parse(self.import_source, parser)
|
||||||
xml = unicode(etree.tostring(file))
|
xml = unicode(etree.tostring(file))
|
||||||
song_xml = objectify.fromstring(xml)
|
song_xml = objectify.fromstring(xml)
|
||||||
self.import_wizard.incrementProgressBar(
|
self.import_wizard.incrementProgressBar(
|
||||||
unicode(translate('SongsPlugin.ImportWizardForm',
|
WizardStrings.ImportingType % os.path.split(self.import_source)[-1])
|
||||||
u'Importing %s...')) % os.path.split(self.filename)[-1])
|
|
||||||
self.import_wizard.progressBar.setMaximum(len(song_xml.Item))
|
self.import_wizard.progressBar.setMaximum(len(song_xml.Item))
|
||||||
for song in song_xml.Item:
|
for song in song_xml.Item:
|
||||||
self.import_wizard.incrementProgressBar(
|
self.import_wizard.incrementProgressBar(
|
||||||
unicode(translate('SongsPlugin.ImportWizardForm',
|
unicode(translate('SongsPlugin.ImportWizardForm',
|
||||||
u'Importing %s, song %s...')) %
|
u'Importing %s, song %s...')) %
|
||||||
(os.path.split(self.filename)[-1], song.Title1))
|
(os.path.split(self.import_source)[-1], song.Title1))
|
||||||
success = self._parse_song(song)
|
success = self._parse_song(song)
|
||||||
if not success or self.stop_import_flag:
|
if not success or self.stop_import_flag:
|
||||||
return False
|
return False
|
||||||
@ -81,14 +79,16 @@ class EasiSlidesImport(SongImport):
|
|||||||
|
|
||||||
def _parse_song(self, song):
|
def _parse_song(self, song):
|
||||||
self._success = True
|
self._success = True
|
||||||
self._add_unicode_attribute(self.title, song.Title1, True)
|
self._add_unicode_attribute(u'title', song.Title1, True)
|
||||||
self._add_unicode_attribute(self.alternate_title, song.Title2)
|
self._add_unicode_attribute(u'alternate_title', song.Title2)
|
||||||
self._add_unicode_attribute(self.song_number, song.SongNumber)
|
self._add_unicode_attribute(u'song_number', song.SongNumber)
|
||||||
if self.song_number == u'0':
|
if self.song_number == u'0':
|
||||||
self.song_number = u''
|
self.song_number = u''
|
||||||
self._add_authors(song)
|
self._add_authors(song)
|
||||||
self._add_copyright(song)
|
self._add_copyright(song.Copyright)
|
||||||
self._add_unicode_attribute(self.song_book_name, song.BookReference)
|
self._add_copyright(song.LicenceAdmin1)
|
||||||
|
self._add_copyright(song.LicenceAdmin2)
|
||||||
|
self._add_unicode_attribute(u'song_book_name', song.BookReference)
|
||||||
self._parse_and_add_lyrics(song)
|
self._parse_and_add_lyrics(song)
|
||||||
return self._success
|
return self._success
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ class EasiSlidesImport(SongImport):
|
|||||||
Signals that this attribute must exist in a valid song.
|
Signals that this attribute must exist in a valid song.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
self_attribute = unicode(import_attribute).strip()
|
setattr(self, self_attribute, unicode(import_attribute).strip())
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
log.exception(u'UnicodeDecodeError decoding %s' % import_attribute)
|
log.exception(u'UnicodeDecodeError decoding %s' % import_attribute)
|
||||||
self._success = False
|
self._success = False
|
||||||
@ -124,7 +124,7 @@ class EasiSlidesImport(SongImport):
|
|||||||
authors = unicode(song.Writer).split(u',')
|
authors = unicode(song.Writer).split(u',')
|
||||||
for author in authors:
|
for author in authors:
|
||||||
author = author.strip()
|
author = author.strip()
|
||||||
if len(author) > 0:
|
if len(author):
|
||||||
self.authors.append(author)
|
self.authors.append(author)
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
log.exception(u'Unicode decode error while decoding Writer')
|
log.exception(u'Unicode decode error while decoding Writer')
|
||||||
@ -132,35 +132,18 @@ class EasiSlidesImport(SongImport):
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _add_copyright(self, song):
|
def _add_copyright(self, element):
|
||||||
"""
|
|
||||||
Assign the copyright information from the import to the song being
|
|
||||||
created.
|
|
||||||
|
|
||||||
``song``
|
|
||||||
The current song being imported.
|
|
||||||
"""
|
|
||||||
copyright_list = []
|
|
||||||
self.__add_copyright_element(copyright_list, song.Copyright)
|
|
||||||
self.__add_copyright_element(copyright_list, song.LicenceAdmin1)
|
|
||||||
self.__add_copyright_element(copyright_list, song.LicenceAdmin2)
|
|
||||||
self.add_copyright(u' '.join(copyright_list))
|
|
||||||
|
|
||||||
def __add_copyright_element(self, copyright_list, element):
|
|
||||||
"""
|
"""
|
||||||
Add a piece of copyright to the total copyright information for the
|
Add a piece of copyright to the total copyright information for the
|
||||||
song.
|
song.
|
||||||
|
|
||||||
``copyright_list``
|
|
||||||
The array to add the information to.
|
|
||||||
|
|
||||||
``element``
|
``element``
|
||||||
The imported variable to get the data from.
|
The imported variable to get the data from.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
copyright_list.append(unicode(element).strip())
|
self.add_copyright(unicode(element).strip())
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
log.exception(u'Unicode error decoding %s' % element)
|
log.exception(u'Unicode error on decoding copyright: %s' % element)
|
||||||
self._success = False
|
self._success = False
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
@ -285,10 +268,12 @@ class EasiSlidesImport(SongImport):
|
|||||||
# as these appeared originally in the file
|
# as these appeared originally in the file
|
||||||
for [reg, vt, vn, inst] in our_verse_order:
|
for [reg, vt, vn, inst] in our_verse_order:
|
||||||
if self._listHas(verses, [reg, vt, vn, inst]):
|
if self._listHas(verses, [reg, vt, vn, inst]):
|
||||||
|
# this is false, but needs user input
|
||||||
|
lang = None
|
||||||
versetag = u'%s%s' % (vt, vn)
|
versetag = u'%s%s' % (vt, vn)
|
||||||
versetags.append(versetag)
|
versetags.append(versetag)
|
||||||
lines = u'\n'.join(verses[reg][vt][vn][inst])
|
lines = u'\n'.join(verses[reg][vt][vn][inst])
|
||||||
self.verses.append([versetag, lines])
|
self.verses.append([versetag, lines, lang])
|
||||||
|
|
||||||
SeqTypes = {
|
SeqTypes = {
|
||||||
u'p': u'P1',
|
u'p': u'P1',
|
||||||
|
@ -32,6 +32,7 @@ import os
|
|||||||
import struct
|
import struct
|
||||||
|
|
||||||
from openlp.core.lib import translate
|
from openlp.core.lib import translate
|
||||||
|
from openlp.core.ui.wizard import WizardStrings
|
||||||
from openlp.plugins.songs.lib import retrieve_windows_encoding
|
from openlp.plugins.songs.lib import retrieve_windows_encoding
|
||||||
from songimport import SongImport
|
from songimport import SongImport
|
||||||
|
|
||||||
@ -134,8 +135,7 @@ class EasyWorshipSongImport(SongImport):
|
|||||||
ability to import EasyWorship song files.
|
ability to import EasyWorship song files.
|
||||||
"""
|
"""
|
||||||
def __init__(self, manager, **kwargs):
|
def __init__(self, manager, **kwargs):
|
||||||
self.import_source = kwargs[u'filename']
|
SongImport.__init__(self, manager, **kwargs)
|
||||||
SongImport.__init__(self, manager)
|
|
||||||
|
|
||||||
def do_import(self):
|
def do_import(self):
|
||||||
# Open the DB and MB files if they exist
|
# Open the DB and MB files if they exist
|
||||||
@ -231,8 +231,7 @@ class EasyWorshipSongImport(SongImport):
|
|||||||
title = self.get_field(fi_title)
|
title = self.get_field(fi_title)
|
||||||
if title:
|
if title:
|
||||||
self.import_wizard.incrementProgressBar(
|
self.import_wizard.incrementProgressBar(
|
||||||
unicode(translate('SongsPlugin.ImportWizardForm',
|
WizardStrings.ImportingType % title, 0)
|
||||||
'Importing "%s"...')) % title, 0)
|
|
||||||
self.title = title
|
self.title = title
|
||||||
# Get remaining fields
|
# Get remaining fields
|
||||||
copy = self.get_field(fi_copy)
|
copy = self.get_field(fi_copy)
|
||||||
|
@ -33,15 +33,26 @@ from sqlalchemy.sql import or_
|
|||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
|
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
|
||||||
translate, check_item_selected, PluginStatus
|
translate, check_item_selected, PluginStatus
|
||||||
|
from openlp.core.lib.searchedit import SearchEdit
|
||||||
from openlp.core.lib.ui import UiStrings
|
from openlp.core.lib.ui import UiStrings
|
||||||
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
|
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
|
||||||
SongImportForm, SongExportForm
|
SongImportForm, SongExportForm
|
||||||
from openlp.plugins.songs.lib import OpenLyrics, SongXML
|
from openlp.plugins.songs.lib import OpenLyrics, SongXML, VerseType
|
||||||
from openlp.plugins.songs.lib.db import Author, Song
|
from openlp.plugins.songs.lib.db import Author, Song
|
||||||
from openlp.core.lib.searchedit import SearchEdit
|
from openlp.plugins.songs.lib.ui import SongStrings
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
class SongSearch(object):
|
||||||
|
"""
|
||||||
|
An enumeration for song search methods.
|
||||||
|
"""
|
||||||
|
Entire = 1
|
||||||
|
Titles = 2
|
||||||
|
Lyrics = 3
|
||||||
|
Authors = 4
|
||||||
|
Themes = 5
|
||||||
|
|
||||||
class SongMediaItem(MediaManagerItem):
|
class SongMediaItem(MediaManagerItem):
|
||||||
"""
|
"""
|
||||||
This is the custom media manager item for Songs.
|
This is the custom media manager item for Songs.
|
||||||
@ -124,25 +135,23 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
QtCore.QVariant(u'True')).toBool()
|
QtCore.QVariant(u'True')).toBool()
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
self.searchTextLabel.setText(
|
self.searchTextLabel.setText(u'%s:' % UiStrings.Search)
|
||||||
translate('SongsPlugin.MediaItem', 'Search:'))
|
self.searchTextButton.setText(UiStrings.Search)
|
||||||
self.searchTextButton.setText(
|
self.maintenanceAction.setText(SongStrings.SongMaintenance)
|
||||||
translate('SongsPlugin.MediaItem', 'Search'))
|
|
||||||
self.maintenanceAction.setText(
|
|
||||||
translate('SongsPlugin.MediaItem', 'Song Maintenance'))
|
|
||||||
self.maintenanceAction.setToolTip(translate('SongsPlugin.MediaItem',
|
self.maintenanceAction.setToolTip(translate('SongsPlugin.MediaItem',
|
||||||
'Maintain the lists of authors, topics and books'))
|
'Maintain the lists of authors, topics and books'))
|
||||||
|
|
||||||
def initialise(self):
|
def initialise(self):
|
||||||
self.searchTextEdit.setSearchTypes([
|
self.searchTextEdit.setSearchTypes([
|
||||||
(1, u':/songs/song_search_all.png',
|
(SongSearch.Entire, u':/songs/song_search_all.png',
|
||||||
translate('SongsPlugin.MediaItem', 'Entire Song')),
|
translate('SongsPlugin.MediaItem', 'Entire Song')),
|
||||||
(2, u':/songs/song_search_title.png',
|
(SongSearch.Titles, u':/songs/song_search_title.png',
|
||||||
translate('SongsPlugin.MediaItem', 'Titles')),
|
translate('SongsPlugin.MediaItem', 'Titles')),
|
||||||
(3, u':/songs/song_search_lyrics.png',
|
(SongSearch.Lyrics, u':/songs/song_search_lyrics.png',
|
||||||
translate('SongsPlugin.MediaItem', 'Lyrics')),
|
translate('SongsPlugin.MediaItem', 'Lyrics')),
|
||||||
(4, u':/songs/song_search_author.png', UiStrings.Authors),
|
(SongSearch.Authors, u':/songs/song_search_author.png',
|
||||||
(5, u':/slides/slide_theme.png', UiStrings.Themes)
|
SongStrings.Authors),
|
||||||
|
(SongSearch.Themes, u':/slides/slide_theme.png', UiStrings.Themes)
|
||||||
])
|
])
|
||||||
self.configUpdated()
|
self.configUpdated()
|
||||||
|
|
||||||
@ -151,7 +160,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
search_results = []
|
search_results = []
|
||||||
# search_type = self.searchTypeComboBox.currentIndex()
|
# search_type = self.searchTypeComboBox.currentIndex()
|
||||||
search_type = self.searchTextEdit.currentSearchType()
|
search_type = self.searchTextEdit.currentSearchType()
|
||||||
if search_type == 1:
|
if search_type == SongSearch.Entire:
|
||||||
log.debug(u'Entire Song Search')
|
log.debug(u'Entire Song Search')
|
||||||
search_results = self.parent.manager.get_all_objects(Song,
|
search_results = self.parent.manager.get_all_objects(Song,
|
||||||
or_(Song.search_title.like(u'%' + self.whitespace.sub(u' ',
|
or_(Song.search_title.like(u'%' + self.whitespace.sub(u' ',
|
||||||
@ -159,25 +168,25 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
Song.search_lyrics.like(u'%' + search_keywords.lower() + \
|
Song.search_lyrics.like(u'%' + search_keywords.lower() + \
|
||||||
u'%')), Song.search_title.asc())
|
u'%')), Song.search_title.asc())
|
||||||
self.displayResultsSong(search_results)
|
self.displayResultsSong(search_results)
|
||||||
if search_type == 2:
|
elif search_type == SongSearch.Titles:
|
||||||
log.debug(u'Titles Search')
|
log.debug(u'Titles Search')
|
||||||
search_results = self.parent.manager.get_all_objects(Song,
|
search_results = self.parent.manager.get_all_objects(Song,
|
||||||
Song.search_title.like(u'%' + self.whitespace.sub(u' ',
|
Song.search_title.like(u'%' + self.whitespace.sub(u' ',
|
||||||
search_keywords.lower()) + u'%'), Song.search_title.asc())
|
search_keywords.lower()) + u'%'), Song.search_title.asc())
|
||||||
self.displayResultsSong(search_results)
|
self.displayResultsSong(search_results)
|
||||||
elif search_type == 3:
|
elif search_type == SongSearch.Lyrics:
|
||||||
log.debug(u'Lyrics Search')
|
log.debug(u'Lyrics Search')
|
||||||
search_results = self.parent.manager.get_all_objects(Song,
|
search_results = self.parent.manager.get_all_objects(Song,
|
||||||
Song.search_lyrics.like(u'%' + search_keywords.lower() + u'%'),
|
Song.search_lyrics.like(u'%' + search_keywords.lower() + u'%'),
|
||||||
Song.search_lyrics.asc())
|
Song.search_lyrics.asc())
|
||||||
self.displayResultsSong(search_results)
|
self.displayResultsSong(search_results)
|
||||||
elif search_type == 4:
|
elif search_type == SongSearch.Authors:
|
||||||
log.debug(u'Authors Search')
|
log.debug(u'Authors Search')
|
||||||
search_results = self.parent.manager.get_all_objects(Author,
|
search_results = self.parent.manager.get_all_objects(Author,
|
||||||
Author.display_name.like(u'%' + search_keywords + u'%'),
|
Author.display_name.like(u'%' + search_keywords + u'%'),
|
||||||
Author.display_name.asc())
|
Author.display_name.asc())
|
||||||
self.displayResultsAuthor(search_results)
|
self.displayResultsAuthor(search_results)
|
||||||
elif search_type == 5:
|
elif search_type == SongSearch.Themes:
|
||||||
log.debug(u'Theme Search')
|
log.debug(u'Theme Search')
|
||||||
search_results = self.parent.manager.get_all_objects(Song,
|
search_results = self.parent.manager.get_all_objects(Song,
|
||||||
Song.theme_name == search_keywords, Song.search_lyrics.asc())
|
Song.theme_name == search_keywords, Song.search_lyrics.asc())
|
||||||
@ -296,9 +305,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
Edit a song
|
Edit a song
|
||||||
"""
|
"""
|
||||||
log.debug(u'onEditClick')
|
log.debug(u'onEditClick')
|
||||||
if check_item_selected(self.listView,
|
if check_item_selected(self.listView, UiStrings.SelectEdit):
|
||||||
translate('SongsPlugin.MediaItem',
|
|
||||||
'You must select an item to edit.')):
|
|
||||||
self.editItem = self.listView.currentItem()
|
self.editItem = self.listView.currentItem()
|
||||||
item_id = (self.editItem.data(QtCore.Qt.UserRole)).toInt()[0]
|
item_id = (self.editItem.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
self.edit_song_form.loadSong(item_id, False)
|
self.edit_song_form.loadSong(item_id, False)
|
||||||
@ -308,9 +315,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
Remove a song from the list and database
|
Remove a song from the list and database
|
||||||
"""
|
"""
|
||||||
if check_item_selected(self.listView,
|
if check_item_selected(self.listView, UiStrings.SelectDelete):
|
||||||
translate('SongsPlugin.MediaItem',
|
|
||||||
'You must select an item to delete.')):
|
|
||||||
items = self.listView.selectedIndexes()
|
items = self.listView.selectedIndexes()
|
||||||
if QtGui.QMessageBox.question(self,
|
if QtGui.QMessageBox.question(self,
|
||||||
translate('SongsPlugin.MediaItem', 'Delete Song(s)?'),
|
translate('SongsPlugin.MediaItem', 'Delete Song(s)?'),
|
||||||
@ -344,24 +349,49 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
if song.lyrics.startswith(u'<?xml version='):
|
if song.lyrics.startswith(u'<?xml version='):
|
||||||
verseList = SongXML().get_verses(song.lyrics)
|
verseList = SongXML().get_verses(song.lyrics)
|
||||||
# no verse list or only 1 space (in error)
|
# no verse list or only 1 space (in error)
|
||||||
if not song.verse_order or not song.verse_order.strip():
|
verse_tags_translated = False
|
||||||
|
if VerseType.from_translated_string(unicode(
|
||||||
|
verseList[0][0][u'type'])) is not None:
|
||||||
|
verse_tags_translated = True
|
||||||
|
if not song.verse_order.strip():
|
||||||
for verse in verseList:
|
for verse in verseList:
|
||||||
verseTag = u'%s:%s' % (
|
# We cannot use from_loose_input() here, because database
|
||||||
verse[0][u'type'], verse[0][u'label'])
|
# is supposed to contain English lowercase singlechar tags.
|
||||||
|
verse_tag = verse[0][u'type']
|
||||||
|
verse_index = None
|
||||||
|
if len(verse_tag) > 1:
|
||||||
|
verse_index = \
|
||||||
|
VerseType.from_translated_string(verse_tag)
|
||||||
|
if verse_index is None:
|
||||||
|
verse_index = VerseType.from_string(verse_tag)
|
||||||
|
if verse_index is None:
|
||||||
|
verse_index = VerseType.from_tag(verse_tag)
|
||||||
|
verse_tag = VerseType.TranslatedTags[verse_index].upper()
|
||||||
|
verse_def = u'%s%s' % (verse_tag, verse[0][u'label'])
|
||||||
service_item.add_from_text(
|
service_item.add_from_text(
|
||||||
verse[1][:30], unicode(verse[1]), verseTag)
|
verse[1][:30], unicode(verse[1]), verse_def)
|
||||||
else:
|
else:
|
||||||
# Loop through the verse list and expand the song accordingly.
|
# Loop through the verse list and expand the song accordingly.
|
||||||
for order in song.verse_order.upper().split():
|
for order in song.verse_order.lower().split():
|
||||||
if len(order) == 0:
|
if len(order) == 0:
|
||||||
break
|
break
|
||||||
for verse in verseList:
|
for verse in verseList:
|
||||||
if verse[0][u'type'][0] == order[0] and \
|
if verse[0][u'type'][0].lower() == order[0] and \
|
||||||
(verse[0][u'label'] == order[1:] or not order[1:]):
|
(verse[0][u'label'].lower() == order[1:] or \
|
||||||
verseTag = u'%s:%s' % \
|
not order[1:]):
|
||||||
(verse[0][u'type'], verse[0][u'label'])
|
if verse_tags_translated:
|
||||||
|
verse_index = VerseType.from_translated_tag(
|
||||||
|
verse[0][u'type'])
|
||||||
|
else:
|
||||||
|
verse_index = VerseType.from_tag(
|
||||||
|
verse[0][u'type'])
|
||||||
|
if verse_index is None:
|
||||||
|
verse_index = VerseType.Other
|
||||||
|
verse_tag = VerseType.TranslatedTags[verse_index]
|
||||||
|
verse_def = u'%s%s' % (verse_tag,
|
||||||
|
verse[0][u'label'])
|
||||||
service_item.add_from_text(
|
service_item.add_from_text(
|
||||||
verse[1][:30], verse[1], verseTag)
|
verse[1][:30], verse[1], verse_def)
|
||||||
else:
|
else:
|
||||||
verses = song.lyrics.split(u'\n\n')
|
verses = song.lyrics.split(u'\n\n')
|
||||||
for slide in verses:
|
for slide in verses:
|
||||||
|
@ -32,7 +32,7 @@ import logging
|
|||||||
from chardet.universaldetector import UniversalDetector
|
from chardet.universaldetector import UniversalDetector
|
||||||
import sqlite
|
import sqlite
|
||||||
|
|
||||||
from openlp.core.lib import translate
|
from openlp.core.ui.wizard import WizardStrings
|
||||||
from openlp.plugins.songs.lib import retrieve_windows_encoding
|
from openlp.plugins.songs.lib import retrieve_windows_encoding
|
||||||
from songimport import SongImport
|
from songimport import SongImport
|
||||||
|
|
||||||
@ -55,8 +55,7 @@ class OpenLP1SongImport(SongImport):
|
|||||||
``filename``
|
``filename``
|
||||||
The database providing the data to import.
|
The database providing the data to import.
|
||||||
"""
|
"""
|
||||||
SongImport.__init__(self, manager)
|
SongImport.__init__(self, manager, **kwargs)
|
||||||
self.import_source = kwargs[u'filename']
|
|
||||||
|
|
||||||
def do_import(self):
|
def do_import(self):
|
||||||
"""
|
"""
|
||||||
@ -103,8 +102,7 @@ class OpenLP1SongImport(SongImport):
|
|||||||
lyrics = song[2].replace(u'\r\n', u'\n')
|
lyrics = song[2].replace(u'\r\n', u'\n')
|
||||||
copyright = song[3]
|
copyright = song[3]
|
||||||
self.import_wizard.incrementProgressBar(
|
self.import_wizard.incrementProgressBar(
|
||||||
unicode(translate('SongsPlugin.ImportWizardForm',
|
WizardStrings.ImportingType % title)
|
||||||
'Importing "%s"...')) % title)
|
|
||||||
self.title = title
|
self.title = title
|
||||||
verses = lyrics.split(u'\n\n')
|
verses = lyrics.split(u'\n\n')
|
||||||
for verse in verses:
|
for verse in verses:
|
||||||
|
@ -86,9 +86,8 @@ class OpenLPSongImport(SongImport):
|
|||||||
``source_db``
|
``source_db``
|
||||||
The database providing the data to import.
|
The database providing the data to import.
|
||||||
"""
|
"""
|
||||||
SongImport.__init__(self, manager)
|
SongImport.__init__(self, manager, **kwargs)
|
||||||
self.import_source = u'sqlite:///%s' % kwargs[u'filename']
|
self.import_source = u'sqlite:///%s' % self.import_source
|
||||||
log.debug(self.import_source)
|
|
||||||
self.source_session = None
|
self.source_session = None
|
||||||
|
|
||||||
def do_import(self):
|
def do_import(self):
|
||||||
|
@ -28,7 +28,6 @@ import os
|
|||||||
|
|
||||||
from PyQt4 import QtCore
|
from PyQt4 import QtCore
|
||||||
|
|
||||||
from openlp.core.lib import Receiver
|
|
||||||
from openlp.core.utils import get_uno_command, get_uno_instance
|
from openlp.core.utils import get_uno_command, get_uno_instance
|
||||||
from songimport import SongImport
|
from songimport import SongImport
|
||||||
|
|
||||||
@ -56,20 +55,15 @@ class OooImport(SongImport):
|
|||||||
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
|
||||||
"""
|
"""
|
||||||
SongImport.__init__(self, master_manager)
|
SongImport.__init__(self, master_manager, **kwargs)
|
||||||
self.song = None
|
|
||||||
self.master_manager = master_manager
|
|
||||||
self.document = None
|
self.document = None
|
||||||
self.process_started = False
|
self.process_started = False
|
||||||
self.filenames = kwargs[u'filenames']
|
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
|
||||||
QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_import)
|
|
||||||
|
|
||||||
def do_import(self):
|
def do_import(self):
|
||||||
self.stop_import_flag = False
|
self.stop_import_flag = False
|
||||||
self.import_wizard.progressBar.setMaximum(0)
|
self.import_wizard.progressBar.setMaximum(0)
|
||||||
self.start_ooo()
|
self.start_ooo()
|
||||||
for filename in self.filenames:
|
for filename in self.import_source:
|
||||||
if self.stop_import_flag:
|
if self.stop_import_flag:
|
||||||
self.import_wizard.incrementProgressBar(u'Import cancelled', 0)
|
self.import_wizard.incrementProgressBar(u'Import cancelled', 0)
|
||||||
return
|
return
|
||||||
|
0
openlp/plugins/songs/lib/openlyricsexport.py
Executable file → Normal file
0
openlp/plugins/songs/lib/openlyricsexport.py
Executable file → Normal file
@ -33,7 +33,7 @@ import os
|
|||||||
|
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
from openlp.core.lib import translate
|
from openlp.core.ui.wizard import WizardStrings
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.songimport import SongImport
|
||||||
from openlp.plugins.songs.lib import OpenLyrics
|
from openlp.plugins.songs.lib import OpenLyrics
|
||||||
|
|
||||||
@ -48,13 +48,8 @@ class OpenLyricsImport(SongImport):
|
|||||||
Initialise the import.
|
Initialise the import.
|
||||||
"""
|
"""
|
||||||
log.debug(u'initialise OpenLyricsImport')
|
log.debug(u'initialise OpenLyricsImport')
|
||||||
SongImport.__init__(self, master_manager)
|
SongImport.__init__(self, master_manager, **kwargs)
|
||||||
self.master_manager = master_manager
|
self.openLyrics = OpenLyrics(self.manager)
|
||||||
self.openLyrics = OpenLyrics(master_manager)
|
|
||||||
if kwargs.has_key(u'filename'):
|
|
||||||
self.import_source = kwargs[u'filename']
|
|
||||||
if kwargs.has_key(u'filenames'):
|
|
||||||
self.import_source = kwargs[u'filenames']
|
|
||||||
|
|
||||||
def do_import(self):
|
def do_import(self):
|
||||||
"""
|
"""
|
||||||
@ -65,9 +60,8 @@ class OpenLyricsImport(SongImport):
|
|||||||
for file_path in self.import_source:
|
for file_path in self.import_source:
|
||||||
if self.stop_import_flag:
|
if self.stop_import_flag:
|
||||||
return False
|
return False
|
||||||
self.import_wizard.incrementProgressBar(unicode(translate(
|
self.import_wizard.incrementProgressBar(
|
||||||
'SongsPlugin.OpenLyricsImport', 'Importing %s...')) %
|
WizardStrings.ImportingType % os.path.basename(file_path))
|
||||||
os.path.basename(file_path))
|
|
||||||
try:
|
try:
|
||||||
parsed_file = etree.parse(file_path, parser)
|
parsed_file = etree.parse(file_path, parser)
|
||||||
xml = unicode(etree.tostring(parsed_file))
|
xml = unicode(etree.tostring(parsed_file))
|
||||||
|
@ -31,7 +31,7 @@ from lxml import objectify
|
|||||||
from lxml.etree import Error, LxmlError
|
from lxml.etree import Error, LxmlError
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from openlp.core.lib import translate
|
from openlp.core.ui.wizard import WizardStrings
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.songimport import SongImport
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -105,21 +105,19 @@ class OpenSongImport(SongImport):
|
|||||||
"""
|
"""
|
||||||
Initialise the class.
|
Initialise the class.
|
||||||
"""
|
"""
|
||||||
SongImport.__init__(self, manager)
|
SongImport.__init__(self, manager, **kwargs)
|
||||||
self.filenames = kwargs[u'filenames']
|
|
||||||
self.song = None
|
|
||||||
self.commit = True
|
self.commit = True
|
||||||
|
|
||||||
def do_import(self):
|
def do_import(self):
|
||||||
"""
|
"""
|
||||||
Import either each of the files in self.filenames - each element of
|
Import either each of the files in self.import_source - each element of
|
||||||
which can be either a single opensong file, or a zipfile containing
|
which can be either a single opensong file, or a zipfile containing
|
||||||
multiple opensong files. If `self.commit` is set False, the
|
multiple opensong files. If `self.commit` is set False, the
|
||||||
import will not be committed to the database (useful for test scripts).
|
import will not be committed to the database (useful for test scripts).
|
||||||
"""
|
"""
|
||||||
success = True
|
success = True
|
||||||
numfiles = 0
|
numfiles = 0
|
||||||
for filename in self.filenames:
|
for filename in self.import_source:
|
||||||
ext = os.path.splitext(filename)[1]
|
ext = os.path.splitext(filename)[1]
|
||||||
if ext.lower() == u'.zip':
|
if ext.lower() == u'.zip':
|
||||||
z = ZipFile(filename, u'r')
|
z = ZipFile(filename, u'r')
|
||||||
@ -128,7 +126,7 @@ class OpenSongImport(SongImport):
|
|||||||
numfiles += 1
|
numfiles += 1
|
||||||
log.debug(u'Total number of files: %d', numfiles)
|
log.debug(u'Total number of files: %d', numfiles)
|
||||||
self.import_wizard.progressBar.setMaximum(numfiles)
|
self.import_wizard.progressBar.setMaximum(numfiles)
|
||||||
for filename in self.filenames:
|
for filename in self.import_source:
|
||||||
if self.stop_import_flag:
|
if self.stop_import_flag:
|
||||||
success = False
|
success = False
|
||||||
break
|
break
|
||||||
@ -146,26 +144,26 @@ class OpenSongImport(SongImport):
|
|||||||
continue
|
continue
|
||||||
log.info(u'Zip importing %s', parts[-1])
|
log.info(u'Zip importing %s', parts[-1])
|
||||||
self.import_wizard.incrementProgressBar(
|
self.import_wizard.incrementProgressBar(
|
||||||
unicode(translate('SongsPlugin.ImportWizardForm',
|
WizardStrings.ImportingType % parts[-1])
|
||||||
'Importing %s...')) % parts[-1])
|
|
||||||
songfile = z.open(song)
|
songfile = z.open(song)
|
||||||
self.do_import_file(songfile)
|
if self.do_import_file(songfile) and self.commit and \
|
||||||
if self.commit:
|
not self.stop_import_flag:
|
||||||
self.finish()
|
self.finish()
|
||||||
if self.stop_import_flag:
|
else:
|
||||||
success = False
|
success = False
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
# not a zipfile
|
# not a zipfile
|
||||||
log.info(u'Direct import %s', filename)
|
log.info(u'Direct import %s', filename)
|
||||||
self.import_wizard.incrementProgressBar(
|
self.import_wizard.incrementProgressBar(
|
||||||
unicode(translate('SongsPlugin.ImportWizardForm',
|
WizardStrings.ImportingType % os.path.split(filename)[-1])
|
||||||
'Importing %s...')) % os.path.split(filename)[-1])
|
song_file = open(filename)
|
||||||
file = open(filename)
|
if self.do_import_file(song_file) and self.commit and \
|
||||||
self.do_import_file(file)
|
not self.stop_import_flag:
|
||||||
if self.commit:
|
|
||||||
self.finish()
|
self.finish()
|
||||||
|
else:
|
||||||
|
success = False
|
||||||
|
break
|
||||||
return success
|
return success
|
||||||
|
|
||||||
def do_import_file(self, file):
|
def do_import_file(self, file):
|
||||||
@ -178,7 +176,7 @@ class OpenSongImport(SongImport):
|
|||||||
tree = objectify.parse(file)
|
tree = objectify.parse(file)
|
||||||
except (Error, LxmlError):
|
except (Error, LxmlError):
|
||||||
log.exception(u'Error parsing XML')
|
log.exception(u'Error parsing XML')
|
||||||
return
|
return False
|
||||||
root = tree.getroot()
|
root = tree.getroot()
|
||||||
fields = dir(root)
|
fields = dir(root)
|
||||||
decode = {
|
decode = {
|
||||||
@ -196,114 +194,103 @@ class OpenSongImport(SongImport):
|
|||||||
setattr(self, fn_or_string, ustring)
|
setattr(self, fn_or_string, ustring)
|
||||||
else:
|
else:
|
||||||
fn_or_string(ustring)
|
fn_or_string(ustring)
|
||||||
|
if not len(self.title):
|
||||||
|
# to prevent creation of empty songs from wrong files
|
||||||
|
return False
|
||||||
if u'theme' in fields and unicode(root.theme) not in self.topics:
|
if u'theme' in fields and unicode(root.theme) not in self.topics:
|
||||||
self.topics.append(unicode(root.theme))
|
self.topics.append(unicode(root.theme))
|
||||||
if u'alttheme' in fields and unicode(root.alttheme) not in self.topics:
|
if u'alttheme' in fields and unicode(root.alttheme) not in self.topics:
|
||||||
self.topics.append(unicode(root.alttheme))
|
self.topics.append(unicode(root.alttheme))
|
||||||
# data storage while importing
|
# data storage while importing
|
||||||
verses = {}
|
verses = {}
|
||||||
# keep track of a "default" verse order, in case none is specified
|
# keep track of verses appearance order
|
||||||
our_verse_order = []
|
our_verse_order = []
|
||||||
verses_seen = {}
|
# default verse
|
||||||
# in the absence of any other indication, verses are the default,
|
verse_tag = u'v'
|
||||||
# erm, versetype!
|
verse_num = u'1'
|
||||||
versetype = u'V'
|
# for the case where song has several sections with same marker
|
||||||
versenum = None
|
inst = 1
|
||||||
lyrics = unicode(root.lyrics)
|
lyrics = unicode(root.lyrics)
|
||||||
for thisline in lyrics.split(u'\n'):
|
for this_line in lyrics.split(u'\n'):
|
||||||
# remove comments
|
# remove comments
|
||||||
semicolon = thisline.find(u';')
|
semicolon = this_line.find(u';')
|
||||||
if semicolon >= 0:
|
if semicolon >= 0:
|
||||||
thisline = thisline[:semicolon]
|
this_line = this_line[:semicolon]
|
||||||
thisline = thisline.strip()
|
this_line = this_line.strip()
|
||||||
if len(thisline) == 0:
|
if not len(this_line):
|
||||||
continue
|
continue
|
||||||
# skip inthisline guitar chords and page and column breaks
|
# skip guitar chords and page and column breaks
|
||||||
if thisline[0] == u'.' or thisline.startswith(u'---') \
|
if this_line.startswith(u'.') or this_line.startswith(u'---') \
|
||||||
or thisline.startswith(u'-!!'):
|
or this_line.startswith(u'-!!'):
|
||||||
continue
|
continue
|
||||||
# verse/chorus/etc. marker
|
# verse/chorus/etc. marker
|
||||||
if thisline[0] == u'[':
|
if this_line.startswith(u'['):
|
||||||
# drop the square brackets
|
# drop the square brackets
|
||||||
right_bracket = thisline.find(u']')
|
right_bracket = this_line.find(u']')
|
||||||
content = thisline[1:right_bracket].upper()
|
content = this_line[1:right_bracket].lower()
|
||||||
# have we got any digits?
|
# have we got any digits?
|
||||||
# If so, versenumber is everything from the digits
|
# If so, verse number is everything from the digits
|
||||||
# to the end (even if there are some alpha chars on the end)
|
# to the end (even if there are some alpha chars on the end)
|
||||||
match = re.match(u'(.*)(\d+.*)', content)
|
match = re.match(u'(.*)(\d+.*)', content)
|
||||||
if match is not None:
|
if match is not None:
|
||||||
versetype = match.group(1)
|
verse_tag = match.group(1)
|
||||||
versenum = match.group(2)
|
verse_num = match.group(2)
|
||||||
else:
|
else:
|
||||||
# otherwise we assume number 1 and take the whole prefix as
|
# otherwise we assume number 1 and take the whole prefix as
|
||||||
# the versetype
|
# the verse tag
|
||||||
versetype = content
|
verse_tag = content
|
||||||
versenum = u'1'
|
verse_num = u'1'
|
||||||
|
inst = 1
|
||||||
|
if [verse_tag, verse_num, inst] in our_verse_order \
|
||||||
|
and verses.has_key(verse_tag) \
|
||||||
|
and verses[verse_tag].has_key(verse_num):
|
||||||
|
inst = len(verses[verse_tag][verse_num])+1
|
||||||
|
our_verse_order.append([verse_tag, verse_num, inst])
|
||||||
continue
|
continue
|
||||||
words = None
|
|
||||||
# number at start of line.. it's verse number
|
# number at start of line.. it's verse number
|
||||||
if thisline[0].isdigit():
|
if this_line[0].isdigit():
|
||||||
versenum = thisline[0]
|
verse_num = this_line[0]
|
||||||
words = thisline[1:].strip()
|
this_line = this_line[1:].strip()
|
||||||
if words is None:
|
our_verse_order.append([verse_tag, verse_num, inst])
|
||||||
words = thisline
|
if not verses.has_key(verse_tag):
|
||||||
if not versenum:
|
verses[verse_tag] = {}
|
||||||
versenum = u'1'
|
if not verses[verse_tag].has_key(verse_num):
|
||||||
if versenum is not None:
|
verses[verse_tag][verse_num] = {}
|
||||||
versetag = u'%s%s' % (versetype, versenum)
|
if not verses[verse_tag][verse_num].has_key(inst):
|
||||||
if not verses.has_key(versetype):
|
verses[verse_tag][verse_num][inst] = []
|
||||||
verses[versetype] = {}
|
# Tidy text and remove the ____s from extended words
|
||||||
if not verses[versetype].has_key(versenum):
|
this_line = self.tidy_text(this_line)
|
||||||
# storage for lines in this verse
|
this_line = this_line.replace(u'_', u'')
|
||||||
verses[versetype][versenum] = []
|
this_line = this_line.replace(u'|', u'\n')
|
||||||
if not verses_seen.has_key(versetag):
|
verses[verse_tag][verse_num][inst].append(this_line)
|
||||||
verses_seen[versetag] = 1
|
|
||||||
our_verse_order.append(versetag)
|
|
||||||
if words:
|
|
||||||
# Tidy text and remove the ____s from extended words
|
|
||||||
words = self.tidy_text(words)
|
|
||||||
words = words.replace('_', '')
|
|
||||||
verses[versetype][versenum].append(words)
|
|
||||||
# done parsing
|
# done parsing
|
||||||
versetypes = verses.keys()
|
# add verses in original order
|
||||||
versetypes.sort()
|
for (verse_tag, verse_num, inst) in our_verse_order:
|
||||||
versetags = {}
|
verse_def = u'%s%s' % (verse_tag, verse_num)
|
||||||
for versetype in versetypes:
|
lines = u'\n'.join(verses[verse_tag][verse_num][inst])
|
||||||
our_verse_type = versetype
|
self.add_verse(lines, verse_def)
|
||||||
if our_verse_type == u'':
|
# figure out the presentation order, if present
|
||||||
our_verse_type = u'V'
|
|
||||||
versenums = verses[versetype].keys()
|
|
||||||
versenums.sort()
|
|
||||||
for num in versenums:
|
|
||||||
versetag = u'%s%s' % (our_verse_type, num)
|
|
||||||
lines = u'\n'.join(verses[versetype][num])
|
|
||||||
self.add_verse(lines, versetag)
|
|
||||||
# Keep track of what we have for error checking later
|
|
||||||
versetags[versetag] = 1
|
|
||||||
# now figure out the presentation order
|
|
||||||
order = []
|
|
||||||
if u'presentation' in fields and root.presentation != u'':
|
if u'presentation' in fields and root.presentation != u'':
|
||||||
order = unicode(root.presentation)
|
order = unicode(root.presentation)
|
||||||
# We make all the tags in the lyrics upper case, so match that here
|
# We make all the tags in the lyrics lower case, so match that here
|
||||||
# and then split into a list on the whitespace
|
# and then split into a list on the whitespace
|
||||||
order = order.upper().split()
|
order = order.lower().split()
|
||||||
else:
|
for verse_def in order:
|
||||||
if len(our_verse_order) > 0:
|
match = re.match(u'(.*)(\d+.*)', verse_def)
|
||||||
order = our_verse_order
|
if match is not None:
|
||||||
else:
|
verse_tag = match.group(1)
|
||||||
log.warn(u'No verse order available for %s, skipping.',
|
verse_num = match.group(2)
|
||||||
self.title)
|
if not len(verse_tag):
|
||||||
# TODO: make sure that the default order list will be overwritten, if
|
verse_tag = u'v'
|
||||||
# the songs provides its own order list.
|
else:
|
||||||
for tag in order:
|
# Assume it's no.1 if there are no digits
|
||||||
if tag[0].isdigit():
|
verse_tag = verse_def
|
||||||
# Assume it's a verse if it has no prefix
|
verse_num = u'1'
|
||||||
tag = u'V' + tag
|
verse_def = u'%s%s' % (verse_tag, verse_num)
|
||||||
elif not re.search('\d+', tag):
|
if verses.has_key(verse_tag) \
|
||||||
# Assume it's no.1 if there's no digits
|
and verses[verse_tag].has_key(verse_num):
|
||||||
tag = tag + u'1'
|
self.verse_order_list.append(verse_def)
|
||||||
if not versetags.has_key(tag):
|
else:
|
||||||
log.info(u'Got order %s but not in versetags, dropping this'
|
log.info(u'Got order %s but not in verse tags, dropping'
|
||||||
u'item from presentation order', tag)
|
u'this item from presentation order', verse_def)
|
||||||
else:
|
return True
|
||||||
self.verse_order_list.append(tag)
|
|
||||||
|
@ -33,7 +33,7 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from openlp.core.lib import translate
|
from openlp.core.ui.wizard import WizardStrings
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.songimport import SongImport
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -74,12 +74,7 @@ class SongBeamerImport(SongImport):
|
|||||||
``master_manager``
|
``master_manager``
|
||||||
The song manager for the running OpenLP installation.
|
The song manager for the running OpenLP installation.
|
||||||
"""
|
"""
|
||||||
SongImport.__init__(self, master_manager)
|
SongImport.__init__(self, master_manager, **kwargs)
|
||||||
if kwargs.has_key(u'filename'):
|
|
||||||
self.import_source = kwargs[u'filename']
|
|
||||||
if kwargs.has_key(u'filenames'):
|
|
||||||
self.import_source = kwargs[u'filenames']
|
|
||||||
log.debug(self.import_source)
|
|
||||||
|
|
||||||
def do_import(self):
|
def do_import(self):
|
||||||
"""
|
"""
|
||||||
@ -96,7 +91,7 @@ class SongBeamerImport(SongImport):
|
|||||||
read_verses = False
|
read_verses = False
|
||||||
file_name = os.path.split(file)[1]
|
file_name = os.path.split(file)[1]
|
||||||
self.import_wizard.incrementProgressBar(
|
self.import_wizard.incrementProgressBar(
|
||||||
u'Importing %s' % (file_name), 0)
|
WizardStrings.ImportingType % file_name, 0)
|
||||||
if os.path.isfile(file):
|
if os.path.isfile(file):
|
||||||
detect_file = open(file, u'r')
|
detect_file = open(file, u'r')
|
||||||
details = chardet.detect(detect_file.read(2048))
|
details = chardet.detect(detect_file.read(2048))
|
||||||
@ -134,9 +129,8 @@ class SongBeamerImport(SongImport):
|
|||||||
self.add_verse(self.current_verse, self.current_verse_type)
|
self.add_verse(self.current_verse, self.current_verse_type)
|
||||||
if self.check_complete():
|
if self.check_complete():
|
||||||
self.finish()
|
self.finish()
|
||||||
self.import_wizard.incrementProgressBar(unicode(translate(
|
self.import_wizard.incrementProgressBar(
|
||||||
'SongsPlugin.SongBeamerImport', 'Importing %s...')) %
|
WizardStrings.ImportingType % file_name)
|
||||||
file_name)
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def replace_html_tags(self):
|
def replace_html_tags(self):
|
||||||
|
@ -31,6 +31,7 @@ from PyQt4 import QtCore
|
|||||||
from openlp.core.lib import Receiver, translate
|
from openlp.core.lib import Receiver, translate
|
||||||
from openlp.plugins.songs.lib import VerseType
|
from openlp.plugins.songs.lib import 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.xml import SongXML
|
from openlp.plugins.songs.lib.xml import SongXML
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -43,7 +44,7 @@ class SongImport(QtCore.QObject):
|
|||||||
whether the authors etc already exist and add them or refer to them
|
whether the authors etc already exist and add them or refer to them
|
||||||
as necessary
|
as necessary
|
||||||
"""
|
"""
|
||||||
def __init__(self, manager):
|
def __init__(self, manager, **kwargs):
|
||||||
"""
|
"""
|
||||||
Initialise and create defaults for properties
|
Initialise and create defaults for properties
|
||||||
|
|
||||||
@ -53,6 +54,14 @@ class SongImport(QtCore.QObject):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
self.manager = manager
|
self.manager = manager
|
||||||
|
if kwargs.has_key(u'filename'):
|
||||||
|
self.import_source = kwargs[u'filename']
|
||||||
|
elif kwargs.has_key(u'filenames'):
|
||||||
|
self.import_source = kwargs[u'filenames']
|
||||||
|
else:
|
||||||
|
raise KeyError(u'Keyword arguments "filename[s]" not supplied.')
|
||||||
|
log.debug(self.import_source)
|
||||||
|
self.song = None
|
||||||
self.stop_import_flag = False
|
self.stop_import_flag = False
|
||||||
self.set_defaults()
|
self.set_defaults()
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
@ -75,13 +84,13 @@ class SongImport(QtCore.QObject):
|
|||||||
self.media_files = []
|
self.media_files = []
|
||||||
self.song_book_name = u''
|
self.song_book_name = u''
|
||||||
self.song_book_pub = u''
|
self.song_book_pub = u''
|
||||||
|
self.verse_order_list_generated_useful = False
|
||||||
|
self.verse_order_list_generated = []
|
||||||
self.verse_order_list = []
|
self.verse_order_list = []
|
||||||
self.verses = []
|
self.verses = []
|
||||||
self.versecounts = {}
|
self.verse_counts = {}
|
||||||
self.copyright_string = unicode(translate(
|
self.copyright_string = unicode(translate(
|
||||||
'SongsPlugin.SongImport', 'copyright'))
|
'SongsPlugin.SongImport', 'copyright'))
|
||||||
self.copyright_symbol = unicode(translate(
|
|
||||||
'SongsPlugin.SongImport', '\xa9'))
|
|
||||||
|
|
||||||
def stop_import(self):
|
def stop_import(self):
|
||||||
"""
|
"""
|
||||||
@ -128,20 +137,20 @@ class SongImport(QtCore.QObject):
|
|||||||
return text
|
return text
|
||||||
|
|
||||||
def process_song_text(self, text):
|
def process_song_text(self, text):
|
||||||
versetexts = text.split(u'\n\n')
|
verse_texts = text.split(u'\n\n')
|
||||||
for versetext in versetexts:
|
for verse_text in verse_texts:
|
||||||
if versetext.strip() != u'':
|
if verse_text.strip() != u'':
|
||||||
self.process_verse_text(versetext.strip())
|
self.process_verse_text(verse_text.strip())
|
||||||
|
|
||||||
def process_verse_text(self, text):
|
def process_verse_text(self, text):
|
||||||
lines = text.split(u'\n')
|
lines = text.split(u'\n')
|
||||||
if text.lower().find(self.copyright_string) >= 0 \
|
if text.lower().find(self.copyright_string) >= 0 \
|
||||||
or text.lower().find(self.copyright_symbol) >= 0:
|
or text.find(SongStrings.CopyrightSymbol) >= 0:
|
||||||
copyright_found = False
|
copyright_found = False
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if (copyright_found or
|
if (copyright_found or
|
||||||
line.lower().find(self.copyright_string) >= 0 or
|
line.lower().find(self.copyright_string) >= 0 or
|
||||||
line.lower().find(self.copyright_symbol) >= 0):
|
line.find(SongStrings.CopyrightSymbol) >= 0):
|
||||||
copyright_found = True
|
copyright_found = True
|
||||||
self.add_copyright(line)
|
self.add_copyright(line)
|
||||||
else:
|
else:
|
||||||
@ -198,45 +207,46 @@ class SongImport(QtCore.QObject):
|
|||||||
return
|
return
|
||||||
self.media_files.append(filename)
|
self.media_files.append(filename)
|
||||||
|
|
||||||
def add_verse(self, versetext, versetag=u'V', lang=None):
|
def add_verse(self, verse_text, verse_def=u'v', lang=None):
|
||||||
"""
|
"""
|
||||||
Add a verse. This is the whole verse, lines split by \\n. It will also
|
Add a verse. This is the whole verse, lines split by \\n. It will also
|
||||||
attempt to detect duplicates. In this case it will just add to the verse
|
attempt to detect duplicates. In this case it will just add to the verse
|
||||||
order.
|
order.
|
||||||
|
|
||||||
``versetext``
|
``verse_text``
|
||||||
The text of the verse.
|
The text of the verse.
|
||||||
|
|
||||||
``versetag``
|
``verse_def``
|
||||||
The verse tag can be V1/C1/B etc, or 'V' and 'C' (will count the
|
The verse tag can be v1/c1/b etc, or 'v' and 'c' (will count the
|
||||||
verses/choruses itself) or None, where it will assume verse.
|
verses/choruses itself) or None, where it will assume verse.
|
||||||
|
|
||||||
``lang``
|
``lang``
|
||||||
The language code (ISO-639) of the verse, for example *en* or *de*.
|
The language code (ISO-639) of the verse, for example *en* or *de*.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
for (oldversetag, oldverse, oldlang) in self.verses:
|
for (old_verse_def, old_verse, old_lang) in self.verses:
|
||||||
if oldverse.strip() == versetext.strip():
|
if old_verse.strip() == verse_text.strip():
|
||||||
self.verse_order_list.append(oldversetag)
|
self.verse_order_list_generated.append(old_verse_def)
|
||||||
|
self.verse_order_list_generated_useful = True
|
||||||
return
|
return
|
||||||
if versetag[0] in self.versecounts:
|
if verse_def[0] in self.verse_counts:
|
||||||
self.versecounts[versetag[0]] += 1
|
self.verse_counts[verse_def[0]] += 1
|
||||||
else:
|
else:
|
||||||
self.versecounts[versetag[0]] = 1
|
self.verse_counts[verse_def[0]] = 1
|
||||||
if len(versetag) == 1:
|
if len(verse_def) == 1:
|
||||||
versetag += unicode(self.versecounts[versetag[0]])
|
verse_def += unicode(self.verse_counts[verse_def[0]])
|
||||||
elif int(versetag[1:]) > self.versecounts[versetag[0]]:
|
elif int(verse_def[1:]) > self.verse_counts[verse_def[0]]:
|
||||||
self.versecounts[versetag[0]] = int(versetag[1:])
|
self.verse_counts[verse_def[0]] = int(verse_def[1:])
|
||||||
self.verses.append([versetag, versetext.rstrip(), lang])
|
self.verses.append([verse_def, verse_text.rstrip(), lang])
|
||||||
self.verse_order_list.append(versetag)
|
self.verse_order_list_generated.append(verse_def)
|
||||||
if versetag.startswith(u'V') and u'C1' in self.verse_order_list:
|
|
||||||
self.verse_order_list.append(u'C1')
|
|
||||||
|
|
||||||
def repeat_verse(self):
|
def repeat_verse(self):
|
||||||
"""
|
"""
|
||||||
Repeat the previous verse in the verse order
|
Repeat the previous verse in the verse order
|
||||||
"""
|
"""
|
||||||
self.verse_order_list.append(self.verse_order_list[-1])
|
self.verse_order_list_generated.append(
|
||||||
|
self.verse_order_list_generated[-1])
|
||||||
|
self.verse_order_list_generated_useful = True
|
||||||
|
|
||||||
def check_complete(self):
|
def check_complete(self):
|
||||||
"""
|
"""
|
||||||
@ -260,9 +270,8 @@ class SongImport(QtCore.QObject):
|
|||||||
All fields have been set to this song. Write the song to disk.
|
All fields have been set to this song. Write the song to disk.
|
||||||
"""
|
"""
|
||||||
if not self.authors:
|
if not self.authors:
|
||||||
self.authors.append(unicode(translate('SongsPlugin.SongImport',
|
self.authors.append(SongStrings.AuthorUnknownUnT)
|
||||||
'Author unknown')))
|
log.info(u'committing song %s to database', self.title)
|
||||||
log.info(u'commiting song %s to database', self.title)
|
|
||||||
song = Song()
|
song = Song()
|
||||||
song.title = self.title
|
song.title = self.title
|
||||||
song.alternate_title = self.alternate_title
|
song.alternate_title = self.alternate_title
|
||||||
@ -273,34 +282,29 @@ class SongImport(QtCore.QObject):
|
|||||||
verses_changed_to_other = {}
|
verses_changed_to_other = {}
|
||||||
sxml = SongXML()
|
sxml = SongXML()
|
||||||
other_count = 1
|
other_count = 1
|
||||||
for (versetag, versetext, lang) in self.verses:
|
for (verse_def, verse_text, lang) in self.verses:
|
||||||
if versetag[0] == u'C':
|
if verse_def[0].lower() in VerseType.Tags:
|
||||||
versetype = VerseType.to_string(VerseType.Chorus)
|
verse_tag = verse_def[0].lower()
|
||||||
elif versetag[0] == u'V':
|
|
||||||
versetype = VerseType.to_string(VerseType.Verse)
|
|
||||||
elif versetag[0] == u'B':
|
|
||||||
versetype = VerseType.to_string(VerseType.Bridge)
|
|
||||||
elif versetag[0] == u'I':
|
|
||||||
versetype = VerseType.to_string(VerseType.Intro)
|
|
||||||
elif versetag[0] == u'P':
|
|
||||||
versetype = VerseType.to_string(VerseType.PreChorus)
|
|
||||||
elif versetag[0] == u'E':
|
|
||||||
versetype = VerseType.to_string(VerseType.Ending)
|
|
||||||
else:
|
else:
|
||||||
newversetag = u'O%d' % other_count
|
new_verse_def = u'%s%d' % (VerseType.Tags[VerseType.Other],
|
||||||
verses_changed_to_other[versetag] = newversetag
|
other_count)
|
||||||
|
verses_changed_to_other[verse_def] = new_verse_def
|
||||||
other_count += 1
|
other_count += 1
|
||||||
versetype = VerseType.to_string(VerseType.Other)
|
verse_tag = VerseType.Tags[VerseType.Other]
|
||||||
log.info(u'Versetype %s changing to %s' , versetag, newversetag)
|
log.info(u'Versetype %s changing to %s' , verse_def,
|
||||||
versetag = newversetag
|
new_verse_def)
|
||||||
sxml.add_verse_to_lyrics(versetype, versetag[1:], versetext, lang)
|
verse_def = new_verse_def
|
||||||
song.search_lyrics += u' ' + self.remove_punctuation(versetext)
|
sxml.add_verse_to_lyrics(verse_tag, verse_def[1:], verse_text, lang)
|
||||||
|
song.search_lyrics += u' ' + self.remove_punctuation(verse_text)
|
||||||
song.search_lyrics = song.search_lyrics.lower()
|
song.search_lyrics = song.search_lyrics.lower()
|
||||||
song.lyrics = unicode(sxml.extract_xml(), u'utf-8')
|
song.lyrics = unicode(sxml.extract_xml(), u'utf-8')
|
||||||
for i, current_verse_tag in enumerate(self.verse_order_list):
|
if not len(self.verse_order_list) and \
|
||||||
if verses_changed_to_other.has_key(current_verse_tag):
|
self.verse_order_list_generated_useful:
|
||||||
|
self.verse_order_list = self.verse_order_list_generated
|
||||||
|
for i, current_verse_def in enumerate(self.verse_order_list):
|
||||||
|
if verses_changed_to_other.has_key(current_verse_def):
|
||||||
self.verse_order_list[i] = \
|
self.verse_order_list[i] = \
|
||||||
verses_changed_to_other[current_verse_tag]
|
verses_changed_to_other[current_verse_def]
|
||||||
song.verse_order = u' '.join(self.verse_order_list)
|
song.verse_order = u' '.join(self.verse_order_list)
|
||||||
song.copyright = self.copyright
|
song.copyright = self.copyright
|
||||||
song.comments = self.comments
|
song.comments = self.comments
|
||||||
@ -345,9 +349,10 @@ class SongImport(QtCore.QObject):
|
|||||||
+ u'========================================'
|
+ u'========================================'
|
||||||
print u'TITLE: ' + self.title
|
print u'TITLE: ' + self.title
|
||||||
print u'ALT TITLE: ' + self.alternate_title
|
print u'ALT TITLE: ' + self.alternate_title
|
||||||
for (versetag, versetext, lang) in self.verses:
|
for (verse_def, verse_text, lang) in self.verses:
|
||||||
print u'VERSE ' + versetag + u': ' + versetext
|
print u'VERSE ' + verse_def + u': ' + verse_text
|
||||||
print u'ORDER: ' + u' '.join(self.verse_order_list)
|
print u'ORDER: ' + u' '.join(self.verse_order_list)
|
||||||
|
print u'GENERATED ORDER: ' + u' '.join(self.verse_order_list_generated)
|
||||||
for author in self.authors:
|
for author in self.authors:
|
||||||
print u'AUTHOR: ' + author
|
print u'AUTHOR: ' + author
|
||||||
if self.copyright:
|
if self.copyright:
|
||||||
|
@ -31,6 +31,7 @@ import os
|
|||||||
import logging
|
import logging
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
|
from openlp.core.ui.wizard import WizardStrings
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.songimport import SongImport
|
||||||
|
|
||||||
TITLE = 1
|
TITLE = 1
|
||||||
@ -92,12 +93,7 @@ class SongShowPlusImport(SongImport):
|
|||||||
``master_manager``
|
``master_manager``
|
||||||
The song manager for the running OpenLP installation.
|
The song manager for the running OpenLP installation.
|
||||||
"""
|
"""
|
||||||
SongImport.__init__(self, master_manager)
|
SongImport.__init__(self, master_manager, **kwargs)
|
||||||
if kwargs.has_key(u'filename'):
|
|
||||||
self.import_source = kwargs[u'filename']
|
|
||||||
if kwargs.has_key(u'filenames'):
|
|
||||||
self.import_source = kwargs[u'filenames']
|
|
||||||
log.debug(self.import_source)
|
|
||||||
|
|
||||||
def do_import(self):
|
def do_import(self):
|
||||||
"""
|
"""
|
||||||
@ -112,7 +108,7 @@ class SongShowPlusImport(SongImport):
|
|||||||
otherList = {}
|
otherList = {}
|
||||||
file_name = os.path.split(file)[1]
|
file_name = os.path.split(file)[1]
|
||||||
self.import_wizard.incrementProgressBar(
|
self.import_wizard.incrementProgressBar(
|
||||||
u'Importing %s' % (file_name), 0)
|
WizardStrings.ImportingType % file_name, 0)
|
||||||
songData = open(file, 'rb')
|
songData = open(file, 'rb')
|
||||||
while (1):
|
while (1):
|
||||||
blockKey, = struct.unpack("I", songData.read(4))
|
blockKey, = struct.unpack("I", songData.read(4))
|
||||||
@ -178,11 +174,11 @@ class SongShowPlusImport(SongImport):
|
|||||||
songData.close()
|
songData.close()
|
||||||
self.finish()
|
self.finish()
|
||||||
self.import_wizard.incrementProgressBar(
|
self.import_wizard.incrementProgressBar(
|
||||||
u'Importing %s' % (file_name))
|
WizardStrings.ImportingType % file_name)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def toOpenLPVerseTag(self, verseName):
|
def toOpenLPVerseTag(self, verseName):
|
||||||
if verseName.find(" ") !=-1:
|
if verseName.find(" ") != -1:
|
||||||
verseParts = verseName.split(" ")
|
verseParts = verseName.split(" ")
|
||||||
verseType = verseParts[0]
|
verseType = verseParts[0]
|
||||||
verseNumber = verseParts[1]
|
verseNumber = verseParts[1]
|
||||||
|
46
openlp/plugins/songs/lib/ui.py
Normal file
46
openlp/plugins/songs/lib/ui.py
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# Copyright (c) 2008-2011 Raoul Snyman #
|
||||||
|
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
|
||||||
|
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
|
||||||
|
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
|
||||||
|
# Carsten Tinggaard, Frode Woldsund #
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# This program is free software; you can redistribute it and/or modify it #
|
||||||
|
# under the terms of the GNU General Public License as published by the Free #
|
||||||
|
# Software Foundation; version 2 of the License. #
|
||||||
|
# #
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||||
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||||
|
# more details. #
|
||||||
|
# #
|
||||||
|
# You should have received a copy of the GNU General Public License along #
|
||||||
|
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||||
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
|
###############################################################################
|
||||||
|
"""
|
||||||
|
The :mod:`openlp.plugins.songs.lib.ui` module provides standard UI components
|
||||||
|
for the songs plugin.
|
||||||
|
"""
|
||||||
|
from openlp.core.lib import translate
|
||||||
|
|
||||||
|
class SongStrings(object):
|
||||||
|
"""
|
||||||
|
Provide standard strings for use throughout the songs plugin.
|
||||||
|
"""
|
||||||
|
# These strings should need a good reason to be retranslated elsewhere.
|
||||||
|
Author = translate('OpenLP.Ui', 'Author', 'Singular')
|
||||||
|
Authors = translate('OpenLP.Ui', 'Authors', 'Plural')
|
||||||
|
AuthorUnknown = translate('OpenLP.Ui', 'Author Unknown') # Used in the UI.
|
||||||
|
AuthorUnknownUnT = u'Author Unknown' # Used to populate the database.
|
||||||
|
CopyrightSymbol = translate('OpenLP.Ui', '\xa9', 'Copyright symbol.')
|
||||||
|
SongBook = translate('OpenLP.Ui', 'Song Book', 'Singular')
|
||||||
|
SongBooks = translate('OpenLP.Ui', 'Song Books', 'Plural')
|
||||||
|
SongMaintenance = translate('OpenLP.Ui', 'Song Maintenance')
|
||||||
|
Topic = translate('OpenLP.Ui', 'Topic', 'Singular')
|
||||||
|
Topics = translate('OpenLP.Ui', 'Topics', 'Plural')
|
@ -30,6 +30,7 @@ Worship songs into the OpenLP database.
|
|||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from openlp.core.ui.wizard import WizardStrings
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.songimport import SongImport
|
||||||
|
|
||||||
BLOCK_TYPES = (u'V', u'C', u'B')
|
BLOCK_TYPES = (u'V', u'C', u'B')
|
||||||
@ -98,12 +99,7 @@ class WowImport(SongImport):
|
|||||||
``master_manager``
|
``master_manager``
|
||||||
The song manager for the running OpenLP installation.
|
The song manager for the running OpenLP installation.
|
||||||
"""
|
"""
|
||||||
SongImport.__init__(self, master_manager)
|
SongImport.__init__(self, master_manager, **kwargs)
|
||||||
if kwargs.has_key(u'filename'):
|
|
||||||
self.import_source = kwargs[u'filename']
|
|
||||||
if kwargs.has_key(u'filenames'):
|
|
||||||
self.import_source = kwargs[u'filenames']
|
|
||||||
log.debug(self.import_source)
|
|
||||||
|
|
||||||
def do_import(self):
|
def do_import(self):
|
||||||
"""
|
"""
|
||||||
@ -116,7 +112,7 @@ class WowImport(SongImport):
|
|||||||
copyright = u''
|
copyright = u''
|
||||||
file_name = os.path.split(file)[1]
|
file_name = os.path.split(file)[1]
|
||||||
self.import_wizard.incrementProgressBar(
|
self.import_wizard.incrementProgressBar(
|
||||||
u'Importing %s' % (file_name), 0)
|
WizardStrings.ImportingType % file_name, 0)
|
||||||
# Get the song title
|
# Get the song title
|
||||||
self.title = file_name.rpartition(u'.')[0]
|
self.title = file_name.rpartition(u'.')[0]
|
||||||
songData = open(file, 'rb')
|
songData = open(file, 'rb')
|
||||||
@ -162,5 +158,5 @@ class WowImport(SongImport):
|
|||||||
songData.close()
|
songData.close()
|
||||||
self.finish()
|
self.finish()
|
||||||
self.import_wizard.incrementProgressBar(
|
self.import_wizard.incrementProgressBar(
|
||||||
u'Importing %s' % (file_name))
|
WizardStrings.ImportingType % file_name)
|
||||||
return True
|
return True
|
||||||
|
@ -66,9 +66,9 @@ import re
|
|||||||
|
|
||||||
from lxml import etree, objectify
|
from lxml import etree, objectify
|
||||||
|
|
||||||
from openlp.core.lib import translate
|
|
||||||
from openlp.plugins.songs.lib import VerseType
|
from openlp.plugins.songs.lib import VerseType
|
||||||
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
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -377,9 +377,7 @@ class OpenLyrics(object):
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
if not authors:
|
if not authors:
|
||||||
# Add "Author unknown" (can be translated).
|
authors.append(SongStrings.AuthorUnknownUnT)
|
||||||
authors.append((unicode(translate('SongsPlugin.XML',
|
|
||||||
'Author unknown'))))
|
|
||||||
for display_name in authors:
|
for display_name in authors:
|
||||||
author = self.manager.get_object_filtered(Author,
|
author = self.manager.get_object_filtered(Author,
|
||||||
Author.display_name == display_name)
|
Author.display_name == display_name)
|
||||||
@ -464,7 +462,8 @@ class OpenLyrics(object):
|
|||||||
text += u'\n'
|
text += u'\n'
|
||||||
text += u'\n'.join([unicode(line) for line in lines.line])
|
text += u'\n'.join([unicode(line) for line in lines.line])
|
||||||
verse_name = self._get(verse, u'name')
|
verse_name = self._get(verse, u'name')
|
||||||
verse_type = unicode(VerseType.to_string(verse_name[0]))
|
verse_type_index = VerseType.from_tag(verse_name[0])
|
||||||
|
verse_type = VerseType.Names[verse_type_index]
|
||||||
verse_number = re.compile(u'[a-zA-Z]*').sub(u'', verse_name)
|
verse_number = re.compile(u'[a-zA-Z]*').sub(u'', verse_name)
|
||||||
verse_part = re.compile(u'[0-9]*').sub(u'', verse_name[1:])
|
verse_part = re.compile(u'[0-9]*').sub(u'', verse_name[1:])
|
||||||
# OpenLyrics allows e. g. "c", but we need "c1".
|
# OpenLyrics allows e. g. "c", but we need "c1".
|
||||||
|
@ -31,6 +31,7 @@ from PyQt4 import QtCore, QtGui
|
|||||||
|
|
||||||
from openlp.core.lib import Plugin, StringContent, build_icon, translate
|
from openlp.core.lib import Plugin, StringContent, build_icon, translate
|
||||||
from openlp.core.lib.db import Manager
|
from openlp.core.lib.db import Manager
|
||||||
|
from openlp.core.lib.ui import UiStrings
|
||||||
from openlp.plugins.songs.lib import SongMediaItem, SongsTab, SongXML
|
from openlp.plugins.songs.lib import SongMediaItem, SongsTab, SongXML
|
||||||
from openlp.plugins.songs.lib.db import init_schema, Song
|
from openlp.plugins.songs.lib.db import init_schema, Song
|
||||||
from openlp.plugins.songs.lib.importer import SongFormat
|
from openlp.plugins.songs.lib.importer import SongFormat
|
||||||
@ -137,8 +138,7 @@ class SongsPlugin(Plugin):
|
|||||||
"""
|
"""
|
||||||
maxSongs = self.manager.get_object_count(Song)
|
maxSongs = self.manager.get_object_count(Song)
|
||||||
progressDialog = QtGui.QProgressDialog(
|
progressDialog = QtGui.QProgressDialog(
|
||||||
translate('SongsPlugin', 'Reindexing songs...'),
|
translate('SongsPlugin', 'Reindexing songs...'), UiStrings.Cancel,
|
||||||
translate('SongsPlugin', 'Cancel'),
|
|
||||||
0, maxSongs + 1, self.formparent)
|
0, maxSongs + 1, self.formparent)
|
||||||
progressDialog.setWindowModality(QtCore.Qt.WindowModal)
|
progressDialog.setWindowModality(QtCore.Qt.WindowModal)
|
||||||
songs = self.manager.get_all_objects(Song)
|
songs = self.manager.get_all_objects(Song)
|
||||||
|
@ -68,6 +68,7 @@ Source: ..\..\dist\OpenLP\*; DestDir: {app}; Flags: ignoreversion recursesubdirs
|
|||||||
|
|
||||||
[Icons]
|
[Icons]
|
||||||
Name: {group}\{#AppName}; Filename: {app}\{#AppExeName}
|
Name: {group}\{#AppName}; Filename: {app}\{#AppExeName}
|
||||||
|
Name: {group}\{#AppName} (Debug); Filename: {app}\{#AppExeName}; Parameters: -l debug
|
||||||
Name: {group}\{cm:ProgramOnTheWeb,{#AppName}}; Filename: {#AppURL}
|
Name: {group}\{cm:ProgramOnTheWeb,{#AppName}}; Filename: {#AppURL}
|
||||||
Name: {group}\{cm:UninstallProgram,{#AppName}}; Filename: {uninstallexe}
|
Name: {group}\{cm:UninstallProgram,{#AppName}}; Filename: {uninstallexe}
|
||||||
Name: {commondesktop}\{#AppName}; Filename: {app}\{#AppExeName}; Tasks: desktopicon
|
Name: {commondesktop}\{#AppName}; Filename: {app}\{#AppExeName}; Tasks: desktopicon
|
||||||
|
Loading…
Reference in New Issue
Block a user