forked from openlp/openlp
Head844
This commit is contained in:
commit
93fa986641
@ -95,24 +95,24 @@ def build_icon(icon):
|
|||||||
The icon to build. This can be a QIcon, a resource string in the form
|
The icon to build. This can be a QIcon, a resource string in the form
|
||||||
``:/resource/file.png``, or a file location like ``/path/to/file.png``.
|
``:/resource/file.png``, or a file location like ``/path/to/file.png``.
|
||||||
"""
|
"""
|
||||||
ButtonIcon = None
|
button_icon = None
|
||||||
if isinstance(icon, QtGui.QIcon):
|
if isinstance(icon, QtGui.QIcon):
|
||||||
ButtonIcon = icon
|
button_icon = icon
|
||||||
elif isinstance(icon, basestring):
|
elif isinstance(icon, basestring):
|
||||||
ButtonIcon = QtGui.QIcon()
|
button_icon = QtGui.QIcon()
|
||||||
if icon.startswith(u':/'):
|
if icon.startswith(u':/'):
|
||||||
ButtonIcon.addPixmap(
|
button_icon.addPixmap(QtGui.QPixmap(icon), QtGui.QIcon.Normal,
|
||||||
QtGui.QPixmap(icon), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
QtGui.QIcon.Off)
|
||||||
else:
|
else:
|
||||||
ButtonIcon.addPixmap(QtGui.QPixmap.fromImage(QtGui.QImage(icon)),
|
button_icon.addPixmap(QtGui.QPixmap.fromImage(QtGui.QImage(icon)),
|
||||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
elif isinstance(icon, QtGui.QImage):
|
elif isinstance(icon, QtGui.QImage):
|
||||||
ButtonIcon = QtGui.QIcon()
|
button_icon = QtGui.QIcon()
|
||||||
ButtonIcon.addPixmap(
|
button_icon.addPixmap(QtGui.QPixmap.fromImage(icon),
|
||||||
QtGui.QPixmap.fromImage(icon), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
return ButtonIcon
|
return button_icon
|
||||||
|
|
||||||
def contextMenuAction(base, icon, text, slot):
|
def context_menu_action(base, icon, text, slot):
|
||||||
"""
|
"""
|
||||||
Utility method to help build context menus for plugins
|
Utility method to help build context menus for plugins
|
||||||
"""
|
"""
|
||||||
@ -122,7 +122,7 @@ def contextMenuAction(base, icon, text, slot):
|
|||||||
QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered()'), slot)
|
QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered()'), slot)
|
||||||
return action
|
return action
|
||||||
|
|
||||||
def contextMenu(base, icon, text):
|
def context_menu(base, icon, text):
|
||||||
"""
|
"""
|
||||||
Utility method to help build context menus for plugins
|
Utility method to help build context menus for plugins
|
||||||
"""
|
"""
|
||||||
@ -130,7 +130,7 @@ def contextMenu(base, icon, text):
|
|||||||
action.setIcon(build_icon(icon))
|
action.setIcon(build_icon(icon))
|
||||||
return action
|
return action
|
||||||
|
|
||||||
def contextMenuSeparator(base):
|
def context_menu_separator(base):
|
||||||
"""
|
"""
|
||||||
Add a separator to a context menu
|
Add a separator to a context menu
|
||||||
"""
|
"""
|
||||||
@ -152,12 +152,12 @@ def resize_image(image, width, height):
|
|||||||
realw = preview.width()
|
realw = preview.width()
|
||||||
realh = preview.height()
|
realh = preview.height()
|
||||||
# and move it to the centre of the preview space
|
# and move it to the centre of the preview space
|
||||||
newImage = QtGui.QImage(width, height,
|
new_image = QtGui.QImage(width, height,
|
||||||
QtGui.QImage.Format_ARGB32_Premultiplied)
|
QtGui.QImage.Format_ARGB32_Premultiplied)
|
||||||
newImage.fill(QtCore.Qt.black)
|
new_image.fill(QtCore.Qt.black)
|
||||||
painter = QtGui.QPainter(newImage)
|
painter = QtGui.QPainter(new_image)
|
||||||
painter.drawImage((width - realw) / 2, (height - realh) / 2, preview)
|
painter.drawImage((width - realw) / 2, (height - realh) / 2, preview)
|
||||||
return newImage
|
return new_image
|
||||||
|
|
||||||
|
|
||||||
class ThemeLevel(object):
|
class ThemeLevel(object):
|
||||||
|
@ -28,7 +28,7 @@ import os
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import contextMenuAction, contextMenuSeparator, \
|
from openlp.core.lib import context_menu_action, context_menu_separator, \
|
||||||
SettingsManager, OpenLPToolbar, ServiceItem, build_icon
|
SettingsManager, OpenLPToolbar, ServiceItem, build_icon
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -271,34 +271,34 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||||
if self.hasEditIcon:
|
if self.hasEditIcon:
|
||||||
self.ListView.addAction(
|
self.ListView.addAction(
|
||||||
contextMenuAction(
|
context_menu_action(
|
||||||
self.ListView, u':/general/general_edit.png',
|
self.ListView, u':/general/general_edit.png',
|
||||||
u'%s %s' % (self.trUtf8('&Edit'), self.PluginNameVisible),
|
u'%s %s' % (self.trUtf8('&Edit'), self.PluginNameVisible),
|
||||||
self.onEditClick))
|
self.onEditClick))
|
||||||
self.ListView.addAction(contextMenuSeparator(self.ListView))
|
self.ListView.addAction(context_menu_separator(self.ListView))
|
||||||
if self.hasDeleteIcon:
|
if self.hasDeleteIcon:
|
||||||
self.ListView.addAction(
|
self.ListView.addAction(
|
||||||
contextMenuAction(
|
context_menu_action(
|
||||||
self.ListView, u':/general/general_delete.png',
|
self.ListView, u':/general/general_delete.png',
|
||||||
u'%s %s' % (self.trUtf8('&Delete'), self.PluginNameVisible),
|
u'%s %s' % (self.trUtf8('&Delete'), self.PluginNameVisible),
|
||||||
self.onDeleteClick))
|
self.onDeleteClick))
|
||||||
self.ListView.addAction(contextMenuSeparator(self.ListView))
|
self.ListView.addAction(context_menu_separator(self.ListView))
|
||||||
self.ListView.addAction(
|
self.ListView.addAction(
|
||||||
contextMenuAction(
|
context_menu_action(
|
||||||
self.ListView, u':/general/general_preview.png',
|
self.ListView, u':/general/general_preview.png',
|
||||||
u'%s %s' % (self.trUtf8('&Preview'), self.PluginNameVisible),
|
u'%s %s' % (self.trUtf8('&Preview'), self.PluginNameVisible),
|
||||||
self.onPreviewClick))
|
self.onPreviewClick))
|
||||||
self.ListView.addAction(
|
self.ListView.addAction(
|
||||||
contextMenuAction(
|
context_menu_action(
|
||||||
self.ListView, u':/general/general_live.png',
|
self.ListView, u':/general/general_live.png',
|
||||||
self.trUtf8('&Show Live'), self.onLiveClick))
|
self.trUtf8('&Show Live'), self.onLiveClick))
|
||||||
self.ListView.addAction(
|
self.ListView.addAction(
|
||||||
contextMenuAction(
|
context_menu_action(
|
||||||
self.ListView, u':/general/general_add.png',
|
self.ListView, u':/general/general_add.png',
|
||||||
self.trUtf8('&Add to Service'), self.onAddClick))
|
self.trUtf8('&Add to Service'), self.onAddClick))
|
||||||
if self.addToServiceItem:
|
if self.addToServiceItem:
|
||||||
self.ListView.addAction(
|
self.ListView.addAction(
|
||||||
contextMenuAction(
|
context_menu_action(
|
||||||
self.ListView, u':/general/general_add.png',
|
self.ListView, u':/general/general_add.png',
|
||||||
self.trUtf8('&Add to selected Service Item'),
|
self.trUtf8('&Add to selected Service Item'),
|
||||||
self.onAddEditClick))
|
self.onAddEditClick))
|
||||||
@ -465,9 +465,9 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
service_item = ServiceItem(self.parent)
|
service_item = ServiceItem(self.parent)
|
||||||
if self.ServiceItemIconName:
|
if self.ServiceItemIconName:
|
||||||
service_item.addIcon(self.ServiceItemIconName)
|
service_item.add_icon(self.ServiceItemIconName)
|
||||||
else:
|
else:
|
||||||
service_item.addIcon(
|
service_item.add_icon(
|
||||||
u':/media/media_' + self.PluginNameShort.lower() + u'.png')
|
u':/media/media_' + self.PluginNameShort.lower() + u'.png')
|
||||||
if self.generateSlideData(service_item, item):
|
if self.generateSlideData(service_item, item):
|
||||||
return service_item
|
return service_item
|
||||||
|
@ -73,9 +73,10 @@ class ServiceItem(object):
|
|||||||
The plugin that this service item belongs to.
|
The plugin that this service item belongs to.
|
||||||
"""
|
"""
|
||||||
if plugin:
|
if plugin:
|
||||||
self.RenderManager = plugin.render_manager
|
self.render_manager = plugin.render_manager
|
||||||
self.name = plugin.name
|
self.name = plugin.name
|
||||||
self.title = u''
|
self.title = u''
|
||||||
|
self.shortname = u''
|
||||||
self.audit = u''
|
self.audit = u''
|
||||||
self.items = []
|
self.items = []
|
||||||
self.iconic_representation = None
|
self.iconic_representation = None
|
||||||
@ -90,6 +91,7 @@ class ServiceItem(object):
|
|||||||
self.capabilities = []
|
self.capabilities = []
|
||||||
self.is_valid = True
|
self.is_valid = True
|
||||||
self.cache = []
|
self.cache = []
|
||||||
|
self.icon = None
|
||||||
|
|
||||||
def add_capability(self, capability):
|
def add_capability(self, capability):
|
||||||
"""
|
"""
|
||||||
@ -109,7 +111,7 @@ class ServiceItem(object):
|
|||||||
"""
|
"""
|
||||||
return capability in self.capabilities
|
return capability in self.capabilities
|
||||||
|
|
||||||
def addIcon(self, icon):
|
def add_icon(self, icon):
|
||||||
"""
|
"""
|
||||||
Add an icon to the service item. This is used when displaying the
|
Add an icon to the service item. This is used when displaying the
|
||||||
service item in the service manager.
|
service item in the service manager.
|
||||||
@ -131,12 +133,12 @@ class ServiceItem(object):
|
|||||||
if self.service_item_type == ServiceItemType.Text:
|
if self.service_item_type == ServiceItemType.Text:
|
||||||
log.debug(u'Formatting slides')
|
log.debug(u'Formatting slides')
|
||||||
if self.theme is None:
|
if self.theme is None:
|
||||||
self.RenderManager.set_override_theme(None)
|
self.render_manager.set_override_theme(None)
|
||||||
else:
|
else:
|
||||||
self.RenderManager.set_override_theme(self.theme)
|
self.render_manager.set_override_theme(self.theme)
|
||||||
for slide in self._raw_frames:
|
for slide in self._raw_frames:
|
||||||
before = time.time()
|
before = time.time()
|
||||||
formated = self.RenderManager.format_slide(slide[u'raw_slide'])
|
formated = self.render_manager.format_slide(slide[u'raw_slide'])
|
||||||
for format in formated:
|
for format in formated:
|
||||||
lines = u''
|
lines = u''
|
||||||
title = u''
|
title = u''
|
||||||
@ -151,9 +153,8 @@ class ServiceItem(object):
|
|||||||
log.log(15, u'Formatting took %4s' % (time.time() - before))
|
log.log(15, u'Formatting took %4s' % (time.time() - before))
|
||||||
elif self.service_item_type == ServiceItemType.Image:
|
elif self.service_item_type == ServiceItemType.Image:
|
||||||
for slide in self._raw_frames:
|
for slide in self._raw_frames:
|
||||||
slide[u'image'] = \
|
slide[u'image'] = resize_image(slide[u'image'],
|
||||||
resize_image(slide[u'image'], self.RenderManager.width,
|
self.render_manager.width, self.render_manager.height)
|
||||||
self.RenderManager.height)
|
|
||||||
elif self.service_item_type == ServiceItemType.Command:
|
elif self.service_item_type == ServiceItemType.Command:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
@ -167,19 +168,19 @@ class ServiceItem(object):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'render individual')
|
log.debug(u'render individual')
|
||||||
if self.theme is None:
|
if self.theme is None:
|
||||||
self.RenderManager.set_override_theme(None)
|
self.render_manager.set_override_theme(None)
|
||||||
else:
|
else:
|
||||||
self.RenderManager.set_override_theme(self.theme)
|
self.render_manager.set_override_theme(self.theme)
|
||||||
format = self._display_frames[row][u'text'].split(u'\n')
|
format = self._display_frames[row][u'text'].split(u'\n')
|
||||||
#if screen blank then do not display footer
|
#if screen blank then do not display footer
|
||||||
if self.cache[row] is not None:
|
if self.cache[row] is not None:
|
||||||
frame = self.cache[row]
|
frame = self.cache[row]
|
||||||
else:
|
else:
|
||||||
if format[0]:
|
if format[0]:
|
||||||
frame = self.RenderManager.generate_slide(format,
|
frame = self.render_manager.generate_slide(format,
|
||||||
self.raw_footer)
|
self.raw_footer)
|
||||||
else:
|
else:
|
||||||
frame = self.RenderManager.generate_slide(format, u'')
|
frame = self.render_manager.generate_slide(format, u'')
|
||||||
self.cache[row] = frame
|
self.cache[row] = frame
|
||||||
return frame
|
return frame
|
||||||
|
|
||||||
@ -200,7 +201,7 @@ class ServiceItem(object):
|
|||||||
self._raw_frames.append(
|
self._raw_frames.append(
|
||||||
{u'title': title, u'image': image, u'path': path})
|
{u'title': title, u'image': image, u'path': path})
|
||||||
|
|
||||||
def add_from_text(self, title, raw_slide, verseTag=None):
|
def add_from_text(self, title, raw_slide, verse_tag=None):
|
||||||
"""
|
"""
|
||||||
Add a text slide to the service item.
|
Add a text slide to the service item.
|
||||||
|
|
||||||
@ -213,7 +214,7 @@ class ServiceItem(object):
|
|||||||
self.service_item_type = ServiceItemType.Text
|
self.service_item_type = ServiceItemType.Text
|
||||||
title = title.split(u'\n')[0]
|
title = title.split(u'\n')[0]
|
||||||
self._raw_frames.append(
|
self._raw_frames.append(
|
||||||
{u'title': title, u'raw_slide': raw_slide, u'verseTag':verseTag})
|
{u'title': title, u'raw_slide': raw_slide, u'verseTag':verse_tag})
|
||||||
|
|
||||||
def add_from_command(self, path, file_name, image):
|
def add_from_command(self, path, file_name, image):
|
||||||
"""
|
"""
|
||||||
@ -280,7 +281,7 @@ class ServiceItem(object):
|
|||||||
self.service_item_type = header[u'type']
|
self.service_item_type = header[u'type']
|
||||||
self.shortname = header[u'plugin']
|
self.shortname = header[u'plugin']
|
||||||
self.theme = header[u'theme']
|
self.theme = header[u'theme']
|
||||||
self.addIcon(header[u'icon'])
|
self.add_icon(header[u'icon'])
|
||||||
self.raw_footer = header[u'footer']
|
self.raw_footer = header[u'footer']
|
||||||
self.audit = header[u'audit']
|
self.audit = header[u'audit']
|
||||||
self.notes = header[u'notes']
|
self.notes = header[u'notes']
|
||||||
|
@ -41,7 +41,7 @@ class XmlRootClass(object):
|
|||||||
|
|
||||||
(element.tag, val) = self.post_tag_hook(element.tag, val)
|
(element.tag, val) = self.post_tag_hook(element.tag, val)
|
||||||
"""
|
"""
|
||||||
def _setFromXml(self, xml, root_tag):
|
def _set_from_xml(self, xml, root_tag):
|
||||||
"""
|
"""
|
||||||
Set song properties from given xml content.
|
Set song properties from given xml content.
|
||||||
|
|
||||||
|
@ -153,8 +153,8 @@ class Theme(object):
|
|||||||
The data to initialise the theme with
|
The data to initialise the theme with
|
||||||
"""
|
"""
|
||||||
# init to defaults
|
# init to defaults
|
||||||
self._set_from_XML(BLANK_STYLE_XML)
|
self._set_from_xml(BLANK_STYLE_XML)
|
||||||
self._set_from_XML(xml)
|
self._set_from_xml(xml)
|
||||||
|
|
||||||
def _get_as_string(self):
|
def _get_as_string(self):
|
||||||
"""
|
"""
|
||||||
@ -176,9 +176,9 @@ class Theme(object):
|
|||||||
The data to apply to the theme
|
The data to apply to the theme
|
||||||
"""
|
"""
|
||||||
root = ElementTree(element=XML(xml))
|
root = ElementTree(element=XML(xml))
|
||||||
iter = root.getiterator()
|
xml_iter = root.getiterator()
|
||||||
for element in iter:
|
for element in xml_iter:
|
||||||
delphiColorChange = False
|
delphi_color_change = False
|
||||||
if element.tag != u'Theme':
|
if element.tag != u'Theme':
|
||||||
element_text = element.text
|
element_text = element.text
|
||||||
val = 0
|
val = 0
|
||||||
@ -194,7 +194,7 @@ class Theme(object):
|
|||||||
pass
|
pass
|
||||||
elif DELPHI_COLORS.has_key(element_text):
|
elif DELPHI_COLORS.has_key(element_text):
|
||||||
val = DELPHI_COLORS[element_text]
|
val = DELPHI_COLORS[element_text]
|
||||||
delphiColorChange = True
|
delphi_color_change = True
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
val = int(element_text)
|
val = int(element_text)
|
||||||
@ -204,7 +204,7 @@ class Theme(object):
|
|||||||
(element.tag.find(u'BackgroundParameter') == 0 and
|
(element.tag.find(u'BackgroundParameter') == 0 and
|
||||||
type(val) == type(0))):
|
type(val) == type(0))):
|
||||||
# convert to a wx.Colour
|
# convert to a wx.Colour
|
||||||
if not delphiColorChange:
|
if not delphi_color_change:
|
||||||
val = QtGui.QColor(
|
val = QtGui.QColor(
|
||||||
val&0xFF, (val>>8)&0xFF, (val>>16)&0xFF)
|
val&0xFF, (val>>8)&0xFF, (val>>16)&0xFF)
|
||||||
else:
|
else:
|
||||||
|
@ -32,7 +32,7 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import OpenLPToolbar, ServiceItem, contextMenuAction, \
|
from openlp.core.lib import OpenLPToolbar, ServiceItem, context_menu_action, \
|
||||||
Receiver, build_icon, ItemCapabilities, SettingsManager, translate
|
Receiver, build_icon, ItemCapabilities, SettingsManager, translate
|
||||||
from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm
|
from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm
|
||||||
from openlp.core.utils import AppLocation
|
from openlp.core.utils import AppLocation
|
||||||
@ -954,7 +954,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
self.ThemeComboBox.addItem(u'')
|
self.ThemeComboBox.addItem(u'')
|
||||||
for theme in theme_list:
|
for theme in theme_list:
|
||||||
self.ThemeComboBox.addItem(theme)
|
self.ThemeComboBox.addItem(theme)
|
||||||
action = contextMenuAction(
|
action = context_menu_action(
|
||||||
self.ServiceManagerList,
|
self.ServiceManagerList,
|
||||||
None,
|
None,
|
||||||
theme , self.onThemeChangeAction)
|
theme , self.onThemeChangeAction)
|
||||||
|
@ -33,9 +33,9 @@ from PyQt4 import QtCore, QtGui
|
|||||||
|
|
||||||
from openlp.core.ui import AmendThemeForm
|
from openlp.core.ui import AmendThemeForm
|
||||||
from openlp.core.theme import Theme
|
from openlp.core.theme import Theme
|
||||||
from openlp.core.lib import OpenLPToolbar, contextMenuAction, \
|
from openlp.core.lib import OpenLPToolbar, context_menu_action, \
|
||||||
ThemeXML, str_to_bool, get_text_file_string, build_icon, Receiver, \
|
ThemeXML, str_to_bool, get_text_file_string, build_icon, Receiver, \
|
||||||
contextMenuSeparator, SettingsManager, translate
|
context_menu_separator, SettingsManager, translate
|
||||||
from openlp.core.utils import AppLocation
|
from openlp.core.utils import AppLocation
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -81,27 +81,28 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
self.Layout.addWidget(self.ThemeListWidget)
|
self.Layout.addWidget(self.ThemeListWidget)
|
||||||
self.ThemeListWidget.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
self.ThemeListWidget.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||||
self.ThemeListWidget.addAction(
|
self.ThemeListWidget.addAction(
|
||||||
contextMenuAction(self.ThemeListWidget, u':/themes/theme_edit.png',
|
context_menu_action(self.ThemeListWidget,
|
||||||
|
u':/themes/theme_edit.png',
|
||||||
translate(u'ThemeManager', u'Edit a theme'), self.onEditTheme))
|
translate(u'ThemeManager', u'Edit a theme'), self.onEditTheme))
|
||||||
self.ThemeListWidget.addAction(
|
self.ThemeListWidget.addAction(
|
||||||
contextMenuSeparator(self.ThemeListWidget))
|
context_menu_separator(self.ThemeListWidget))
|
||||||
self.ThemeListWidget.addAction(
|
self.ThemeListWidget.addAction(
|
||||||
contextMenuAction(self.ThemeListWidget,
|
context_menu_action(self.ThemeListWidget,
|
||||||
u':/general/general_delete.png',
|
u':/general/general_delete.png',
|
||||||
translate(u'ThemeManager', u'Delete theme'),
|
translate(u'ThemeManager', u'Delete theme'),
|
||||||
self.onDeleteTheme))
|
self.onDeleteTheme))
|
||||||
self.ThemeListWidget.addAction(
|
self.ThemeListWidget.addAction(
|
||||||
contextMenuAction(self.ThemeListWidget,
|
context_menu_action(self.ThemeListWidget,
|
||||||
u':/general/general_export.png',
|
u':/general/general_export.png',
|
||||||
translate(u'ThemeManager', u'Make Global'),
|
translate(u'ThemeManager', u'Make Global'),
|
||||||
self.changeGlobalFromScreen))
|
self.changeGlobalFromScreen))
|
||||||
self.ThemeListWidget.addAction(
|
self.ThemeListWidget.addAction(
|
||||||
contextMenuAction(self.ThemeListWidget,
|
context_menu_action(self.ThemeListWidget,
|
||||||
u':/general/general_export.png',
|
u':/general/general_export.png',
|
||||||
translate(u'ThemeManager', u'Export theme'),
|
translate(u'ThemeManager', u'Export theme'),
|
||||||
self.onExportTheme))
|
self.onExportTheme))
|
||||||
self.ThemeListWidget.addAction(
|
self.ThemeListWidget.addAction(
|
||||||
contextMenuSeparator(self.ThemeListWidget))
|
context_menu_separator(self.ThemeListWidget))
|
||||||
#Signals
|
#Signals
|
||||||
QtCore.QObject.connect(self.ThemeListWidget,
|
QtCore.QObject.connect(self.ThemeListWidget,
|
||||||
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
|
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
|
||||||
|
@ -322,8 +322,8 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
|
|||||||
Load the list of Crosswalk and BibleGateway bibles.
|
Load the list of Crosswalk and BibleGateway bibles.
|
||||||
"""
|
"""
|
||||||
#Load and store Crosswalk Bibles
|
#Load and store Crosswalk Bibles
|
||||||
filepath = AppLocation.get_directory(AppLocation.PluginsDir)
|
filepath = os.path.join(AppLocation.get_section_data_path(
|
||||||
filepath = os.path.join(filepath, u'bibles', u'resources')
|
self.bibleplugin.settingsSection), u'resources')
|
||||||
try:
|
try:
|
||||||
self.web_bible_list[WebDownload.Crosswalk] = {}
|
self.web_bible_list[WebDownload.Crosswalk] = {}
|
||||||
books_file = open(
|
books_file = open(
|
||||||
|
@ -59,6 +59,7 @@ class BibleDB(QtCore.QObject):
|
|||||||
"""
|
"""
|
||||||
log.info(u'BibleDB loaded')
|
log.info(u'BibleDB loaded')
|
||||||
QtCore.QObject.__init__(self)
|
QtCore.QObject.__init__(self)
|
||||||
|
self.bible_plugin = parent
|
||||||
if u'path' not in kwargs:
|
if u'path' not in kwargs:
|
||||||
raise KeyError(u'Missing keyword argument "path".')
|
raise KeyError(u'Missing keyword argument "path".')
|
||||||
if u'name' not in kwargs and u'file' not in kwargs:
|
if u'name' not in kwargs and u'file' not in kwargs:
|
||||||
|
@ -56,8 +56,8 @@ class HTTPBooks(object):
|
|||||||
"""
|
"""
|
||||||
if HTTPBooks.cursor is None:
|
if HTTPBooks.cursor is None:
|
||||||
filepath = os.path.join(
|
filepath = os.path.join(
|
||||||
AppLocation.get_directory(AppLocation.PluginsDir), u'bibles',
|
AppLocation.get_section_data_path(u'bibles'), u'resources',
|
||||||
u'resources', u'httpbooks.sqlite')
|
u'httpbooks.sqlite')
|
||||||
conn = sqlite3.connect(filepath)
|
conn = sqlite3.connect(filepath)
|
||||||
HTTPBooks.cursor = conn.cursor()
|
HTTPBooks.cursor = conn.cursor()
|
||||||
return HTTPBooks.cursor
|
return HTTPBooks.cursor
|
||||||
@ -288,8 +288,7 @@ class CWExtract(BibleCommon):
|
|||||||
``chapter``
|
``chapter``
|
||||||
Chapter number
|
Chapter number
|
||||||
"""
|
"""
|
||||||
log.debug(u'get_bible_chapter %s,%s,%s',
|
log.debug(u'get_bible_chapter %s,%s,%s', version, bookname, chapter)
|
||||||
version, bookname, chapter)
|
|
||||||
urlbookname = bookname.replace(u' ', u'-')
|
urlbookname = bookname.replace(u' ', u'-')
|
||||||
chapter_url = u'http://www.biblestudytools.com/%s/%s/%s.html' % \
|
chapter_url = u'http://www.biblestudytools.com/%s/%s/%s.html' % \
|
||||||
(version, urlbookname.lower(), chapter)
|
(version, urlbookname.lower(), chapter)
|
||||||
|
@ -68,9 +68,8 @@ class OSISBible(BibleDB):
|
|||||||
self.trans_regex = re.compile(r'<transChange(.*?)>(.*?)</transChange>')
|
self.trans_regex = re.compile(r'<transChange(.*?)>(.*?)</transChange>')
|
||||||
self.spaces_regex = re.compile(r'([ ]{2,})')
|
self.spaces_regex = re.compile(r'([ ]{2,})')
|
||||||
self.books = {}
|
self.books = {}
|
||||||
filepath = os.path.join(
|
filepath = os.path.join(AppLocation.get_section_data_path(
|
||||||
AppLocation.get_directory(AppLocation.PluginsDir), u'bibles',
|
self.bible_plugin.settingsSection), u'resources', u'osisbooks.csv')
|
||||||
u'resources', u'osisbooks.csv')
|
|
||||||
fbibles = None
|
fbibles = None
|
||||||
try:
|
try:
|
||||||
fbibles = open(filepath, u'r')
|
fbibles = open(filepath, u'r')
|
||||||
|
@ -29,7 +29,7 @@ import os
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
||||||
contextMenuAction, ItemCapabilities, SettingsManager, translate
|
context_menu_action, ItemCapabilities, SettingsManager, translate
|
||||||
from openlp.core.utils import AppLocation
|
from openlp.core.utils import AppLocation
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -54,6 +54,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
# be instanced by the base MediaManagerItem
|
# be instanced by the base MediaManagerItem
|
||||||
self.ListViewWithDnD_class = ImageListView
|
self.ListViewWithDnD_class = ImageListView
|
||||||
MediaManagerItem.__init__(self, parent, icon, title)
|
MediaManagerItem.__init__(self, parent, icon, title)
|
||||||
|
self.addToServiceItem = True
|
||||||
|
|
||||||
def initPluginNameVisible(self):
|
def initPluginNameVisible(self):
|
||||||
self.PluginNameVisible = translate(u'ImagePlugin.MediaItem', u'Image')
|
self.PluginNameVisible = translate(u'ImagePlugin.MediaItem', u'Image')
|
||||||
@ -73,7 +74,6 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
self.hasFileIcon = True
|
self.hasFileIcon = True
|
||||||
self.hasNewIcon = False
|
self.hasNewIcon = False
|
||||||
self.hasEditIcon = False
|
self.hasEditIcon = False
|
||||||
self.addToServiceItem = True
|
|
||||||
|
|
||||||
def initialise(self):
|
def initialise(self):
|
||||||
log.debug(u'initialise')
|
log.debug(u'initialise')
|
||||||
@ -93,7 +93,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
MediaManagerItem.addListViewToToolBar(self)
|
MediaManagerItem.addListViewToToolBar(self)
|
||||||
self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||||
self.ListView.addAction(
|
self.ListView.addAction(
|
||||||
contextMenuAction(
|
context_menu_action(
|
||||||
self.ListView, u':/slides/slide_blank.png',
|
self.ListView, u':/slides/slide_blank.png',
|
||||||
translate(u'ImagePlugin.MediaItem', u'Replace Live Background'),
|
translate(u'ImagePlugin.MediaItem', u'Replace Live Background'),
|
||||||
self.onReplaceClick))
|
self.onReplaceClick))
|
||||||
|
@ -29,7 +29,7 @@ import os
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
||||||
ItemCapabilities, SettingsManager, contextMenuAction, Receiver, translate
|
ItemCapabilities, SettingsManager, context_menu_action, Receiver, translate
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
MediaManagerItem.addListViewToToolBar(self)
|
MediaManagerItem.addListViewToToolBar(self)
|
||||||
self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||||
self.ListView.addAction(
|
self.ListView.addAction(
|
||||||
contextMenuAction(self.ListView, u':/slides/slide_blank.png',
|
context_menu_action(self.ListView, u':/slides/slide_blank.png',
|
||||||
translate(u'MediaPlugin.MediaItem', u'Replace Live Background'),
|
translate(u'MediaPlugin.MediaItem', u'Replace Live Background'),
|
||||||
self.onReplaceClick))
|
self.onReplaceClick))
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ class SongManager(object):
|
|||||||
settings = QtCore.QSettings()
|
settings = QtCore.QSettings()
|
||||||
settings.beginGroup(u'songs')
|
settings.beginGroup(u'songs')
|
||||||
self.db_url = u''
|
self.db_url = u''
|
||||||
db_type = unicode(settings.value(u'songs/db type',
|
db_type = unicode(settings.value(u'db type',
|
||||||
QtCore.QVariant(u'sqlite')).toString())
|
QtCore.QVariant(u'sqlite')).toString())
|
||||||
if db_type == u'sqlite':
|
if db_type == u'sqlite':
|
||||||
self.db_url = u'sqlite:///%s/songs.sqlite' % \
|
self.db_url = u'sqlite:///%s/songs.sqlite' % \
|
||||||
|
@ -333,7 +333,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
for verse in verseList:
|
for verse in verseList:
|
||||||
verseTag = u'%s:%s' % (
|
verseTag = u'%s:%s' % (
|
||||||
verse[0][u'type'], verse[0][u'label'])
|
verse[0][u'type'], 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]), verseTag)
|
||||||
else:
|
else:
|
||||||
#Loop through the verse list and expand the song accordingly.
|
#Loop through the verse list and expand the song accordingly.
|
||||||
@ -345,8 +345,8 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
verse[0][u'type'][0] == order[0]:
|
verse[0][u'type'][0] == order[0]:
|
||||||
verseTag = u'%s:%s' % \
|
verseTag = u'%s:%s' % \
|
||||||
(verse[0][u'type'], verse[0][u'label'])
|
(verse[0][u'type'], 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], verseTag)
|
||||||
else:
|
else:
|
||||||
verses = song.lyrics.split(u'\n\n')
|
verses = song.lyrics.split(u'\n\n')
|
||||||
for slide in verses:
|
for slide in verses:
|
||||||
|
Loading…
Reference in New Issue
Block a user