forked from openlp/openlp
Transparent themes
This commit is contained in:
parent
14dde1f0c4
commit
46a4bade8c
@ -129,10 +129,10 @@ sup {
|
|||||||
var match = /-webkit-text-fill-color:[^;\"]+/gi;
|
var match = /-webkit-text-fill-color:[^;\"]+/gi;
|
||||||
if(timer != null)
|
if(timer != null)
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
/*
|
/*
|
||||||
QtWebkit bug with outlines and justify causing outline alignment
|
QtWebkit bug with outlines and justify causing outline alignment
|
||||||
problems. (Bug 859950) Surround each word with a <span> to workaround,
|
problems. (Bug 859950) Surround each word with a <span> to workaround,
|
||||||
but only in this scenario.
|
but only in this scenario.
|
||||||
*/
|
*/
|
||||||
var txt = document.getElementById('lyricsmain');
|
var txt = document.getElementById('lyricsmain');
|
||||||
if(window.getComputedStyle(txt).textAlign == 'justify'){
|
if(window.getComputedStyle(txt).textAlign == 'justify'){
|
||||||
@ -141,7 +141,7 @@ sup {
|
|||||||
txt = outline;
|
txt = outline;
|
||||||
if(window.getComputedStyle(txt).webkitTextStrokeWidth != '0px'){
|
if(window.getComputedStyle(txt).webkitTextStrokeWidth != '0px'){
|
||||||
newtext = newtext.replace(/(\s| )+(?![^<]*>)/g,
|
newtext = newtext.replace(/(\s| )+(?![^<]*>)/g,
|
||||||
function(match) {
|
function(match) {
|
||||||
return '</span>' + match + '<span>';
|
return '</span>' + match + '<span>';
|
||||||
});
|
});
|
||||||
newtext = '<span>' + newtext + '</span>';
|
newtext = '<span>' + newtext + '</span>';
|
||||||
@ -288,6 +288,9 @@ def build_background_css(item, width, height):
|
|||||||
background = u'background-color: black'
|
background = u'background-color: black'
|
||||||
if theme:
|
if theme:
|
||||||
if theme.background_type == \
|
if theme.background_type == \
|
||||||
|
BackgroundType.to_string(BackgroundType.Transparent):
|
||||||
|
background = u''
|
||||||
|
elif theme.background_type == \
|
||||||
BackgroundType.to_string(BackgroundType.Solid):
|
BackgroundType.to_string(BackgroundType.Solid):
|
||||||
background = u'background-color: %s' % theme.background_color
|
background = u'background-color: %s' % theme.background_color
|
||||||
else:
|
else:
|
||||||
|
@ -100,6 +100,7 @@ class BackgroundType(object):
|
|||||||
Solid = 0
|
Solid = 0
|
||||||
Gradient = 1
|
Gradient = 1
|
||||||
Image = 2
|
Image = 2
|
||||||
|
Transparent = 3
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def to_string(background_type):
|
def to_string(background_type):
|
||||||
@ -112,6 +113,8 @@ class BackgroundType(object):
|
|||||||
return u'gradient'
|
return u'gradient'
|
||||||
elif background_type == BackgroundType.Image:
|
elif background_type == BackgroundType.Image:
|
||||||
return u'image'
|
return u'image'
|
||||||
|
elif background_type == BackgroundType.Transparent:
|
||||||
|
return u'transparent'
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_string(type_string):
|
def from_string(type_string):
|
||||||
@ -124,6 +127,8 @@ class BackgroundType(object):
|
|||||||
return BackgroundType.Gradient
|
return BackgroundType.Gradient
|
||||||
elif type_string == u'image':
|
elif type_string == u'image':
|
||||||
return BackgroundType.Image
|
return BackgroundType.Image
|
||||||
|
elif type_string == u'transparent':
|
||||||
|
return BackgroundType.Transparent
|
||||||
|
|
||||||
|
|
||||||
class BackgroundGradientType(object):
|
class BackgroundGradientType(object):
|
||||||
@ -246,7 +251,7 @@ class ThemeXML(object):
|
|||||||
Add a transparent background.
|
Add a transparent background.
|
||||||
"""
|
"""
|
||||||
background = self.theme_xml.createElement(u'background')
|
background = self.theme_xml.createElement(u'background')
|
||||||
background.setAttribute(u'mode', u'transparent')
|
background.setAttribute(u'type', u'transparent')
|
||||||
self.theme.appendChild(background)
|
self.theme.appendChild(background)
|
||||||
|
|
||||||
def add_background_solid(self, bkcolor):
|
def add_background_solid(self, bkcolor):
|
||||||
@ -487,25 +492,25 @@ class ThemeXML(object):
|
|||||||
return
|
return
|
||||||
xml_iter = theme_xml.getiterator()
|
xml_iter = theme_xml.getiterator()
|
||||||
for element in xml_iter:
|
for element in xml_iter:
|
||||||
parent = element.getparent()
|
|
||||||
master = u''
|
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 parent is not None:
|
||||||
if element.getparent().tag == u'font':
|
if parent.tag == u'font':
|
||||||
master = element.getparent().tag + u'_' + \
|
master = parent.tag + u'_' + parent.attrib[u'type']
|
||||||
element.getparent().attrib[u'type']
|
|
||||||
# set up Outline and Shadow Tags and move to font_main
|
# 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 \
|
if element.tag.startswith(u'shadow') or \
|
||||||
element.tag.startswith(u'outline'):
|
element.tag.startswith(u'outline'):
|
||||||
self._create_attr(u'font_main', element.tag,
|
self._create_attr(u'font_main', element.tag,
|
||||||
element.text)
|
element.text)
|
||||||
master = element.getparent().tag
|
master = parent.tag
|
||||||
if element.getparent().tag == u'background':
|
if parent.tag == u'background':
|
||||||
master = element.getparent().tag
|
master = parent.tag
|
||||||
if element.getparent().attrib:
|
|
||||||
for attr in element.getparent().attrib:
|
|
||||||
self._create_attr(master, attr, \
|
|
||||||
element.getparent().attrib[attr])
|
|
||||||
if master:
|
if master:
|
||||||
self._create_attr(master, element.tag, element.text)
|
self._create_attr(master, element.tag, element.text)
|
||||||
if element.attrib:
|
if element.attrib:
|
||||||
@ -599,9 +604,13 @@ class ThemeXML(object):
|
|||||||
self.background_start_color,
|
self.background_start_color,
|
||||||
self.background_end_color,
|
self.background_end_color,
|
||||||
self.background_direction)
|
self.background_direction)
|
||||||
else:
|
elif self.background_type == \
|
||||||
|
BackgroundType.to_string(BackgroundType.Image):
|
||||||
filename = os.path.split(self.background_filename)[1]
|
filename = os.path.split(self.background_filename)[1]
|
||||||
self.add_background_image(filename, self.background_border_color)
|
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.add_font(self.font_main_name,
|
||||||
self.font_main_color,
|
self.font_main_color,
|
||||||
self.font_main_size,
|
self.font_main_size,
|
||||||
|
@ -81,6 +81,10 @@ class Display(QtGui.QGraphicsView):
|
|||||||
self.screen[u'size'].width(), self.screen[u'size'].height())
|
self.screen[u'size'].width(), self.screen[u'size'].height())
|
||||||
self.webView.settings().setAttribute(
|
self.webView.settings().setAttribute(
|
||||||
QtWebKit.QWebSettings.PluginsEnabled, True)
|
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.page = self.webView.page()
|
||||||
self.frame = self.page.mainFrame()
|
self.frame = self.page.mainFrame()
|
||||||
if self.isLive and log.getEffectiveLevel() == logging.DEBUG:
|
if self.isLive and log.getEffectiveLevel() == logging.DEBUG:
|
||||||
@ -138,6 +142,7 @@ class MainDisplay(Display):
|
|||||||
windowFlags = windowFlags | QtCore.Qt.SplashScreen
|
windowFlags = windowFlags | QtCore.Qt.SplashScreen
|
||||||
self.setWindowFlags(windowFlags)
|
self.setWindowFlags(windowFlags)
|
||||||
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
|
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
|
||||||
|
self.setAttribute(QtCore.Qt.WA_TranslucentBackground, True)
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'live_display_hide'), self.hideDisplay)
|
QtCore.SIGNAL(u'live_display_hide'), self.hideDisplay)
|
||||||
|
@ -359,11 +359,15 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||||||
self.gradientEndButton.setStyleSheet(u'background-color: %s' %
|
self.gradientEndButton.setStyleSheet(u'background-color: %s' %
|
||||||
self.theme.background_end_color)
|
self.theme.background_end_color)
|
||||||
self.setField(u'background_type', QtCore.QVariant(1))
|
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.imageColorButton.setStyleSheet(u'background-color: %s' %
|
||||||
self.theme.background_border_color)
|
self.theme.background_border_color)
|
||||||
self.imageFileEdit.setText(self.theme.background_filename)
|
self.imageFileEdit.setText(self.theme.background_filename)
|
||||||
self.setField(u'background_type', QtCore.QVariant(2))
|
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 == \
|
if self.theme.background_direction == \
|
||||||
BackgroundGradientType.to_string(BackgroundGradientType.Horizontal):
|
BackgroundGradientType.to_string(BackgroundGradientType.Horizontal):
|
||||||
self.setField(u'gradient', QtCore.QVariant(0))
|
self.setField(u'gradient', QtCore.QVariant(0))
|
||||||
|
@ -813,10 +813,13 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
unicode(theme.BackgroundParameter1.name())
|
unicode(theme.BackgroundParameter1.name())
|
||||||
newtheme.background_end_color = \
|
newtheme.background_end_color = \
|
||||||
unicode(theme.BackgroundParameter2.name())
|
unicode(theme.BackgroundParameter2.name())
|
||||||
else:
|
elif theme.BackgroundType == 2:
|
||||||
newtheme.background_type = \
|
newtheme.background_type = \
|
||||||
BackgroundType.to_string(BackgroundType.Image)
|
BackgroundType.to_string(BackgroundType.Image)
|
||||||
newtheme.background_filename = unicode(theme.BackgroundParameter1)
|
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_name = theme.FontName
|
||||||
newtheme.font_main_color = unicode(theme.FontColor.name())
|
newtheme.font_main_color = unicode(theme.FontColor.name())
|
||||||
newtheme.font_main_size = theme.FontProportion * 3
|
newtheme.font_main_size = theme.FontProportion * 3
|
||||||
|
@ -54,7 +54,7 @@ class Ui_ThemeWizard(object):
|
|||||||
self.backgroundLabel = QtGui.QLabel(self.backgroundPage)
|
self.backgroundLabel = QtGui.QLabel(self.backgroundPage)
|
||||||
self.backgroundLabel.setObjectName(u'BackgroundLabel')
|
self.backgroundLabel.setObjectName(u'BackgroundLabel')
|
||||||
self.backgroundComboBox = QtGui.QComboBox(self.backgroundPage)
|
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.backgroundComboBox.setObjectName(u'BackgroundComboBox')
|
||||||
self.backgroundTypeLayout.addRow(self.backgroundLabel,
|
self.backgroundTypeLayout.addRow(self.backgroundLabel,
|
||||||
self.backgroundComboBox)
|
self.backgroundComboBox)
|
||||||
@ -126,6 +126,12 @@ class Ui_ThemeWizard(object):
|
|||||||
self.imageLayout.addRow(self.imageLabel, self.imageFileLayout)
|
self.imageLayout.addRow(self.imageLabel, self.imageFileLayout)
|
||||||
self.imageLayout.setItem(2, QtGui.QFormLayout.LabelRole, self.spacer)
|
self.imageLayout.setItem(2, QtGui.QFormLayout.LabelRole, self.spacer)
|
||||||
self.backgroundStack.addWidget(self.imageWidget)
|
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)
|
self.backgroundLayout.addLayout(self.backgroundStack)
|
||||||
themeWizard.addPage(self.backgroundPage)
|
themeWizard.addPage(self.backgroundPage)
|
||||||
# Main Area Page
|
# Main Area Page
|
||||||
@ -432,6 +438,8 @@ class Ui_ThemeWizard(object):
|
|||||||
translate('OpenLP.ThemeWizard', 'Gradient'))
|
translate('OpenLP.ThemeWizard', 'Gradient'))
|
||||||
self.backgroundComboBox.setItemText(
|
self.backgroundComboBox.setItemText(
|
||||||
BackgroundType.Image, UiStrings().Image)
|
BackgroundType.Image, UiStrings().Image)
|
||||||
|
self.backgroundComboBox.setItemText(BackgroundType.Transparent,
|
||||||
|
translate('OpenLP.ThemeWizard', 'Transparent'))
|
||||||
self.colorLabel.setText(translate('OpenLP.ThemeWizard', 'Color:'))
|
self.colorLabel.setText(translate('OpenLP.ThemeWizard', 'Color:'))
|
||||||
self.gradientStartLabel.setText(
|
self.gradientStartLabel.setText(
|
||||||
translate(u'OpenLP.ThemeWizard', 'Starting color:'))
|
translate(u'OpenLP.ThemeWizard', 'Starting color:'))
|
||||||
|
Loading…
Reference in New Issue
Block a user