mirror of https://gitlab.com/openlp/openlp.git
cleanups for merge
This commit is contained in:
parent
086cf2d814
commit
3698f4abd9
|
@ -183,7 +183,7 @@ def image_to_byte(image):
|
|||
else:
|
||||
pixmap = QtGui.QPixmap(image)
|
||||
pixmap.save(buffie, "PNG")
|
||||
#convert to base64 encoding so does not get missed!
|
||||
# convert to base64 encoding so does not get missed!
|
||||
return byte_array.toBase64()
|
||||
|
||||
def resize_image(image, width, height, background=QtCore.Qt.black):
|
||||
|
@ -201,7 +201,7 @@ def resize_image(image, width, height, background=QtCore.Qt.black):
|
|||
"""
|
||||
preview = QtGui.QImage(image)
|
||||
if not preview.isNull():
|
||||
#Only resize if different size
|
||||
# Only resize if different size
|
||||
if preview.width() == width and preview.height == height:
|
||||
return preview
|
||||
preview = preview.scaled(width, height, QtCore.Qt.KeepAspectRatio,
|
||||
|
|
|
@ -80,7 +80,6 @@ class Renderer(object):
|
|||
self.bg_image = None
|
||||
self._bg_image_filename = None
|
||||
self.theme_name = theme.theme_name
|
||||
#self._set_theme_font()
|
||||
if theme.background_type == u'image':
|
||||
if theme.background_filename:
|
||||
self.set_bg_image(theme.background_filename)
|
||||
|
@ -186,7 +185,7 @@ class Renderer(object):
|
|||
temp_text = temp_text + line + line_end
|
||||
html_text = shell % temp_text
|
||||
doc.setHtml(html_text)
|
||||
#Text too long so gone to next mage
|
||||
# Text too long so gone to next mage
|
||||
if layout.pageCount() != 1:
|
||||
formatted.append(shell % old_html_text)
|
||||
temp_text = line
|
||||
|
@ -195,126 +194,17 @@ class Renderer(object):
|
|||
log.debug(u'format_slide - End')
|
||||
return formatted
|
||||
|
||||
# def pre_render_text(self, text):
|
||||
# metrics = QtGui.QFontMetrics(self.main_font)
|
||||
# #work out line width
|
||||
# line_width = self._rect.width()
|
||||
# #number of lines on a page - adjust for rounding up.
|
||||
# line_height = metrics.height()
|
||||
# if self._theme.display_shadow:
|
||||
# line_height += int(self._theme.display_shadow_size)
|
||||
# if self._theme.display_outline:
|
||||
# # pixels top/bottom
|
||||
# line_height += 2 * int(self._theme.display_outline_size)
|
||||
# page_length = int(self._rect.height() / line_height )
|
||||
# #Average number of characters in line
|
||||
# ave_line_width = line_width / metrics.averageCharWidth()
|
||||
# #Maximum size of a character
|
||||
# max_char_width = metrics.maxWidth()
|
||||
# #Max characters pre line based on min size of a character
|
||||
# char_per_line = line_width / metrics.width(u'i')
|
||||
# log.debug(u'Page Length area height %s , metrics %s , lines %s' %
|
||||
# (int(self._rect.height()), metrics.height(), page_length ))
|
||||
# split_pages = []
|
||||
# page = []
|
||||
# split_lines = []
|
||||
# count = 0
|
||||
# for line in text:
|
||||
# #Must be a blank line so keep it.
|
||||
# if len(line) == 0:
|
||||
# line = u' '
|
||||
# while line:
|
||||
# pos = char_per_line
|
||||
# split_text = line[:pos]
|
||||
# #line needs splitting
|
||||
# if metrics.width(split_text, -1) > line_width:
|
||||
# #We have no spaces
|
||||
# if split_text.find(u' ') == -1:
|
||||
# #Move back 1 char at a time till it fits
|
||||
# while metrics.width(split_text, -1) > line_width:
|
||||
# split_text = split_text[:-1]
|
||||
# pos = len(split_text)
|
||||
# else:
|
||||
# #We have spaces so split at previous one
|
||||
# while metrics.width(split_text, -1) > line_width:
|
||||
# pos = split_text.rfind(u' ')
|
||||
# #no more spaces and we are still too long
|
||||
# if pos == -1:
|
||||
# while \
|
||||
# metrics.width(split_text, -1) > line_width:
|
||||
# split_text = split_text[:-1]
|
||||
# pos = len(split_text)
|
||||
# else:
|
||||
# split_text = line[:pos]
|
||||
# split_lines.append(split_text)
|
||||
# line = line[pos:].lstrip()
|
||||
# #if we have more text add up to 10 spaces on the front.
|
||||
# if line and self._theme.font_main_indentation > 0:
|
||||
# line = u'%s%s' % \
|
||||
# (u' '[:int(self._theme.font_main_indentation)],
|
||||
# line)
|
||||
# #Text fits in a line now
|
||||
# for count, line in enumerate(split_lines):
|
||||
# page.append(line)
|
||||
# #last but one line and only 2 lines to go or end of page
|
||||
# if (len(page) == page_length - 1 and
|
||||
# len(split_lines) - 3 == count) or \
|
||||
# len(page) == page_length:
|
||||
# split_pages.append(page)
|
||||
# page = []
|
||||
# if page and page != u' ':
|
||||
# split_pages.append(page)
|
||||
# return split_pages
|
||||
#
|
||||
# def generate_frame_from_lines(self, lines, footer_lines=None):
|
||||
# """
|
||||
# Render a set of lines according to the theme, and return the block
|
||||
# dimensions.
|
||||
#
|
||||
# ``lines``
|
||||
# The lines to be rendered.
|
||||
#
|
||||
# ``footer_lines``
|
||||
# Defaults to *None*. The footer to render.
|
||||
# """
|
||||
# log.debug(u'generate_frame_from_lines - Start')
|
||||
# bbox = self._render_lines_unaligned(lines, False)
|
||||
# if footer_lines:
|
||||
# bbox1 = self._render_lines_unaligned(footer_lines, True)
|
||||
# # reset the frame. first time do not worry about what you paint on.
|
||||
# self.frame = QtGui.QImage(self.bg_frame)
|
||||
# if self._theme.display_slideTransition:
|
||||
# self.frame_opaque = QtGui.QImage(self.bg_frame)
|
||||
# x, y = self._correct_alignment(self._rect, bbox)
|
||||
# bbox = self._render_lines_unaligned(lines, False, (x, y), True)
|
||||
# if footer_lines:
|
||||
# bbox = self._render_lines_unaligned(footer_lines, True,
|
||||
# (self._rect_footer.left(), self._rect_footer.top()), True)
|
||||
# log.debug(u'generate_frame_from_lines - Finish')
|
||||
# if self._theme.display_slideTransition:
|
||||
# return {u'main':self.frame, u'trans':self.frame_opaque}
|
||||
# else:
|
||||
# return {u'main':self.frame, u'trans':None}
|
||||
|
||||
def _generate_background_frame(self):
|
||||
"""
|
||||
Generate a background frame to the same size as the frame to be used.
|
||||
Results are cached for performance reasons.
|
||||
"""
|
||||
assert(self._theme)
|
||||
# if self._theme.background_mode == u'transparent':
|
||||
# self.bg_frame = \
|
||||
# QtGui.QPixmap(self.frame.width(), self.frame.height())
|
||||
# self.bg_frame.fill(QtCore.Qt.transparent)
|
||||
# else:
|
||||
self.bg_frame = QtGui.QImage(self.frame.width(),
|
||||
self.frame.height(), QtGui.QImage.Format_ARGB32_Premultiplied)
|
||||
log.debug(u'render background %s start', self._theme.background_type)
|
||||
painter = QtGui.QPainter()
|
||||
painter.begin(self.bg_frame)
|
||||
# if self._theme.background_mode == u'transparent':
|
||||
# painter.fillRect(self.frame.rect(), QtCore.Qt.transparent)
|
||||
# else:
|
||||
if self._theme.background_type == u'solid':
|
||||
painter.fillRect(self.frame.rect(),
|
||||
QtGui.QColor(self._theme.background_color))
|
||||
|
@ -324,13 +214,11 @@ class Renderer(object):
|
|||
if self._theme.background_direction == u'horizontal':
|
||||
w = int(self.frame.width()) / 2
|
||||
# vertical
|
||||
gradient = QtGui.QLinearGradient(w, 0, w,
|
||||
self.frame.height())
|
||||
gradient = QtGui.QLinearGradient(w, 0, w, self.frame.height())
|
||||
elif self._theme.background_direction == u'vertical':
|
||||
h = int(self.frame.height()) / 2
|
||||
# Horizontal
|
||||
gradient = QtGui.QLinearGradient(0, h, self.frame.width(),
|
||||
h)
|
||||
gradient = QtGui.QLinearGradient(0, h, self.frame.width(), h)
|
||||
else:
|
||||
w = int(self.frame.width()) / 2
|
||||
h = int(self.frame.height()) / 2
|
||||
|
@ -356,273 +244,3 @@ class Renderer(object):
|
|||
if self.bg_image:
|
||||
painter.drawImage(0, 0, self.bg_image)
|
||||
painter.end()
|
||||
log.debug(u'render background End')
|
||||
|
||||
# def _correct_alignment(self, rect, bbox):
|
||||
# """
|
||||
# Corrects the vertical alignment of text.
|
||||
#
|
||||
# ``rect``
|
||||
# The block dimentions.
|
||||
#
|
||||
# ``bbox``
|
||||
# Footer dimensions?
|
||||
# """
|
||||
# x = rect.left()
|
||||
# if self._theme.display_verticalAlign == 0:
|
||||
# # top align
|
||||
# y = rect.top()
|
||||
# elif self._theme.display_verticalAlign == 2:
|
||||
# # bottom align
|
||||
# y = rect.bottom() - bbox.height()
|
||||
# elif self._theme.display_verticalAlign == 1:
|
||||
# # centre align
|
||||
# y = rect.top() + (rect.height() - bbox.height()) / 2
|
||||
# else:
|
||||
# log.error(u'Invalid value for theme.VerticalAlign:%s',
|
||||
# self._theme.display_verticalAlign)
|
||||
# return x, y
|
||||
#
|
||||
# def _render_lines_unaligned(self, lines, footer, tlcorner=(0, 0),
|
||||
# live=False):
|
||||
# """
|
||||
# Given a list of lines to render, render each one in turn (using the
|
||||
# ``_render_single_line`` fn - which may result in going off the bottom).
|
||||
# They are expected to be pre-arranged to less than a screenful (eg. by
|
||||
# using split_set_of_lines).
|
||||
#
|
||||
# Returns the bounding box of the text as QRect.
|
||||
#
|
||||
# ``lines``
|
||||
# The lines of text to render.
|
||||
#
|
||||
# ``footer``
|
||||
# The slide footer.
|
||||
#
|
||||
# ``tlcorner``
|
||||
# Defaults to *``(0, 0)``*. Co-ordinates of the top left corner.
|
||||
#
|
||||
# ``live``
|
||||
# Defaults to *False*. Whether or not this is a live screen.
|
||||
# """
|
||||
# x, y = tlcorner
|
||||
# brx = x
|
||||
# bry = y
|
||||
# for line in lines:
|
||||
# # render after current bottom, but at original left edge
|
||||
# # keep track of right edge to see which is biggest
|
||||
# (thisx, bry) = self._render_and_wrap_single_line(line, footer,
|
||||
# (x, bry), live)
|
||||
# if (thisx > brx):
|
||||
# brx = thisx
|
||||
# retval = QtCore.QRect(x, y, brx - x, bry - y)
|
||||
# if self._debug:
|
||||
# painter = QtGui.QPainter()
|
||||
# painter.begin(self.frame)
|
||||
# painter.setPen(QtGui.QPen(QtGui.QColor(0, 0, 255)))
|
||||
# painter.drawRect(retval)
|
||||
# painter.end()
|
||||
# return retval
|
||||
#
|
||||
# def _render_and_wrap_single_line(self, line, footer, tlcorner=(0, 0),
|
||||
# live=False):
|
||||
# """
|
||||
# Render a single line of words onto the DC, top left corner specified.
|
||||
# If the line is too wide for the context, it wraps, but right-aligns
|
||||
# the surplus words in the manner of song lyrics.
|
||||
#
|
||||
# Returns the bottom-right corner (of what was rendered) as a tuple(x, y).
|
||||
#
|
||||
# ``line``
|
||||
# Line of text to be rendered.
|
||||
#
|
||||
# ``footer``
|
||||
# The footer of the slide.
|
||||
#
|
||||
# ``tlcorner``
|
||||
# Defaults to *``(0, 0)``*. The top left corner.
|
||||
#
|
||||
# ``live``
|
||||
# Defaults to *False*. Whether or not this is a live screen.
|
||||
# """
|
||||
# x, y = tlcorner
|
||||
# maxx = self._rect.width()
|
||||
# maxy = self._rect.height()
|
||||
# lines = []
|
||||
# lines.append(line)
|
||||
# startx = x
|
||||
# starty = y
|
||||
# rightextent = None
|
||||
# self.painter = QtGui.QPainter()
|
||||
# self.painter.begin(self.frame)
|
||||
# self.painter.setRenderHint(QtGui.QPainter.Antialiasing)
|
||||
# if self._theme.display_slideTransition:
|
||||
# self.painter2 = QtGui.QPainter()
|
||||
# self.painter2.begin(self.frame_opaque)
|
||||
# self.painter2.setRenderHint(QtGui.QPainter.Antialiasing)
|
||||
# self.painter2.setOpacity(0.7)
|
||||
# # dont allow alignment messing with footers
|
||||
# if footer:
|
||||
# align = 0
|
||||
# display_shadow_size = self._display_shadow_size_footer
|
||||
# display_outline_size = self._display_outline_size_footer
|
||||
# else:
|
||||
# align = self._theme.display_horizontalAlign
|
||||
# display_shadow_size = int(self._theme.display_shadow_size)
|
||||
# display_outline_size = int(self._theme.display_outline_size)
|
||||
# for linenum in range(len(lines)):
|
||||
# line = lines[linenum]
|
||||
# #find out how wide line is
|
||||
# w, h = self._get_extent_and_render(line, footer, tlcorner=(x, y),
|
||||
# draw=False)
|
||||
# if self._theme.display_shadow:
|
||||
# w += display_shadow_size
|
||||
# h += display_shadow_size
|
||||
# if self._theme.display_outline:
|
||||
# # pixels either side
|
||||
# w += 2 * display_outline_size
|
||||
# # pixels top/bottom
|
||||
# h += 2 * display_outline_size
|
||||
# if align == 0: # left align
|
||||
# rightextent = x + w
|
||||
# # shift right from last line's rh edge
|
||||
# if self._theme.display_wrapStyle == 1 and linenum != 0:
|
||||
# rightextent = self._first_line_right_extent
|
||||
# if rightextent > maxx:
|
||||
# rightextent = maxx
|
||||
# x = rightextent - w
|
||||
# # right align
|
||||
# elif align == 1:
|
||||
# rightextent = maxx
|
||||
# x = maxx - w
|
||||
# # centre
|
||||
# elif align == 2:
|
||||
# x = (maxx - w) / 2
|
||||
# rightextent = x + w
|
||||
# if live:
|
||||
# # now draw the text, and any outlines/shadows
|
||||
# if self._theme.display_shadow:
|
||||
# self._get_extent_and_render(line, footer,
|
||||
# tlcorner=(x + display_shadow_size,
|
||||
# y + display_shadow_size),
|
||||
# draw=True, color=self._theme.display_shadow_color)
|
||||
# self._get_extent_and_render(line, footer, tlcorner=(x, y),
|
||||
# draw=True, outline_size=display_outline_size)
|
||||
# y += h
|
||||
# if linenum == 0:
|
||||
# self._first_line_right_extent = rightextent
|
||||
# # draw a box around the text - debug only
|
||||
#
|
||||
# if self._debug:
|
||||
# self.painter.setPen(QtGui.QPen(QtGui.QColor(0, 255, 0)))
|
||||
# self.painter.drawRect(startx, starty, rightextent-startx, y-starty)
|
||||
# brcorner = (rightextent, y)
|
||||
# self.painter.end()
|
||||
# if self._theme.display_slideTransition:
|
||||
# self.painter2.end()
|
||||
# return brcorner
|
||||
#
|
||||
# def _set_theme_font(self):
|
||||
# """
|
||||
# Set the fonts from the current theme settings.
|
||||
# """
|
||||
# footer_weight = 50
|
||||
# if self._theme.font_footer_weight == u'Bold':
|
||||
# footer_weight = 75
|
||||
# #TODO Add myfont.setPixelSize((screen_height / 100) * font_size)
|
||||
# self.footer_font = QtGui.QFont(self._theme.font_footer_name,
|
||||
# self._theme.font_footer_proportion, # size
|
||||
# footer_weight, # weight
|
||||
# self._theme.font_footer_italics) # italic
|
||||
# self.footer_font.setPixelSize(self._theme.font_footer_proportion)
|
||||
# main_weight = 50
|
||||
# if self._theme.font_main_weight == u'Bold':
|
||||
# main_weight = 75
|
||||
# self.main_font = QtGui.QFont(self._theme.font_main_name,
|
||||
# self._theme.font_main_proportion, # size
|
||||
# main_weight, # weight
|
||||
# self._theme.font_main_italics)# italic
|
||||
# self.main_font.setPixelSize(self._theme.font_main_proportion)
|
||||
#
|
||||
# def _get_extent_and_render(self, line, footer, tlcorner=(0, 0), draw=False,
|
||||
# color=None, outline_size=0):
|
||||
# """
|
||||
# Find bounding box of text - as render_single_line. If draw is set,
|
||||
# actually draw the text to the current DC as well return width and
|
||||
# height of text as a tuple (w, h).
|
||||
#
|
||||
# ``line``
|
||||
# The line of text to render.
|
||||
#
|
||||
# ``footer``
|
||||
# The footer text.
|
||||
#
|
||||
# ``tlcorner``
|
||||
# Defaults to *``(0, 0)``*. The top left corner co-ordinates.
|
||||
#
|
||||
# ``draw``
|
||||
# Defaults to *False*. Draw the text to the current surface.
|
||||
#
|
||||
# ``color``
|
||||
# Defaults to *None*. The colour to draw with.
|
||||
# """
|
||||
# # setup defaults
|
||||
# if footer:
|
||||
# font = self.footer_font
|
||||
# else:
|
||||
# font = self.main_font
|
||||
# metrics = QtGui.QFontMetrics(font)
|
||||
# w = metrics.width(line)
|
||||
# if footer:
|
||||
# h = metrics.height()
|
||||
# else:
|
||||
# h = metrics.height() + int(self._theme.font_main_line_adjustment)
|
||||
# if draw:
|
||||
# self.painter.setFont(font)
|
||||
# if color is None:
|
||||
# if footer:
|
||||
# pen = QtGui.QColor(self._theme.font_footer_color)
|
||||
# else:
|
||||
# pen = QtGui.QColor(self._theme.font_main_color)
|
||||
# else:
|
||||
# pen = QtGui.QColor(color)
|
||||
# x, y = tlcorner
|
||||
# rowpos = y + metrics.ascent()
|
||||
# if self._theme.display_outline and outline_size != 0 and not footer:
|
||||
# path = QtGui.QPainterPath()
|
||||
# path.addText(QtCore.QPointF(x, rowpos), font, line)
|
||||
# self.painter.setBrush(self.painter.pen().brush())
|
||||
# self.painter.setPen(QtGui.QPen(QtGui.QColor(
|
||||
# self._theme.display_outline_color), outline_size))
|
||||
# self.painter.drawPath(path)
|
||||
# self.painter.setPen(pen)
|
||||
# self.painter.drawText(x, rowpos, line)
|
||||
# if self._theme.display_slideTransition:
|
||||
# # Print 2nd image with 70% weight
|
||||
# if self._theme.display_outline and outline_size != 0 and \
|
||||
# not footer:
|
||||
# path = QtGui.QPainterPath()
|
||||
# path.addText(QtCore.QPointF(x, rowpos), font, line)
|
||||
# self.painter2.setBrush(self.painter2.pen().brush())
|
||||
# self.painter2.setPen(QtGui.QPen(
|
||||
# QtGui.QColor(self._theme.display_outline_color),
|
||||
# outline_size))
|
||||
# self.painter2.drawPath(path)
|
||||
# self.painter2.setFont(font)
|
||||
# self.painter2.setPen(pen)
|
||||
# self.painter2.drawText(x, rowpos, line)
|
||||
# return (w, h)
|
||||
#
|
||||
# def snoop_image(self, image, image2=None):
|
||||
# """
|
||||
# Debugging method to allow images to be viewed.
|
||||
#
|
||||
# ``image``
|
||||
# An image to save to disk.
|
||||
#
|
||||
# ``image2``
|
||||
# Defaults to *None*. Another image to save to disk.
|
||||
# """
|
||||
# image.save(u'renderer.png', u'png')
|
||||
# if image2:
|
||||
# image2.save(u'renderer2.png', u'png')
|
||||
|
|
|
@ -71,43 +71,44 @@ class RenderManager(object):
|
|||
# TODO make external and configurable in alpha 4
|
||||
self.html_expands = []
|
||||
|
||||
self.html_expands.append({u'desc':u'Red',u'start tag':u'{r}', \
|
||||
self.html_expands.append({u'desc':u'Red', u'start tag':u'{r}', \
|
||||
u'start html':u'<font color=red>', \
|
||||
u'end tag':u'{/r}', u'end html':u'</font>', \
|
||||
u'protected':False})
|
||||
self.html_expands.append({u'desc':u'Black',u'start tag':u'{b}', \
|
||||
self.html_expands.append({u'desc':u'Black', u'start tag':u'{b}', \
|
||||
u'start html':u'<font color=black>', \
|
||||
u'end tag':u'{/b}', u'end html':u'</font>', \
|
||||
u'protected':False})
|
||||
self.html_expands.append({u'desc':u'Blue',u'start tag':u'{bl}', \
|
||||
self.html_expands.append({u'desc':u'Blue', u'start tag':u'{bl}', \
|
||||
u'start html':u'<font color=blue>', \
|
||||
u'end tag':u'{/bl}', u'end html':u'</font>', \
|
||||
u'protected':False})
|
||||
self.html_expands.append({u'desc':u'Yellow',u'start tag':u'{y}', \
|
||||
self.html_expands.append({u'desc':u'Yellow', u'start tag':u'{y}', \
|
||||
u'start html':u'<font color=yellow>', \
|
||||
u'end tag':u'{/y}', u'end html':u'</font>', \
|
||||
u'protected':False})
|
||||
self.html_expands.append({u'desc':u'Green',u'start tag':u'{g}', \
|
||||
self.html_expands.append({u'desc':u'Green', u'start tag':u'{g}', \
|
||||
u'start html':u'<font color=green>', \
|
||||
u'end tag':u'{/g}', u'end html':u'</font>', \
|
||||
u'protected':False})
|
||||
self.html_expands.append({u'desc':u'Superscript',u'start tag':u'{su}', \
|
||||
self.html_expands.append({u'desc':u'Superscript', u'start tag':u'{su}', \
|
||||
u'start html':u'<sup>', \
|
||||
u'end tag':u'{/su}', u'end html':u'</sup>', \
|
||||
u'protected':True})
|
||||
self.html_expands.append({u'desc':u'Subscript',u'start tag':u'{sb}', \
|
||||
self.html_expands.append({u'desc':u'Subscript', u'start tag':u'{sb}', \
|
||||
u'start html':u'<sub>', \
|
||||
u'end tag':u'{/sb}', u'end html':u'</sub>', \
|
||||
u'protected':True})
|
||||
self.html_expands.append({u'desc':u'Paragraph',u'start tag':u'{p}', \
|
||||
self.html_expands.append({u'desc':u'Paragraph', u'start tag':u'{p}', \
|
||||
u'start html':u'<p>', \
|
||||
u'end tag':u'{/p}', u'end html':u'</p>', \
|
||||
u'protected':True})
|
||||
self.html_expands.append({u'desc':u'Bold',u'start tag':u'{st}', \
|
||||
self.html_expands.append({u'desc':u'Bold', u'start tag':u'{st}', \
|
||||
u'start html':u'<strong>', \
|
||||
u'end tag':u'{/st}', u'end html':u'</strong>', \
|
||||
u'end tag':u'{/st}', \
|
||||
u'end html':u'</strong>', \
|
||||
u'protected':True})
|
||||
self.html_expands.append({u'desc':u'Italics',u'start tag':u'{it}', \
|
||||
self.html_expands.append({u'desc':u'Italics', u'start tag':u'{it}', \
|
||||
u'start html':u'<em>', \
|
||||
u'end tag':u'{/it}', u'end html':u'</em>', \
|
||||
u'protected':True})
|
||||
|
@ -262,20 +263,6 @@ class RenderManager(object):
|
|||
self.build_text_rectangle(self.themedata)
|
||||
return self.renderer.format_slide(words, line_break)
|
||||
|
||||
# def generate_slide(self, main_text):
|
||||
# """
|
||||
# Generate the actual slide image.
|
||||
#
|
||||
# ``main_text``
|
||||
# The text for the main area of the slide.
|
||||
# """
|
||||
# log.debug(u'generate slide')
|
||||
# self.build_text_rectangle(self.themedata)
|
||||
# self.renderer.set_frame_dest(self.width, self.height)
|
||||
# image = self.previewDisplay.preview(self.renderer.bg_frame,
|
||||
# main_text[0], self.themedata)
|
||||
# return image
|
||||
|
||||
def calculate_default(self, screen):
|
||||
"""
|
||||
Calculate the default dimentions of the screen.
|
||||
|
@ -304,10 +291,9 @@ class RenderManager(object):
|
|||
|
||||
def expand(self, text):
|
||||
"""
|
||||
Expand tags fto HTML for display
|
||||
Expand tags HTML for display
|
||||
"""
|
||||
for tag in self.html_expands:
|
||||
text = text.replace(tag[u'start tag'], tag[u'start html'])
|
||||
text = text.replace(tag[u'end tag'], tag[u'end html'])
|
||||
return text
|
||||
|
||||
|
|
|
@ -100,6 +100,11 @@ class ServiceItem(object):
|
|||
self.bg_frame = None
|
||||
|
||||
def _new_item(self):
|
||||
"""
|
||||
Method to set the internal id of the item
|
||||
This is used to compare service items to see if they are
|
||||
the same
|
||||
"""
|
||||
self._uuid = unicode(uuid.uuid1())
|
||||
|
||||
def add_capability(self, capability):
|
||||
|
|
|
@ -661,12 +661,6 @@ class Ui_AmendThemeDialog(object):
|
|||
translate('OpenLP.AmendThemeForm', 'Theme Maintenance'))
|
||||
self.themeNameLabel.setText(
|
||||
translate('OpenLP.AmendThemeForm', 'Theme &name:'))
|
||||
# self.backgroundLabel.setText(
|
||||
# translate('OpenLP.AmendThemeForm', '&Visibility:'))
|
||||
# self.backgroundComboBox.setItemText(0,
|
||||
# translate('OpenLP.AmendThemeForm', 'Opaque'))
|
||||
# self.backgroundComboBox.setItemText(1,
|
||||
# translate('OpenLP.AmendThemeForm', 'Transparent'))
|
||||
self.backgroundTypeLabel.setText(
|
||||
translate('OpenLP.AmendThemeForm', 'Type:'))
|
||||
self.backgroundTypeComboBox.setItemText(0,
|
||||
|
@ -700,8 +694,6 @@ class Ui_AmendThemeDialog(object):
|
|||
translate('OpenLP.AmendThemeForm', 'Size:'))
|
||||
self.fontMainSizeSpinBox.setSuffix(
|
||||
translate('OpenLP.AmendThemeForm', 'pt'))
|
||||
# self.fontMainWrapIndentationLabel.setText(
|
||||
# translate('OpenLP.AmendThemeForm', 'Wrap indentation:'))
|
||||
self.fontMainWrapLineAdjustmentLabel.setText(
|
||||
translate('OpenLP.AmendThemeForm', 'Adjust line spacing:'))
|
||||
self.fontMainWeightComboBox.setItemText(0,
|
||||
|
|
|
@ -50,7 +50,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||
self.path = None
|
||||
self.theme = ThemeXML()
|
||||
self.setupUi(self)
|
||||
# define signals
|
||||
# Buttons
|
||||
QtCore.QObject.connect(self.color1PushButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onColor1PushButtonClicked)
|
||||
|
@ -68,8 +67,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||
QtCore.QObject.connect(self.imageToolButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onImageToolButtonClicked)
|
||||
# Combo boxes
|
||||
# QtCore.QObject.connect(self.backgroundComboBox,
|
||||
# QtCore.SIGNAL(u'activated(int)'), self.onBackgroundComboBoxSelected)
|
||||
QtCore.QObject.connect(self.backgroundTypeComboBox,
|
||||
QtCore.SIGNAL(u'activated(int)'),
|
||||
self.onBackgroundTypeComboBoxSelected)
|
||||
|
@ -109,9 +106,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||
QtCore.QObject.connect(self.fontMainLineAdjustmentSpinBox,
|
||||
QtCore.SIGNAL(u'editingFinished()'),
|
||||
self.onFontMainLineAdjustmentSpinBoxChanged)
|
||||
# QtCore.QObject.connect(self.fontMainLineSpacingSpinBox,
|
||||
# QtCore.SIGNAL(u'editingFinished()'),
|
||||
# self.onFontMainLineSpacingSpinBoxChanged)
|
||||
QtCore.QObject.connect(self.fontFooterXSpinBox,
|
||||
QtCore.SIGNAL(u'editingFinished()'),
|
||||
self.onFontFooterXSpinBoxChanged)
|
||||
|
@ -151,9 +145,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||
new_theme.new_document(theme_name)
|
||||
save_from = None
|
||||
save_to = None
|
||||
# if self.theme.background_mode == u'transparent':
|
||||
# new_theme.add_background_transparent()
|
||||
# else:
|
||||
if self.theme.background_type == u'solid':
|
||||
new_theme.add_background_solid(
|
||||
unicode(self.theme.background_color))
|
||||
|
@ -281,8 +272,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||
self.fontMainHeightSpinBox.setValue(self.theme.font_main_height)
|
||||
self.fontMainLineAdjustmentSpinBox.setValue(
|
||||
self.theme.font_main_line_adjustment)
|
||||
# self.fontMainLineSpacingSpinBox.setValue(
|
||||
# self.theme.font_main_indentation)
|
||||
self.stateChanging(self.theme)
|
||||
self.previewTheme()
|
||||
|
||||
|
@ -308,13 +297,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||
self.fontMainLineAdjustmentSpinBox.value()
|
||||
self.previewTheme()
|
||||
|
||||
# def onFontMainLineSpacingSpinBoxChanged(self):
|
||||
# if self.theme.font_main_indentation != \
|
||||
# self.fontMainLineSpacingSpinBox.value():
|
||||
# self.theme.font_main_indentation = \
|
||||
# self.fontMainLineSpacingSpinBox.value()
|
||||
# self.previewTheme()
|
||||
|
||||
def onFontMainHeightSpinBoxChanged(self):
|
||||
if self.theme.font_main_height != self.fontMainHeightSpinBox.value():
|
||||
self.theme.font_main_height = self.fontMainHeightSpinBox.value()
|
||||
|
@ -408,14 +390,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||
self.setBackground(self.backgroundTypeComboBox.currentIndex(),
|
||||
currentIndex)
|
||||
|
||||
# def onBackgroundComboBoxSelected(self, currentIndex):
|
||||
# if currentIndex == 0: # Opaque
|
||||
# self.theme.background_mode = u'opaque'
|
||||
# else:
|
||||
# self.theme.background_mode = u'transparent'
|
||||
# self.stateChanging(self.theme)
|
||||
# self.previewTheme()
|
||||
|
||||
def onBackgroundTypeComboBoxSelected(self, currentIndex):
|
||||
self.setBackground(currentIndex, self.gradientComboBox.currentIndex())
|
||||
|
||||
|
@ -541,10 +515,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||
self.stateChanging(theme)
|
||||
self.themeNameEdit.setText(self.theme.theme_name)
|
||||
# Background Tab
|
||||
# if self.theme.background_mode == u'opaque':
|
||||
# self.backgroundComboBox.setCurrentIndex(0)
|
||||
# else:
|
||||
# self.backgroundComboBox.setCurrentIndex(1)
|
||||
self.imageLineEdit.setText(u'')
|
||||
if theme.background_type == u'solid':
|
||||
self.backgroundTypeComboBox.setCurrentIndex(0)
|
||||
|
@ -574,8 +544,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||
self.fontMainWeightComboBox.setCurrentIndex(2)
|
||||
else:
|
||||
self.fontMainWeightComboBox.setCurrentIndex(3)
|
||||
# self.fontMainLineSpacingSpinBox.setValue(
|
||||
# self.theme.font_main_indentation)
|
||||
self.fontMainXSpinBox.setValue(self.theme.font_main_x)
|
||||
self.fontMainYSpinBox.setValue(self.theme.font_main_y)
|
||||
self.fontMainWidthSpinBox.setValue(self.theme.font_main_width)
|
||||
|
@ -639,19 +607,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||
self.verticalComboBox.setCurrentIndex(self.theme.display_verticalAlign)
|
||||
|
||||
def stateChanging(self, theme):
|
||||
# if theme.background_mode == u'transparent':
|
||||
# self.color1Label.setVisible(False)
|
||||
# self.color1PushButton.setVisible(False)
|
||||
# self.color2Label.setVisible(False)
|
||||
# self.color2PushButton.setVisible(False)
|
||||
# self.imageLabel.setVisible(False)
|
||||
# self.imageLineEdit.setVisible(False)
|
||||
# self.imageFilenameWidget.setVisible(False)
|
||||
# self.gradientLabel.setVisible(False)
|
||||
# self.gradientComboBox.setVisible(False)
|
||||
# self.backgroundTypeComboBox.setVisible(False)
|
||||
# self.backgroundTypeLabel.setVisible(False)
|
||||
# else:
|
||||
self.backgroundTypeComboBox.setVisible(True)
|
||||
self.backgroundTypeLabel.setVisible(True)
|
||||
if theme.background_type == u'solid':
|
||||
|
|
|
@ -957,7 +957,6 @@ class SlideController(QtGui.QWidget):
|
|||
"""
|
||||
log.debug(u'SlideController mediaVolume')
|
||||
self.volume = self.volumeSlider.value()
|
||||
print self.volume
|
||||
self.display.videoVolume(self.volume)
|
||||
|
||||
def onMediaPause(self):
|
||||
|
|
Loading…
Reference in New Issue