forked from openlp/openlp
More imporovements
This commit is contained in:
parent
cbef9f0519
commit
cf2d215534
@ -312,6 +312,7 @@ def expand_tags(text):
|
||||
text = text.replace(tag[u'end tag'], tag[u'end html'])
|
||||
return text
|
||||
|
||||
from theme import ThemeLevel, ThemeXML, BackgroundGradientType, BackgroundType
|
||||
from spelltextedit import SpellTextEdit
|
||||
from eventreceiver import Receiver
|
||||
from settingsmanager import SettingsManager
|
||||
@ -325,7 +326,6 @@ from htmlbuilder import build_html, build_lyrics_format_css, \
|
||||
build_lyrics_outline_css
|
||||
from toolbar import OpenLPToolbar
|
||||
from dockwidget import OpenLPDockWidget
|
||||
from theme import ThemeLevel, ThemeXML
|
||||
from renderer import Renderer
|
||||
from rendermanager import RenderManager
|
||||
from mediamanageritem import MediaManagerItem
|
||||
|
@ -25,8 +25,11 @@
|
||||
###############################################################################
|
||||
|
||||
import logging
|
||||
|
||||
from PyQt4 import QtWebKit
|
||||
|
||||
from openlp.core.lib import BackgroundType, BackgroundGradientType
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
HTMLSRC = u"""
|
||||
@ -367,16 +370,29 @@ def build_background_css(item, width, height):
|
||||
theme = item.themedata
|
||||
background = u'background-color: black'
|
||||
if theme:
|
||||
if theme.background_type == u'solid':
|
||||
if theme.background_type == BackgroundType.Solid:
|
||||
background = u'background-color: %s' % theme.background_color
|
||||
else:
|
||||
if theme.background_direction == u'horizontal':
|
||||
if theme.background_direction == BackgroundGradientType.Horizontal:
|
||||
background = \
|
||||
u'background: ' \
|
||||
u'-webkit-gradient(linear, left top, left bottom, ' \
|
||||
'from(%s), to(%s))' % (theme.background_start_color,
|
||||
theme.background_end_color)
|
||||
elif theme.background_direction == u'vertical':
|
||||
elif theme.background_direction == BackgroundGradientType.LeftTop:
|
||||
background = \
|
||||
u'background: ' \
|
||||
u'-webkit-gradient(linear, left top, right bottom, ' \
|
||||
'from(%s), to(%s))' % (theme.background_start_color,
|
||||
theme.background_end_color)
|
||||
elif theme.background_direction == \
|
||||
BackgroundGradientType.LeftBottom:
|
||||
background = \
|
||||
u'background: ' \
|
||||
u'-webkit-gradient(linear, left bottom, right top, ' \
|
||||
'from(%s), to(%s))' % (theme.background_start_color,
|
||||
theme.background_end_color)
|
||||
elif theme.background_direction == BackgroundGradientType.Vertical:
|
||||
background = \
|
||||
u'background: -webkit-gradient(linear, left top, ' \
|
||||
u'right top, from(%s), to(%s))' % \
|
||||
|
@ -91,6 +91,62 @@ class ThemeLevel(object):
|
||||
Service = 2
|
||||
Song = 3
|
||||
|
||||
class BackgroundType(object):
|
||||
Solid = 0
|
||||
Gradient = 1
|
||||
Image = 2
|
||||
|
||||
@staticmethod
|
||||
def to_string(type):
|
||||
if type == BackgroundType.Solid:
|
||||
return u'solid'
|
||||
elif type == BackgroundType.Gradient:
|
||||
return u'gradient'
|
||||
elif type == BackgroundType.Image:
|
||||
return u'image'
|
||||
|
||||
@staticmethod
|
||||
def from_string(type_string):
|
||||
if type_string == u'solid':
|
||||
return BackgroundType.Solid
|
||||
elif type_string == u'gradient':
|
||||
return BackgroundType.Gradient
|
||||
elif type_string == u'image':
|
||||
return BackgroundType.Image
|
||||
|
||||
class BackgroundGradientType(object):
|
||||
Horizontal = 0
|
||||
Vertical = 1
|
||||
Circular = 2
|
||||
LeftTop = 3
|
||||
LeftBottom = 4
|
||||
|
||||
@staticmethod
|
||||
def to_string(type):
|
||||
if type == BackgroundGradientType.Horizontal:
|
||||
return u'horizontal'
|
||||
elif type == BackgroundGradientType.Vertical:
|
||||
return u'vertical'
|
||||
elif type == BackgroundGradientType.Circular:
|
||||
return u'circular'
|
||||
elif type == BackgroundGradientType.LeftTop:
|
||||
return u'leftTop'
|
||||
elif type == BackgroundGradientType.LeftBottom:
|
||||
return u'leftBottom'
|
||||
|
||||
@staticmethod
|
||||
def from_string(type_string):
|
||||
if type_string == u'horizontal':
|
||||
return BackgroundGradientType.Horizontal
|
||||
elif type_string == u'vertical':
|
||||
return BackgroundGradientType.Vertical
|
||||
elif type_string == u'circular':
|
||||
return BackgroundGradientType.Circular
|
||||
elif type_string == u'leftTop':
|
||||
return BackgroundGradientType.LeftTop
|
||||
elif type_string == u'leftBottom':
|
||||
return BackgroundGradientType.LeftBottom
|
||||
|
||||
boolean_list = [u'bold', u'italics', u'override', u'outline', u'shadow', \
|
||||
u'slide_transition']
|
||||
|
||||
@ -485,10 +541,10 @@ class ThemeXML(object):
|
||||
"""
|
||||
Build the XML from the varables in the object
|
||||
"""
|
||||
if self.background_type == u'solid':
|
||||
if self.background_type == BackgroundType.Solid:
|
||||
self.add_background_solid(
|
||||
unicode(self.background_color))
|
||||
elif self.background_type == u'gradient':
|
||||
elif self.background_type == BackgroundType.Gradient:
|
||||
self.add_background_gradient(
|
||||
unicode(self.background_start_color),
|
||||
unicode(self.background_end_color),
|
||||
|
@ -28,67 +28,12 @@ import logging
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib import translate, theme, BackgroundType, BackgroundGradientType
|
||||
|
||||
from themewizard import Ui_ThemeWizard
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class BackgroundType(object):
|
||||
Solid = 0
|
||||
Gradient = 1
|
||||
Image = 2
|
||||
|
||||
@staticmethod
|
||||
def to_string(type):
|
||||
if type == BackgroundType.Solid:
|
||||
return u'solid'
|
||||
elif type == BackgroundType.Gradient:
|
||||
return u'gradient'
|
||||
elif type == BackgroundType.Image:
|
||||
return u'image'
|
||||
|
||||
@staticmethod
|
||||
def from_string(type_string):
|
||||
if type_string == u'solid':
|
||||
return BackgroundType.Solid
|
||||
elif type_string == u'gradient':
|
||||
return BackgroundType.Gradient
|
||||
elif type_string == u'image':
|
||||
return BackgroundType.Image
|
||||
|
||||
class BackgroundGradientType(object):
|
||||
Horizontal = 0
|
||||
Vertical = 1
|
||||
Circular = 2
|
||||
LeftTop = 3
|
||||
LeftBottom = 4
|
||||
|
||||
@staticmethod
|
||||
def to_string(type):
|
||||
if type == BackgroundGradientType.Horizontal:
|
||||
return u'horizontal'
|
||||
elif type == BackgroundGradientType.Vertical:
|
||||
return u'vertical'
|
||||
elif type == BackgroundGradientType.Circular:
|
||||
return u'circular'
|
||||
elif type == BackgroundGradientType.LeftTop:
|
||||
return u'leftTop'
|
||||
elif type == BackgroundGradientType.LeftBottom:
|
||||
return u'leftBottom'
|
||||
|
||||
@staticmethod
|
||||
def from_string(type_string):
|
||||
if type_string == u'horizontal':
|
||||
return BackgroundGradientType.Horizontal
|
||||
elif type_string == u'vertical':
|
||||
return BackgroundGradientType.Vertical
|
||||
elif type_string == u'circular':
|
||||
return BackgroundGradientType.Circular
|
||||
elif type_string == u'leftTop':
|
||||
return BackgroundGradientType.LeftTop
|
||||
elif type_string == u'leftBottom':
|
||||
return BackgroundGradientType.LeftBottom
|
||||
|
||||
class ThemeWizardForm(QtGui.QWizard, Ui_ThemeWizard):
|
||||
"""
|
||||
This is the Bible Import Wizard, which allows easy importing of Bibles
|
||||
@ -158,7 +103,7 @@ class ThemeWizardForm(QtGui.QWizard, Ui_ThemeWizard):
|
||||
|
||||
def onOutlineCheckCheckBoxChanged(self, state):
|
||||
"""
|
||||
Change statd as Outline check box changed
|
||||
Change state as Outline check box changed
|
||||
"""
|
||||
self.outlineColorPushButton.setEnabled(state)
|
||||
self.outlineSizeSpinBox.setEnabled(state)
|
||||
@ -325,7 +270,9 @@ class ThemeWizardForm(QtGui.QWizard, Ui_ThemeWizard):
|
||||
QtCore.QVariant(self.theme.font_footer_size))
|
||||
|
||||
def setPositionTabValues(self):
|
||||
print self.theme.font_main_override
|
||||
"""
|
||||
Handle the display and State of the Position tab.
|
||||
"""
|
||||
if self.theme.font_main_override:
|
||||
self.setField(u'mainDefaultPosition', QtCore.QVariant(False))
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user