forked from openlp/openlp
Fix themes and class names
This commit is contained in:
parent
feb3be1cb9
commit
68fa2c4791
@ -33,7 +33,7 @@ import logging
|
||||
import os
|
||||
import time
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import resize_image, image_to_byte
|
||||
|
||||
|
@ -58,6 +58,7 @@ class RenderManager(object):
|
||||
self.screens = screens
|
||||
self.image_manager = ImageManager()
|
||||
self.display = MainDisplay(self, screens, False)
|
||||
self.display.imageManager = self.image_manager
|
||||
self.display.setup()
|
||||
self.theme_manager = theme_manager
|
||||
self.renderer = Renderer()
|
||||
@ -76,6 +77,7 @@ class RenderManager(object):
|
||||
log.debug(u'Update Display')
|
||||
self.calculate_default(self.screens.current[u'size'])
|
||||
self.display = MainDisplay(self, self.screens, False)
|
||||
self.display.imageManager = self.image_manager
|
||||
self.display.setup()
|
||||
self.renderer.bg_frame = None
|
||||
self.themedata = None
|
||||
@ -214,7 +216,7 @@ class RenderManager(object):
|
||||
serviceItem.raw_footer = footer
|
||||
serviceItem.render(True)
|
||||
self.display.buildHtml(serviceItem)
|
||||
raw_html = serviceItem.get_rendered_frame(0)[1]
|
||||
raw_html = serviceItem.get_rendered_frame(0)
|
||||
preview = self.display.text(raw_html)
|
||||
# Reset the real screen size for subsequent render requests
|
||||
self.calculate_default(self.screens.current[u'size'])
|
||||
|
@ -30,7 +30,6 @@ type and capability of an item.
|
||||
|
||||
import logging
|
||||
import os
|
||||
import time
|
||||
import uuid
|
||||
|
||||
from PyQt4 import QtGui
|
||||
@ -164,7 +163,6 @@ class ServiceItem(object):
|
||||
if self.service_item_type == ServiceItemType.Text:
|
||||
log.debug(u'Formatting slides')
|
||||
for slide in self._raw_frames:
|
||||
before = time.time()
|
||||
formatted = self.render_manager \
|
||||
.format_slide(slide[u'raw_slide'], line_break)
|
||||
for page in formatted:
|
||||
@ -173,12 +171,8 @@ class ServiceItem(object):
|
||||
u'text': clean_tags(page.rstrip()),
|
||||
u'html': expand_tags(page.rstrip()),
|
||||
u'verseTag': slide[u'verseTag'] })
|
||||
log.log(15, u'Formatting took %4s' % (time.time() - before))
|
||||
elif self.service_item_type == ServiceItemType.Image:
|
||||
for slide in self._raw_frames:
|
||||
slide[u'image'] = resize_image(slide[u'image'],
|
||||
self.render_manager.width, self.render_manager.height)
|
||||
elif self.service_item_type == ServiceItemType.Command:
|
||||
elif self.service_item_type == ServiceItemType.Image or \
|
||||
self.service_item_type == ServiceItemType.Command:
|
||||
pass
|
||||
else:
|
||||
log.error(u'Invalid value renderer :%s' % self.service_item_type)
|
||||
@ -191,7 +185,7 @@ class ServiceItem(object):
|
||||
else:
|
||||
self.foot_text = u'%s<br>%s' % (self.foot_text, foot)
|
||||
|
||||
def add_from_image(self, path, title, image):
|
||||
def add_from_image(self, path, title):
|
||||
"""
|
||||
Add an image slide to the service item.
|
||||
|
||||
@ -200,13 +194,10 @@ class ServiceItem(object):
|
||||
|
||||
``title``
|
||||
A title for the slide in the service item.
|
||||
|
||||
``image``
|
||||
The actual image file name.
|
||||
"""
|
||||
self.service_item_type = ServiceItemType.Image
|
||||
self._raw_frames.append(
|
||||
{u'title': title, u'image': image, u'path': path})
|
||||
{u'title': title, u'path': path})
|
||||
self.render_manager.image_manager.add_image(title, path)
|
||||
self._new_item()
|
||||
|
||||
@ -310,8 +301,7 @@ class ServiceItem(object):
|
||||
elif self.service_item_type == ServiceItemType.Image:
|
||||
for text_image in serviceitem[u'serviceitem'][u'data']:
|
||||
filename = os.path.join(path, text_image)
|
||||
real_image = QtGui.QImage(unicode(filename))
|
||||
self.add_from_image(path, text_image, real_image)
|
||||
self.add_from_image(filename, text_image)
|
||||
elif self.service_item_type == ServiceItemType.Command:
|
||||
for text_image in serviceitem[u'serviceitem'][u'data']:
|
||||
filename = os.path.join(path, text_image[u'title'])
|
||||
@ -387,9 +377,9 @@ class ServiceItem(object):
|
||||
renders it if required.
|
||||
"""
|
||||
if self.service_item_type == ServiceItemType.Text:
|
||||
return None, self._display_frames[row][u'html'].split(u'\n')[0]
|
||||
return self._display_frames[row][u'html'].split(u'\n')[0]
|
||||
else:
|
||||
return self._raw_frames[row][u'title'], u''
|
||||
return self._raw_frames[row][u'title']
|
||||
|
||||
def get_frame_title(self, row=0):
|
||||
"""
|
||||
|
@ -229,8 +229,7 @@ class MainDisplay(DisplayWidget):
|
||||
"""
|
||||
API for replacement backgounds so Images are added directly to cache
|
||||
"""
|
||||
image = self.parent.parent.RenderManager.image_manager. \
|
||||
add_image(name, path)
|
||||
image = self.imageManager.add_image(name, path)
|
||||
self.image(name)
|
||||
|
||||
def image(self, name):
|
||||
@ -242,13 +241,13 @@ class MainDisplay(DisplayWidget):
|
||||
The Image to be displayed can be QImage or QPixmap
|
||||
"""
|
||||
log.debug(u'image to display')
|
||||
image = self.parent.parent.RenderManager.image_manager. \
|
||||
get_image_bytes(name)
|
||||
image = self.imageManager.get_image_bytes(name)
|
||||
self.resetVideo()
|
||||
self.displayImage(image)
|
||||
# show screen
|
||||
if self.isLive:
|
||||
self.setVisible(True)
|
||||
return self.preview()
|
||||
|
||||
def displayImage(self, image):
|
||||
"""
|
||||
@ -403,7 +402,7 @@ class MainDisplay(DisplayWidget):
|
||||
self.initialFrame = False
|
||||
self.serviceItem = serviceItem
|
||||
if self.serviceItem.themedata.background_filename:
|
||||
self.serviceItem.bg_image_bytes = self.parent.parent.RenderManager.image_manager. \
|
||||
self.serviceItem.bg_image_bytes = self.imageManager. \
|
||||
get_image_bytes(self.serviceItem.themedata.theme_name)
|
||||
html = build_html(self.serviceItem, self.screen, self.parent.alertTab,
|
||||
self.isLive)
|
||||
|
@ -401,6 +401,7 @@ class SlideController(QtGui.QWidget):
|
||||
log.debug(u'screenSizeChanged live = %s' % self.isLive)
|
||||
# rebuild display as screen size changed
|
||||
self.display = MainDisplay(self, self.screens, self.isLive)
|
||||
self.display.imageManager = self.parent.RenderManager.image_manager
|
||||
self.display.alertTab = self.alertTab
|
||||
self.ratio = float(self.screens.current[u'size'].width()) / \
|
||||
float(self.screens.current[u'size'].height())
|
||||
@ -779,15 +780,12 @@ class SlideController(QtGui.QWidget):
|
||||
[self.serviceItem, self.isLive, row])
|
||||
self.updatePreview()
|
||||
else:
|
||||
frame, raw_html = self.serviceItem.get_rendered_frame(row)
|
||||
toDisplay = self.serviceItem.get_rendered_frame(row)
|
||||
if self.serviceItem.is_text():
|
||||
frame = self.display.text(raw_html)
|
||||
frame = self.display.text(toDisplay)
|
||||
else:
|
||||
self.display.image(frame)
|
||||
if isinstance(frame, QtGui.QImage):
|
||||
self.SlidePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
|
||||
else:
|
||||
self.SlidePreview.setPixmap(QtGui.QPixmap(frame))
|
||||
frame = self.display.image(toDisplay)
|
||||
self.SlidePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
|
||||
self.selectedRow = row
|
||||
Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix,
|
||||
row)
|
||||
|
@ -167,7 +167,7 @@ class ImageMediaItem(MediaManagerItem):
|
||||
bitem = self.listView.item(item.row())
|
||||
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
|
||||
(path, name) = os.path.split(filename)
|
||||
service_item.add_from_image(filename, name, None)
|
||||
service_item.add_from_image(filename, name)
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
Loading…
Reference in New Issue
Block a user