forked from openlp/openlp
CONSTANTS and an exception
This commit is contained in:
parent
85b5437f80
commit
f41cadd17b
@ -30,7 +30,7 @@ from xml.etree.ElementTree import ElementTree, XML
|
|||||||
|
|
||||||
from openlp.core.lib import str_to_bool
|
from openlp.core.lib import str_to_bool
|
||||||
|
|
||||||
blankthemexml = \
|
BLANK_THEME_XML = \
|
||||||
'''<?xml version="1.0" encoding="utf-8"?>
|
'''<?xml version="1.0" encoding="utf-8"?>
|
||||||
<theme version="1.0">
|
<theme version="1.0">
|
||||||
<name>BlankStyle</name>
|
<name>BlankStyle</name>
|
||||||
@ -356,7 +356,7 @@ class ThemeXML(object):
|
|||||||
"""
|
"""
|
||||||
Pull in the blank theme XML as a starting point.
|
Pull in the blank theme XML as a starting point.
|
||||||
"""
|
"""
|
||||||
self.parse_xml(blankthemexml)
|
self.parse_xml(BLANK_THEME_XML)
|
||||||
|
|
||||||
def parse_xml(self, xml):
|
def parse_xml(self, xml):
|
||||||
"""
|
"""
|
||||||
|
@ -28,13 +28,13 @@ import types
|
|||||||
from xml.etree.ElementTree import ElementTree, XML
|
from xml.etree.ElementTree import ElementTree, XML
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
DelphiColors = {"clRed":0xFF0000,
|
DELPHI_COLORS = {"clRed":0xFF0000,
|
||||||
"clBlue":0x0000FF,
|
"clBlue":0x0000FF,
|
||||||
"clYellow":0xFFFF00,
|
"clYellow":0xFFFF00,
|
||||||
"clBlack":0x000000,
|
"clBlack":0x000000,
|
||||||
"clWhite":0xFFFFFF}
|
"clWhite":0xFFFFFF}
|
||||||
|
|
||||||
blankstylexml = \
|
BLANK_STYLE_XML = \
|
||||||
'''<?xml version="1.0" encoding="iso-8859-1"?>
|
'''<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<Theme>
|
<Theme>
|
||||||
<Name>BlankStyle</Name>
|
<Name>BlankStyle</Name>
|
||||||
@ -97,7 +97,7 @@ class Theme(object):
|
|||||||
1 - lyrics
|
1 - lyrics
|
||||||
"""
|
"""
|
||||||
# init to defaults
|
# init to defaults
|
||||||
self._set_from_XML(blankstylexml)
|
self._set_from_XML(BLANK_STYLE_XML)
|
||||||
self._set_from_XML(xml)
|
self._set_from_XML(xml)
|
||||||
|
|
||||||
def _get_as_string(self):
|
def _get_as_string(self):
|
||||||
@ -128,8 +128,8 @@ class Theme(object):
|
|||||||
val = int(element_text[1:], 16)
|
val = int(element_text[1:], 16)
|
||||||
except ValueError: # nope
|
except ValueError: # nope
|
||||||
pass
|
pass
|
||||||
elif DelphiColors.has_key(element_text):
|
elif DELPHI_COLORS.has_key(element_text):
|
||||||
val = DelphiColors[element_text]
|
val = DELPHI_COLORS[element_text]
|
||||||
delphiColorChange = True
|
delphiColorChange = True
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
|
@ -231,7 +231,10 @@ class PresentationDocument(object):
|
|||||||
Cleans up/deletes any controller specific files created for
|
Cleans up/deletes any controller specific files created for
|
||||||
a file, e.g. thumbnails
|
a file, e.g. thumbnails
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
shutil.rmtree(self.thumbnailpath)
|
shutil.rmtree(self.thumbnailpath)
|
||||||
|
except OSError:
|
||||||
|
log.exception(u'Failed to delete presentation controller files')
|
||||||
|
|
||||||
def store_filename(self, presentation):
|
def store_filename(self, presentation):
|
||||||
"""
|
"""
|
||||||
@ -388,3 +391,4 @@ class PresentationDocument(object):
|
|||||||
The slide the notes are required for, starting at 1
|
The slide the notes are required for, starting at 1
|
||||||
"""
|
"""
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ class SongFeatureError(SongException):
|
|||||||
# TODO: Song: Import ChangingSong
|
# TODO: Song: Import ChangingSong
|
||||||
# TODO: Song: Export ChangingSong
|
# TODO: Song: Export ChangingSong
|
||||||
|
|
||||||
_blankOpenSongXml = \
|
_BLANK_OPENSONG_XML = \
|
||||||
'''<?xml version="1.0" encoding="UTF-8"?>
|
'''<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<song>
|
<song>
|
||||||
<title></title>
|
<title></title>
|
||||||
@ -84,7 +84,7 @@ class _OpenSong(XmlRootClass):
|
|||||||
|
|
||||||
def _reset(self):
|
def _reset(self):
|
||||||
"""Reset all song attributes"""
|
"""Reset all song attributes"""
|
||||||
self._setFromXml(_blankOpenSongXml, 'song')
|
self._setFromXml(_BLANK_OPENSONG_XML, 'song')
|
||||||
|
|
||||||
def from_buffer(self, xmlContent):
|
def from_buffer(self, xmlContent):
|
||||||
"""Initialize from buffer(string) with xml content"""
|
"""Initialize from buffer(string) with xml content"""
|
||||||
|
Loading…
Reference in New Issue
Block a user