forked from openlp/openlp
Renderer replacement- text now outputs
This commit is contained in:
parent
f3b4a1dae5
commit
3d9fca212f
@ -205,9 +205,10 @@ class RenderManager(object):
|
|||||||
The text for the slide footer.
|
The text for the slide footer.
|
||||||
"""
|
"""
|
||||||
log.debug(u'generate slide')
|
log.debug(u'generate slide')
|
||||||
self.build_text_rectangle(self.themedata)
|
#self.build_text_rectangle(self.themedata)
|
||||||
self.renderer.set_frame_dest(self.width, self.height)
|
#self.renderer.set_frame_dest(self.width, self.height)
|
||||||
return self.renderer.generate_frame_from_lines(main_text, footer_text)
|
image = self.previewDisplay.preview(self.renderer.bg_image, main_text[0])
|
||||||
|
return image #self.renderer.generate_frame_from_lines(main_text, footer_text)
|
||||||
|
|
||||||
def calculate_default(self, screen):
|
def calculate_default(self, screen):
|
||||||
"""
|
"""
|
||||||
|
@ -171,15 +171,15 @@ class ServiceItem(object):
|
|||||||
self.render_manager.set_override_theme(None)
|
self.render_manager.set_override_theme(None)
|
||||||
else:
|
else:
|
||||||
self.render_manager.set_override_theme(self.theme)
|
self.render_manager.set_override_theme(self.theme)
|
||||||
format = self._display_frames[row][u'text'].split(u'\n')
|
raw_html = self._display_frames[row][u'text'].split(u'\n')
|
||||||
if self.cache.get(row):
|
if self.cache.get(row):
|
||||||
frame = self.cache[row]
|
frame = self.cache[row]
|
||||||
else:
|
else:
|
||||||
if format[0]:
|
if raw_html[0]:
|
||||||
frame = self.render_manager.generate_slide(format,
|
frame = self.render_manager.generate_slide(raw_html,
|
||||||
self.raw_footer)
|
self.raw_footer)
|
||||||
else:
|
else:
|
||||||
frame = self.render_manager.generate_slide(format, u'')
|
frame = self.render_manager.generate_slide(raw_html, u'')
|
||||||
self.cache[row] = frame
|
self.cache[row] = frame
|
||||||
return frame
|
return frame
|
||||||
|
|
||||||
|
@ -65,11 +65,13 @@ class DisplayManager(QtGui.QWidget):
|
|||||||
extra displays to be added.
|
extra displays to be added.
|
||||||
RenderManager is poked in by MainWindow
|
RenderManager is poked in by MainWindow
|
||||||
"""
|
"""
|
||||||
def __init__(self, screens):
|
def __init__(self, parent, screens):
|
||||||
QtGui.QWidget.__init__(self)
|
QtGui.QWidget.__init__(self)
|
||||||
|
self.parent = parent
|
||||||
self.screens = screens
|
self.screens = screens
|
||||||
self.audioPlayer = AudioPlayer(self)
|
self.audioPlayer = AudioPlayer(self)
|
||||||
self.mainDisplay = WebViewer(self, screens)
|
self.mainDisplay = WebViewer(self, screens, True)
|
||||||
|
self.previewDisplay = WebViewer(self, screens, False)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'maindisplay_hide'), self.hideDisplay)
|
QtCore.SIGNAL(u'maindisplay_hide'), self.hideDisplay)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
@ -83,12 +85,12 @@ class DisplayManager(QtGui.QWidget):
|
|||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
log.debug(u'mainDisplay - setup')
|
log.debug(u'mainDisplay - setup')
|
||||||
|
self.parent.RenderManager.previewDisplay = self.previewDisplay
|
||||||
#Build the initial frame.
|
#Build the initial frame.
|
||||||
self.initialFrame = QtGui.QImage(
|
self.initialFrame = QtGui.QImage(
|
||||||
self.screens.current[u'size'].width(),
|
self.screens.current[u'size'].width(),
|
||||||
self.screens.current[u'size'].height(),
|
self.screens.current[u'size'].height(),
|
||||||
QtGui.QImage.Format_ARGB32_Premultiplied)
|
QtGui.QImage.Format_ARGB32_Premultiplied)
|
||||||
print self.screens.current
|
|
||||||
splash_image = QtGui.QImage(u':/graphics/openlp-splash-screen.png')
|
splash_image = QtGui.QImage(u':/graphics/openlp-splash-screen.png')
|
||||||
painter_image = QtGui.QPainter()
|
painter_image = QtGui.QPainter()
|
||||||
painter_image.begin(self.initialFrame)
|
painter_image.begin(self.initialFrame)
|
||||||
@ -98,6 +100,7 @@ class DisplayManager(QtGui.QWidget):
|
|||||||
(self.screens.current[u'size'].height() - splash_image.height()) / 2,
|
(self.screens.current[u'size'].height() - splash_image.height()) / 2,
|
||||||
splash_image)
|
splash_image)
|
||||||
self.mainDisplay.setup()
|
self.mainDisplay.setup()
|
||||||
|
self.previewDisplay.setup()
|
||||||
self.mainDisplay.newDisplay(self.initialFrame, None, None)
|
self.mainDisplay.newDisplay(self.initialFrame, None, None)
|
||||||
self.mainDisplay.show()
|
self.mainDisplay.show()
|
||||||
|
|
||||||
@ -163,11 +166,14 @@ class DisplayWidget(QtGui.QGraphicsView):
|
|||||||
"""
|
"""
|
||||||
log.info(u'Display Widget loaded')
|
log.info(u'Display Widget loaded')
|
||||||
|
|
||||||
def __init__(self, parent=None, name=None):
|
def __init__(self, live, parent=None, name=None):
|
||||||
QtGui.QGraphicsView.__init__(self)
|
QtGui.QGraphicsView.__init__(self)
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
|
self.live = live
|
||||||
|
|
||||||
def keyPressEvent(self, event):
|
def keyPressEvent(self, event):
|
||||||
|
if not live:
|
||||||
|
return
|
||||||
if type(event) == QtGui.QKeyEvent:
|
if type(event) == QtGui.QKeyEvent:
|
||||||
#here accept the event and do something
|
#here accept the event and do something
|
||||||
if event.key() == QtCore.Qt.Key_Down:
|
if event.key() == QtCore.Qt.Key_Down:
|
||||||
@ -205,8 +211,8 @@ class DisplayWidget(QtGui.QGraphicsView):
|
|||||||
|
|
||||||
class WebViewer(DisplayWidget):
|
class WebViewer(DisplayWidget):
|
||||||
|
|
||||||
def __init__(self, parent, screens):
|
def __init__(self, parent, screens, live):
|
||||||
DisplayWidget.__init__(self, parent=None)
|
DisplayWidget.__init__(self, live, parent=None)
|
||||||
self.screens = screens
|
self.screens = screens
|
||||||
self.setWindowTitle(u'OpenLP Display')
|
self.setWindowTitle(u'OpenLP Display')
|
||||||
self.setWindowFlags(QtCore.Qt.FramelessWindowHint |
|
self.setWindowFlags(QtCore.Qt.FramelessWindowHint |
|
||||||
@ -285,13 +291,19 @@ class WebViewer(DisplayWidget):
|
|||||||
self.frame.setScrollBarPolicy(QtCore.Qt.Horizontal,
|
self.frame.setScrollBarPolicy(QtCore.Qt.Horizontal,
|
||||||
QtCore.Qt.ScrollBarAlwaysOff)
|
QtCore.Qt.ScrollBarAlwaysOff)
|
||||||
|
|
||||||
def preview(self):
|
def preview(self, image, text):
|
||||||
self.setVisible(False)
|
self.setVisible(False)
|
||||||
preview = QtGui.QImage(QtCore.QSize(640, 480), QtGui.QImage.Format_ARGB32_Premultiplied)
|
html = build_html(text, self.screen, None, image)
|
||||||
|
self.webView.setHtml(html)
|
||||||
|
self.frame.findFirstElement('div#lyrics').setInnerXml(text)
|
||||||
|
preview = QtGui.QImage(self.screen[u'size'].width(),
|
||||||
|
self.screen[u'size'].height(),
|
||||||
|
QtGui.QImage.Format_ARGB32_Premultiplied)
|
||||||
painter = QtGui.QPainter(preview)
|
painter = QtGui.QPainter(preview)
|
||||||
painter.setRenderHint(QtGui.QPainter.Antialiasing)
|
painter.setRenderHint(QtGui.QPainter.Antialiasing)
|
||||||
self.frame.render(painter)
|
self.frame.render(painter)
|
||||||
painter.end()
|
painter.end()
|
||||||
|
#save preview for debugging
|
||||||
preview.save("temp.png", "png")
|
preview.save("temp.png", "png")
|
||||||
return preview
|
return preview
|
||||||
|
|
||||||
|
@ -527,7 +527,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
self.songsSettingsSection = u'songs'
|
self.songsSettingsSection = u'songs'
|
||||||
self.serviceNotSaved = False
|
self.serviceNotSaved = False
|
||||||
self.settingsmanager = SettingsManager(screens)
|
self.settingsmanager = SettingsManager(screens)
|
||||||
self.displayManager = DisplayManager(screens)
|
self.displayManager = DisplayManager(self, screens)
|
||||||
self.aboutForm = AboutForm(self, applicationVersion)
|
self.aboutForm = AboutForm(self, applicationVersion)
|
||||||
self.settingsForm = SettingsForm(self.screens, self, self)
|
self.settingsForm = SettingsForm(self.screens, self, self)
|
||||||
self.recentFiles = QtCore.QStringList()
|
self.recentFiles = QtCore.QStringList()
|
||||||
|
@ -783,7 +783,8 @@ class SlideController(QtGui.QWidget):
|
|||||||
15, u'Slide Rendering took %4s' % (time.time() - before))
|
15, u'Slide Rendering took %4s' % (time.time() - before))
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
if self.serviceItem.is_text():
|
if self.serviceItem.is_text():
|
||||||
self.mainDisplay.frameView(frame, True)
|
pass
|
||||||
|
#self.mainDisplay.frameView(frame, True)
|
||||||
else:
|
else:
|
||||||
self.displayManager.displayImage(frame[u'main'])
|
self.displayManager.displayImage(frame[u'main'])
|
||||||
self.selectedRow = row
|
self.selectedRow = row
|
||||||
|
Loading…
Reference in New Issue
Block a user