forked from openlp/openlp
Head r1866
This commit is contained in:
commit
71e0075e69
@ -129,10 +129,10 @@ sup {
|
||||
var match = /-webkit-text-fill-color:[^;\"]+/gi;
|
||||
if(timer != null)
|
||||
clearTimeout(timer);
|
||||
/*
|
||||
QtWebkit bug with outlines and justify causing outline alignment
|
||||
problems. (Bug 859950) Surround each word with a <span> to workaround,
|
||||
but only in this scenario.
|
||||
/*
|
||||
QtWebkit bug with outlines and justify causing outline alignment
|
||||
problems. (Bug 859950) Surround each word with a <span> to workaround,
|
||||
but only in this scenario.
|
||||
*/
|
||||
var txt = document.getElementById('lyricsmain');
|
||||
if(window.getComputedStyle(txt).textAlign == 'justify'){
|
||||
@ -141,7 +141,7 @@ sup {
|
||||
txt = outline;
|
||||
if(window.getComputedStyle(txt).webkitTextStrokeWidth != '0px'){
|
||||
newtext = newtext.replace(/(\s| )+(?![^<]*>)/g,
|
||||
function(match) {
|
||||
function(match) {
|
||||
return '</span>' + match + '<span>';
|
||||
});
|
||||
newtext = '<span>' + newtext + '</span>';
|
||||
@ -288,6 +288,9 @@ def build_background_css(item, width, height):
|
||||
background = u'background-color: black'
|
||||
if theme:
|
||||
if theme.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Transparent):
|
||||
background = u''
|
||||
elif theme.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Solid):
|
||||
background = u'background-color: %s' % theme.background_color
|
||||
else:
|
||||
|
@ -100,6 +100,7 @@ class BackgroundType(object):
|
||||
Solid = 0
|
||||
Gradient = 1
|
||||
Image = 2
|
||||
Transparent = 3
|
||||
|
||||
@staticmethod
|
||||
def to_string(background_type):
|
||||
@ -112,6 +113,8 @@ class BackgroundType(object):
|
||||
return u'gradient'
|
||||
elif background_type == BackgroundType.Image:
|
||||
return u'image'
|
||||
elif background_type == BackgroundType.Transparent:
|
||||
return u'transparent'
|
||||
|
||||
@staticmethod
|
||||
def from_string(type_string):
|
||||
@ -124,6 +127,8 @@ class BackgroundType(object):
|
||||
return BackgroundType.Gradient
|
||||
elif type_string == u'image':
|
||||
return BackgroundType.Image
|
||||
elif type_string == u'transparent':
|
||||
return BackgroundType.Transparent
|
||||
|
||||
|
||||
class BackgroundGradientType(object):
|
||||
@ -246,7 +251,7 @@ class ThemeXML(object):
|
||||
Add a transparent background.
|
||||
"""
|
||||
background = self.theme_xml.createElement(u'background')
|
||||
background.setAttribute(u'mode', u'transparent')
|
||||
background.setAttribute(u'type', u'transparent')
|
||||
self.theme.appendChild(background)
|
||||
|
||||
def add_background_solid(self, bkcolor):
|
||||
@ -487,25 +492,25 @@ class ThemeXML(object):
|
||||
return
|
||||
xml_iter = theme_xml.getiterator()
|
||||
for element in xml_iter:
|
||||
parent = element.getparent()
|
||||
master = u''
|
||||
if element.tag == u'background':
|
||||
if element.attrib:
|
||||
for attr in element.attrib:
|
||||
self._create_attr(element.tag, attr, \
|
||||
element.attrib[attr])
|
||||
parent = element.getparent()
|
||||
if parent is not None:
|
||||
if element.getparent().tag == u'font':
|
||||
master = element.getparent().tag + u'_' + \
|
||||
element.getparent().attrib[u'type']
|
||||
if parent.tag == u'font':
|
||||
master = parent.tag + u'_' + parent.attrib[u'type']
|
||||
# set up Outline and Shadow Tags and move to font_main
|
||||
if element.getparent().tag == u'display':
|
||||
if parent.tag == u'display':
|
||||
if element.tag.startswith(u'shadow') or \
|
||||
element.tag.startswith(u'outline'):
|
||||
self._create_attr(u'font_main', element.tag,
|
||||
element.text)
|
||||
master = element.getparent().tag
|
||||
if element.getparent().tag == u'background':
|
||||
master = element.getparent().tag
|
||||
if element.getparent().attrib:
|
||||
for attr in element.getparent().attrib:
|
||||
self._create_attr(master, attr, \
|
||||
element.getparent().attrib[attr])
|
||||
master = parent.tag
|
||||
if parent.tag == u'background':
|
||||
master = parent.tag
|
||||
if master:
|
||||
self._create_attr(master, element.tag, element.text)
|
||||
if element.attrib:
|
||||
@ -599,9 +604,13 @@ class ThemeXML(object):
|
||||
self.background_start_color,
|
||||
self.background_end_color,
|
||||
self.background_direction)
|
||||
else:
|
||||
elif self.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Image):
|
||||
filename = os.path.split(self.background_filename)[1]
|
||||
self.add_background_image(filename, self.background_border_color)
|
||||
elif self.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Transparent):
|
||||
self.add_background_transparent()
|
||||
self.add_font(self.font_main_name,
|
||||
self.font_main_color,
|
||||
self.font_main_size,
|
||||
|
@ -28,6 +28,7 @@
|
||||
The :mod:`maindisplay` module provides the functionality to display screens
|
||||
and play multimedia within OpenLP.
|
||||
"""
|
||||
import cgi
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
@ -36,7 +37,7 @@ from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL
|
||||
from PyQt4.phonon import Phonon
|
||||
|
||||
from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \
|
||||
translate, PluginManager
|
||||
translate, PluginManager, expand_tags
|
||||
|
||||
from openlp.core.ui import HideMode, ScreenList, AlertLocation
|
||||
|
||||
@ -81,6 +82,10 @@ class Display(QtGui.QGraphicsView):
|
||||
self.screen[u'size'].width(), self.screen[u'size'].height())
|
||||
self.webView.settings().setAttribute(
|
||||
QtWebKit.QWebSettings.PluginsEnabled, True)
|
||||
palette = self.webView.palette()
|
||||
palette.setBrush(QtGui.QPalette.Base, QtCore.Qt.transparent)
|
||||
self.webView.page().setPalette(palette)
|
||||
self.webView.setAttribute(QtCore.Qt.WA_OpaquePaintEvent, False)
|
||||
self.page = self.webView.page()
|
||||
self.frame = self.page.mainFrame()
|
||||
if self.isLive and log.getEffectiveLevel() == logging.DEBUG:
|
||||
@ -138,6 +143,7 @@ class MainDisplay(Display):
|
||||
windowFlags = windowFlags | QtCore.Qt.SplashScreen
|
||||
self.setWindowFlags(windowFlags)
|
||||
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
|
||||
self.setAttribute(QtCore.Qt.WA_TranslucentBackground, True)
|
||||
if self.isLive:
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'live_display_hide'), self.hideDisplay)
|
||||
@ -236,16 +242,17 @@ class MainDisplay(Display):
|
||||
The text to be displayed.
|
||||
"""
|
||||
log.debug(u'alert to display')
|
||||
# First we convert <>& marks to html variants, then apply
|
||||
# formattingtags, finally we double all backslashes for JavaScript.
|
||||
text_prepared = expand_tags(cgi.escape(text)) \
|
||||
.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"')
|
||||
if self.height() != self.screen[u'size'].height() or \
|
||||
not self.isVisible():
|
||||
shrink = True
|
||||
js = u'show_alert("%s", "%s")' % (
|
||||
text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'),
|
||||
u'top')
|
||||
js = u'show_alert("%s", "%s")' % (text_prepared, u'top')
|
||||
else:
|
||||
shrink = False
|
||||
js = u'show_alert("%s", "")' % (
|
||||
text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
|
||||
js = u'show_alert("%s", "")' % text_prepared
|
||||
height = self.frame.evaluateJavaScript(js)
|
||||
if shrink:
|
||||
if text:
|
||||
@ -346,13 +353,7 @@ class MainDisplay(Display):
|
||||
self.setVisible(True)
|
||||
else:
|
||||
self.setVisible(True)
|
||||
preview = QtGui.QPixmap(self.screen[u'size'].width(),
|
||||
self.screen[u'size'].height())
|
||||
painter = QtGui.QPainter(preview)
|
||||
painter.setRenderHint(QtGui.QPainter.Antialiasing)
|
||||
self.frame.render(painter)
|
||||
painter.end()
|
||||
return preview
|
||||
return QtGui.QPixmap.grabWidget(self)
|
||||
|
||||
def buildHtml(self, serviceItem, image=None):
|
||||
"""
|
||||
|
@ -595,7 +595,10 @@ class ServiceManager(QtGui.QWidget):
|
||||
self.mainwindow.finishedProgressBar()
|
||||
Receiver.send_message(u'cursor_normal')
|
||||
if success:
|
||||
shutil.copy(temp_file_name, path_file_name)
|
||||
try:
|
||||
shutil.copy(temp_file_name, path_file_name)
|
||||
except:
|
||||
return self.saveFileAs()
|
||||
self.mainwindow.addRecentFile(path_file_name)
|
||||
self.setModified(False)
|
||||
try:
|
||||
|
@ -359,11 +359,15 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
||||
self.gradientEndButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.background_end_color)
|
||||
self.setField(u'background_type', QtCore.QVariant(1))
|
||||
else:
|
||||
elif self.theme.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Image):
|
||||
self.imageColorButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.background_border_color)
|
||||
self.imageFileEdit.setText(self.theme.background_filename)
|
||||
self.setField(u'background_type', QtCore.QVariant(2))
|
||||
elif self.theme.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Transparent):
|
||||
self.setField(u'background_type', QtCore.QVariant(3))
|
||||
if self.theme.background_direction == \
|
||||
BackgroundGradientType.to_string(BackgroundGradientType.Horizontal):
|
||||
self.setField(u'gradient', QtCore.QVariant(0))
|
||||
|
@ -813,10 +813,13 @@ class ThemeManager(QtGui.QWidget):
|
||||
unicode(theme.BackgroundParameter1.name())
|
||||
newtheme.background_end_color = \
|
||||
unicode(theme.BackgroundParameter2.name())
|
||||
else:
|
||||
elif theme.BackgroundType == 2:
|
||||
newtheme.background_type = \
|
||||
BackgroundType.to_string(BackgroundType.Image)
|
||||
newtheme.background_filename = unicode(theme.BackgroundParameter1)
|
||||
elif theme.BackgroundType == 3:
|
||||
newtheme.background_type = \
|
||||
BackgroundType.to_string(BackgroundType.Transparent)
|
||||
newtheme.font_main_name = theme.FontName
|
||||
newtheme.font_main_color = unicode(theme.FontColor.name())
|
||||
newtheme.font_main_size = theme.FontProportion * 3
|
||||
|
@ -54,7 +54,7 @@ class Ui_ThemeWizard(object):
|
||||
self.backgroundLabel = QtGui.QLabel(self.backgroundPage)
|
||||
self.backgroundLabel.setObjectName(u'BackgroundLabel')
|
||||
self.backgroundComboBox = QtGui.QComboBox(self.backgroundPage)
|
||||
self.backgroundComboBox.addItems([u'', u'', u''])
|
||||
self.backgroundComboBox.addItems([u'', u'', u'', u''])
|
||||
self.backgroundComboBox.setObjectName(u'BackgroundComboBox')
|
||||
self.backgroundTypeLayout.addRow(self.backgroundLabel,
|
||||
self.backgroundComboBox)
|
||||
@ -126,6 +126,12 @@ class Ui_ThemeWizard(object):
|
||||
self.imageLayout.addRow(self.imageLabel, self.imageFileLayout)
|
||||
self.imageLayout.setItem(2, QtGui.QFormLayout.LabelRole, self.spacer)
|
||||
self.backgroundStack.addWidget(self.imageWidget)
|
||||
self.transparentWidget = QtGui.QWidget(self.backgroundPage)
|
||||
self.transparentWidget.setObjectName(u'TransparentWidget')
|
||||
self.transparentLayout = QtGui.QFormLayout(self.transparentWidget)
|
||||
self.transparentLayout.setMargin(0)
|
||||
self.transparentLayout.setObjectName(u'TransparentLayout')
|
||||
self.backgroundStack.addWidget(self.transparentWidget)
|
||||
self.backgroundLayout.addLayout(self.backgroundStack)
|
||||
themeWizard.addPage(self.backgroundPage)
|
||||
# Main Area Page
|
||||
@ -432,6 +438,8 @@ class Ui_ThemeWizard(object):
|
||||
translate('OpenLP.ThemeWizard', 'Gradient'))
|
||||
self.backgroundComboBox.setItemText(
|
||||
BackgroundType.Image, UiStrings().Image)
|
||||
self.backgroundComboBox.setItemText(BackgroundType.Transparent,
|
||||
translate('OpenLP.ThemeWizard', 'Transparent'))
|
||||
self.colorLabel.setText(translate('OpenLP.ThemeWizard', 'Color:'))
|
||||
self.gradientStartLabel.setText(
|
||||
translate(u'OpenLP.ThemeWizard', 'Starting color:'))
|
||||
|
Loading…
Reference in New Issue
Block a user