forked from openlp/openlp
Move towards sorting out renderer text sizes
This commit is contained in:
parent
ee8a92b77f
commit
85bada91ba
@ -226,7 +226,6 @@ class Renderer(object):
|
|||||||
"""
|
"""
|
||||||
self._rect = rect_main
|
self._rect = rect_main
|
||||||
self._rect_footer = rect_footer
|
self._rect_footer = rect_footer
|
||||||
print "render = ", self._rect
|
|
||||||
|
|
||||||
def generate_frame_from_lines(self, lines, footer_lines=None):
|
def generate_frame_from_lines(self, lines, footer_lines=None):
|
||||||
"""
|
"""
|
||||||
@ -245,6 +244,7 @@ class Renderer(object):
|
|||||||
bbox1 = self._render_lines_unaligned(footer_lines, True)
|
bbox1 = self._render_lines_unaligned(footer_lines, True)
|
||||||
# reset the frame. first time do not worry about what you paint on.
|
# reset the frame. first time do not worry about what you paint on.
|
||||||
self._frame = QtGui.QImage(self.bg_frame)
|
self._frame = QtGui.QImage(self.bg_frame)
|
||||||
|
print "generate ", self._frame.size()
|
||||||
self._frameOp = QtGui.QImage(self.bg_frame)
|
self._frameOp = QtGui.QImage(self.bg_frame)
|
||||||
x, y = self._correctAlignment(self._rect, bbox)
|
x, y = self._correctAlignment(self._rect, bbox)
|
||||||
bbox = self._render_lines_unaligned(lines, False, (x, y), True)
|
bbox = self._render_lines_unaligned(lines, False, (x, y), True)
|
||||||
|
@ -83,6 +83,7 @@ class RenderManager(object):
|
|||||||
self.current_display = screen_number
|
self.current_display = screen_number
|
||||||
self.calculate_default(
|
self.calculate_default(
|
||||||
self.screen_list[self.current_display][u'size'])
|
self.screen_list[self.current_display][u'size'])
|
||||||
|
self.renderer.bg_frame = None
|
||||||
|
|
||||||
def set_global_theme(self, global_theme, theme_level=ThemeLevel.Global):
|
def set_global_theme(self, global_theme, theme_level=ThemeLevel.Global):
|
||||||
"""
|
"""
|
||||||
@ -141,7 +142,7 @@ class RenderManager(object):
|
|||||||
self.screen_list[self.current_display][u'size'])
|
self.screen_list[self.current_display][u'size'])
|
||||||
self.renderer.set_theme(self.themedata)
|
self.renderer.set_theme(self.themedata)
|
||||||
self.build_text_rectangle(self.themedata)
|
self.build_text_rectangle(self.themedata)
|
||||||
#Replace the backgrount image from renderer with one from image
|
#Replace the background image from renderer with one from image
|
||||||
if self.override_background:
|
if self.override_background:
|
||||||
if self.save_bg_frame is None:
|
if self.save_bg_frame is None:
|
||||||
self.save_bg_frame = self.renderer.bg_frame
|
self.save_bg_frame = self.renderer.bg_frame
|
||||||
@ -182,6 +183,7 @@ class RenderManager(object):
|
|||||||
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,
|
||||||
theme.font_footer_height - 1)
|
theme.font_footer_height - 1)
|
||||||
|
print "build_text_rectangle", main_rect
|
||||||
self.renderer.set_text_rectangle(main_rect, footer_rect)
|
self.renderer.set_text_rectangle(main_rect, footer_rect)
|
||||||
|
|
||||||
def generate_preview(self, themedata):
|
def generate_preview(self, themedata):
|
||||||
@ -235,6 +237,7 @@ class RenderManager(object):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'generate slide')
|
log.debug(u'generate slide')
|
||||||
self.build_text_rectangle(self.themedata)
|
self.build_text_rectangle(self.themedata)
|
||||||
|
print "set_frame_dest", self.width, self.height
|
||||||
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)
|
return self.renderer.generate_frame_from_lines(main_text, footer_text)
|
||||||
|
|
||||||
@ -253,3 +256,4 @@ class RenderManager(object):
|
|||||||
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)
|
||||||
|
print "calculate_default ", self.width, self.height, self.footer_start
|
||||||
|
@ -90,22 +90,16 @@ class MainDisplay(DisplayWidget):
|
|||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.setWindowTitle(u'OpenLP Display')
|
self.setWindowTitle(u'OpenLP Display')
|
||||||
self.screens = screens
|
self.screens = screens
|
||||||
# self.layout = QtGui.QVBoxLayout(self)
|
|
||||||
# self.layout.setSpacing(0)
|
|
||||||
# self.layout.setMargin(0)
|
|
||||||
# self.layout.setObjectName(u'layout')
|
|
||||||
self.mediaObject = Phonon.MediaObject(self)
|
self.mediaObject = Phonon.MediaObject(self)
|
||||||
self.video = Phonon.VideoWidget()
|
self.video = Phonon.VideoWidget()
|
||||||
self.video.setVisible(False)
|
self.video.setVisible(False)
|
||||||
self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject)
|
self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject)
|
||||||
Phonon.createPath(self.mediaObject, self.video)
|
Phonon.createPath(self.mediaObject, self.video)
|
||||||
Phonon.createPath(self.mediaObject, self.audio)
|
Phonon.createPath(self.mediaObject, self.audio)
|
||||||
#self.layout.insertWidget(0, self.video)
|
|
||||||
self.display = QtGui.QLabel(self)
|
self.display = QtGui.QLabel(self)
|
||||||
self.display.setScaledContents(True)
|
self.display.setScaledContents(True)
|
||||||
self.alertDisplay = QtGui.QLabel(self)
|
self.alertDisplay = QtGui.QLabel(self)
|
||||||
self.alertDisplay.setScaledContents(True)
|
self.alertDisplay.setScaledContents(True)
|
||||||
#self.layout.insertWidget(0, self.display)
|
|
||||||
self.primary = True
|
self.primary = True
|
||||||
self.displayBlank = False
|
self.displayBlank = False
|
||||||
self.blankFrame = None
|
self.blankFrame = None
|
||||||
@ -150,7 +144,21 @@ class MainDisplay(DisplayWidget):
|
|||||||
if scrn[u'number'] == screenNumber:
|
if scrn[u'number'] == screenNumber:
|
||||||
self.screen = scrn
|
self.screen = scrn
|
||||||
break
|
break
|
||||||
self.setScreenGeometry()
|
#Sort out screen locations and sizes
|
||||||
|
print "--------- Set screen geom ------------"
|
||||||
|
print "display ", self.screen[u'size']
|
||||||
|
self.setGeometry(self.screen[u'size'])
|
||||||
|
print "main geom", self.geometry()
|
||||||
|
print "display geom 1", self.display.geometry()
|
||||||
|
self.alertScreenPosition = self.screen[u'size'].height() * 0.9
|
||||||
|
self.alertHeight = self.screen[u'size'].height() - self.alertScreenPosition
|
||||||
|
self.alertDisplay.setGeometry(
|
||||||
|
QtCore.QRect(0, self.alertScreenPosition,
|
||||||
|
self.screen[u'size'].width(),self.alertHeight))
|
||||||
|
self.video.setGeometry(self.screen[u'size'])
|
||||||
|
self.display.resize(self.screen[u'size'].width(),
|
||||||
|
self.screen[u'size'].height())
|
||||||
|
print "display geom 2", self.display.geometry()
|
||||||
#Build a custom splash screen
|
#Build a custom splash screen
|
||||||
self.InitialFrame = QtGui.QImage(
|
self.InitialFrame = QtGui.QImage(
|
||||||
self.screen[u'size'].width(),
|
self.screen[u'size'].width(),
|
||||||
@ -172,7 +180,7 @@ class MainDisplay(DisplayWidget):
|
|||||||
self.screen[u'size'].height(),
|
self.screen[u'size'].height(),
|
||||||
QtGui.QImage.Format_ARGB32_Premultiplied)
|
QtGui.QImage.Format_ARGB32_Premultiplied)
|
||||||
painter.begin(self.blankFrame)
|
painter.begin(self.blankFrame)
|
||||||
painter.fillRect(self.blankFrame.rect(), QtCore.Qt.black)
|
painter.fillRect(self.blankFrame.rect(), QtCore.Qt.red)
|
||||||
#buid a blank transparent image
|
#buid a blank transparent image
|
||||||
self.transparent = QtGui.QPixmap(self.screen[u'size'].width(),
|
self.transparent = QtGui.QPixmap(self.screen[u'size'].width(),
|
||||||
self.screen[u'size'].height())
|
self.screen[u'size'].height())
|
||||||
@ -185,25 +193,6 @@ class MainDisplay(DisplayWidget):
|
|||||||
self.setVisible(False)
|
self.setVisible(False)
|
||||||
self.primary = True
|
self.primary = True
|
||||||
|
|
||||||
def setScreenGeometry(self):
|
|
||||||
"""
|
|
||||||
Define and set up the display sizes.
|
|
||||||
The alert displays are set to 10% of the screen as the video display
|
|
||||||
is unable to handle transparent pixmaps. This is a problem with QT.
|
|
||||||
"""
|
|
||||||
print "--------- Set screen geom ------------"
|
|
||||||
print "display ", self.screen[u'size']
|
|
||||||
print "main geom before ", self.geometry()
|
|
||||||
self.setGeometry(self.screen[u'size'])
|
|
||||||
print "main geom after ", self.geometry()
|
|
||||||
print "display geom", self.display.geometry()
|
|
||||||
self.alertScreenPosition = self.screen[u'size'].height() * 0.9
|
|
||||||
self.alertHeight = self.screen[u'size'].height() - self.alertScreenPosition
|
|
||||||
self.alertDisplay.setGeometry(
|
|
||||||
QtCore.QRect(0, self.alertScreenPosition,
|
|
||||||
self.screen[u'size'].width(),self.alertHeight))
|
|
||||||
self.video.setGeometry(self.screen[u'size'])
|
|
||||||
|
|
||||||
def resetDisplay(self):
|
def resetDisplay(self):
|
||||||
if self.primary:
|
if self.primary:
|
||||||
self.setVisible(False)
|
self.setVisible(False)
|
||||||
@ -222,27 +211,31 @@ class MainDisplay(DisplayWidget):
|
|||||||
``frame``
|
``frame``
|
||||||
Image frame to be rendered
|
Image frame to be rendered
|
||||||
"""
|
"""
|
||||||
if self.timer_id != 0 :
|
# if self.timer_id != 0 :
|
||||||
self.displayAlert()
|
# self.displayAlert()
|
||||||
elif not self.displayBlank:
|
print "render display start ", self.display.geometry()
|
||||||
|
if not self.displayBlank:
|
||||||
if transition:
|
if transition:
|
||||||
if self.hasTransition:
|
if self.frame is not None:
|
||||||
print len(self.frame[u'trans'])
|
print "render frame 1 ", self.frame.size()
|
||||||
if self.frame[u'trans'] is not None:
|
self.display.setPixmap(QtGui.QPixmap.fromImage(self.frame))
|
||||||
self.display.setPixmap(QtGui.QPixmap.fromImage(self.frame[u'trans']))
|
self.repaint()
|
||||||
self.repaint()
|
self.frame = None
|
||||||
if frame[u'trans'] is not None:
|
if frame[u'trans'] is not None:
|
||||||
self.display.setPixmap(QtGui.QPixmap.fromImage(frame[u'trans']))
|
print "render frame 2 ", frame[u'trans'].size()
|
||||||
self.repaint()
|
self.display.setPixmap(QtGui.QPixmap.fromImage(frame[u'trans']))
|
||||||
self.hasTransition = True
|
self.repaint()
|
||||||
|
self.frame = frame[u'trans']
|
||||||
|
print "render frame 3 ", frame[u'main'].size()
|
||||||
self.display.setPixmap(QtGui.QPixmap.fromImage(frame[u'main']))
|
self.display.setPixmap(QtGui.QPixmap.fromImage(frame[u'main']))
|
||||||
self.repaint()
|
self.repaint()
|
||||||
else:
|
else:
|
||||||
|
print "render frame 3 ", frame.size()
|
||||||
self.display.setPixmap(QtGui.QPixmap.fromImage(frame))
|
self.display.setPixmap(QtGui.QPixmap.fromImage(frame))
|
||||||
if not self.isVisible():
|
if not self.isVisible():
|
||||||
self.setVisible(True)
|
self.setVisible(True)
|
||||||
self.showFullScreen()
|
self.showFullScreen()
|
||||||
self.frame = frame
|
print "render display end ", self.display.geometry()
|
||||||
|
|
||||||
def blankDisplay(self, blanked=True):
|
def blankDisplay(self, blanked=True):
|
||||||
if blanked:
|
if blanked:
|
||||||
|
Loading…
Reference in New Issue
Block a user