diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index ade4bc019..560450741 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -81,6 +81,9 @@ html_expands.append({u'desc':u'Italics', u'start tag':u'{it}', u'start html':u'', u'end tag':u'{/it}', u'end html':u'', u'protected':True}) +# Image image_cache to stop regualar image resizing +image_cache = {} + def translate(context, text, comment=None): """ A special shortcut method to wrap around the Qt4 translation functions. @@ -220,7 +223,7 @@ def image_to_byte(image): ``image`` The image to converted. """ - log.debug(u'image_to_byte') + log.debug(u'image_to_byte') byte_array = QtCore.QByteArray() # use buffer to store pixmap into byteArray buffie = QtCore.QBuffer(byte_array) @@ -250,7 +253,7 @@ def resize_image(image, width, height, background=QtCore.Qt.black): The background colour defaults to black. """ - log.debug(u'resize_image') + log.debug(u'resize_image') preview = QtGui.QImage(image) if not preview.isNull(): # Only resize if different size @@ -258,6 +261,9 @@ def resize_image(image, width, height, background=QtCore.Qt.black): return preview preview = preview.scaled(width, height, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation) + image_cache_key = u'%s%s%s' % (image, unicode(width), unicode(height)) + if image_cache_key in image_cache: + return image_cache[image_cache_key] realw = preview.width() realh = preview.height() # and move it to the centre of the preview space @@ -266,6 +272,7 @@ def resize_image(image, width, height, background=QtCore.Qt.black): new_image.fill(background) painter = QtGui.QPainter(new_image) painter.drawImage((width - realw) / 2, (height - realh) / 2, preview) + image_cache[image_cache_key] = new_image return new_image def check_item_selected(list_widget, message): diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index 505122b1f..765d0f9fa 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -333,7 +333,7 @@ def build_html(item, screen, alert, islive): build_alert_css(alert, width), build_footer_css(item, height), build_lyrics_css(item, webkitvers), - u'true' if theme and theme.display_slideTransition and islive \ + u'true' if theme and theme.display_slide_transition and islive \ else u'false', image, build_lyrics_html(item, webkitvers)) @@ -370,18 +370,18 @@ def build_background_css(item, width, height): background = \ u'background: ' \ u'-webkit-gradient(linear, left top, left bottom, ' \ - 'from(%s), to(%s))' % (theme.background_startColor, - theme.background_endColor) + 'from(%s), to(%s))' % (theme.background_start_color, + theme.background_end_color) elif theme.background_direction == u'vertical': background = \ u'background: -webkit-gradient(linear, left top, ' \ u'right top, from(%s), to(%s))' % \ - (theme.background_startColor, theme.background_endColor) + (theme.background_start_color, theme.background_end_color) else: background = \ u'background: -webkit-gradient(radial, %s 50%%, 100, %s ' \ u'50%%, %s, from(%s), to(%s))' % (width, width, width, - theme.background_startColor, theme.background_endColor) + theme.background_start_color, theme.background_end_color) return background def build_lyrics_css(item, webkitvers): @@ -500,15 +500,15 @@ def build_lyrics_format_css(theme, width, height): Height of the lyrics block """ - if theme.display_horizontalAlign == 2: + if theme.display_horizontal_align == 2: align = u'center' - elif theme.display_horizontalAlign == 1: + elif theme.display_horizontal_align == 1: align = u'right' else: align = u'left' - if theme.display_verticalAlign == 2: + if theme.display_vertical_align == 2: valign = u'bottom' - elif theme.display_verticalAlign == 1: + elif theme.display_vertical_align == 1: valign = u'middle' else: valign = u'top' @@ -576,7 +576,7 @@ def build_footer_css(item, height): font-size: %spt; color: %s; text-align: left; - white-space:nowrap; + white-space:nowrap; """ theme = item.themedata if not theme or not item.footer: diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index ee3418dca..def6f01cc 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -27,6 +27,7 @@ Provide the theme XML and handling functions for OpenLP v2 themes. """ import os +import re from xml.dom.minidom import Document from xml.etree.ElementTree import ElementTree, XML @@ -86,6 +87,13 @@ class ThemeLevel(object): Service = 2 Song = 3 +boolean_list = [u'italics', u'override', u'outline', u'shadow', \ +u'slide_transition'] + +integer_list =[u'proportion', u'line_adjustment', u'x', u'height', u'y', \ +u'width', u'shadow_size', u'outline_size', u'horizontal_align', \ +u'vertical_align', u'wrap_style' ] + class ThemeXML(object): """ A class to encapsulate the Theme XML. @@ -326,16 +334,14 @@ class ThemeXML(object): def dump_xml(self): """ - Dump the XML to file. + Dump the XML to file used for debugging """ - # Debugging aid to see what we have return self.theme_xml.toprettyxml(indent=u' ') def extract_xml(self): """ - Pull out the XML string. + Print out the XML string. """ - # Print our newly created XML return self.theme_xml.toxml(u'utf-8').decode(u'utf-8') def extract_formatted_xml(self): @@ -372,33 +378,37 @@ class ThemeXML(object): if element.getchildren(): master = element.tag + u'_' else: - #background transparent tags have no children so special case + # background transparent tags have no children so special case if element.tag == u'background': for e in element.attrib.iteritems(): - setattr(self, element.tag + u'_' + e[0], e[1]) + self._create_attr(element.tag , e[0], e[1]) if element.attrib: for e in element.attrib.iteritems(): if master == u'font_' and e[0] == u'type': master += e[1] + u'_' elif master == u'display_' and (element.tag == u'shadow' \ or element.tag == u'outline' ): - et = str_to_bool(element.text) - setattr(self, master + element.tag, et) - setattr(self, master + element.tag + u'_'+ e[0], e[1]) + self._create_attr(master, element.tag, element.text) + self._create_attr(master, element.tag + u'_'+ e[0], e[1]) else: field = master + e[0] - if e[1] == u'True' or e[1] == u'False': - setattr(self, field, str_to_bool(e[1])) - else: - setattr(self, field, e[1]) + self._create_attr(master, e[0], e[1]) else: if element.tag: - field = master + element.tag element.text = element.text.strip().lstrip() - if element.text == u'True' or element.text == u'False': - setattr(self, field, str_to_bool(element.text)) - else: - setattr(self, field, element.text) + self._create_attr(master , element.tag, element.text) + + def _create_attr(self, master , element, value): + """ + Create the attributes with the correct data types and name format + """ + field = self._de_hump(element) + if field in boolean_list: + setattr(self, master + field, str_to_bool(value)) + elif field in integer_list: + setattr(self, master + field, int(value)) + else: + setattr(self, master + field, unicode(value)) def __str__(self): """ @@ -409,3 +419,11 @@ class ThemeXML(object): if key[0:1] != u'_': theme_strings.append(u'%30s: %s' % (key, getattr(self, key))) return u'\n'.join(theme_strings) + + def _de_hump(self, name): + """ + Change Camel Case string to python string + """ + s1 = re.sub(u'(.)([A-Z][a-z]+)', r'\1_\2', name) + return re.sub(u'([a-z0-9])([A-Z])', r'\1_\2', s1).lower() + diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index 33ba25046..80d677386 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -37,6 +37,7 @@ class HideMode(object): Theme = 2 Screen = 3 +from filerenameform import FileRenameForm from maindisplay import MainDisplay from slidecontroller import HideMode from servicenoteform import ServiceNoteForm diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py index e23044a2b..1e0404f10 100644 --- a/openlp/core/ui/amendthemeform.py +++ b/openlp/core/ui/amendthemeform.py @@ -150,8 +150,8 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): unicode(self.theme.background_color)) elif self.theme.background_type == u'gradient': new_theme.add_background_gradient( - unicode(self.theme.background_startColor), - unicode(self.theme.background_endColor), + unicode(self.theme.background_start_color), + unicode(self.theme.background_end_color), self.theme.background_direction) else: filename = \ @@ -185,10 +185,10 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): unicode(self.theme.display_shadow_color), unicode(self.theme.display_outline), unicode(self.theme.display_outline_color), - unicode(self.theme.display_horizontalAlign), - unicode(self.theme.display_verticalAlign), - unicode(self.theme.display_wrapStyle), - unicode(self.theme.display_slideTransition), + unicode(self.theme.display_horizontal_align), + unicode(self.theme.display_vertical_align), + unicode(self.theme.display_wrap_style), + unicode(self.theme.display_slide_transition), unicode(self.theme.display_shadow_size), unicode(self.theme.display_outline_size)) theme = new_theme.extract_xml() @@ -217,7 +217,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.imageLineEdit.setText(filename) self.theme.background_filename = filename self.previewTheme() - # # Main Font Tab # @@ -301,7 +300,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): if self.theme.font_main_height != self.fontMainHeightSpinBox.value(): self.theme.font_main_height = self.fontMainHeightSpinBox.value() self.previewTheme() - # # Footer Font Tab # @@ -382,7 +380,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.theme.font_footer_height = \ self.fontFooterHeightSpinBox.value() self.previewTheme() - # # Background Tab # @@ -407,10 +404,10 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.theme.background_direction = u'vertical' else: self.theme.background_direction = u'circular' - if self.theme.background_startColor is None: - self.theme.background_startColor = u'#000000' - if self.theme.background_endColor is None: - self.theme.background_endColor = u'#ff0000' + if self.theme.background_start_color is None: + self.theme.background_start_color = u'#000000' + if self.theme.background_end_color is None: + self.theme.background_end_color = u'#ff0000' self.imageLineEdit.setText(u'') else: self.theme.background_type = u'image' @@ -427,22 +424,21 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): unicode(self.theme.background_color)) else: new_color = QtGui.QColorDialog.getColor( - QtGui.QColor(self.theme.background_startColor), self) + QtGui.QColor(self.theme.background_start_color), self) if new_color.isValid(): - self.theme.background_startColor = new_color.name() + self.theme.background_start_color = new_color.name() self.color1PushButton.setStyleSheet(u'background-color: %s' % - unicode(self.theme.background_startColor)) + unicode(self.theme.background_start_color)) self.previewTheme() def onColor2PushButtonClicked(self): new_color = QtGui.QColorDialog.getColor( - QtGui.QColor(self.theme.background_endColor), self) + QtGui.QColor(self.theme.background_end_color), self) if new_color.isValid(): - self.theme.background_endColor = new_color.name() + self.theme.background_end_color = new_color.name() self.color2PushButton.setStyleSheet(u'background-color: %s' % - unicode(self.theme.background_endColor)) + unicode(self.theme.background_end_color)) self.previewTheme() - # # Other Tab # @@ -483,9 +479,9 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): def onSlideTransitionCheckBoxChanged(self, value): if value == 2: # checked - self.theme.display_slideTransition = True + self.theme.display_slide_transition = True else: - self.theme.display_slideTransition = False + self.theme.display_slide_transition = False self.stateChanging(self.theme) self.previewTheme() @@ -499,15 +495,14 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.previewTheme() def onHorizontalComboBoxSelected(self, currentIndex): - self.theme.display_horizontalAlign = currentIndex + self.theme.display_horizontal_align = currentIndex self.stateChanging(self.theme) self.previewTheme() def onVerticalComboBoxSelected(self, currentIndex): - self.theme.display_verticalAlign = currentIndex + self.theme.display_vertical_align = currentIndex self.stateChanging(self.theme) self.previewTheme() - # # Local Methods # @@ -598,13 +593,13 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.shadowCheckBox.setChecked(False) self.shadowColorPushButton.setEnabled(False) self.shadowSpinBox.setValue(int(self.theme.display_shadow_size)) - if self.theme.display_slideTransition: + if self.theme.display_slide_transition: self.slideTransitionCheckBox.setCheckState(QtCore.Qt.Checked) else: self.slideTransitionCheckBox.setCheckState(QtCore.Qt.Unchecked) self.horizontalComboBox.setCurrentIndex( - self.theme.display_horizontalAlign) - self.verticalComboBox.setCurrentIndex(self.theme.display_verticalAlign) + self.theme.display_horizontal_align) + self.verticalComboBox.setCurrentIndex(self.theme.display_vertical_align) def stateChanging(self, theme): self.backgroundTypeComboBox.setVisible(True) @@ -625,9 +620,9 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.gradientComboBox.setVisible(False) elif theme.background_type == u'gradient': self.color1PushButton.setStyleSheet(u'background-color: %s' \ - % unicode(theme.background_startColor)) + % unicode(theme.background_start_color)) self.color2PushButton.setStyleSheet(u'background-color: %s' \ - % unicode(theme.background_endColor)) + % unicode(theme.background_end_color)) self.color1Label.setText( translate('OpenLP.AmendThemeForm', 'First color:')) self.color2Label.setText( diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py index d181ad0d1..8c344e662 100644 --- a/openlp/core/ui/exceptionform.py +++ b/openlp/core/ui/exceptionform.py @@ -27,7 +27,6 @@ from PyQt4 import QtCore, QtGui from exceptiondialog import Ui_ExceptionDialog -from openlp.core.lib import translate class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): """ diff --git a/openlp/core/ui/filerenamedialog.py b/openlp/core/ui/filerenamedialog.py new file mode 100644 index 000000000..897acf02f --- /dev/null +++ b/openlp/core/ui/filerenamedialog.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2010 Raoul Snyman # +# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # +# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # +# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # +# Carsten Tinggaard, Frode Woldsund # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### + +from PyQt4 import QtCore, QtGui + +from openlp.core.lib import translate + +class Ui_FileRenameDialog(object): + def setupUi(self, FileRenameDialog): + FileRenameDialog.setObjectName("FileRenameDialog") + FileRenameDialog.resize(400, 87) + self.buttonBox = QtGui.QDialogButtonBox(FileRenameDialog) + self.buttonBox.setGeometry(QtCore.QRect(210, 50, 171, 25)) + self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) + self.buttonBox.setObjectName("buttonBox") + self.widget = QtGui.QWidget(FileRenameDialog) + self.widget.setGeometry(QtCore.QRect(10, 10, 381, 35)) + self.widget.setObjectName("widget") + self.horizontalLayout = QtGui.QHBoxLayout(self.widget) + self.horizontalLayout.setObjectName("horizontalLayout") + self.FileRenameLabel = QtGui.QLabel(self.widget) + self.FileRenameLabel.setObjectName("FileRenameLabel") + self.horizontalLayout.addWidget(self.FileRenameLabel) + self.FileNameEdit = QtGui.QLineEdit(self.widget) + self.FileNameEdit.setObjectName("FileNameEdit") + self.horizontalLayout.addWidget(self.FileNameEdit) + + self.retranslateUi(FileRenameDialog) + QtCore.QMetaObject.connectSlotsByName(FileRenameDialog) + + def retranslateUi(self, FileRenameDialog): + FileRenameDialog.setWindowTitle(translate('OpenLP.FileRenameForm', + 'File Rename')) + self.FileRenameLabel.setText(translate('OpenLP.FileRenameForm', + 'New File Name:')) + diff --git a/openlp/core/ui/filerenameform.py b/openlp/core/ui/filerenameform.py new file mode 100644 index 000000000..d1c339811 --- /dev/null +++ b/openlp/core/ui/filerenameform.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2010 Raoul Snyman # +# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # +# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # +# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # +# Carsten Tinggaard, Frode Woldsund # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### + +from PyQt4 import QtCore, QtGui + +from filerenamedialog import Ui_FileRenameDialog +from openlp.core.lib import translate + +class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog): + """ + The exception dialog + """ + def __init__(self, parent): + QtGui.QDialog.__init__(self, parent) + self.setupUi(self) + QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'), + self.accept) + QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'), + self.reject) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 45079a1c8..ad26bb2d4 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -324,7 +324,7 @@ class MainDisplay(DisplayWidget): # Wait for the fade to finish before geting the preview. # Important otherwise preview will have incorrect text if at all ! if self.serviceItem.themedata and \ - self.serviceItem.themedata.display_slideTransition: + self.serviceItem.themedata.display_slide_transition: while self.frame.evaluateJavaScript(u'show_text_complete()') \ .toString() == u'false': Receiver.send_message(u'openlp_process_events') diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 5abb8d576..319725790 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -236,7 +236,7 @@ class ServiceManager(QtGui.QWidget): self.addToAction = self.dndMenu.addAction( translate('OpenLP.ServiceManager', '&Add to Selected Item')) self.addToAction.setIcon(build_icon(u':/general/general_edit.png')) - #build the context menu + # build the context menu self.menu = QtGui.QMenu() self.editAction = self.menu.addAction( translate('OpenLP.ServiceManager', '&Edit Item')) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index d8324f977..ff61b05e8 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -32,7 +32,7 @@ import logging from xml.etree.ElementTree import ElementTree, XML from PyQt4 import QtCore, QtGui -from openlp.core.ui import AmendThemeForm +from openlp.core.ui import AmendThemeForm, FileRenameForm from openlp.core.theme import Theme from openlp.core.lib import OpenLPToolbar, context_menu_action, \ ThemeXML, str_to_bool, get_text_file_string, build_icon, Receiver, \ @@ -54,6 +54,7 @@ class ThemeManager(QtGui.QWidget): self.layout.setSpacing(0) self.layout.setMargin(0) self.amendThemeForm = AmendThemeForm(self) + self.fileRenameForm = FileRenameForm(self) self.toolbar = OpenLPToolbar(self) self.toolbar.addToolbarButton( translate('OpenLP.ThemeManager', 'New Theme'), @@ -87,31 +88,32 @@ class ThemeManager(QtGui.QWidget): self.themeListWidget.setAlternatingRowColors(True) self.themeListWidget.setIconSize(QtCore.QSize(88, 50)) self.layout.addWidget(self.themeListWidget) - self.themeListWidget.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) - self.themeListWidget.addAction( - context_menu_action(self.themeListWidget, - u':/themes/theme_edit.png', - translate('OpenLP.ThemeManager', '&Edit Theme'), - self.onEditTheme)) - self.themeListWidget.addAction( - context_menu_separator(self.themeListWidget)) - self.themeListWidget.addAction( - context_menu_action(self.themeListWidget, - u':/general/general_delete.png', - translate('OpenLP.ThemeManager', '&Delete Theme'), - self.onDeleteTheme)) - self.themeListWidget.addAction( - context_menu_action(self.themeListWidget, - u':/general/general_export.png', - translate('OpenLP.ThemeManager', 'Set As &Global Default'), - self.changeGlobalFromScreen)) - self.themeListWidget.addAction( - context_menu_action(self.themeListWidget, - u':/general/general_export.png', - translate('OpenLP.ThemeManager', 'E&xport Theme'), - self.onExportTheme)) - self.themeListWidget.addAction( - context_menu_separator(self.themeListWidget)) + self.themeListWidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) + QtCore.QObject.connect(self.themeListWidget, + QtCore.SIGNAL('customContextMenuRequested(QPoint)'), + self.contextMenu) + # build the context menu + self.menu = QtGui.QMenu() + self.editAction = self.menu.addAction( + translate('OpenLP.ThemeManager', '&Edit Theme')) + self.editAction.setIcon(build_icon(u':/themes/theme_edit.png')) + self.copyAction = self.menu.addAction( + translate('OpenLP.ThemeManager', '&Copy Theme')) + self.copyAction.setIcon(build_icon(u':/themes/theme_edit.png')) + self.renameAction = self.menu.addAction( + translate('OpenLP.ThemeManager', '&Rename Theme')) + self.renameAction.setIcon(build_icon(u':/themes/theme_edit.png')) + self.deleteAction = self.menu.addAction( + translate('OpenLP.ThemeManager', '&Delete Theme')) + self.deleteAction.setIcon(build_icon(u':/general/general_delete.png')) + self.sep1 = self.menu.addAction(u'') + self.sep1.setSeparator(True) + self.globalAction = self.menu.addAction( + translate('OpenLP.ThemeManager', 'Set As &Global Default')) + self.globalAction.setIcon(build_icon(u':/general/general_export.png')) + self.exportAction = self.menu.addAction( + translate('OpenLP.ThemeManager', '&Export Theme')) + self.exportAction.setIcon(build_icon(u':/general/general_export.png')) #Signals QtCore.QObject.connect(self.themeListWidget, QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), @@ -132,6 +134,34 @@ class ThemeManager(QtGui.QWidget): self.settingsSection + u'/global theme', QtCore.QVariant(u'')).toString()) + def contextMenu(self, point): + item = self.themeListWidget.itemAt(point) + if item is None: + return + realThemeName = unicode(item.data(QtCore.Qt.UserRole).toString()) + themeName = unicode(item.text()) + self.deleteAction.setVisible(False) + self.renameAction.setVisible(False) + self.globalAction.setVisible(False) + # If default theme restrict actions + if realThemeName == themeName: + self.deleteAction.setVisible(True) + self.renameAction.setVisible(True) + self.globalAction.setVisible(True) + action = self.menu.exec_(self.themeListWidget.mapToGlobal(point)) + if action == self.editAction: + self.onEditTheme() + if action == self.copyAction: + self.onCopyTheme() + if action == self.renameAction: + self.onRenameTheme() + if action == self.deleteAction: + self.onDeleteTheme() + if action == self.globalAction: + self.changeGlobalFromScreen() + if action == self.exportAction: + self.onExportTheme() + def changeGlobalFromTab(self, themeName): """ Change the global theme when it is changed through the Themes settings @@ -189,6 +219,92 @@ class ThemeManager(QtGui.QWidget): self.saveThemeName = u'' self.amendThemeForm.exec_() + def onRenameTheme(self): + """ + Renames an existing theme to a new name + """ + item = self.themeListWidget.currentItem() + oldThemeName = unicode(item.data(QtCore.Qt.UserRole).toString()) + self.fileRenameForm.FileNameEdit.setText(oldThemeName) + self.saveThemeName = u'' + if self.fileRenameForm.exec_(): + newThemeName = unicode(self.fileRenameForm.FileNameEdit.text()) + oldThemeData = self.getThemeData(oldThemeName) + self.deleteTheme(oldThemeName) + self.cloneThemeData(oldThemeData, newThemeName) + + def onCopyTheme(self): + """ + Copies an existing theme to a new name + """ + item = self.themeListWidget.currentItem() + oldThemeName = unicode(item.data(QtCore.Qt.UserRole).toString()) + self.fileRenameForm.FileNameEdit.setText(oldThemeName) + self.saveThemeName = u'' + if self.fileRenameForm.exec_(): + newThemeName = unicode(self.fileRenameForm.FileNameEdit.text()) + oldThemeData = self.getThemeData(oldThemeName) + self.cloneThemeData(oldThemeData, newThemeName) + self.loadThemes() + + def cloneThemeData(self, oldThemeData, newThemeName): + """ + """ + log.debug(u'cloneThemeData') + new_theme = ThemeXML() + new_theme.new_document(newThemeName) + save_from = None + save_to = None + if oldThemeData.background_type == u'solid': + new_theme.add_background_solid( + unicode(oldThemeData.background_color)) + elif oldThemeData.background_type == u'gradient': + new_theme.add_background_gradient( + unicode(oldThemeData.background_start_color), + unicode(oldThemeData.background_end_color), + oldThemeData.background_direction) + else: + filename = \ + os.path.split(unicode(oldThemeData.background_filename))[1] + new_theme.add_background_image(filename) + save_to = os.path.join(self.path, theme_name, filename) + save_from = oldThemeData.background_filename + new_theme.add_font(unicode(oldThemeData.font_main_name), + unicode(oldThemeData.font_main_color), + unicode(oldThemeData.font_main_proportion), + unicode(oldThemeData.font_main_override), u'main', + unicode(oldThemeData.font_main_weight), + unicode(oldThemeData.font_main_italics), + unicode(oldThemeData.font_main_line_adjustment), + unicode(oldThemeData.font_main_x), + unicode(oldThemeData.font_main_y), + unicode(oldThemeData.font_main_width), + unicode(oldThemeData.font_main_height)) + new_theme.add_font(unicode(oldThemeData.font_footer_name), + unicode(oldThemeData.font_footer_color), + unicode(oldThemeData.font_footer_proportion), + unicode(oldThemeData.font_footer_override), u'footer', + unicode(oldThemeData.font_footer_weight), + unicode(oldThemeData.font_footer_italics), + 0, # line adjustment + unicode(oldThemeData.font_footer_x), + unicode(oldThemeData.font_footer_y), + unicode(oldThemeData.font_footer_width), + unicode(oldThemeData.font_footer_height)) + new_theme.add_display(unicode(oldThemeData.display_shadow), + unicode(oldThemeData.display_shadow_color), + unicode(oldThemeData.display_outline), + unicode(oldThemeData.display_outline_color), + unicode(oldThemeData.display_horizontal_align), + unicode(oldThemeData.display_vertical_align), + unicode(oldThemeData.display_wrap_style), + unicode(oldThemeData.display_slide_transition), + unicode(oldThemeData.display_shadow_size), + unicode(oldThemeData.display_outline_size)) + theme = new_theme.extract_xml() + pretty_theme = new_theme.extract_formatted_xml() + self.saveTheme(newThemeName, theme, pretty_theme, save_from, save_to) + def onEditTheme(self): """ Loads the settings for the theme that is to be edited and launches the @@ -462,11 +578,7 @@ class ThemeManager(QtGui.QWidget): log.exception(u'Theme XML is not UTF-8 ' u'encoded.') break - if self.checkVersion1(xml_data): - # upgrade theme xml - filexml = self.migrateVersion122(xml_data) - else: - filexml = xml_data + filexml = self.checkVersionAndConvert(xml_data) outfile = open(fullpath, u'w') outfile.write(filexml.encode(u'utf-8')) else: @@ -492,20 +604,21 @@ class ThemeManager(QtGui.QWidget): if outfile: outfile.close() - def checkVersion1(self, xmlfile): + def checkVersionAndConvert(self, xml_data): """ Check if a theme is from OpenLP version 1 - ``xmlfile`` + ``xml_data`` Theme XML to check the version of """ log.debug(u'checkVersion1 ') - theme = xmlfile.encode(u'ascii', u'xmlcharrefreplace') + theme = xml_data.encode(u'ascii', u'xmlcharrefreplace') tree = ElementTree(element=XML(theme)).getroot() + # look for old version 1 tags if tree.find(u'BackgroundType') is None: - return False + return xml_data else: - return True + return self.migrateVersion122(xml_data) def migrateVersion122(self, xml_data): """ @@ -699,61 +812,5 @@ class ThemeManager(QtGui.QWidget): """ theme = ThemeXML() theme.parse(theme_xml) - self.cleanTheme(theme) theme.extend_image_filename(path) return theme - - def cleanTheme(self, theme): - """ - Clean a theme loaded from an XML file by removing stray whitespace and - making sure parameters are the correct type for the theme object - attributes - """ - theme.background_color = theme.background_color.strip() - theme.background_direction = theme.background_direction.strip() - theme.background_endColor = theme.background_endColor.strip() - if theme.background_filename: - theme.background_filename = theme.background_filename.strip() - #theme.background_mode - theme.background_startColor = theme.background_startColor.strip() - #theme.background_type - if theme.display_display: - theme.display_display = theme.display_display.strip() - theme.display_horizontalAlign = \ - int(theme.display_horizontalAlign.strip()) - theme.display_outline = str_to_bool(theme.display_outline) - #theme.display_outline_color - theme.display_shadow = str_to_bool(theme.display_shadow) - #theme.display_shadow_color - theme.display_verticalAlign = int(theme.display_verticalAlign.strip()) - theme.display_wrapStyle = theme.display_wrapStyle.strip() - theme.display_slideTransition = theme.display_slideTransition - theme.font_footer_color = theme.font_footer_color.strip() - theme.font_footer_height = int(theme.font_footer_height.strip()) - theme.font_footer_italics = str_to_bool(theme.font_footer_italics) - theme.font_footer_name = theme.font_footer_name.strip() - #theme.font_footer_override - theme.font_footer_proportion = \ - int(theme.font_footer_proportion.strip()) - theme.font_footer_weight = theme.font_footer_weight.strip() - theme.font_footer_width = int(theme.font_footer_width.strip()) - theme.font_footer_x = int(theme.font_footer_x.strip()) - theme.font_footer_y = int(theme.font_footer_y.strip()) - theme.font_main_color = theme.font_main_color.strip() - theme.font_main_height = int(theme.font_main_height.strip()) - theme.font_main_italics = str_to_bool(theme.font_main_italics) - theme.font_main_name = theme.font_main_name.strip() - #theme.font_main_override - theme.font_main_proportion = int(theme.font_main_proportion.strip()) - theme.font_main_weight = theme.font_main_weight.strip() - theme.font_main_width = int(theme.font_main_width.strip()) - theme.font_main_x = int(theme.font_main_x.strip()) - theme.font_main_y = int(theme.font_main_y.strip()) - #theme.theme_mode - theme.theme_name = theme.theme_name.strip() - #theme.theme_version - # Remove the Transparent settings as they are not relevent - if theme.background_mode == u'transparent': - theme.background_mode = u'opaque' - theme.background_type = u'solid' - theme.background_startColor = u'#000000' diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 037951954..cc57d973e 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -341,6 +341,31 @@ class BibleMediaItem(MediaManagerItem): # minor delay to get the events processed time.sleep(0.1) + def onListViewResize(self, width, height): + listViewGeometry = self.listView.geometry() + self.SearchProgress.setGeometry(listViewGeometry.x(), + (listViewGeometry.y() + listViewGeometry.height()) - 23, 81, 23) + + def onSearchProgressShow(self): + self.SearchProgress.setVisible(True) + Receiver.send_message(u'openlp_process_events') + + def onSearchProgressHide(self): + self.SearchProgress.setVisible(False) + + def onNoBookFound(self): + QtGui.QMessageBox.critical(self, + translate('BiblesPlugin.MediaItem', 'No Book Found'), + translate('BiblesPlugin.MediaItem', + 'No matching book could be found in this Bible.')) + + def onImportClick(self): + if not hasattr(self, u'import_wizard'): + self.import_wizard = ImportWizardForm(self, self.parent.manager, + self.parent) + self.import_wizard.exec_() + self.reloadBibles() + def loadBibles(self): log.debug(u'Loading Bibles') self.QuickVersionComboBox.clear() @@ -362,23 +387,41 @@ class BibleMediaItem(MediaManagerItem): first = False self.initialiseBible(bible) - def onListViewResize(self, width, height): - listViewGeometry = self.listView.geometry() - self.SearchProgress.setGeometry(listViewGeometry.x(), - (listViewGeometry.y() + listViewGeometry.height()) - 23, 81, 23) + def reloadBibles(self): + log.debug(u'Reloading Bibles') + self.parent.manager.reload_bibles() + self.loadBibles() - def onSearchProgressShow(self): - self.SearchProgress.setVisible(True) - Receiver.send_message(u'openlp_process_events') + def initialiseBible(self, bible): + log.debug(u'initialiseBible %s', bible) + book_data = self.parent.manager.get_books(bible) + self.AdvancedBookComboBox.clear() + first = True + for book in book_data: + row = self.AdvancedBookComboBox.count() + self.AdvancedBookComboBox.addItem(book[u'name']) + self.AdvancedBookComboBox.setItemData( + row, QtCore.QVariant(book[u'chapters'])) + if first: + first = False + self.initialiseChapterVerse(bible, book[u'name'], + book[u'chapters']) - def onSearchProgressHide(self): - self.SearchProgress.setVisible(False) - - def onNoBookFound(self): - QtGui.QMessageBox.critical(self, - translate('BiblesPlugin.MediaItem', 'No Book Found'), - translate('BiblesPlugin.MediaItem', - 'No matching book could be found in this Bible.')) + def initialiseChapterVerse(self, bible, book, chapters): + log.debug(u'initialiseChapterVerse %s, %s', bible, book) + self.chapters_from = chapters + self.verses = self.parent.manager.get_verse_count(bible, book, 1) + if self.verses == 0: + self.AdvancedSearchButton.setEnabled(False) + self.AdvancedMessage.setText( + translate('BiblesPlugin.MediaItem', 'Bible not fully loaded.')) + else: + self.AdvancedSearchButton.setEnabled(True) + self.AdvancedMessage.setText(u'') + self.adjustComboBox(1, self.chapters_from, self.AdvancedFromChapter) + self.adjustComboBox(1, self.chapters_from, self.AdvancedToChapter) + self.adjustComboBox(1, self.verses, self.AdvancedFromVerse) + self.adjustComboBox(1, self.verses, self.AdvancedToVerse) def onAdvancedVersionComboBox(self): self.initialiseBible( @@ -391,13 +434,6 @@ class BibleMediaItem(MediaManagerItem): unicode(self.AdvancedBookComboBox.currentText()), self.AdvancedBookComboBox.itemData(item).toInt()[0]) - def onImportClick(self): - if not hasattr(self, u'import_wizard'): - self.import_wizard = ImportWizardForm(self, self.parent.manager, - self.parent) - self.import_wizard.exec_() - self.reloadBibles() - def onAdvancedFromVerse(self): frm = int(self.AdvancedFromVerse.currentText()) chapter_frm = int(self.AdvancedFromChapter.currentText()) @@ -422,6 +458,22 @@ class BibleMediaItem(MediaManagerItem): if to < frm: self.adjustComboBox(frm, verses, self.AdvancedToVerse) + def onAdvancedFromChapter(self): + bible = unicode(self.AdvancedVersionComboBox.currentText()) + book = unicode(self.AdvancedBookComboBox.currentText()) + chapter_frm = int(self.AdvancedFromChapter.currentText()) + self.adjustComboBox(chapter_frm, self.chapters_from, + self.AdvancedToChapter) + verse = self.parent.manager.get_verse_count(bible, book, chapter_frm) + self.adjustComboBox(1, verse, self.AdvancedToVerse) + self.adjustComboBox(1, verse, self.AdvancedFromVerse) + + def adjustComboBox(self, range_from, range_to, combo): + log.debug(u'adjustComboBox %s, %s, %s', combo, range_from, range_to) + combo.clear() + for i in range(int(range_from), int(range_to) + 1): + combo.addItem(unicode(i)) + def onAdvancedSearchButton(self): log.debug(u'Advanced Search Button pressed') bible = unicode(self.AdvancedVersionComboBox.currentText()) @@ -457,16 +509,6 @@ class BibleMediaItem(MediaManagerItem): else: self.displayResults(bible, dual_bible) - def onAdvancedFromChapter(self): - bible = unicode(self.AdvancedVersionComboBox.currentText()) - book = unicode(self.AdvancedBookComboBox.currentText()) - chapter_frm = int(self.AdvancedFromChapter.currentText()) - self.adjustComboBox(chapter_frm, self.chapters_from, - self.AdvancedToChapter) - verse = self.parent.manager.get_verse_count(bible, book, chapter_frm) - self.adjustComboBox(1, verse, self.AdvancedToVerse) - self.adjustComboBox(1, verse, self.AdvancedFromVerse) - def onQuickSearchButton(self): log.debug(u'Quick Search Button pressed') bible = unicode(self.QuickVersionComboBox.currentText()) @@ -496,6 +538,73 @@ class BibleMediaItem(MediaManagerItem): elif self.search_results: self.displayResults(bible, dual_bible) + def displayResults(self, bible, dual_bible=u''): + """ + Displays the search results in the media manager. All data needed for + further action is saved for/in each row. + """ + version = self.parent.manager.get_meta_data(bible, u'Version') + copyright = self.parent.manager.get_meta_data(bible, u'Copyright') + permission = self.parent.manager.get_meta_data(bible, u'Permissions') + if dual_bible: + dual_version = self.parent.manager.get_meta_data(dual_bible, + u'Version') + dual_copyright = self.parent.manager.get_meta_data(dual_bible, + u'Copyright') + dual_permission = self.parent.manager.get_meta_data(dual_bible, + u'Permissions') + if not dual_permission: + dual_permission = u'' + # We count the number of rows which are maybe already present. + start_count = self.listView.count() + for count, verse in enumerate(self.search_results): + if dual_bible: + vdict = { + 'book': QtCore.QVariant(verse.book.name), + 'chapter': QtCore.QVariant(verse.chapter), + 'verse': QtCore.QVariant(verse.verse), + 'bible': QtCore.QVariant(bible), + 'version': QtCore.QVariant(version.value), + 'copyright': QtCore.QVariant(copyright.value), + 'permission': QtCore.QVariant(permission.value), + 'text': QtCore.QVariant(verse.text), + 'dual_bible': QtCore.QVariant(dual_bible), + 'dual_version': QtCore.QVariant(dual_version.value), + 'dual_copyright': QtCore.QVariant(dual_copyright.value), + 'dual_permission': QtCore.QVariant(dual_permission.value), + 'dual_text': QtCore.QVariant( + self.dual_search_results[count].text) + } + bible_text = u' %s %d:%d (%s, %s)' % (verse.book.name, + verse.chapter, verse.verse, version.value, + dual_version.value) + else: + vdict = { + 'book': QtCore.QVariant(verse.book.name), + 'chapter': QtCore.QVariant(verse.chapter), + 'verse': QtCore.QVariant(verse.verse), + 'bible': QtCore.QVariant(bible), + 'version': QtCore.QVariant(version.value), + 'copyright': QtCore.QVariant(copyright.value), + 'permission': QtCore.QVariant(permission.value), + 'text': QtCore.QVariant(verse.text), + 'dual_bible': QtCore.QVariant(u''), + 'dual_version': QtCore.QVariant(u''), + 'dual_copyright': QtCore.QVariant(u''), + 'dual_permission': QtCore.QVariant(u''), + 'dual_text': QtCore.QVariant(u'') + } + bible_text = u' %s %d:%d (%s)' % (verse.book.name, + verse.chapter, verse.verse, version.value) + bible_verse = QtGui.QListWidgetItem(bible_text) + bible_verse.setData(QtCore.Qt.UserRole, QtCore.QVariant(vdict)) + self.listView.addItem(bible_verse) + row = self.listView.setCurrentRow(count + start_count) + if row: + row.setSelected(True) + self.search_results = {} + self.dual_search_results = {} + def _decodeQtObject(self, bitem, key): reference = bitem.data(QtCore.Qt.UserRole) if isinstance(reference, QtCore.QVariant): @@ -681,112 +790,3 @@ class BibleMediaItem(MediaManagerItem): else: verse_text = u'{su}' + verse_text + u'{/su}' return verse_text - - def reloadBibles(self): - log.debug(u'Reloading Bibles') - self.parent.manager.reload_bibles() - self.loadBibles() - - def initialiseBible(self, bible): - log.debug(u'initialiseBible %s', bible) - book_data = self.parent.manager.get_books(bible) - self.AdvancedBookComboBox.clear() - first = True - for book in book_data: - row = self.AdvancedBookComboBox.count() - self.AdvancedBookComboBox.addItem(book[u'name']) - self.AdvancedBookComboBox.setItemData( - row, QtCore.QVariant(book[u'chapters'])) - if first: - first = False - self.initialiseChapterVerse(bible, book[u'name'], - book[u'chapters']) - - def initialiseChapterVerse(self, bible, book, chapters): - log.debug(u'initialiseChapterVerse %s, %s', bible, book) - self.chapters_from = chapters - self.verses = self.parent.manager.get_verse_count(bible, book, 1) - if self.verses == 0: - self.AdvancedSearchButton.setEnabled(False) - self.AdvancedMessage.setText( - translate('BiblesPlugin.MediaItem', 'Bible not fully loaded.')) - else: - self.AdvancedSearchButton.setEnabled(True) - self.AdvancedMessage.setText(u'') - self.adjustComboBox(1, self.chapters_from, self.AdvancedFromChapter) - self.adjustComboBox(1, self.chapters_from, self.AdvancedToChapter) - self.adjustComboBox(1, self.verses, self.AdvancedFromVerse) - self.adjustComboBox(1, self.verses, self.AdvancedToVerse) - - def adjustComboBox(self, range_from, range_to, combo): - log.debug(u'adjustComboBox %s, %s, %s', combo, range_from, range_to) - combo.clear() - for i in range(int(range_from), int(range_to) + 1): - combo.addItem(unicode(i)) - - def displayResults(self, bible, dual_bible=u''): - """ - Displays the search results in the media manager. All data needed for - further action is saved for/in each row. - """ - version = self.parent.manager.get_meta_data(bible, u'Version') - copyright = self.parent.manager.get_meta_data(bible, u'Copyright') - permission = self.parent.manager.get_meta_data(bible, u'Permissions') - if dual_bible: - dual_version = self.parent.manager.get_meta_data(dual_bible, - u'Version') - dual_copyright = self.parent.manager.get_meta_data(dual_bible, - u'Copyright') - dual_permission = self.parent.manager.get_meta_data(dual_bible, - u'Permissions') - if not dual_permission: - dual_permission = u'' - # We count the number of rows which are maybe already present. - start_count = self.listView.count() - for count, verse in enumerate(self.search_results): - if dual_bible: - vdict = { - 'book': QtCore.QVariant(verse.book.name), - 'chapter': QtCore.QVariant(verse.chapter), - 'verse': QtCore.QVariant(verse.verse), - 'bible': QtCore.QVariant(bible), - 'version': QtCore.QVariant(version.value), - 'copyright': QtCore.QVariant(copyright.value), - 'permission': QtCore.QVariant(permission.value), - 'text': QtCore.QVariant(verse.text), - 'dual_bible': QtCore.QVariant(dual_bible), - 'dual_version': QtCore.QVariant(dual_version.value), - 'dual_copyright': QtCore.QVariant(dual_copyright.value), - 'dual_permission': QtCore.QVariant(dual_permission.value), - 'dual_text': QtCore.QVariant( - self.dual_search_results[count].text) - } - bible_text = u' %s %d:%d (%s, %s)' % (verse.book.name, - verse.chapter, verse.verse, version.value, - dual_version.value) - else: - vdict = { - 'book': QtCore.QVariant(verse.book.name), - 'chapter': QtCore.QVariant(verse.chapter), - 'verse': QtCore.QVariant(verse.verse), - 'bible': QtCore.QVariant(bible), - 'version': QtCore.QVariant(version.value), - 'copyright': QtCore.QVariant(copyright.value), - 'permission': QtCore.QVariant(permission.value), - 'text': QtCore.QVariant(verse.text), - 'dual_bible': QtCore.QVariant(u''), - 'dual_version': QtCore.QVariant(u''), - 'dual_copyright': QtCore.QVariant(u''), - 'dual_permission': QtCore.QVariant(u''), - 'dual_text': QtCore.QVariant(u'') - } - bible_text = u' %s %d:%d (%s)' % (verse.book.name, - verse.chapter, verse.verse, version.value) - bible_verse = QtGui.QListWidgetItem(bible_text) - bible_verse.setData(QtCore.Qt.UserRole, QtCore.QVariant(vdict)) - self.listView.addItem(bible_verse) - row = self.listView.setCurrentRow(count + start_count) - if row: - row.setSelected(True) - self.search_results = {} - self.dual_search_results = {} diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py index 7f910f395..711000191 100644 --- a/openlp/plugins/images/imageplugin.py +++ b/openlp/plugins/images/imageplugin.py @@ -35,7 +35,7 @@ class ImagePlugin(Plugin): log.info(u'Image Plugin loaded') def __init__(self, plugin_helpers): - Plugin.__init__(self, u'Images', u'1.9.3', plugin_helpers) + Plugin.__init__(self, u'Images', u'1.9.4', plugin_helpers) self.weight = -7 self.icon_path = u':/plugins/plugin_images.png' self.icon = build_icon(self.icon_path) diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 93271a604..4caf5bfc2 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -187,8 +187,7 @@ class ImageMediaItem(MediaManagerItem): for item in items: bitem = self.listView.item(item.row()) filename = unicode(bitem.data(QtCore.Qt.UserRole).toString()) - frame = QtGui.QImage(unicode(filename)) - self.parent.liveController.display.image(frame) + self.parent.liveController.display.image(filename) self.resetButton.setVisible(True) def onPreviewClick(self): diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index 8180c9a52..27d71cdd7 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -140,7 +140,7 @@ class SongsPlugin(Plugin): Song.theme_name == oldTheme) for song in songsUsingTheme: song.theme_name = newTheme - self.custommanager.save_object(song) + self.manager.save_object(song) def importSongs(self, format, **kwargs): class_ = SongFormat.get_class(format) diff --git a/resources/forms/filerenamedialog.ui b/resources/forms/filerenamedialog.ui new file mode 100644 index 000000000..fb2d8780d --- /dev/null +++ b/resources/forms/filerenamedialog.ui @@ -0,0 +1,54 @@ + + + FileRenameDialog + + + + 0 + 0 + 400 + 87 + + + + File Rename + + + + + 210 + 50 + 171 + 25 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 10 + 10 + 381 + 27 + + + + + + + New File Name: + + + + + + + + + + + + diff --git a/resources/forms/themewizard.ui b/resources/forms/themewizard.ui index 54f9e43aa..a87052322 100644 --- a/resources/forms/themewizard.ui +++ b/resources/forms/themewizard.ui @@ -1,95 +1,893 @@ - - ThemeWizard - - - Qt::ApplicationModal - - + + + Wizard + + 0 0 - 576 - 397 + 559 + 487 - + Theme Wizard - + true - + QWizard::ModernStyle - - QWizard::DisabledBackButtonOnLastPage|QWizard::IndependentPages|QWizard::NoBackButtonOnStartPage|QWizard::NoCancelButton + + QWizard::HaveCustomButton1|QWizard::NoBackButtonOnStartPage - - - Welcome - - + + - - - - 20 - 100 - 341 - 31 - + + + + + + 8 - - Welcome to the Theme Wizard. This wizard will guide you through the process of creating a new theme. + + 0 - - true - - + + + + + 163 + 0 + + + + + 163 + 16777215 + + + + 0 + + + + + + :/wizards/wizard_importbible.bmp + + + 0 + + + + + + + 8 + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; font-weight:600;">Welcome to the Theme Wizard</span></p></body></html> + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 40 + + + + + + + + This wizard will help you to maintain Themes . Click the next button below to start the process.. + + + true + + + 10 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + - - - Theme Name + + + Select Import Source - - Choose a name for your theme + + Select the import format, and where to import from. - - - - 100 - 130 - 91 - 17 - + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - Theme Name: - - - - - - 200 - 127 - 261 - 22 - - - + + + + + + Background: + + + + + + + + Opaque + + + + + Transparent + + + + + + + + + + + + Background Type: + + + + + + + + Solid Color + + + + + Gradient + + + + + Image + + + + + + + + + + + + <Color1> + + + + + + + + + + + + + + + + + + <Color2> + + + + + + + + + + + + + + + + + + Gradient : + + + + + + + + Horizontal + + + + + Vertical + + + + + Circular + + + + + + + + + + + + Image: + + + + + + + + + + ... + + + + + + - - - Select Background + + + Main Area Font Details - - Select a background type and configure your background + + Define the font and display charaistics for the Display text + + + + + Font: + + + + + + + + + + Font Color: + + + + + + + + + + + + + + Size: + + + + + + + + 0 + 0 + + + + + 70 + 0 + + + + pt + + + 999 + + + 16 + + + + + + + Wrap Indentation + + + + + + + + + + TextLabel + + + + + + + Show Outline: + + + + + + + + + + + + + + Outline Color: + + + + + + + + + + + + + + Show Shadow: + + + + + + + + + + + + + + Shadow Color: + + + + + + + + + + + + + + + Footer Area Font Details + + + Define the font and display charaistics for the Footer text + + + + + + Font: + + + + + + + + + + Font Color: + + + + + + + + + + + + + + Size: + + + + + + + + 0 + 0 + + + + + 70 + 0 + + + + pt + + + 999 + + + 10 + + + + + + + Show Outline: + + + + + + + + + + + + + + Shadow Color: + + + + + + + + + + + + + + Show Shadow: + + + + + + + + + + + + + + Outline Color: + + + + + + + + + + + + + + + Text Display Layout + + + Allows you to change and move the Main and Footer areas. + + + + + + + + + false + + + + + + + + + Main Area + + + + + + + Footer Area + + + + + + + X Position: + + + + + + + + 0 + 0 + + + + + 78 + 0 + + + + px + + + 9999 + + + 0 + + + + + + + X Position: + + + + + + + + 0 + 0 + + + + + 78 + 0 + + + + px + + + 9999 + + + 0 + + + + + + + Y Position: + + + + + + + + 0 + 0 + + + + + 78 + 0 + + + + px + + + 9999 + + + + + + + Y Position: + + + + + + + + 0 + 0 + + + + + 78 + 0 + + + + px + + + 9999 + + + 0 + + + + + + + Width: + + + + + + + + 0 + 0 + + + + + 78 + 0 + + + + px + + + 9999 + + + + + + + Width: + + + + + + + + 78 + 0 + + + + px + + + 9999 + + + + + + + Height: + + + + + + + + 0 + 0 + + + + + 78 + 0 + + + + px + + + 9999 + + + + + + + Height: + + + + + + + + 78 + 0 + + + + px + + + 9999 + + + + + + + + + Use Default Location: + + + + + + + + Save and Preview + + + View the theme and save it replacing the current one or change the name to create a new theme + + + + + + + + Theme Name: + + + + + + + + + + + + + + Preview + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 300 + 225 + + + + QFrame::WinPanel + + + QFrame::Sunken + + + 1 + + + + + + true + + + + + + - +