forked from openlp/openlp
r2013
This commit is contained in:
commit
b58dec8237
@ -282,14 +282,15 @@ def resize_image(image_path, width, height, background=u'#000000'):
|
|||||||
if image_ratio == resize_ratio:
|
if image_ratio == resize_ratio:
|
||||||
# We neither need to centre the image nor add "bars" to the image.
|
# We neither need to centre the image nor add "bars" to the image.
|
||||||
return preview
|
return preview
|
||||||
realw = preview.width()
|
real_width = preview.width()
|
||||||
realh = preview.height()
|
real_height = preview.height()
|
||||||
# and move it to the centre of the preview space
|
# and move it to the centre of the preview space
|
||||||
new_image = QtGui.QImage(width, height,
|
new_image = QtGui.QImage(width, height,
|
||||||
QtGui.QImage.Format_ARGB32_Premultiplied)
|
QtGui.QImage.Format_ARGB32_Premultiplied)
|
||||||
painter = QtGui.QPainter(new_image)
|
painter = QtGui.QPainter(new_image)
|
||||||
painter.fillRect(new_image.rect(), QtGui.QColor(background))
|
painter.fillRect(new_image.rect(), QtGui.QColor(background))
|
||||||
painter.drawImage((width - realw) / 2, (height - realh) / 2, preview)
|
painter.drawImage(
|
||||||
|
(width - real_width) / 2, (height - real_height) / 2, preview)
|
||||||
return new_image
|
return new_image
|
||||||
|
|
||||||
|
|
||||||
|
@ -352,24 +352,23 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
``files``
|
``files``
|
||||||
The list of files to be loaded
|
The list of files to be loaded
|
||||||
"""
|
"""
|
||||||
#FIXME: change local variables to words_separated_by_underscores.
|
new_files = []
|
||||||
newFiles = []
|
error_shown = False
|
||||||
errorShown = False
|
|
||||||
for file in files:
|
for file in files:
|
||||||
type = file.split(u'.')[-1]
|
type = file.split(u'.')[-1]
|
||||||
if type.lower() not in self.onNewFileMasks:
|
if type.lower() not in self.onNewFileMasks:
|
||||||
if not errorShown:
|
if not error_shown:
|
||||||
critical_error_message_box(
|
critical_error_message_box(
|
||||||
translate('OpenLP.MediaManagerItem',
|
translate('OpenLP.MediaManagerItem',
|
||||||
'Invalid File Type'),
|
'Invalid File Type'),
|
||||||
unicode(translate('OpenLP.MediaManagerItem',
|
unicode(translate('OpenLP.MediaManagerItem',
|
||||||
'Invalid File %s.\nSuffix not supported'))
|
'Invalid File %s.\nSuffix not supported'))
|
||||||
% file)
|
% file)
|
||||||
errorShown = True
|
error_shown = True
|
||||||
else:
|
else:
|
||||||
newFiles.append(file)
|
new_files.append(file)
|
||||||
if files:
|
if new_files:
|
||||||
self.validateAndLoad(newFiles)
|
self.validateAndLoad(new_files)
|
||||||
|
|
||||||
def validateAndLoad(self, files):
|
def validateAndLoad(self, files):
|
||||||
"""
|
"""
|
||||||
@ -379,30 +378,29 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
``files``
|
``files``
|
||||||
The files to be loaded.
|
The files to be loaded.
|
||||||
"""
|
"""
|
||||||
#FIXME: change local variables to words_separated_by_underscores.
|
|
||||||
names = []
|
names = []
|
||||||
fullList = []
|
full_list = []
|
||||||
for count in range(self.listView.count()):
|
for count in range(self.listView.count()):
|
||||||
names.append(unicode(self.listView.item(count).text()))
|
names.append(unicode(self.listView.item(count).text()))
|
||||||
fullList.append(unicode(self.listView.item(count).
|
full_list.append(unicode(self.listView.item(count).
|
||||||
data(QtCore.Qt.UserRole).toString()))
|
data(QtCore.Qt.UserRole).toString()))
|
||||||
duplicatesFound = False
|
duplicates_found = False
|
||||||
filesAdded = False
|
files_added = False
|
||||||
for file in files:
|
for file in files:
|
||||||
filename = os.path.split(unicode(file))[1]
|
filename = os.path.split(unicode(file))[1]
|
||||||
if filename in names:
|
if filename in names:
|
||||||
duplicatesFound = True
|
duplicates_found = True
|
||||||
else:
|
else:
|
||||||
filesAdded = True
|
files_added = True
|
||||||
fullList.append(file)
|
full_list.append(file)
|
||||||
if fullList and filesAdded:
|
if full_list and files_added:
|
||||||
self.listView.clear()
|
self.listView.clear()
|
||||||
self.loadList(fullList)
|
self.loadList(full_list)
|
||||||
lastDir = os.path.split(unicode(files[0]))[0]
|
last_dir = os.path.split(unicode(files[0]))[0]
|
||||||
SettingsManager.set_last_dir(self.settingsSection, lastDir)
|
SettingsManager.set_last_dir(self.settingsSection, last_dir)
|
||||||
SettingsManager.set_list(self.settingsSection,
|
SettingsManager.set_list(self.settingsSection,
|
||||||
self.settingsSection, self.getFileList())
|
self.settingsSection, self.getFileList())
|
||||||
if duplicatesFound:
|
if duplicates_found:
|
||||||
critical_error_message_box(
|
critical_error_message_box(
|
||||||
UiStrings().Duplicate,
|
UiStrings().Duplicate,
|
||||||
unicode(translate('OpenLP.MediaManagerItem',
|
unicode(translate('OpenLP.MediaManagerItem',
|
||||||
@ -422,13 +420,13 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
Return the current list of files
|
Return the current list of files
|
||||||
"""
|
"""
|
||||||
count = 0
|
count = 0
|
||||||
filelist = []
|
file_list = []
|
||||||
while count < self.listView.count():
|
while count < self.listView.count():
|
||||||
bitem = self.listView.item(count)
|
bitem = self.listView.item(count)
|
||||||
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
|
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
|
||||||
filelist.append(filename)
|
file_list.append(filename)
|
||||||
count += 1
|
count += 1
|
||||||
return filelist
|
return file_list
|
||||||
|
|
||||||
def loadList(self, list):
|
def loadList(self, list):
|
||||||
raise NotImplementedError(u'MediaManagerItem.loadList needs to be '
|
raise NotImplementedError(u'MediaManagerItem.loadList needs to be '
|
||||||
@ -477,9 +475,8 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
Allows the change of current item in the list to be actioned
|
Allows the change of current item in the list to be actioned
|
||||||
"""
|
"""
|
||||||
if Settings().value(u'advanced/single click preview',
|
if Settings().value(u'advanced/single click preview',
|
||||||
QtCore.QVariant(False)).toBool() and self.quickPreviewAllowed \
|
QtCore.QVariant(False)).toBool() and self.quickPreviewAllowed and \
|
||||||
and self.listView.selectedIndexes() \
|
self.listView.selectedIndexes() and self.autoSelectId == -1:
|
||||||
and self.autoSelectId == -1:
|
|
||||||
self.onPreviewClick(True)
|
self.onPreviewClick(True)
|
||||||
|
|
||||||
def onPreviewClick(self, keepFocus=False):
|
def onPreviewClick(self, keepFocus=False):
|
||||||
|
@ -82,6 +82,9 @@ class Renderer(object):
|
|||||||
self._calculate_default()
|
self._calculate_default()
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'theme_update_global'), self.set_global_theme)
|
QtCore.SIGNAL(u'theme_update_global'), self.set_global_theme)
|
||||||
|
self.web = QtWebKit.QWebView()
|
||||||
|
self.web.setVisible(False)
|
||||||
|
self.web_frame = self.web.page().mainFrame()
|
||||||
|
|
||||||
def update_display(self):
|
def update_display(self):
|
||||||
"""
|
"""
|
||||||
@ -403,10 +406,7 @@ class Renderer(object):
|
|||||||
if theme_data.font_main_shadow:
|
if theme_data.font_main_shadow:
|
||||||
self.page_width -= int(theme_data.font_main_shadow_size)
|
self.page_width -= int(theme_data.font_main_shadow_size)
|
||||||
self.page_height -= int(theme_data.font_main_shadow_size)
|
self.page_height -= int(theme_data.font_main_shadow_size)
|
||||||
self.web = QtWebKit.QWebView()
|
|
||||||
self.web.setVisible(False)
|
|
||||||
self.web.resize(self.page_width, self.page_height)
|
self.web.resize(self.page_width, self.page_height)
|
||||||
self.web_frame = self.web.page().mainFrame()
|
|
||||||
# Adjust width and height to account for shadow. outline done in css.
|
# Adjust width and height to account for shadow. outline done in css.
|
||||||
html = u"""<!DOCTYPE html><html><head><script>
|
html = u"""<!DOCTYPE html><html><head><script>
|
||||||
function show_text(newtext) {
|
function show_text(newtext) {
|
||||||
|
@ -179,7 +179,7 @@ class ServiceItem(object):
|
|||||||
self.renderer.set_item_theme(self.theme)
|
self.renderer.set_item_theme(self.theme)
|
||||||
self.themedata, self.main, self.footer = self.renderer.pre_render()
|
self.themedata, self.main, self.footer = self.renderer.pre_render()
|
||||||
if self.service_item_type == ServiceItemType.Text:
|
if self.service_item_type == ServiceItemType.Text:
|
||||||
log.debug(u'Formatting slides')
|
log.debug(u'Formatting slides: %s' % self.title)
|
||||||
for slide in self._raw_frames:
|
for slide in self._raw_frames:
|
||||||
pages = self.renderer.format_slide(slide[u'raw_slide'], self)
|
pages = self.renderer.format_slide(slide[u'raw_slide'], self)
|
||||||
for page in pages:
|
for page in pages:
|
||||||
|
@ -228,10 +228,8 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||||||
"""
|
"""
|
||||||
Detects Page changes and updates as approprate.
|
Detects Page changes and updates as approprate.
|
||||||
"""
|
"""
|
||||||
if self.page(pageId) == self.areaPositionPage:
|
enabled = self.page(pageId) == self.areaPositionPage
|
||||||
self.setOption(QtGui.QWizard.HaveCustomButton1, True)
|
self.setOption(QtGui.QWizard.HaveCustomButton1, enabled)
|
||||||
else:
|
|
||||||
self.setOption(QtGui.QWizard.HaveCustomButton1, False)
|
|
||||||
if self.page(pageId) == self.previewPage:
|
if self.page(pageId) == self.previewPage:
|
||||||
self.updateTheme()
|
self.updateTheme()
|
||||||
frame = self.thememanager.generateImage(self.theme)
|
frame = self.thememanager.generateImage(self.theme)
|
||||||
|
@ -139,14 +139,14 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'config_updated'), self.configUpdated)
|
QtCore.SIGNAL(u'config_updated'), self.configUpdated)
|
||||||
# Variables
|
# Variables
|
||||||
self.theme_list = []
|
self.themeList = []
|
||||||
self.path = AppLocation.get_section_data_path(self.settingsSection)
|
self.path = AppLocation.get_section_data_path(self.settingsSection)
|
||||||
check_directory_exists(self.path)
|
check_directory_exists(self.path)
|
||||||
self.thumb_path = os.path.join(self.path, u'thumbnails')
|
self.thumbPath = os.path.join(self.path, u'thumbnails')
|
||||||
check_directory_exists(self.thumb_path)
|
check_directory_exists(self.thumbPath)
|
||||||
self.themeForm.path = self.path
|
self.themeForm.path = self.path
|
||||||
self.old_background_image = None
|
self.oldBackgroundImage = None
|
||||||
self.bad_v1_name_chars = re.compile(r'[%+\[\]]')
|
self.badV1NameChars = re.compile(r'[%+\[\]]')
|
||||||
# Last little bits of setting up
|
# Last little bits of setting up
|
||||||
self.configUpdated()
|
self.configUpdated()
|
||||||
|
|
||||||
@ -194,14 +194,10 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
return
|
return
|
||||||
real_theme_name = unicode(item.data(QtCore.Qt.UserRole).toString())
|
real_theme_name = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||||
theme_name = unicode(item.text())
|
theme_name = unicode(item.text())
|
||||||
self.deleteAction.setVisible(False)
|
visible = real_theme_name == theme_name
|
||||||
self.renameAction.setVisible(False)
|
self.deleteAction.setVisible(visible)
|
||||||
self.globalAction.setVisible(False)
|
self.renameAction.setVisible(visible)
|
||||||
# If default theme restrict actions
|
self.globalAction.setVisible(visible)
|
||||||
if real_theme_name == theme_name:
|
|
||||||
self.deleteAction.setVisible(True)
|
|
||||||
self.renameAction.setVisible(True)
|
|
||||||
self.globalAction.setVisible(True)
|
|
||||||
self.menu.exec_(self.themeListWidget.mapToGlobal(point))
|
self.menu.exec_(self.themeListWidget.mapToGlobal(point))
|
||||||
|
|
||||||
def changeGlobalFromTab(self, theme_name):
|
def changeGlobalFromTab(self, theme_name):
|
||||||
@ -330,10 +326,10 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
theme = self.getThemeData(
|
theme = self.getThemeData(
|
||||||
unicode(item.data(QtCore.Qt.UserRole).toString()))
|
unicode(item.data(QtCore.Qt.UserRole).toString()))
|
||||||
if theme.background_type == u'image':
|
if theme.background_type == u'image':
|
||||||
self.old_background_image = theme.background_filename
|
self.oldBackgroundImage = theme.background_filename
|
||||||
self.themeForm.theme = theme
|
self.themeForm.theme = theme
|
||||||
self.themeForm.exec_(True)
|
self.themeForm.exec_(True)
|
||||||
self.old_background_image = None
|
self.oldBackgroundImage = None
|
||||||
self.mainwindow.renderer.update_theme(theme.theme_name)
|
self.mainwindow.renderer.update_theme(theme.theme_name)
|
||||||
|
|
||||||
def onDeleteTheme(self):
|
def onDeleteTheme(self):
|
||||||
@ -361,10 +357,10 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
``theme``
|
``theme``
|
||||||
The theme to delete.
|
The theme to delete.
|
||||||
"""
|
"""
|
||||||
self.theme_list.remove(theme)
|
self.themeList.remove(theme)
|
||||||
thumb = u'%s.png' % theme
|
thumb = u'%s.png' % theme
|
||||||
delete_file(os.path.join(self.path, thumb))
|
delete_file(os.path.join(self.path, thumb))
|
||||||
delete_file(os.path.join(self.thumb_path, thumb))
|
delete_file(os.path.join(self.thumbPath, thumb))
|
||||||
try:
|
try:
|
||||||
encoding = get_filesystem_encoding()
|
encoding = get_filesystem_encoding()
|
||||||
shutil.rmtree(os.path.join(self.path, theme).encode(encoding))
|
shutil.rmtree(os.path.join(self.path, theme).encode(encoding))
|
||||||
@ -442,7 +438,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
The plugins will call back in to get the real list if they want it.
|
The plugins will call back in to get the real list if they want it.
|
||||||
"""
|
"""
|
||||||
log.debug(u'Load themes from dir')
|
log.debug(u'Load themes from dir')
|
||||||
self.theme_list = []
|
self.themeList = []
|
||||||
self.themeListWidget.clear()
|
self.themeListWidget.clear()
|
||||||
files = SettingsManager.get_files(self.settingsSection, u'.png')
|
files = SettingsManager.get_files(self.settingsSection, u'.png')
|
||||||
if firstTime:
|
if firstTime:
|
||||||
@ -473,16 +469,17 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
'%s (default)')) % text_name
|
'%s (default)')) % text_name
|
||||||
else:
|
else:
|
||||||
name = text_name
|
name = text_name
|
||||||
thumb = os.path.join(self.thumb_path, u'%s.png' % text_name)
|
thumb = os.path.join(self.thumbPath, u'%s.png' % text_name)
|
||||||
item_name = QtGui.QListWidgetItem(name)
|
item_name = QtGui.QListWidgetItem(name)
|
||||||
if validate_thumb(theme, thumb):
|
if validate_thumb(theme, thumb):
|
||||||
icon = build_icon(thumb)
|
icon = build_icon(thumb)
|
||||||
else:
|
else:
|
||||||
icon = create_thumb(theme, thumb)
|
icon = create_thumb(theme, thumb)
|
||||||
item_name.setIcon(icon)
|
item_name.setIcon(icon)
|
||||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(text_name))
|
item_name.setData(
|
||||||
|
QtCore.Qt.UserRole, QtCore.QVariant(text_name))
|
||||||
self.themeListWidget.addItem(item_name)
|
self.themeListWidget.addItem(item_name)
|
||||||
self.theme_list.append(text_name)
|
self.themeList.append(text_name)
|
||||||
self._pushThemes()
|
self._pushThemes()
|
||||||
|
|
||||||
def _pushThemes(self):
|
def _pushThemes(self):
|
||||||
@ -495,7 +492,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
Return the list of loaded themes
|
Return the list of loaded themes
|
||||||
"""
|
"""
|
||||||
return self.theme_list
|
return self.themeList
|
||||||
|
|
||||||
def getThemeData(self, theme_name):
|
def getThemeData(self, theme_name):
|
||||||
"""
|
"""
|
||||||
@ -509,7 +506,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
unicode(theme_name) + u'.xml')
|
unicode(theme_name) + u'.xml')
|
||||||
xml = get_text_file_string(xml_file)
|
xml = get_text_file_string(xml_file)
|
||||||
if not xml:
|
if not xml:
|
||||||
log.debug("No theme data - using default theme")
|
log.debug(u'No theme data - using default theme')
|
||||||
return ThemeXML()
|
return ThemeXML()
|
||||||
else:
|
else:
|
||||||
return self._createThemeFromXml(xml, self.path)
|
return self._createThemeFromXml(xml, self.path)
|
||||||
@ -547,8 +544,9 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
xml_tree = ElementTree(element=XML(zip.read(xml_file[0]))).getroot()
|
xml_tree = ElementTree(element=XML(zip.read(xml_file[0]))).getroot()
|
||||||
v1_background = xml_tree.find(u'BackgroundType')
|
v1_background = xml_tree.find(u'BackgroundType')
|
||||||
if v1_background is not None:
|
if v1_background is not None:
|
||||||
theme_name, file_xml, out_file, abort_import = self.unzipVersion122(dir, zip,
|
theme_name, file_xml, out_file, abort_import = \
|
||||||
xml_file[0], xml_tree, v1_background, out_file)
|
self.unzipVersion122(
|
||||||
|
dir, zip, xml_file[0], xml_tree, v1_background, out_file)
|
||||||
else:
|
else:
|
||||||
theme_name = xml_tree.find(u'name').text.strip()
|
theme_name = xml_tree.find(u'name').text.strip()
|
||||||
theme_folder = os.path.join(dir, theme_name)
|
theme_folder = os.path.join(dir, theme_name)
|
||||||
@ -601,8 +599,8 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
if file_xml:
|
if file_xml:
|
||||||
theme = self._createThemeFromXml(file_xml, self.path)
|
theme = self._createThemeFromXml(file_xml, self.path)
|
||||||
self.generateAndSaveImage(dir, theme_name, theme)
|
self.generateAndSaveImage(dir, theme_name, theme)
|
||||||
# Only show the error message, when IOError was not raised (in this
|
# Only show the error message, when IOError was not raised (in
|
||||||
# case the error message has already been shown).
|
# this case the error message has already been shown).
|
||||||
elif zip is not None:
|
elif zip is not None:
|
||||||
critical_error_message_box(
|
critical_error_message_box(
|
||||||
translate('OpenLP.ThemeManager', 'Validation Error'),
|
translate('OpenLP.ThemeManager', 'Validation Error'),
|
||||||
@ -611,13 +609,14 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
log.exception(u'Theme file does not contain XML data %s' %
|
log.exception(u'Theme file does not contain XML data %s' %
|
||||||
file_name)
|
file_name)
|
||||||
|
|
||||||
def unzipVersion122(self, dir, zip, xml_file, xml_tree, background, out_file):
|
def unzipVersion122(self, dir, zip, xml_file, xml_tree, background,
|
||||||
|
out_file):
|
||||||
"""
|
"""
|
||||||
Unzip openlp.org 1.2x theme file and upgrade the theme xml. When calling
|
Unzip openlp.org 1.2x theme file and upgrade the theme xml. When calling
|
||||||
this method, please keep in mind, that some parameters are redundant.
|
this method, please keep in mind, that some parameters are redundant.
|
||||||
"""
|
"""
|
||||||
theme_name = xml_tree.find(u'Name').text.strip()
|
theme_name = xml_tree.find(u'Name').text.strip()
|
||||||
theme_name = self.bad_v1_name_chars.sub(u'', theme_name)
|
theme_name = self.badV1NameChars.sub(u'', theme_name)
|
||||||
theme_folder = os.path.join(dir, theme_name)
|
theme_folder = os.path.join(dir, theme_name)
|
||||||
theme_exists = os.path.exists(theme_folder)
|
theme_exists = os.path.exists(theme_folder)
|
||||||
if theme_exists and not self.overWriteMessageBox(theme_name):
|
if theme_exists and not self.overWriteMessageBox(theme_name):
|
||||||
@ -632,12 +631,12 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
if background.text.strip() == u'2':
|
if background.text.strip() == u'2':
|
||||||
image_name = xml_tree.find(u'BackgroundParameter1').text.strip()
|
image_name = xml_tree.find(u'BackgroundParameter1').text.strip()
|
||||||
# image file has same extension and is in subfolder
|
# image file has same extension and is in subfolder
|
||||||
imagefile = filter(lambda name: os.path.splitext(name)[1].lower()
|
image_file = filter(lambda name: os.path.splitext(name)[1].lower()
|
||||||
== os.path.splitext(image_name)[1].lower() and name.find(r'/'),
|
== os.path.splitext(image_name)[1].lower() and name.find(r'/'),
|
||||||
zip.namelist())
|
zip.namelist())
|
||||||
if len(imagefile) >= 1:
|
if len(image_file) >= 1:
|
||||||
out_file = open(os.path.join(themedir, image_name), u'wb')
|
out_file = open(os.path.join(themedir, image_name), u'wb')
|
||||||
out_file.write(zip.read(imagefile[0]))
|
out_file.write(zip.read(image_file[0]))
|
||||||
out_file.close()
|
out_file.close()
|
||||||
else:
|
else:
|
||||||
log.exception(u'Theme file does not contain image file "%s"' %
|
log.exception(u'Theme file does not contain image file "%s"' %
|
||||||
@ -686,9 +685,8 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
theme_dir = os.path.join(self.path, name)
|
theme_dir = os.path.join(self.path, name)
|
||||||
check_directory_exists(theme_dir)
|
check_directory_exists(theme_dir)
|
||||||
theme_file = os.path.join(theme_dir, name + u'.xml')
|
theme_file = os.path.join(theme_dir, name + u'.xml')
|
||||||
if self.old_background_image and \
|
if self.oldBackgroundImage and image_to != self.oldBackgroundImage:
|
||||||
image_to != self.old_background_image:
|
delete_file(self.oldBackgroundImage)
|
||||||
delete_file(self.old_background_image)
|
|
||||||
out_file = None
|
out_file = None
|
||||||
try:
|
try:
|
||||||
out_file = open(theme_file, u'w')
|
out_file = open(theme_file, u'w')
|
||||||
@ -715,7 +713,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
if os.path.exists(sample_path_name):
|
if os.path.exists(sample_path_name):
|
||||||
os.unlink(sample_path_name)
|
os.unlink(sample_path_name)
|
||||||
frame.save(sample_path_name, u'png')
|
frame.save(sample_path_name, u'png')
|
||||||
thumb = os.path.join(self.thumb_path, u'%s.png' % name)
|
thumb = os.path.join(self.thumbPath, u'%s.png' % name)
|
||||||
create_thumb(sample_path_name, thumb, False)
|
create_thumb(sample_path_name, thumb, False)
|
||||||
log.debug(u'Theme image written to %s', sample_path_name)
|
log.debug(u'Theme image written to %s', sample_path_name)
|
||||||
|
|
||||||
@ -723,8 +721,8 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
Called to update the themes' preview images.
|
Called to update the themes' preview images.
|
||||||
"""
|
"""
|
||||||
self.mainwindow.displayProgressBar(len(self.theme_list))
|
self.mainwindow.displayProgressBar(len(self.themeList))
|
||||||
for theme in self.theme_list:
|
for theme in self.themeList:
|
||||||
self.mainwindow.incrementProgressBar()
|
self.mainwindow.incrementProgressBar()
|
||||||
self.generateAndSaveImage(
|
self.generateAndSaveImage(
|
||||||
self.path, theme, self.getThemeData(theme))
|
self.path, theme, self.getThemeData(theme))
|
||||||
@ -820,7 +818,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
theme = Theme(xml_data)
|
theme = Theme(xml_data)
|
||||||
new_theme = ThemeXML()
|
new_theme = ThemeXML()
|
||||||
new_theme.theme_name = self.bad_v1_name_chars.sub(u'', theme.Name)
|
new_theme.theme_name = self.badV1NameChars.sub(u'', theme.Name)
|
||||||
if theme.BackgroundType == 0:
|
if theme.BackgroundType == 0:
|
||||||
new_theme.background_type = \
|
new_theme.background_type = \
|
||||||
BackgroundType.to_string(BackgroundType.Solid)
|
BackgroundType.to_string(BackgroundType.Solid)
|
||||||
|
@ -552,11 +552,9 @@ class Ui_ThemeWizard(object):
|
|||||||
themeWizard.setButtonText(QtGui.QWizard.CustomButton1,
|
themeWizard.setButtonText(QtGui.QWizard.CustomButton1,
|
||||||
translate('OpenLP.ThemeWizard', 'Layout Preview'))
|
translate('OpenLP.ThemeWizard', 'Layout Preview'))
|
||||||
self.previewPage.setTitle(
|
self.previewPage.setTitle(
|
||||||
translate('OpenLP.ThemeWizard', 'Save and Preview'))
|
translate('OpenLP.ThemeWizard', 'Preview and Save'))
|
||||||
self.previewPage.setSubTitle(
|
self.previewPage.setSubTitle(
|
||||||
translate('OpenLP.ThemeWizard', 'View the theme and save it '
|
translate('OpenLP.ThemeWizard', 'Preview the theme and save it.'))
|
||||||
'replacing the current one or change the name to create a '
|
|
||||||
'new theme'))
|
|
||||||
self.themeNameLabel.setText(
|
self.themeNameLabel.setText(
|
||||||
translate('OpenLP.ThemeWizard', 'Theme name:'))
|
translate('OpenLP.ThemeWizard', 'Theme name:'))
|
||||||
# Align all QFormLayouts towards each other.
|
# Align all QFormLayouts towards each other.
|
||||||
|
Loading…
Reference in New Issue
Block a user