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