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;
|
||||
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,
|
||||
|
@ -81,6 +81,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 +142,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)
|
||||
|
@ -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