diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py
index 5970efd4f..37d1de79c 100644
--- a/openlp/core/lib/imagemanager.py
+++ b/openlp/core/lib/imagemanager.py
@@ -112,17 +112,29 @@ class PriorityQueue(Queue.PriorityQueue):
"""
Customised ``Queue.PriorityQueue``.
"""
- def remove(self, item):
+ def modify_priority(self, image, new_priority):
"""
- Removes the given ``item`` from the queue.
+ Modifies the priority of the given ``image``.
- ``item``
- The item to remove. This should be a tuple::
+ ``image``
+ The image to remove. This should be an ``Image`` instance.
- ``(Priority, Image)``
+ ``new_priority``
+ The image's new priority.
"""
- if item in self.queue:
- self.queue.remove(item)
+ self.remove(image)
+ image.priority = new_priority
+ self.put((image.priority, image))
+
+ def remove(self, image):
+ """
+ Removes the given ``image`` from the queue.
+
+ ``image``
+ The image to remove. This should be an ``Image`` instance.
+ """
+ if (image.priority, image) in self.queue:
+ self.queue.remove((image.priority, image))
class ImageManager(QtCore.QObject):
@@ -168,12 +180,16 @@ class ImageManager(QtCore.QObject):
log.debug(u'get_image %s' % name)
image = self._cache[name]
if image.image is None:
- self._conversion_queue.remove((image.priority, image))
- image.priority = Priority.High
- self._conversion_queue.put((image.priority, image))
+ self._conversion_queue.modify_priority(image, Priority.High)
while image.image is None:
log.debug(u'get_image - waiting')
time.sleep(0.1)
+ elif image.image_bytes is None:
+ # Set the priority to Low, because the image was requested but the
+ # byte stream was not generated yet. However, we only need to do
+ # this, when the image was generated before it was requested
+ # (otherwise this is already taken care of).
+ self._conversion_queue.modify_priority(image, Priority.Low)
return image.image
def get_image_bytes(self, name):
@@ -184,9 +200,7 @@ class ImageManager(QtCore.QObject):
log.debug(u'get_image_bytes %s' % name)
image = self._cache[name]
if image.image_bytes is None:
- self._conversion_queue.remove((image.priority, image))
- image.priority = Priority.Urgent
- self._conversion_queue.put((image.priority, image))
+ self._conversion_queue.modify_priority(image, Priority.Urgent)
while image.image_bytes is None:
log.debug(u'get_image_bytes - waiting')
time.sleep(0.1)
@@ -198,8 +212,7 @@ class ImageManager(QtCore.QObject):
"""
log.debug(u'del_image %s' % name)
if name in self._cache:
- self._conversion_queue.remove(
- (self._cache[name].priority, self._cache[name]))
+ self._conversion_queue.remove(self._cache[name])
del self._cache[name]
def add_image(self, name, path):
@@ -238,18 +251,14 @@ class ImageManager(QtCore.QObject):
# Set the priority to Lowest and stop here as we need to process
# more important images first.
if image.priority == Priority.Normal:
- self._conversion_queue.remove((image.priority, image))
- image.priority = Priority.Lowest
- self._conversion_queue.put((image.priority, image))
+ self._conversion_queue.modify_priority(image, Priority.Lowest)
return
# For image with high priority we set the priority to Low, as the
# byte stream might be needed earlier the byte stream of image with
# Normal priority. We stop here as we need to process more important
# images first.
elif image.priority == Priority.High:
- self._conversion_queue.remove((image.priority, image))
- image.priority = Priority.Low
- self._conversion_queue.put((image.priority, image))
+ self._conversion_queue.modify_priority(image, Priority.Low)
return
# Generate the byte stream for the image.
if image.image_bytes is None:
diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py
index ad762e326..1245988b4 100644
--- a/openlp/core/lib/serviceitem.py
+++ b/openlp/core/lib/serviceitem.py
@@ -35,7 +35,7 @@ import logging
import os
import uuid
-from openlp.core.lib import build_icon, clean_tags, expand_tags
+from openlp.core.lib import build_icon, clean_tags, expand_tags, translate
from openlp.core.lib.ui import UiStrings
log = logging.getLogger(__name__)
@@ -352,6 +352,9 @@ class ServiceItem(object):
Updates the _uuid with the value from the original one
The _uuid is unique for a given service item but this allows one to
replace an original version.
+
+ ``other``
+ The service item to be merged with
"""
self._uuid = other._uuid
self.notes = other.notes
@@ -447,10 +450,12 @@ class ServiceItem(object):
start = None
end = None
if self.start_time != 0:
- start = UiStrings().StartTimeCode % \
+ start = unicode(translate('OpenLP.ServiceItem',
+ 'Start: %s')) % \
unicode(datetime.timedelta(seconds=self.start_time))
if self.media_length != 0:
- end = UiStrings().LengthTime % \
+ end = unicode(translate('OpenLP.ServiceItem',
+ 'Length: %s')) % \
unicode(datetime.timedelta(seconds=self.media_length))
if not start and not end:
return None
@@ -459,5 +464,16 @@ class ServiceItem(object):
elif not start and end:
return end
else:
- return u'%s : %s' % (start, end)
+ return u'%s
%s' % (start, end)
+
+ def update_theme(self, theme):
+ """
+ updates the theme in the service item
+
+ ``theme``
+ The new theme to be replaced in the service item
+ """
+ self.theme = theme
+ self._new_item()
+ self.render()
diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py
index 973c76660..756df36c3 100644
--- a/openlp/core/lib/ui.py
+++ b/openlp/core/lib/ui.py
@@ -83,7 +83,6 @@ class UiStrings(object):
self.Image = translate('OpenLP.Ui', 'Image')
self.Import = translate('OpenLP.Ui', 'Import')
self.LayoutStyle = translate('OpenLP.Ui', 'Layout style:')
- self.LengthTime = unicode(translate('OpenLP.Ui', 'Length %s'))
self.Live = translate('OpenLP.Ui', 'Live')
self.LiveBGError = translate('OpenLP.Ui', 'Live Background Error')
self.LiveToolbar = translate('OpenLP.Ui', 'Live Toolbar')
@@ -103,6 +102,8 @@ class UiStrings(object):
self.OpenLPStart = translate('OpenLP.Ui', 'OpenLP is already running. '
'Do you wish to continue?')
self.OpenService = translate('OpenLP.Ui', 'Open service.')
+ self.PlaySlidesInLoop = translate('OpenLP.Ui','Play Slides in Loop')
+ self.PlaySlidesToEnd = translate('OpenLP.Ui','Play Slides to End')
self.Preview = translate('OpenLP.Ui', 'Preview')
self.PrintService = translate('OpenLP.Ui', 'Print Service')
self.ReplaceBG = translate('OpenLP.Ui', 'Replace Background')
@@ -124,6 +125,10 @@ class UiStrings(object):
self.SplitToolTip = translate('OpenLP.Ui', 'Split a slide into two '
'only if it does not fit on the screen as one slide.')
self.StartTimeCode = unicode(translate('OpenLP.Ui', 'Start %s'))
+ self.StopPlaySlidesInLoop = translate('OpenLP.Ui',
+ 'Stop Play Slides in Loop')
+ self.StopPlaySlidesToEnd = translate('OpenLP.Ui',
+ 'Stop Play Slides to End')
self.Theme = translate('OpenLP.Ui', 'Theme', 'Singular')
self.Themes = translate('OpenLP.Ui', 'Themes', 'Plural')
self.Tools = translate('OpenLP.Ui', 'Tools')
diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py
index 6a34dc1e6..f6c069525 100644
--- a/openlp/core/ui/servicemanager.py
+++ b/openlp/core/ui/servicemanager.py
@@ -956,7 +956,19 @@ class ServiceManager(QtGui.QWidget):
treewidgetitem.setIcon(0,
build_icon(u':/general/general_delete.png'))
treewidgetitem.setText(0, serviceitem.get_display_title())
- treewidgetitem.setToolTip(0, serviceitem.notes)
+ tips = []
+ if serviceitem.theme and serviceitem.theme != -1:
+ tips.append(u'%s: %s' %
+ (unicode(translate('OpenLP.ServiceManager', 'Slide theme')),
+ serviceitem.theme))
+ if serviceitem.notes:
+ tips.append(u'%s: %s' %
+ (unicode(translate('OpenLP.ServiceManager', 'Notes')),
+ unicode(serviceitem.notes)))
+ if item[u'service_item'] \
+ .is_capable(ItemCapabilities.AllowsVariableStartTime):
+ tips.append(item[u'service_item'].get_media_time())
+ treewidgetitem.setToolTip(0, u'
'.join(tips))
treewidgetitem.setData(0, QtCore.Qt.UserRole,
QtCore.QVariant(item[u'order']))
treewidgetitem.setSelected(item[u'selected'])
@@ -966,11 +978,6 @@ class ServiceManager(QtGui.QWidget):
text = frame[u'title'].replace(u'\n', u' ')
child.setText(0, text[:40])
child.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(count))
- if item[u'service_item'] \
- .is_capable(ItemCapabilities.AllowsVariableStartTime):
- tip = item[u'service_item'].get_media_time()
- if tip:
- child.setToolTip(0, tip)
if serviceItem == itemcount:
if item[u'expanded'] and serviceItemChild == count:
self.serviceManagerList.setCurrentItem(child)
@@ -1338,7 +1345,7 @@ class ServiceManager(QtGui.QWidget):
if not theme:
theme = None
item = self.findServiceItem()[0]
- self.serviceItems[item][u'service_item'].theme = theme
+ self.serviceItems[item][u'service_item'].update_theme(theme)
self.regenerateServiceItems()
def _getParentItemData(self, item):
diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py
index ac3505d12..9d35c1166 100644
--- a/openlp/core/ui/slidecontroller.py
+++ b/openlp/core/ui/slidecontroller.py
@@ -28,12 +28,13 @@
import logging
import os
import time
+import copy
from PyQt4 import QtCore, QtGui
from PyQt4.phonon import Phonon
from openlp.core.lib import OpenLPToolbar, Receiver, ItemCapabilities, \
- translate
+ translate, build_icon
from openlp.core.lib.ui import UiStrings, shortcut_action
from openlp.core.ui import HideMode, MainDisplay, ScreenList
from openlp.core.utils.actions import ActionList, CategoryOrder
@@ -194,13 +195,11 @@ class SlideController(QtGui.QWidget):
self.playSlidesLoop = shortcut_action(self.playSlidesMenu,
u'playSlidesLoop', [], self.onPlaySlidesLoop,
u':/media/media_time.png', False, UiStrings().LiveToolbar)
- self.playSlidesLoop.setText(
- translate('OpenLP.SlideController', 'Play Slides in Loop'))
+ self.playSlidesLoop.setText(UiStrings().PlaySlidesInLoop)
self.playSlidesOnce = shortcut_action(self.playSlidesMenu,
u'playSlidesOnce', [], self.onPlaySlidesOnce,
u':/media/media_time.png', False, UiStrings().LiveToolbar)
- self.playSlidesOnce.setText(
- translate('OpenLP.SlideController', 'Play Slides to End'))
+ self.playSlidesOnce.setText(UiStrings().PlaySlidesToEnd)
if QtCore.QSettings().value(self.parent().generalSettingsSection +
u'/enable slide loop', QtCore.QVariant(True)).toBool():
self.playSlidesMenu.setDefaultAction(self.playSlidesLoop)
@@ -600,7 +599,8 @@ class SlideController(QtGui.QWidget):
log.debug(u'processManagerItem live = %s' % self.isLive)
self.onStopLoop()
old_item = self.serviceItem
- self.serviceItem = serviceItem
+ # take a copy not a link to the servicemeanager copy.
+ self.serviceItem = copy.copy(serviceItem)
if old_item and self.isLive and old_item.is_capable(
ItemCapabilities.ProvidesOwnDisplay):
self._resetBlank()
@@ -1059,6 +1059,14 @@ class SlideController(QtGui.QWidget):
else:
self.playSlidesLoop.setChecked(checked)
log.debug(u'onPlaySlidesLoop %s' % checked)
+ if checked:
+ self.playSlidesLoop.setIcon(build_icon(u':/media/media_stop.png'))
+ self.playSlidesLoop.setText(UiStrings().StopPlaySlidesInLoop)
+ self.playSlidesOnce.setIcon(build_icon(u':/media/media_time.png'))
+ self.playSlidesOnce.setText(UiStrings().PlaySlidesToEnd)
+ else:
+ self.playSlidesLoop.setIcon(build_icon(u':/media/media_time.png'))
+ self.playSlidesLoop.setText(UiStrings().PlaySlidesInLoop)
self.playSlidesMenu.setDefaultAction(self.playSlidesLoop)
self.playSlidesOnce.setChecked(False)
self.onToggleLoop()
@@ -1072,6 +1080,14 @@ class SlideController(QtGui.QWidget):
else:
self.playSlidesOnce.setChecked(checked)
log.debug(u'onPlaySlidesOnce %s' % checked)
+ if checked:
+ self.playSlidesOnce.setIcon(build_icon(u':/media/media_stop.png'))
+ self.playSlidesOnce.setText(UiStrings().StopPlaySlidesToEnd)
+ self.playSlidesLoop.setIcon(build_icon(u':/media/media_time.png'))
+ self.playSlidesLoop.setText(UiStrings().PlaySlidesInLoop)
+ else:
+ self.playSlidesOnce.setIcon(build_icon(u':/media/media_time'))
+ self.playSlidesOnce.setText(UiStrings().PlaySlidesToEnd)
self.playSlidesMenu.setDefaultAction(self.playSlidesOnce)
self.playSlidesLoop.setChecked(False)
self.onToggleLoop()
diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py
index 8a46b75c4..510905fa8 100644
--- a/openlp/plugins/bibles/lib/http.py
+++ b/openlp/plugins/bibles/lib/http.py
@@ -145,7 +145,10 @@ class BGExtract(object):
send_error_message(u'download')
return None
page_source = page.read()
- page_source = unicode(page_source, 'utf8')
+ try:
+ page_source = unicode(page_source, u'utf8')
+ except UnicodeDecodeError:
+ page_source = unicode(page_source, u'cp1251')
page_source_temp = re.search(u'