diff --git a/openlp.pyw b/openlp.pyw index fb8eff2ed..5ec730e22 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -100,7 +100,7 @@ class OpenLP(QtGui.QApplication): ) else: log.info(u'Openlp version %s' % app_version[u'version']) - except: + except IOError: log.exception('Error in version file.') app_version = { u'full': u'1.9.0-bzr000', diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 30663ffbe..d5b46e6cb 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -173,7 +173,6 @@ from settingsmanager import SettingsManager from plugin import PluginStatus, Plugin from pluginmanager import PluginManager from settingstab import SettingsTab -from mediamanageritem import MediaManagerItem from xmlrootclass import XmlRootClass from serviceitem import ServiceItem from serviceitem import ServiceItemType @@ -184,5 +183,6 @@ from songxmlhandler import SongXMLBuilder, SongXMLParser from themexmlhandler import ThemeXML from renderer import Renderer from rendermanager import RenderManager +from mediamanageritem import MediaManagerItem from basemodel import BaseModel from baselistwithdnd import BaseListWithDnD diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index b1429770a..8bfefceb0 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -23,15 +23,14 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### +import logging import types import os from PyQt4 import QtCore, QtGui -from openlp.core.lib.toolbar import * from openlp.core.lib import contextMenuAction, contextMenuSeparator, \ - SettingsManager -from serviceitem import ServiceItem + SettingsManager, OpenLPToolbar, ServiceItem, build_icon log = logging.getLogger(__name__) @@ -336,8 +335,8 @@ class MediaManagerItem(QtGui.QWidget): log.info(u'New files(s) %s', unicode(files)) if files: self.loadList(files) - dir = os.path.split(unicode(files[0]))[0] - SettingsManager.set_last_dir(self.settingsSection, dir) + lastDir = os.path.split(unicode(files[0]))[0] + SettingsManager.set_last_dir(self.settingsSection, lastDir) SettingsManager.set_list(self.settingsSection, self.settingsSection, self.getFileList()) diff --git a/openlp/core/lib/pluginmanager.py b/openlp/core/lib/pluginmanager.py index fe48ccf0a..95bf3971c 100644 --- a/openlp/core/lib/pluginmanager.py +++ b/openlp/core/lib/pluginmanager.py @@ -38,30 +38,32 @@ class PluginManager(object): """ log.info(u'Plugin manager loaded') - def __init__(self, dir): + def __init__(self, plugin_dir): """ The constructor for the plugin manager. Passes the controllers on to the plugins for them to interact with via their ServiceItems. - ``dir`` + ``plugin_dir`` The directory to search for plugins. """ log.info(u'Plugin manager initing') - if not dir in sys.path: - log.debug(u'Inserting %s into sys.path', dir) - sys.path.insert(0, dir) - self.basepath = os.path.abspath(dir) + if not plugin_dir in sys.path: + log.debug(u'Inserting %s into sys.path', plugin_dir) + sys.path.insert(0, plugin_dir) + self.basepath = os.path.abspath(plugin_dir) log.debug(u'Base path %s ', self.basepath) + self.plugin_helpers = [] self.plugins = [] - # this has to happen after the UI is sorted self.find_plugins(dir) + # this has to happen after the UI is sorted + # self.find_plugins(plugin_dir) log.info(u'Plugin manager Initialised') - def find_plugins(self, dir, plugin_helpers): + def find_plugins(self, plugin_dir, plugin_helpers): """ - Scan the directory ``dir`` for objects inheriting from the ``Plugin`` - class. + Scan the directory ``plugin_dir`` for objects inheriting from the + ``Plugin`` class. - ``dir`` + ``plugin_dir`` The directory to scan. ``plugin_helpers`` @@ -69,10 +71,11 @@ class PluginManager(object): """ self.plugin_helpers = plugin_helpers - startdepth = len(os.path.abspath(dir).split(os.sep)) - log.debug(u'find plugins %s at depth %d', unicode(dir), startdepth) + startdepth = len(os.path.abspath(plugin_dir).split(os.sep)) + log.debug(u'finding plugins in %s at depth %d', + unicode(plugin_dir), startdepth) - for root, dirs, files in os.walk(dir): + for root, dirs, files in os.walk(plugin_dir): for name in files: if name.endswith(u'.py') and not name.startswith(u'__'): path = os.path.abspath(os.path.join(root, name)) @@ -80,7 +83,7 @@ class PluginManager(object): if thisdepth - startdepth > 2: # skip anything lower down continue - modulename, pyext = os.path.splitext(path) + modulename = os.path.splitext(path)[0] prefix = os.path.commonprefix([self.basepath, path]) # hack off the plugin base path modulename = modulename[len(prefix) + 1:] @@ -91,8 +94,8 @@ class PluginManager(object): try: __import__(modulename, globals(), locals(), []) except ImportError, e: - log.exception(u'Failed to import module %s on path %s for reason %s', - modulename, path, e.args[0]) + log.exception(u'Failed to import module %s on path %s ' + 'for reason %s', modulename, path, e.args[0]) plugin_classes = Plugin.__subclasses__() plugin_objects = [] for p in plugin_classes: @@ -214,3 +217,4 @@ class PluginManager(object): if plugin.is_active(): plugin.finalise() log.info(u'Finalisation Complete for %s ' % plugin.name) + diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 55c66a809..55700ebac 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -189,7 +189,8 @@ class Renderer(object): pos = split_text.rfind(u' ') #no more spaces and we are still too long if pos == -1: - while metrics.width(split_text, -1) > line_width: + while \ + metrics.width(split_text, -1) > line_width: split_text = split_text[:-1] pos = len(split_text) else: @@ -199,12 +200,14 @@ class Renderer(object): #if we have more text add up to 10 spaces on the front. if line and self._theme.font_main_indentation > 0: line = u'%s%s' % \ - (u' '[:int(self._theme.font_main_indentation)], line) + (u' '[:int(self._theme.font_main_indentation)], + line) #Text fits in a line now for count, line in enumerate(split_lines): page.append(line) #last but one line and only 2 lines to go or end of page - if (len(page) == page_length - 1 and len(split_lines) - 3 == count) or \ + if (len(page) == page_length - 1 and + len(split_lines) - 3 == count) or \ len(page) == page_length: split_pages.append(page) page = [] @@ -559,7 +562,8 @@ class Renderer(object): self.painter.drawText(x, rowpos, line) if self._theme.display_slideTransition: # Print 2nd image with 70% weight - if self._theme.display_outline and outline_size != 0 and not footer: + if self._theme.display_outline and outline_size != 0 and \ + not footer: path = QtGui.QPainterPath() path.addText(QtCore.QPointF(x, rowpos), font, line) self.painter2.setBrush(self.painter2.pen().brush()) diff --git a/openlp/core/lib/rendermanager.py b/openlp/core/lib/rendermanager.py index e811529db..431f74564 100644 --- a/openlp/core/lib/rendermanager.py +++ b/openlp/core/lib/rendermanager.py @@ -181,7 +181,8 @@ class RenderManager(object): footer.append(u'CCLI 123456') formatted = self.renderer.format_slide(verse, False) #Only Render the first slide page returned - return self.renderer.generate_frame_from_lines(formatted[0], footer)[u'main'] + return self.renderer.generate_frame_from_lines(formatted[0], + footer)[u'main'] def format_slide(self, words): """ diff --git a/openlp/core/lib/settingsmanager.py b/openlp/core/lib/settingsmanager.py index d6b987db4..b3d16595e 100644 --- a/openlp/core/lib/settingsmanager.py +++ b/openlp/core/lib/settingsmanager.py @@ -172,11 +172,12 @@ class SettingsManager(object): path = os.path.join(path, section) try: files = os.listdir(path) - except: + except OSError: return [] if extension: - return [file for file in files - if extension == os.path.splitext(file)[1]] + return [filename for filename in files + if extension == os.path.splitext(filename)[1]] else: # no filtering required return files + diff --git a/openlp/core/lib/songxmlhandler.py b/openlp/core/lib/songxmlhandler.py index 4b0a26d7b..acb75609b 100644 --- a/openlp/core/lib/songxmlhandler.py +++ b/openlp/core/lib/songxmlhandler.py @@ -24,8 +24,10 @@ ############################################################################### import logging + from xml.dom.minidom import Document from xml.etree.ElementTree import ElementTree, XML, dump +from xml.parsers.expat import ExpatError log = logging.getLogger(__name__) @@ -136,7 +138,7 @@ class SongXMLParser(object): try: self.song_xml = ElementTree( element=XML(unicode(xml).encode('unicode-escape'))) - except: + except ExpatError: log.exception(u'Invalid xml %s', xml) def get_verses(self): @@ -144,9 +146,9 @@ class SongXMLParser(object): Iterates through the verses in the XML and returns a list of verses and their attributes. """ - iter = self.song_xml.getiterator() + xml_iter = self.song_xml.getiterator() verse_list = [] - for element in iter: + for element in xml_iter: if element.tag == u'verse': if element.text is None: element.text = u'' diff --git a/openlp/core/lib/themexmlhandler.py b/openlp/core/lib/themexmlhandler.py index b3cfb0307..a6d1ec186 100644 --- a/openlp/core/lib/themexmlhandler.py +++ b/openlp/core/lib/themexmlhandler.py @@ -30,7 +30,7 @@ from xml.etree.ElementTree import ElementTree, XML from openlp.core.lib import str_to_bool -blankthemexml = \ +BLANK_THEME_XML = \ ''' BlankStyle @@ -97,7 +97,8 @@ class ThemeXML(object): """ if self.background_filename and path: self.theme_name = self.theme_name.rstrip().lstrip() - self.background_filename = self.background_filename.rstrip().lstrip() + self.background_filename = \ + self.background_filename.rstrip().lstrip() self.background_filename = os.path.join(path, self.theme_name, self.background_filename) @@ -244,7 +245,8 @@ class ThemeXML(object): background.appendChild(element) def add_display(self, shadow, shadow_color, outline, outline_color, - horizontal, vertical, wrap, transition, shadow_pixel=5, outline_pixel=2): + horizontal, vertical, wrap, transition, shadow_pixel=5, + outline_pixel=2): """ Add a Display options. @@ -349,13 +351,12 @@ class ThemeXML(object): """ self.base_parse_xml() self.parse_xml(xml) - self.theme_filename_extended = False def base_parse_xml(self): """ 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): """ @@ -365,9 +366,9 @@ class ThemeXML(object): The XML string to parse. """ theme_xml = ElementTree(element=XML(xml)) - iter = theme_xml.getiterator() + xml_iter = theme_xml.getiterator() master = u'' - for element in iter: + for element in xml_iter: element.text = unicode(element.text).decode('unicode-escape') if element.getchildren(): master = element.tag + u'_' @@ -409,3 +410,4 @@ class ThemeXML(object): if key[0:1] != u'_': theme_strings.append(u'%30s: %s' % (key, getattr(self, key))) return u'\n'.join(theme_strings) + diff --git a/openlp/core/lib/toolbar.py b/openlp/core/lib/toolbar.py index a1af42736..12916097e 100644 --- a/openlp/core/lib/toolbar.py +++ b/openlp/core/lib/toolbar.py @@ -120,7 +120,7 @@ class OpenLPToolbar(QtGui.QToolBar): try: if self.icons[title]: return self.icons[title] - except: + except NameError: log.exception(u'getIconFromTitle - no icon for %s' % title) return QtGui.QIcon() diff --git a/openlp/core/lib/xmlrootclass.py b/openlp/core/lib/xmlrootclass.py index 017d365c2..9b58a6f03 100644 --- a/openlp/core/lib/xmlrootclass.py +++ b/openlp/core/lib/xmlrootclass.py @@ -52,8 +52,8 @@ class XmlRootClass(object): The root tag of the xml. """ root = ElementTree(element=XML(xml)) - iter = root.getiterator() - for element in iter: + xml_iter = root.getiterator() + for element in xml_iter: if element.tag != root_tag: text = element.text if type(text) is NoneType: @@ -76,7 +76,8 @@ class XmlRootClass(object): # Ok, it seems to be a string. val = text if hasattr(self, u'post_tag_hook'): - (element.tag, val) = self.post_tag_hook(element.tag, val) + (element.tag, val) = \ + self.post_tag_hook(element.tag, val) setattr(self, element.tag, val) def __str__(self): @@ -90,7 +91,8 @@ class XmlRootClass(object): attributes = [] for attrib in dir(self): if not attrib.startswith(u'_'): - attributes.append(u'%30s : %s' % (attrib, getattr(self, attrib))) + attributes.append( + u'%30s : %s' % (attrib, getattr(self, attrib))) return u'\n'.join(attributes) def _get_as_string(self): diff --git a/openlp/core/theme/theme.py b/openlp/core/theme/theme.py index 501a7c33e..f63ee4c26 100644 --- a/openlp/core/theme/theme.py +++ b/openlp/core/theme/theme.py @@ -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 = \ ''' BlankStyle @@ -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): @@ -115,26 +115,27 @@ class Theme(object): for element in iter: delphiColorChange = False if element.tag != u'Theme': - t = element.text + element_text = element.text val = 0 # easy! - if type(t) == type(None): - val = t + if element_text is None: + val = element_text # strings need special handling to sort the colours out - if type(t) is types.StringType or type(t) is types.UnicodeType: - if t[0] == u'$': # might be a hex number + if type(element_text) is types.StringType or \ + type(element_text) is types.UnicodeType: + if element_text[0] == u'$': # might be a hex number try: - val = int(t[1:], 16) + val = int(element_text[1:], 16) except ValueError: # nope pass - elif DelphiColors.has_key(t): - val = DelphiColors[t] + elif DELPHI_COLORS.has_key(element_text): + val = DELPHI_COLORS[element_text] delphiColorChange = True else: try: - val = int(t) + val = int(element_text) except ValueError: - val = t + val = element_text if (element.tag.find(u'Color') > 0 or (element.tag.find(u'BackgroundParameter') == 0 and type(val) == type(0))): diff --git a/openlp/core/ui/aboutdialog.py b/openlp/core/ui/aboutdialog.py index fac8874f5..9e4179072 100644 --- a/openlp/core/ui/aboutdialog.py +++ b/openlp/core/ui/aboutdialog.py @@ -132,7 +132,8 @@ class Ui_AboutDialog(object): 'consider contributing by using the button below.' )) self.AboutNotebook.setTabText( - self.AboutNotebook.indexOf(self.AboutTab), translate('AboutForm', 'About')) + self.AboutNotebook.indexOf(self.AboutTab), + translate('AboutForm', 'About')) self.CreditsTextEdit.setPlainText(translate('AboutForm', 'Project Lead\n' ' Raoul "superfly" Snyman\n' diff --git a/openlp/core/ui/aboutform.py b/openlp/core/ui/aboutform.py index c79324515..72ebc5315 100644 --- a/openlp/core/ui/aboutform.py +++ b/openlp/core/ui/aboutform.py @@ -57,5 +57,6 @@ class AboutForm(QtGui.QDialog, Ui_AboutDialog): Launch a web browser and go to the contribute page on the site. """ import webbrowser - url = u'http://www.openlp.org/en/documentation/introduction/contributing.html' + url = u'http://www.openlp.org/en/documentation/introduction/' \ + + u'contributing.html' webbrowser.open_new(url) diff --git a/openlp/core/ui/amendthemedialog.py b/openlp/core/ui/amendthemedialog.py index 848f6ec72..a9e07f1e6 100644 --- a/openlp/core/ui/amendthemedialog.py +++ b/openlp/core/ui/amendthemedialog.py @@ -24,8 +24,8 @@ ############################################################################### from PyQt4 import QtCore, QtGui -from openlp.core.lib import build_icon -from openlp.core.lib import translate + +from openlp.core.lib import build_icon, translate class Ui_AmendThemeDialog(object): def setupUi(self, AmendThemeDialog): @@ -68,45 +68,56 @@ class Ui_AmendThemeDialog(object): self.BackgroundLayout.setObjectName(u'BackgroundLayout') self.BackgroundLabel = QtGui.QLabel(self.BackgroundTab) self.BackgroundLabel.setObjectName(u'BackgroundLabel') - self.BackgroundLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.BackgroundLabel) + self.BackgroundLayout.setWidget(0, QtGui.QFormLayout.LabelRole, + self.BackgroundLabel) self.BackgroundComboBox = QtGui.QComboBox(self.BackgroundTab) self.BackgroundComboBox.setObjectName(u'BackgroundComboBox') self.BackgroundComboBox.addItem(QtCore.QString()) self.BackgroundComboBox.addItem(QtCore.QString()) - self.BackgroundLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.BackgroundComboBox) + self.BackgroundLayout.setWidget(0, QtGui.QFormLayout.FieldRole, + self.BackgroundComboBox) self.BackgroundTypeLabel = QtGui.QLabel(self.BackgroundTab) self.BackgroundTypeLabel.setObjectName(u'BackgroundTypeLabel') - self.BackgroundLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.BackgroundTypeLabel) + self.BackgroundLayout.setWidget(1, QtGui.QFormLayout.LabelRole, + self.BackgroundTypeLabel) self.BackgroundTypeComboBox = QtGui.QComboBox(self.BackgroundTab) self.BackgroundTypeComboBox.setObjectName(u'BackgroundTypeComboBox') self.BackgroundTypeComboBox.addItem(QtCore.QString()) self.BackgroundTypeComboBox.addItem(QtCore.QString()) self.BackgroundTypeComboBox.addItem(QtCore.QString()) - self.BackgroundLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.BackgroundTypeComboBox) + self.BackgroundLayout.setWidget(1, QtGui.QFormLayout.FieldRole, + self.BackgroundTypeComboBox) self.Color1Label = QtGui.QLabel(self.BackgroundTab) self.Color1Label.setObjectName(u'Color1Label') - self.BackgroundLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.Color1Label) + self.BackgroundLayout.setWidget(2, QtGui.QFormLayout.LabelRole, + self.Color1Label) self.Color1PushButton = QtGui.QPushButton(self.BackgroundTab) self.Color1PushButton.setObjectName(u'Color1PushButton') - self.BackgroundLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.Color1PushButton) + self.BackgroundLayout.setWidget(2, QtGui.QFormLayout.FieldRole, + self.Color1PushButton) self.Color2Label = QtGui.QLabel(self.BackgroundTab) self.Color2Label.setObjectName(u'Color2Label') - self.BackgroundLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.Color2Label) + self.BackgroundLayout.setWidget(3, QtGui.QFormLayout.LabelRole, + self.Color2Label) self.Color2PushButton = QtGui.QPushButton(self.BackgroundTab) self.Color2PushButton.setObjectName(u'Color2PushButton') - self.BackgroundLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.Color2PushButton) + self.BackgroundLayout.setWidget(3, QtGui.QFormLayout.FieldRole, + self.Color2PushButton) self.ImageLabel = QtGui.QLabel(self.BackgroundTab) self.ImageLabel.setObjectName(u'ImageLabel') - self.BackgroundLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.ImageLabel) + self.BackgroundLayout.setWidget(4, QtGui.QFormLayout.LabelRole, + self.ImageLabel) self.GradientLabel = QtGui.QLabel(self.BackgroundTab) self.GradientLabel.setObjectName(u'GradientLabel') - self.BackgroundLayout.setWidget(6, QtGui.QFormLayout.LabelRole, self.GradientLabel) + self.BackgroundLayout.setWidget(6, QtGui.QFormLayout.LabelRole, + self.GradientLabel) self.GradientComboBox = QtGui.QComboBox(self.BackgroundTab) self.GradientComboBox.setObjectName(u'GradientComboBox') self.GradientComboBox.addItem(QtCore.QString()) self.GradientComboBox.addItem(QtCore.QString()) self.GradientComboBox.addItem(QtCore.QString()) - self.BackgroundLayout.setWidget(6, QtGui.QFormLayout.FieldRole, self.GradientComboBox) + self.BackgroundLayout.setWidget(6, QtGui.QFormLayout.FieldRole, + self.GradientComboBox) self.ImageFilenameWidget = QtGui.QWidget(self.BackgroundTab) self.ImageFilenameWidget.setObjectName(u'ImageFilenameWidget') self.horizontalLayout_2 = QtGui.QHBoxLayout(self.ImageFilenameWidget) @@ -121,7 +132,8 @@ class Ui_AmendThemeDialog(object): self.ImageToolButton.setIcon(icon1) self.ImageToolButton.setObjectName(u'ImageToolButton') self.horizontalLayout_2.addWidget(self.ImageToolButton) - self.BackgroundLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.ImageFilenameWidget) + self.BackgroundLayout.setWidget(4, QtGui.QFormLayout.FieldRole, + self.ImageFilenameWidget) self.ThemeTabWidget.addTab(self.BackgroundTab, u'') self.FontMainTab = QtGui.QWidget() self.FontMainTab.setObjectName(u'FontMainTab') @@ -138,65 +150,88 @@ class Ui_AmendThemeDialog(object): self.FontMainGroupBox = QtGui.QGroupBox(self.MainLeftWidget) self.FontMainGroupBox.setObjectName(u'FontMainGroupBox') self.MainFontLayout = QtGui.QFormLayout(self.FontMainGroupBox) - self.MainFontLayout.setFormAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.MainFontLayout.setFormAlignment(QtCore.Qt.AlignLeading | + QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) self.MainFontLayout.setMargin(8) self.MainFontLayout.setSpacing(8) self.MainFontLayout.setObjectName(u'MainFontLayout') self.FontMainlabel = QtGui.QLabel(self.FontMainGroupBox) self.FontMainlabel.setObjectName(u'FontMainlabel') - self.MainFontLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.FontMainlabel) + self.MainFontLayout.setWidget(0, QtGui.QFormLayout.LabelRole, + self.FontMainlabel) self.FontMainComboBox = QtGui.QFontComboBox(self.FontMainGroupBox) self.FontMainComboBox.setObjectName(u'FontMainComboBox') - self.MainFontLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.FontMainComboBox) + self.MainFontLayout.setWidget(0, QtGui.QFormLayout.FieldRole, + self.FontMainComboBox) self.FontMainColorLabel = QtGui.QLabel(self.FontMainGroupBox) self.FontMainColorLabel.setObjectName(u'FontMainColorLabel') - self.MainFontLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.FontMainColorLabel) + self.MainFontLayout.setWidget(1, QtGui.QFormLayout.LabelRole, + self.FontMainColorLabel) self.FontMainColorPushButton = QtGui.QPushButton(self.FontMainGroupBox) self.FontMainColorPushButton.setObjectName(u'FontMainColorPushButton') - self.MainFontLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.FontMainColorPushButton) + self.MainFontLayout.setWidget(1, QtGui.QFormLayout.FieldRole, + self.FontMainColorPushButton) self.FontMainSize = QtGui.QLabel(self.FontMainGroupBox) self.FontMainSize.setObjectName(u'FontMainSize') - self.MainFontLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.FontMainSize) + self.MainFontLayout.setWidget(2, QtGui.QFormLayout.LabelRole, + self.FontMainSize) self.FontMainSizeSpinBox = QtGui.QSpinBox(self.FontMainGroupBox) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, + QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.FontMainSizeSpinBox.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.FontMainSizeSpinBox.sizePolicy().hasHeightForWidth()) self.FontMainSizeSpinBox.setSizePolicy(sizePolicy) self.FontMainSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0)) self.FontMainSizeSpinBox.setProperty(u'value', QtCore.QVariant(16)) self.FontMainSizeSpinBox.setMaximum(999) self.FontMainSizeSpinBox.setObjectName(u'FontMainSizeSpinBox') - self.MainFontLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.FontMainSizeSpinBox) + self.MainFontLayout.setWidget(2, QtGui.QFormLayout.FieldRole, + self.FontMainSizeSpinBox) self.FontMainWeightComboBox = QtGui.QComboBox(self.FontMainGroupBox) - self.FontMainWeightComboBox.setObjectName("FontMainWeightComboBox") + self.FontMainWeightComboBox.setObjectName(u'FontMainWeightComboBox') self.FontMainWeightComboBox.addItem(QtCore.QString()) self.FontMainWeightComboBox.addItem(QtCore.QString()) self.FontMainWeightComboBox.addItem(QtCore.QString()) self.FontMainWeightComboBox.addItem(QtCore.QString()) - self.MainFontLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.FontMainWeightComboBox) + self.MainFontLayout.setWidget(3, QtGui.QFormLayout.FieldRole, + self.FontMainWeightComboBox) self.FontMainWeightLabel = QtGui.QLabel(self.FontMainGroupBox) - self.FontMainWeightLabel.setObjectName("FontMainWeightLabel") - self.MainFontLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.FontMainWeightLabel) + self.FontMainWeightLabel.setObjectName(u'FontMainWeightLabel') + self.MainFontLayout.setWidget(3, QtGui.QFormLayout.LabelRole, + self.FontMainWeightLabel) self.MainLeftLayout.addWidget(self.FontMainGroupBox) - self.FontMainWrapLineAdjustmentLabel = QtGui.QLabel(self.FontMainGroupBox) - self.FontMainWrapLineAdjustmentLabel.setObjectName("FontMainWrapLineAdjustmentLabel") - self.MainFontLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.FontMainWrapLineAdjustmentLabel) - self.FontMainLineAdjustmentSpinBox = QtGui.QSpinBox(self.FontMainGroupBox) - self.FontMainLineAdjustmentSpinBox.setObjectName("FontMainLineAdjustmentSpinBox") + self.FontMainWrapLineAdjustmentLabel = QtGui.QLabel( + self.FontMainGroupBox) + self.FontMainWrapLineAdjustmentLabel.setObjectName( + u'FontMainWrapLineAdjustmentLabel') + self.MainFontLayout.setWidget(4, QtGui.QFormLayout.LabelRole, + self.FontMainWrapLineAdjustmentLabel) + self.FontMainLineAdjustmentSpinBox = QtGui.QSpinBox( + self.FontMainGroupBox) + self.FontMainLineAdjustmentSpinBox.setObjectName( + u'FontMainLineAdjustmentSpinBox') self.FontMainLineAdjustmentSpinBox.setMinimum(-99) - self.MainFontLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.FontMainLineAdjustmentSpinBox) + self.MainFontLayout.setWidget(4, QtGui.QFormLayout.FieldRole, + self.FontMainLineAdjustmentSpinBox) self.FontMainWrapIndentationLabel = QtGui.QLabel(self.FontMainGroupBox) - self.FontMainWrapIndentationLabel.setObjectName("FontMainWrapIndentationLabel") - self.MainFontLayout.setWidget(5, QtGui.QFormLayout.LabelRole, self.FontMainWrapIndentationLabel) + self.FontMainWrapIndentationLabel.setObjectName( + u'FontMainWrapIndentationLabel') + self.MainFontLayout.setWidget(5, QtGui.QFormLayout.LabelRole, + self.FontMainWrapIndentationLabel) self.FontMainLineSpacingSpinBox = QtGui.QSpinBox(self.FontMainGroupBox) - self.FontMainLineSpacingSpinBox.setObjectName("FontMainLineSpacingSpinBox") + self.FontMainLineSpacingSpinBox.setObjectName( + u'FontMainLineSpacingSpinBox') self.FontMainLineSpacingSpinBox.setMaximum(10) - self.MainFontLayout.setWidget(5, QtGui.QFormLayout.FieldRole, self.FontMainLineSpacingSpinBox) + self.MainFontLayout.setWidget(5, QtGui.QFormLayout.FieldRole, + self.FontMainLineSpacingSpinBox) self.FontMainLinesPageLabel = QtGui.QLabel(self.FontMainGroupBox) - self.FontMainLinesPageLabel.setObjectName("FontMainLinesPageLabel") - self.MainFontLayout.setWidget(6, QtGui.QFormLayout.LabelRole, self.FontMainLinesPageLabel) - spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.FontMainLinesPageLabel.setObjectName(u'FontMainLinesPageLabel') + self.MainFontLayout.setWidget(6, QtGui.QFormLayout.LabelRole, + self.FontMainLinesPageLabel) + spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, + QtGui.QSizePolicy.Expanding) self.MainLeftLayout.addItem(spacerItem1) self.FontMainLayout.addWidget(self.MainLeftWidget) self.MainRightWidget = QtGui.QWidget(self.FontMainTab) @@ -213,66 +248,86 @@ class Ui_AmendThemeDialog(object): self.MainLocationLayout.setObjectName(u'MainLocationLayout') self.DefaultLocationLabel = QtGui.QLabel(self.MainLocationGroupBox) self.DefaultLocationLabel.setObjectName(u'DefaultLocationLabel') - self.MainLocationLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.DefaultLocationLabel) - self.FontMainDefaultCheckBox = QtGui.QCheckBox(self.MainLocationGroupBox) + self.MainLocationLayout.setWidget(0, QtGui.QFormLayout.LabelRole, + self.DefaultLocationLabel) + self.FontMainDefaultCheckBox = QtGui.QCheckBox( + self.MainLocationGroupBox) self.FontMainDefaultCheckBox.setTristate(False) self.FontMainDefaultCheckBox.setObjectName(u'FontMainDefaultCheckBox') - self.MainLocationLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.FontMainDefaultCheckBox) + self.MainLocationLayout.setWidget(0, QtGui.QFormLayout.FieldRole, + self.FontMainDefaultCheckBox) self.FontMainXLabel = QtGui.QLabel(self.MainLocationGroupBox) self.FontMainXLabel.setObjectName(u'FontMainXLabel') - self.MainLocationLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.FontMainXLabel) + self.MainLocationLayout.setWidget(1, QtGui.QFormLayout.LabelRole, + self.FontMainXLabel) self.FontMainYLabel = QtGui.QLabel(self.MainLocationGroupBox) self.FontMainYLabel.setObjectName(u'FontMainYLabel') - self.MainLocationLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.FontMainYLabel) + self.MainLocationLayout.setWidget(2, QtGui.QFormLayout.LabelRole, + self.FontMainYLabel) self.FontMainWidthLabel = QtGui.QLabel(self.MainLocationGroupBox) self.FontMainWidthLabel.setObjectName(u'FontMainWidthLabel') - self.MainLocationLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.FontMainWidthLabel) + self.MainLocationLayout.setWidget(3, QtGui.QFormLayout.LabelRole, + self.FontMainWidthLabel) self.FontMainHeightLabel = QtGui.QLabel(self.MainLocationGroupBox) self.FontMainHeightLabel.setObjectName(u'FontMainHeightLabel') - self.MainLocationLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.FontMainHeightLabel) + self.MainLocationLayout.setWidget(4, QtGui.QFormLayout.LabelRole, + self.FontMainHeightLabel) self.FontMainXSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, + QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.FontMainXSpinBox.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.FontMainXSpinBox.sizePolicy().hasHeightForWidth()) self.FontMainXSpinBox.setSizePolicy(sizePolicy) self.FontMainXSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.FontMainXSpinBox.setProperty(u'value', QtCore.QVariant(0)) self.FontMainXSpinBox.setMaximum(9999) self.FontMainXSpinBox.setObjectName(u'FontMainXSpinBox') - self.MainLocationLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.FontMainXSpinBox) + self.MainLocationLayout.setWidget(1, QtGui.QFormLayout.FieldRole, + self.FontMainXSpinBox) self.FontMainYSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, + QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.FontMainYSpinBox.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.FontMainYSpinBox.sizePolicy().hasHeightForWidth()) self.FontMainYSpinBox.setSizePolicy(sizePolicy) self.FontMainYSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.FontMainYSpinBox.setMaximum(9999) self.FontMainYSpinBox.setObjectName(u'FontMainYSpinBox') - self.MainLocationLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.FontMainYSpinBox) + self.MainLocationLayout.setWidget(2, QtGui.QFormLayout.FieldRole, + self.FontMainYSpinBox) self.FontMainWidthSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, + QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.FontMainWidthSpinBox.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.FontMainWidthSpinBox.sizePolicy().hasHeightForWidth()) self.FontMainWidthSpinBox.setSizePolicy(sizePolicy) self.FontMainWidthSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.FontMainWidthSpinBox.setMaximum(9999) self.FontMainWidthSpinBox.setObjectName(u'FontMainWidthSpinBox') - self.MainLocationLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.FontMainWidthSpinBox) + self.MainLocationLayout.setWidget(3, QtGui.QFormLayout.FieldRole, + self.FontMainWidthSpinBox) self.FontMainHeightSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, + QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.FontMainHeightSpinBox.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.FontMainHeightSpinBox.sizePolicy().hasHeightForWidth()) self.FontMainHeightSpinBox.setSizePolicy(sizePolicy) self.FontMainHeightSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.FontMainHeightSpinBox.setMaximum(9999) self.FontMainHeightSpinBox.setObjectName(u'FontMainHeightSpinBox') - self.MainLocationLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.FontMainHeightSpinBox) + self.MainLocationLayout.setWidget(4, QtGui.QFormLayout.FieldRole, + self.FontMainHeightSpinBox) self.MainRightLayout.addWidget(self.MainLocationGroupBox) - spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, + QtGui.QSizePolicy.Expanding) self.MainRightLayout.addItem(spacerItem2) self.FontMainLayout.addWidget(self.MainRightWidget) self.ThemeTabWidget.addTab(self.FontMainTab, u'') @@ -291,49 +346,64 @@ class Ui_AmendThemeDialog(object): self.FooterFontGroupBox = QtGui.QGroupBox(self.FooterLeftWidget) self.FooterFontGroupBox.setObjectName(u'FooterFontGroupBox') self.FooterFontLayout = QtGui.QFormLayout(self.FooterFontGroupBox) - self.FooterFontLayout.setFieldGrowthPolicy(QtGui.QFormLayout.ExpandingFieldsGrow) - self.FooterFontLayout.setFormAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.FooterFontLayout.setFieldGrowthPolicy( + QtGui.QFormLayout.ExpandingFieldsGrow) + self.FooterFontLayout.setFormAlignment(QtCore.Qt.AlignLeading | + QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) self.FooterFontLayout.setMargin(8) self.FooterFontLayout.setSpacing(8) self.FooterFontLayout.setObjectName(u'FooterFontLayout') self.FontFooterLabel = QtGui.QLabel(self.FooterFontGroupBox) self.FontFooterLabel.setObjectName(u'FontFooterLabel') - self.FooterFontLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.FontFooterLabel) + self.FooterFontLayout.setWidget(0, QtGui.QFormLayout.LabelRole, + self.FontFooterLabel) self.FontFooterComboBox = QtGui.QFontComboBox(self.FooterFontGroupBox) self.FontFooterComboBox.setObjectName(u'FontFooterComboBox') - self.FooterFontLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.FontFooterComboBox) + self.FooterFontLayout.setWidget(0, QtGui.QFormLayout.FieldRole, + self.FontFooterComboBox) self.FontFooterColorLabel = QtGui.QLabel(self.FooterFontGroupBox) self.FontFooterColorLabel.setObjectName(u'FontFooterColorLabel') - self.FooterFontLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.FontFooterColorLabel) - self.FontFooterColorPushButton = QtGui.QPushButton(self.FooterFontGroupBox) - self.FontFooterColorPushButton.setObjectName(u'FontFooterColorPushButton') - self.FooterFontLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.FontFooterColorPushButton) + self.FooterFontLayout.setWidget(1, QtGui.QFormLayout.LabelRole, + self.FontFooterColorLabel) + self.FontFooterColorPushButton = QtGui.QPushButton( + self.FooterFontGroupBox) + self.FontFooterColorPushButton.setObjectName( + u'FontFooterColorPushButton') + self.FooterFontLayout.setWidget(1, QtGui.QFormLayout.FieldRole, + self.FontFooterColorPushButton) self.FontFooterSizeLabel = QtGui.QLabel(self.FooterFontGroupBox) self.FontFooterSizeLabel.setObjectName(u'FontFooterSizeLabel') - self.FooterFontLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.FontFooterSizeLabel) + self.FooterFontLayout.setWidget(2, QtGui.QFormLayout.LabelRole, + self.FontFooterSizeLabel) self.FontFooterSizeSpinBox = QtGui.QSpinBox(self.FooterFontGroupBox) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, + QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.FontFooterSizeSpinBox.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.FontFooterSizeSpinBox.sizePolicy().hasHeightForWidth()) self.FontFooterSizeSpinBox.setSizePolicy(sizePolicy) self.FontFooterSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0)) self.FontFooterSizeSpinBox.setProperty(u'value', QtCore.QVariant(10)) self.FontFooterSizeSpinBox.setMaximum(999) self.FontFooterSizeSpinBox.setObjectName(u'FontFooterSizeSpinBox') - self.FooterFontLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.FontFooterSizeSpinBox) + self.FooterFontLayout.setWidget(2, QtGui.QFormLayout.FieldRole, + self.FontFooterSizeSpinBox) self.FontFooterWeightComboBox = QtGui.QComboBox(self.FooterFontGroupBox) - self.FontFooterWeightComboBox.setObjectName("FontFooterWeightComboBox") + self.FontFooterWeightComboBox.setObjectName(u'FontFooterWeightComboBox') self.FontFooterWeightComboBox.addItem(QtCore.QString()) self.FontFooterWeightComboBox.addItem(QtCore.QString()) self.FontFooterWeightComboBox.addItem(QtCore.QString()) self.FontFooterWeightComboBox.addItem(QtCore.QString()) - self.FooterFontLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.FontFooterWeightComboBox) + self.FooterFontLayout.setWidget(3, QtGui.QFormLayout.FieldRole, + self.FontFooterWeightComboBox) self.FontFooterWeightLabel = QtGui.QLabel(self.FooterFontGroupBox) - self.FontFooterWeightLabel.setObjectName("FontFooterWeightLabel") - self.FooterFontLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.FontFooterWeightLabel) + self.FontFooterWeightLabel.setObjectName(u'FontFooterWeightLabel') + self.FooterFontLayout.setWidget(3, QtGui.QFormLayout.LabelRole, + self.FontFooterWeightLabel) self.FooterLeftLayout.addWidget(self.FooterFontGroupBox) - spacerItem3 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + spacerItem3 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, + QtGui.QSizePolicy.Expanding) self.FooterLeftLayout.addItem(spacerItem3) self.FontFooterLayout.addWidget(self.FooterLeftWidget) self.FooterRightWidget = QtGui.QWidget(self.FontFooterTab) @@ -344,65 +414,87 @@ class Ui_AmendThemeDialog(object): self.FooterRightLayout.setObjectName(u'FooterRightLayout') self.LocationFooterGroupBox = QtGui.QGroupBox(self.FooterRightWidget) self.LocationFooterGroupBox.setObjectName(u'LocationFooterGroupBox') - self.LocationFooterLayout = QtGui.QFormLayout(self.LocationFooterGroupBox) - self.LocationFooterLayout.setFieldGrowthPolicy(QtGui.QFormLayout.ExpandingFieldsGrow) - self.LocationFooterLayout.setFormAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.LocationFooterLayout = QtGui.QFormLayout( + self.LocationFooterGroupBox) + self.LocationFooterLayout.setFieldGrowthPolicy( + QtGui.QFormLayout.ExpandingFieldsGrow) + self.LocationFooterLayout.setFormAlignment(QtCore.Qt.AlignLeading | + QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) self.LocationFooterLayout.setMargin(8) self.LocationFooterLayout.setSpacing(8) self.LocationFooterLayout.setObjectName(u'LocationFooterLayout') self.FontFooterDefaultLabel = QtGui.QLabel(self.LocationFooterGroupBox) self.FontFooterDefaultLabel.setObjectName(u'FontFooterDefaultLabel') - self.LocationFooterLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.FontFooterDefaultLabel) - self.FontFooterDefaultCheckBox = QtGui.QCheckBox(self.LocationFooterGroupBox) + self.LocationFooterLayout.setWidget(0, QtGui.QFormLayout.LabelRole, + self.FontFooterDefaultLabel) + self.FontFooterDefaultCheckBox = QtGui.QCheckBox( + self.LocationFooterGroupBox) self.FontFooterDefaultCheckBox.setTristate(False) - self.FontFooterDefaultCheckBox.setObjectName(u'FontFooterDefaultCheckBox') - self.LocationFooterLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.FontFooterDefaultCheckBox) + self.FontFooterDefaultCheckBox.setObjectName( + u'FontFooterDefaultCheckBox') + self.LocationFooterLayout.setWidget(0, QtGui.QFormLayout.FieldRole, + self.FontFooterDefaultCheckBox) self.FontFooterXLabel = QtGui.QLabel(self.LocationFooterGroupBox) self.FontFooterXLabel.setObjectName(u'FontFooterXLabel') - self.LocationFooterLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.FontFooterXLabel) + self.LocationFooterLayout.setWidget(1, QtGui.QFormLayout.LabelRole, + self.FontFooterXLabel) self.FontFooterYLabel = QtGui.QLabel(self.LocationFooterGroupBox) self.FontFooterYLabel.setObjectName(u'FontFooterYLabel') - self.LocationFooterLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.FontFooterYLabel) + self.LocationFooterLayout.setWidget(2, QtGui.QFormLayout.LabelRole, + self.FontFooterYLabel) self.FontFooterWidthLabel = QtGui.QLabel(self.LocationFooterGroupBox) self.FontFooterWidthLabel.setObjectName(u'FontFooterWidthLabel') - self.LocationFooterLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.FontFooterWidthLabel) + self.LocationFooterLayout.setWidget(3, QtGui.QFormLayout.LabelRole, + self.FontFooterWidthLabel) self.FontFooterHeightLabel = QtGui.QLabel(self.LocationFooterGroupBox) self.FontFooterHeightLabel.setObjectName(u'FontFooterHeightLabel') - self.LocationFooterLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.FontFooterHeightLabel) + self.LocationFooterLayout.setWidget(4, QtGui.QFormLayout.LabelRole, + self.FontFooterHeightLabel) self.FontFooterXSpinBox = QtGui.QSpinBox(self.LocationFooterGroupBox) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, + QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.FontFooterXSpinBox.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.FontFooterXSpinBox.sizePolicy().hasHeightForWidth()) self.FontFooterXSpinBox.setSizePolicy(sizePolicy) self.FontFooterXSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.FontFooterXSpinBox.setProperty(u'value', QtCore.QVariant(0)) self.FontFooterXSpinBox.setMaximum(9999) self.FontFooterXSpinBox.setObjectName(u'FontFooterXSpinBox') - self.LocationFooterLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.FontFooterXSpinBox) + self.LocationFooterLayout.setWidget(1, QtGui.QFormLayout.FieldRole, + self.FontFooterXSpinBox) self.FontFooterYSpinBox = QtGui.QSpinBox(self.LocationFooterGroupBox) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, + QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.FontFooterYSpinBox.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.FontFooterYSpinBox.sizePolicy().hasHeightForWidth()) self.FontFooterYSpinBox.setSizePolicy(sizePolicy) self.FontFooterYSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.FontFooterYSpinBox.setProperty(u'value', QtCore.QVariant(0)) self.FontFooterYSpinBox.setMaximum(9999) self.FontFooterYSpinBox.setObjectName(u'FontFooterYSpinBox') - self.LocationFooterLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.FontFooterYSpinBox) - self.FontFooterWidthSpinBox = QtGui.QSpinBox(self.LocationFooterGroupBox) + self.LocationFooterLayout.setWidget(2, QtGui.QFormLayout.FieldRole, + self.FontFooterYSpinBox) + self.FontFooterWidthSpinBox = QtGui.QSpinBox( + self.LocationFooterGroupBox) self.FontFooterWidthSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.FontFooterWidthSpinBox.setMaximum(9999) self.FontFooterWidthSpinBox.setObjectName(u'FontFooterWidthSpinBox') - self.LocationFooterLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.FontFooterWidthSpinBox) - self.FontFooterHeightSpinBox = QtGui.QSpinBox(self.LocationFooterGroupBox) + self.LocationFooterLayout.setWidget(3, QtGui.QFormLayout.FieldRole, + self.FontFooterWidthSpinBox) + self.FontFooterHeightSpinBox = QtGui.QSpinBox( + self.LocationFooterGroupBox) self.FontFooterHeightSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.FontFooterHeightSpinBox.setMaximum(9999) self.FontFooterHeightSpinBox.setObjectName(u'FontFooterHeightSpinBox') - self.LocationFooterLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.FontFooterHeightSpinBox) + self.LocationFooterLayout.setWidget(4, QtGui.QFormLayout.FieldRole, + self.FontFooterHeightSpinBox) self.FooterRightLayout.addWidget(self.LocationFooterGroupBox) - spacerItem4 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + spacerItem4 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, + QtGui.QSizePolicy.Expanding) self.FooterRightLayout.addItem(spacerItem4) self.FontFooterLayout.addWidget(self.FooterRightWidget) self.ThemeTabWidget.addTab(self.FontFooterTab, u'') @@ -432,23 +524,29 @@ class Ui_AmendThemeDialog(object): self.OutlineLayout.setObjectName(u'OutlineLayout') self.OutlineCheckBox = QtGui.QCheckBox(self.OutlineWidget) self.OutlineCheckBox.setObjectName(u'OutlineCheckBox') - self.OutlineLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.OutlineCheckBox) + self.OutlineLayout.setWidget(0, QtGui.QFormLayout.FieldRole, + self.OutlineCheckBox) self.OutlineSpinBox = QtGui.QSpinBox(self.OutlineWidget) - self.OutlineSpinBox.setObjectName("OutlineSpinBox") + self.OutlineSpinBox.setObjectName(u'OutlineSpinBox') self.OutlineSpinBox.setMaximum(10) - self.OutlineLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.OutlineSpinBox) + self.OutlineLayout.setWidget(1, QtGui.QFormLayout.FieldRole, + self.OutlineSpinBox) self.OutlineSpinBoxLabel = QtGui.QLabel(self.OutlineWidget) self.OutlineSpinBoxLabel.setObjectName(u'OutlineSpinBoxLabel') - self.OutlineLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.OutlineSpinBoxLabel) + self.OutlineLayout.setWidget(1, QtGui.QFormLayout.LabelRole, + self.OutlineSpinBoxLabel) self.OutlineColorLabel = QtGui.QLabel(self.OutlineWidget) self.OutlineColorLabel.setObjectName(u'OutlineColorLabel') - self.OutlineLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.OutlineColorLabel) + self.OutlineLayout.setWidget(2, QtGui.QFormLayout.LabelRole, + self.OutlineColorLabel) self.OutlineColorPushButton = QtGui.QPushButton(self.OutlineWidget) self.OutlineColorPushButton.setObjectName(u'OutlineColorPushButton') - self.OutlineLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.OutlineColorPushButton) + self.OutlineLayout.setWidget(2, QtGui.QFormLayout.FieldRole, + self.OutlineColorPushButton) self.OutlineEnabledLabel = QtGui.QLabel(self.OutlineWidget) self.OutlineEnabledLabel.setObjectName(u'OutlineEnabledLabel') - self.OutlineLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.OutlineEnabledLabel) + self.OutlineLayout.setWidget(0, QtGui.QFormLayout.LabelRole, + self.OutlineEnabledLabel) self.verticalLayout.addWidget(self.OutlineWidget) self.OptionsLeftLayout.addWidget(self.OutlineGroupBox) self.ShadowGroupBox = QtGui.QGroupBox(self.OptionsLeftWidget) @@ -465,26 +563,33 @@ class Ui_AmendThemeDialog(object): self.ShadowLayout.setObjectName(u'ShadowLayout') self.ShadowCheckBox = QtGui.QCheckBox(self.ShadowWidget) self.ShadowCheckBox.setObjectName(u'ShadowCheckBox') - self.ShadowLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.ShadowCheckBox) + self.ShadowLayout.setWidget(0, QtGui.QFormLayout.FieldRole, + self.ShadowCheckBox) self.ShadowSpinBox = QtGui.QSpinBox(self.OutlineWidget) - self.ShadowSpinBox.setObjectName("ShadowSpinBox") + self.ShadowSpinBox.setObjectName(u'ShadowSpinBox') self.ShadowSpinBox.setMaximum(10) - self.ShadowLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.ShadowSpinBox) + self.ShadowLayout.setWidget(1, QtGui.QFormLayout.FieldRole, + self.ShadowSpinBox) self.ShadowSpinBoxLabel = QtGui.QLabel(self.OutlineWidget) self.ShadowSpinBoxLabel.setObjectName(u'ShadowSpinBoxLabel') - self.ShadowLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.ShadowSpinBoxLabel) + self.ShadowLayout.setWidget(1, QtGui.QFormLayout.LabelRole, + self.ShadowSpinBoxLabel) self.ShadowColorLabel = QtGui.QLabel(self.ShadowWidget) self.ShadowColorLabel.setObjectName(u'ShadowColorLabel') - self.ShadowLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.ShadowColorLabel) + self.ShadowLayout.setWidget(2, QtGui.QFormLayout.LabelRole, + self.ShadowColorLabel) self.ShadowColorPushButton = QtGui.QPushButton(self.ShadowWidget) self.ShadowColorPushButton.setObjectName(u'ShadowColorPushButton') - self.ShadowLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.ShadowColorPushButton) + self.ShadowLayout.setWidget(2, QtGui.QFormLayout.FieldRole, + self.ShadowColorPushButton) self.ShadowEnabledLabel = QtGui.QLabel(self.ShadowWidget) self.ShadowEnabledLabel.setObjectName(u'ShadowEnabledLabel') - self.ShadowLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.ShadowEnabledLabel) + self.ShadowLayout.setWidget(0, QtGui.QFormLayout.LabelRole, + self.ShadowEnabledLabel) self.verticalLayout.addWidget(self.ShadowWidget) self.OptionsLeftLayout.addWidget(self.ShadowGroupBox) - spacerItem5 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + spacerItem5 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, + QtGui.QSizePolicy.Expanding) self.OptionsLeftLayout.addItem(spacerItem5) self.OtherOptionsLayout.addWidget(self.OptionsLeftWidget) self.OptionsRightWidget = QtGui.QWidget(self.OtherOptionsTab) @@ -520,14 +625,18 @@ class Ui_AmendThemeDialog(object): self.TransitionGroupBox.setObjectName(u'TransitionGroupBox') self.gridLayout_5 = QtGui.QGridLayout(self.TransitionGroupBox) self.gridLayout_5.setObjectName(u'gridLayout_5') - self.SlideTransitionCheckedBoxLabel = QtGui.QLabel(self.TransitionGroupBox) - self.SlideTransitionCheckedBoxLabel.setObjectName(u'SlideTransitionCheckedBoxLabel') - self.gridLayout_5.addWidget(self.SlideTransitionCheckedBoxLabel, 0, 0, 1, 1) + self.SlideTransitionCheckedBoxLabel = QtGui.QLabel( + self.TransitionGroupBox) + self.SlideTransitionCheckedBoxLabel.setObjectName( + u'SlideTransitionCheckedBoxLabel') + self.gridLayout_5.addWidget( + self.SlideTransitionCheckedBoxLabel, 0, 0, 1, 1) self.SlideTransitionCheckedBox = QtGui.QCheckBox(self.AlignmentGroupBox) self.SlideTransitionCheckedBox.setTristate(False) self.gridLayout_5.addWidget(self.SlideTransitionCheckedBox, 0, 1, 1, 1) self.OptionsRightLayout.addWidget(self.TransitionGroupBox) - spacerItem6 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + spacerItem6 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, + QtGui.QSizePolicy.Expanding) self.OptionsRightLayout.addItem(spacerItem6) self.OtherOptionsLayout.addWidget(self.OptionsRightWidget) self.ThemeTabWidget.addTab(self.OtherOptionsTab, u'') @@ -539,13 +648,16 @@ class Ui_AmendThemeDialog(object): self.ThemePreviewLayout.setSpacing(8) self.ThemePreviewLayout.setMargin(8) self.ThemePreviewLayout.setObjectName(u'ThemePreviewLayout') - spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) + spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, + QtGui.QSizePolicy.Expanding) self.ThemePreviewLayout.addItem(spacerItem7) self.ThemePreview = QtGui.QLabel(self.PreviewGroupBox) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, + QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.ThemePreview.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.ThemePreview.sizePolicy().hasHeightForWidth()) self.ThemePreview.setSizePolicy(sizePolicy) self.ThemePreview.setMaximumSize(QtCore.QSize(300, 225)) self.ThemePreview.setFrameShape(QtGui.QFrame.WinPanel) @@ -554,88 +666,142 @@ class Ui_AmendThemeDialog(object): self.ThemePreview.setScaledContents(True) self.ThemePreview.setObjectName(u'ThemePreview') self.ThemePreviewLayout.addWidget(self.ThemePreview) - spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) + spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, + QtGui.QSizePolicy.Expanding) self.ThemePreviewLayout.addItem(spacerItem8) self.AmendThemeLayout.addWidget(self.PreviewGroupBox) self.ThemeButtonBox = QtGui.QDialogButtonBox(AmendThemeDialog) - self.ThemeButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) + self.ThemeButtonBox.setStandardButtons( + QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok) self.ThemeButtonBox.setObjectName(u'ThemeButtonBox') self.AmendThemeLayout.addWidget(self.ThemeButtonBox) self.retranslateUi(AmendThemeDialog) self.ThemeTabWidget.setCurrentIndex(0) - QtCore.QObject.connect(self.ThemeButtonBox, QtCore.SIGNAL(u'accepted()'), AmendThemeDialog.accept) - QtCore.QObject.connect(self.ThemeButtonBox, QtCore.SIGNAL(u'rejected()'), AmendThemeDialog.reject) + QtCore.QObject.connect(self.ThemeButtonBox, + QtCore.SIGNAL(u'accepted()'), AmendThemeDialog.accept) + QtCore.QObject.connect(self.ThemeButtonBox, + QtCore.SIGNAL(u'rejected()'), AmendThemeDialog.reject) QtCore.QMetaObject.connectSlotsByName(AmendThemeDialog) AmendThemeDialog.setTabOrder(self.ThemeButtonBox, self.ThemeNameEdit) AmendThemeDialog.setTabOrder(self.ThemeNameEdit, self.ThemeTabWidget) - AmendThemeDialog.setTabOrder(self.ThemeTabWidget, self.BackgroundComboBox) - AmendThemeDialog.setTabOrder(self.BackgroundComboBox, self.BackgroundTypeComboBox) - AmendThemeDialog.setTabOrder(self.BackgroundTypeComboBox, self.Color1PushButton) - AmendThemeDialog.setTabOrder(self.Color1PushButton, self.Color2PushButton) + AmendThemeDialog.setTabOrder(self.ThemeTabWidget, + self.BackgroundComboBox) + AmendThemeDialog.setTabOrder(self.BackgroundComboBox, + self.BackgroundTypeComboBox) + AmendThemeDialog.setTabOrder(self.BackgroundTypeComboBox, + self.Color1PushButton) + AmendThemeDialog.setTabOrder(self.Color1PushButton, + self.Color2PushButton) AmendThemeDialog.setTabOrder(self.Color2PushButton, self.ImageLineEdit) AmendThemeDialog.setTabOrder(self.ImageLineEdit, self.ImageToolButton) - AmendThemeDialog.setTabOrder(self.ImageToolButton, self.GradientComboBox) - AmendThemeDialog.setTabOrder(self.GradientComboBox, self.FontMainComboBox) - AmendThemeDialog.setTabOrder(self.FontMainComboBox, self.FontMainColorPushButton) - AmendThemeDialog.setTabOrder(self.FontMainColorPushButton, self.FontMainSizeSpinBox) - AmendThemeDialog.setTabOrder(self.FontMainSizeSpinBox, self.FontMainWeightComboBox) - AmendThemeDialog.setTabOrder(self.FontMainWeightComboBox, self.FontMainLineSpacingSpinBox) - AmendThemeDialog.setTabOrder(self.FontMainLineSpacingSpinBox, self.FontMainDefaultCheckBox) - AmendThemeDialog.setTabOrder(self.FontMainDefaultCheckBox, self.FontMainXSpinBox) - AmendThemeDialog.setTabOrder(self.FontMainXSpinBox, self.FontMainYSpinBox) - AmendThemeDialog.setTabOrder(self.FontMainYSpinBox, self.FontMainWidthSpinBox) - AmendThemeDialog.setTabOrder(self.FontMainWidthSpinBox, self.FontMainHeightSpinBox) - AmendThemeDialog.setTabOrder(self.FontMainHeightSpinBox, self.FontFooterComboBox) - AmendThemeDialog.setTabOrder(self.FontFooterComboBox, self.FontFooterColorPushButton) - AmendThemeDialog.setTabOrder(self.FontFooterColorPushButton, self.FontFooterSizeSpinBox) - AmendThemeDialog.setTabOrder(self.FontFooterSizeSpinBox, self.FontFooterWeightComboBox) - AmendThemeDialog.setTabOrder(self.FontFooterWeightComboBox, self.FontFooterDefaultCheckBox) - AmendThemeDialog.setTabOrder(self.FontFooterDefaultCheckBox, self.FontFooterXSpinBox) - AmendThemeDialog.setTabOrder(self.FontFooterXSpinBox, self.FontFooterYSpinBox) - AmendThemeDialog.setTabOrder(self.FontFooterYSpinBox, self.FontFooterWidthSpinBox) - AmendThemeDialog.setTabOrder(self.FontFooterWidthSpinBox, self.FontFooterHeightSpinBox) - AmendThemeDialog.setTabOrder(self.FontFooterHeightSpinBox, self.OutlineCheckBox) - AmendThemeDialog.setTabOrder(self.OutlineCheckBox, self.OutlineColorPushButton) - AmendThemeDialog.setTabOrder(self.OutlineColorPushButton, self.ShadowCheckBox) - AmendThemeDialog.setTabOrder(self.ShadowCheckBox, self.ShadowColorPushButton) - AmendThemeDialog.setTabOrder(self.ShadowColorPushButton, self.HorizontalComboBox) - AmendThemeDialog.setTabOrder(self.HorizontalComboBox, self.VerticalComboBox) + AmendThemeDialog.setTabOrder(self.ImageToolButton, + self.GradientComboBox) + AmendThemeDialog.setTabOrder(self.GradientComboBox, + self.FontMainComboBox) + AmendThemeDialog.setTabOrder(self.FontMainComboBox, + self.FontMainColorPushButton) + AmendThemeDialog.setTabOrder(self.FontMainColorPushButton, + self.FontMainSizeSpinBox) + AmendThemeDialog.setTabOrder(self.FontMainSizeSpinBox, + self.FontMainWeightComboBox) + AmendThemeDialog.setTabOrder(self.FontMainWeightComboBox, + self.FontMainLineSpacingSpinBox) + AmendThemeDialog.setTabOrder(self.FontMainLineSpacingSpinBox, + self.FontMainDefaultCheckBox) + AmendThemeDialog.setTabOrder(self.FontMainDefaultCheckBox, + self.FontMainXSpinBox) + AmendThemeDialog.setTabOrder(self.FontMainXSpinBox, + self.FontMainYSpinBox) + AmendThemeDialog.setTabOrder(self.FontMainYSpinBox, + self.FontMainWidthSpinBox) + AmendThemeDialog.setTabOrder(self.FontMainWidthSpinBox, + self.FontMainHeightSpinBox) + AmendThemeDialog.setTabOrder(self.FontMainHeightSpinBox, + self.FontFooterComboBox) + AmendThemeDialog.setTabOrder(self.FontFooterComboBox, + self.FontFooterColorPushButton) + AmendThemeDialog.setTabOrder(self.FontFooterColorPushButton, + self.FontFooterSizeSpinBox) + AmendThemeDialog.setTabOrder(self.FontFooterSizeSpinBox, + self.FontFooterWeightComboBox) + AmendThemeDialog.setTabOrder(self.FontFooterWeightComboBox, + self.FontFooterDefaultCheckBox) + AmendThemeDialog.setTabOrder(self.FontFooterDefaultCheckBox, + self.FontFooterXSpinBox) + AmendThemeDialog.setTabOrder(self.FontFooterXSpinBox, + self.FontFooterYSpinBox) + AmendThemeDialog.setTabOrder(self.FontFooterYSpinBox, + self.FontFooterWidthSpinBox) + AmendThemeDialog.setTabOrder(self.FontFooterWidthSpinBox, + self.FontFooterHeightSpinBox) + AmendThemeDialog.setTabOrder(self.FontFooterHeightSpinBox, + self.OutlineCheckBox) + AmendThemeDialog.setTabOrder(self.OutlineCheckBox, + self.OutlineColorPushButton) + AmendThemeDialog.setTabOrder(self.OutlineColorPushButton, + self.ShadowCheckBox) + AmendThemeDialog.setTabOrder(self.ShadowCheckBox, + self.ShadowColorPushButton) + AmendThemeDialog.setTabOrder(self.ShadowColorPushButton, + self.HorizontalComboBox) + AmendThemeDialog.setTabOrder(self.HorizontalComboBox, + self.VerticalComboBox) def retranslateUi(self, AmendThemeDialog): - AmendThemeDialog.setWindowTitle(translate('AmendThemeForm', 'Theme Maintenance')) + AmendThemeDialog.setWindowTitle( + translate('AmendThemeForm', 'Theme Maintenance')) self.ThemeNameLabel.setText(translate('AmendThemeForm', 'Theme Name:')) self.BackgroundLabel.setText(translate('AmendThemeForm', 'Background:')) - self.BackgroundComboBox.setItemText(0, translate('AmendThemeForm', 'Opaque')) - self.BackgroundComboBox.setItemText(1, translate('AmendThemeForm', 'Transparent')) - self.BackgroundTypeLabel.setText(translate('AmendThemeForm', 'Background Type:')) - self.BackgroundTypeComboBox.setItemText(0, translate('AmendThemeForm', 'Solid Color')) - self.BackgroundTypeComboBox.setItemText(1, translate('AmendThemeForm', 'Gradient')) - self.BackgroundTypeComboBox.setItemText(2, translate('AmendThemeForm', 'Image')) + self.BackgroundComboBox.setItemText(0, + translate('AmendThemeForm', 'Opaque')) + self.BackgroundComboBox.setItemText(1, + translate('AmendThemeForm', 'Transparent')) + self.BackgroundTypeLabel.setText( + translate('AmendThemeForm', 'Background Type:')) + self.BackgroundTypeComboBox.setItemText(0, + translate('AmendThemeForm', 'Solid Color')) + self.BackgroundTypeComboBox.setItemText(1, + translate('AmendThemeForm', 'Gradient')) + self.BackgroundTypeComboBox.setItemText(2, + translate('AmendThemeForm', 'Image')) self.Color1Label.setText(translate('AmendThemeForm', '')) self.Color2Label.setText(translate('AmendThemeForm', '')) self.ImageLabel.setText(translate('AmendThemeForm', 'Image:')) self.GradientLabel.setText(translate('AmendThemeForm', 'Gradient :')) - self.GradientComboBox.setItemText(0, translate('AmendThemeForm', 'Horizontal')) - self.GradientComboBox.setItemText(1, translate('AmendThemeForm', 'Vertical')) - self.GradientComboBox.setItemText(2, translate('AmendThemeForm', 'Circular')) + self.GradientComboBox.setItemText(0, + translate('AmendThemeForm', 'Horizontal')) + self.GradientComboBox.setItemText(1, + translate('AmendThemeForm', 'Vertical')) + self.GradientComboBox.setItemText(2, + translate('AmendThemeForm', 'Circular')) self.ThemeTabWidget.setTabText( self.ThemeTabWidget.indexOf(self.BackgroundTab), translate('AmendThemeForm', 'Background')) self.FontMainGroupBox.setTitle(translate('AmendThemeForm', 'Main Font')) self.FontMainlabel.setText(translate('AmendThemeForm', 'Font:')) - self.FontMainColorLabel.setText(translate('AmendThemeForm', 'Font Color:')) + self.FontMainColorLabel.setText( + translate('AmendThemeForm', 'Font Color:')) self.FontMainSize.setText(translate('AmendThemeForm', 'Size:')) self.FontMainSizeSpinBox.setSuffix(translate('AmendThemeForm', 'pt')) - self.FontMainWrapIndentationLabel.setText(translate('AmendThemeForm', 'Wrap Indentation')) - self.FontMainWrapLineAdjustmentLabel.setText(translate('AmendThemeForm', 'Adjust Line Spacing')) - self.FontMainWeightComboBox.setItemText(0, translate('AmendThemeForm', 'Normal')) - self.FontMainWeightComboBox.setItemText(1, translate('AmendThemeForm', 'Bold')) - self.FontMainWeightComboBox.setItemText(2, translate('AmendThemeForm', 'Italics')) - self.FontMainWeightComboBox.setItemText(3, translate('AmendThemeForm', 'Bold/Italics')) - self.FontMainWeightLabel.setText(translate('AmendThemeForm', 'Font Weight:')) - self.MainLocationGroupBox.setTitle(translate('AmendThemeForm', 'Display Location')) - self.DefaultLocationLabel.setText(translate('AmendThemeForm', 'Use Default Location:')) + self.FontMainWrapIndentationLabel.setText( + translate('AmendThemeForm', 'Wrap Indentation')) + self.FontMainWrapLineAdjustmentLabel.setText( + translate('AmendThemeForm', 'Adjust Line Spacing')) + self.FontMainWeightComboBox.setItemText(0, + translate('AmendThemeForm', 'Normal')) + self.FontMainWeightComboBox.setItemText(1, + translate('AmendThemeForm', 'Bold')) + self.FontMainWeightComboBox.setItemText(2, + translate('AmendThemeForm', 'Italics')) + self.FontMainWeightComboBox.setItemText(3, + translate('AmendThemeForm', 'Bold/Italics')) + self.FontMainWeightLabel.setText( + translate('AmendThemeForm', 'Font Weight:')) + self.MainLocationGroupBox.setTitle( + translate('AmendThemeForm', 'Display Location')) + self.DefaultLocationLabel.setText( + translate('AmendThemeForm', 'Use Default Location:')) self.FontMainXLabel.setText(translate('AmendThemeForm', 'X Position:')) self.FontMainYLabel.setText(translate('AmendThemeForm', 'Y Position:')) self.FontMainWidthLabel.setText(translate('AmendThemeForm', 'Width:')) @@ -647,51 +813,81 @@ class Ui_AmendThemeDialog(object): self.ThemeTabWidget.setTabText( self.ThemeTabWidget.indexOf(self.FontMainTab), translate('AmendThemeForm', 'Font Main')) - self.FooterFontGroupBox.setTitle(translate('AmendThemeForm', 'Footer Font')) + self.FooterFontGroupBox.setTitle( + translate('AmendThemeForm', 'Footer Font')) self.FontFooterLabel.setText(translate('AmendThemeForm', 'Font:')) - self.FontFooterColorLabel.setText(translate('AmendThemeForm', 'Font Color:')) + self.FontFooterColorLabel.setText( + translate('AmendThemeForm', 'Font Color:')) self.FontFooterSizeLabel.setText(translate('AmendThemeForm', 'Size:')) self.FontFooterSizeSpinBox.setSuffix(translate('AmendThemeForm', 'pt')) - self.FontFooterWeightComboBox.setItemText(0, translate('AmendThemeForm', 'Normal')) - self.FontFooterWeightComboBox.setItemText(1, translate('AmendThemeForm', 'Bold')) - self.FontFooterWeightComboBox.setItemText(2, translate('AmendThemeForm', 'Italics')) - self.FontFooterWeightComboBox.setItemText(3, translate('AmendThemeForm', 'Bold/Italics')) - self.FontFooterWeightLabel.setText(translate('AmendThemeForm', 'Font Weight:')) - self.LocationFooterGroupBox.setTitle(translate('AmendThemeForm', 'Display Location')) - self.FontFooterDefaultLabel.setText(translate('AmendThemeForm', 'Use Default Location:')) - self.FontFooterXLabel.setText(translate('AmendThemeForm', 'X Position:')) - self.FontFooterYLabel.setText(translate('AmendThemeForm', 'Y Position:')) + self.FontFooterWeightComboBox.setItemText(0, + translate('AmendThemeForm', 'Normal')) + self.FontFooterWeightComboBox.setItemText(1, + translate('AmendThemeForm', 'Bold')) + self.FontFooterWeightComboBox.setItemText(2, + translate('AmendThemeForm', 'Italics')) + self.FontFooterWeightComboBox.setItemText(3, + translate('AmendThemeForm', 'Bold/Italics')) + self.FontFooterWeightLabel.setText( + translate('AmendThemeForm', 'Font Weight:')) + self.LocationFooterGroupBox.setTitle( + translate('AmendThemeForm', 'Display Location')) + self.FontFooterDefaultLabel.setText( + translate('AmendThemeForm', 'Use Default Location:')) + self.FontFooterXLabel.setText( + translate('AmendThemeForm', 'X Position:')) + self.FontFooterYLabel.setText( + translate('AmendThemeForm', 'Y Position:')) self.FontFooterWidthLabel.setText(translate('AmendThemeForm', 'Width:')) - self.FontFooterHeightLabel.setText(translate('AmendThemeForm', 'Height:')) + self.FontFooterHeightLabel.setText( + translate('AmendThemeForm', 'Height:')) self.FontFooterXSpinBox.setSuffix(translate('AmendThemeForm', 'px')) self.FontFooterYSpinBox.setSuffix(translate('AmendThemeForm', 'px')) self.FontFooterWidthSpinBox.setSuffix(translate('AmendThemeForm', 'px')) - self.FontFooterHeightSpinBox.setSuffix(translate('AmendThemeForm', 'px')) + self.FontFooterHeightSpinBox.setSuffix( + translate('AmendThemeForm', 'px')) self.ThemeTabWidget.setTabText( self.ThemeTabWidget.indexOf(self.FontFooterTab), translate('AmendThemeForm', 'Font Footer')) self.OutlineGroupBox.setTitle(translate('AmendThemeForm', 'Outline')) - self.OutlineSpinBoxLabel.setText(translate('AmendThemeForm', 'Outline Size:')) + self.OutlineSpinBoxLabel.setText( + translate('AmendThemeForm', 'Outline Size:')) self.OutlineSpinBox.setSuffix(translate('AmendThemeForm', 'px')) - self.OutlineColorLabel.setText(translate('AmendThemeForm', 'Outline Color:')) - self.OutlineEnabledLabel.setText(translate('AmendThemeForm', 'Show Outline:')) + self.OutlineColorLabel.setText( + translate('AmendThemeForm', 'Outline Color:')) + self.OutlineEnabledLabel.setText( + translate('AmendThemeForm', 'Show Outline:')) self.ShadowGroupBox.setTitle(translate('AmendThemeForm', 'Shadow')) - self.ShadowSpinBoxLabel.setText(translate('AmendThemeForm', 'Shadow Size:')) + self.ShadowSpinBoxLabel.setText( + translate('AmendThemeForm', 'Shadow Size:')) self.ShadowSpinBox.setSuffix(translate('AmendThemeForm', 'px')) - self.ShadowColorLabel.setText(translate('AmendThemeForm', 'Shadow Color:')) - self.ShadowEnabledLabel.setText(translate('AmendThemeForm', 'Show Shadow:')) - self.AlignmentGroupBox.setTitle(translate('AmendThemeForm', 'Alignment')) - self.HorizontalLabel.setText(translate('AmendThemeForm', 'Horizontal Align:')) - self.HorizontalComboBox.setItemText(0, translate('AmendThemeForm', 'Left')) - self.HorizontalComboBox.setItemText(1, translate('AmendThemeForm', 'Right')) - self.HorizontalComboBox.setItemText(2, translate('AmendThemeForm', 'Center')) - self.VerticalLabel.setText(translate('AmendThemeForm', 'Vertical Align:')) + self.ShadowColorLabel.setText( + translate('AmendThemeForm', 'Shadow Color:')) + self.ShadowEnabledLabel.setText( + translate('AmendThemeForm', 'Show Shadow:')) + self.AlignmentGroupBox.setTitle( + translate('AmendThemeForm', 'Alignment')) + self.HorizontalLabel.setText( + translate('AmendThemeForm', 'Horizontal Align:')) + self.HorizontalComboBox.setItemText(0, + translate('AmendThemeForm', 'Left')) + self.HorizontalComboBox.setItemText(1, + translate('AmendThemeForm', 'Right')) + self.HorizontalComboBox.setItemText(2, + translate('AmendThemeForm', 'Center')) + self.VerticalLabel.setText( + translate('AmendThemeForm', 'Vertical Align:')) self.VerticalComboBox.setItemText(0, translate('AmendThemeForm', 'Top')) - self.VerticalComboBox.setItemText(1, translate('AmendThemeForm', 'Middle')) - self.VerticalComboBox.setItemText(2, translate('AmendThemeForm', 'Bottom')) - self.TransitionGroupBox.setTitle(translate('AmendThemeForm', 'Slide Transition')) - self.SlideTransitionCheckedBoxLabel.setText(translate('AmendThemeForm', 'Transition Active:')) + self.VerticalComboBox.setItemText(1, + translate('AmendThemeForm', 'Middle')) + self.VerticalComboBox.setItemText(2, + translate('AmendThemeForm', 'Bottom')) + self.TransitionGroupBox.setTitle( + translate('AmendThemeForm', 'Slide Transition')) + self.SlideTransitionCheckedBoxLabel.setText( + translate('AmendThemeForm', 'Transition Active:')) self.ThemeTabWidget.setTabText( self.ThemeTabWidget.indexOf(self.OtherOptionsTab), translate('AmendThemeForm', 'Other Options')) self.PreviewGroupBox.setTitle(translate('AmendThemeForm', 'Preview')) + diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py index fab72c312..6371ab610 100644 --- a/openlp/core/ui/amendthemeform.py +++ b/openlp/core/ui/amendthemeform.py @@ -154,8 +154,8 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): unicode(self.theme.background_endColor), self.theme.background_direction) else: - (path, filename) = \ - os.path.split(unicode(self.theme.background_filename)) + filename = \ + os.path.split(unicode(self.theme.background_filename))[0] new_theme.add_background_image(filename) save_to = os.path.join(self.path, theme_name, filename) save_from = self.theme.background_filename diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 4dc75ea92..75519da8a 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -33,7 +33,8 @@ from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \ ThemeManager, SlideController, PluginForm, MediaDockManager, DisplayManager from openlp.core.lib import RenderManager, build_icon, OpenLPDockWidget, \ SettingsManager, PluginManager, Receiver, translate -from openlp.core.utils import check_latest_version, AppLocation, add_actions, LanguageManager +from openlp.core.utils import check_latest_version, AppLocation, add_actions, \ + LanguageManager log = logging.getLogger(__name__) @@ -61,7 +62,8 @@ class VersionThread(QtCore.QThread): QtCore.QThread.__init__(self, parent) self.parent = parent self.app_version = app_version - self.version_splitter = re.compile(r'([0-9]+).([0-9]+).([0-9]+)(?:-bzr([0-9]+))') + self.version_splitter = re.compile( + r'([0-9]+).([0-9]+).([0-9]+)(?:-bzr([0-9]+))') def run(self): """ @@ -842,7 +844,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): recentFileCount = QtCore.QSettings().value( self.generalSettingsSection + u'/max recent files', QtCore.QVariant(4)).toInt()[0] - if filename and not self.recentFiles.contains(filename): - self.recentFiles.prepend(QtCore.QString(filename)) + if filename and filename not in self.recentFiles: + self.recentFiles.insert(0, QtCore.QString(filename)) while self.recentFiles.count() > recentFileCount: - self.recentFiles.takeLast() + self.recentFiles.pop() + diff --git a/openlp/core/ui/plugindialog.py b/openlp/core/ui/plugindialog.py index e9c205e20..419a309da 100644 --- a/openlp/core/ui/plugindialog.py +++ b/openlp/core/ui/plugindialog.py @@ -100,10 +100,12 @@ class Ui_PluginViewDialog(object): def retranslateUi(self, PluginViewDialog): PluginViewDialog.setWindowTitle(translate('PluginForm', 'Plugin List')) - self.PluginInfoGroupBox.setTitle(translate('PluginForm', 'Plugin Details')) + self.PluginInfoGroupBox.setTitle( + translate('PluginForm', 'Plugin Details')) self.VersionLabel.setText(translate('PluginForm', 'Version:')) self.VersionNumberLabel.setText(translate('PluginForm', 'TextLabel')) self.AboutLabel.setText(translate('PluginForm', 'About:')) self.StatusLabel.setText(translate('PluginForm', 'Status:')) self.StatusComboBox.setItemText(0, translate('PluginForm', 'Active')) self.StatusComboBox.setItemText(1, translate('PluginForm', 'Inactive')) + diff --git a/openlp/core/ui/serviceitemeditdialog.py b/openlp/core/ui/serviceitemeditdialog.py index 467c2aed8..b71513e0b 100644 --- a/openlp/core/ui/serviceitemeditdialog.py +++ b/openlp/core/ui/serviceitemeditdialog.py @@ -67,7 +67,8 @@ class Ui_ServiceItemEditDialog(object): QtCore.QMetaObject.connectSlotsByName(ServiceItemEditDialog) def retranslateUi(self, ServiceItemEditDialog): - ServiceItemEditDialog.setWindowTitle(translate('ServiceItemEditForm', 'Service Item Maintenance')) + ServiceItemEditDialog.setWindowTitle( + translate('ServiceItemEditForm', 'Service Item Maintenance')) self.upButton.setText(translate('ServiceItemEditForm', 'Up')) self.deleteButton.setText(translate('ServiceItemEditForm', 'Delete')) self.downButton.setText(translate('ServiceItemEditForm', 'Down')) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 548d04357..e06bea6d6 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -147,9 +147,11 @@ class ServiceManager(QtGui.QWidget): self.ServiceManagerList.setAlternatingRowColors(True) self.ServiceManagerList.setHeaderHidden(True) self.ServiceManagerList.setExpandsOnDoubleClick(False) - self.ServiceManagerList.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) + self.ServiceManagerList.setContextMenuPolicy( + QtCore.Qt.CustomContextMenu) QtCore.QObject.connect(self.ServiceManagerList, - QtCore.SIGNAL('customContextMenuRequested(QPoint)'), self.contextMenu) + QtCore.SIGNAL('customContextMenuRequested(QPoint)'), + self.contextMenu) self.ServiceManagerList.setObjectName(u'ServiceManagerList') # enable drop self.ServiceManagerList.__class__.dragEnterEvent = self.dragEnterEvent @@ -172,7 +174,8 @@ class ServiceManager(QtGui.QWidget): self.trUtf8('Move to end'), self.onServiceEnd) self.OrderToolbar.addSeparator() self.OrderToolbar.addToolbarButton( - self.trUtf8('&Delete From Service'), u':/general/general_delete.png', + self.trUtf8('&Delete From Service'), + u':/general/general_delete.png', self.trUtf8('Delete From Service'), self.onDeleteFromService) self.Layout.addWidget(self.OrderToolbar) # Connect up our signals and slots @@ -205,7 +208,8 @@ class ServiceManager(QtGui.QWidget): self.dndMenu = QtGui.QMenu() self.newAction = self.dndMenu.addAction(self.trUtf8('&Add New Item')) self.newAction.setIcon(build_icon(u':/general/general_edit.png')) - self.addToAction = self.dndMenu.addAction(self.trUtf8('&Add to Selected Item')) + self.addToAction = self.dndMenu.addAction( + self.trUtf8('&Add to Selected Item')) self.addToAction.setIcon(build_icon(u':/general/general_edit.png')) #build the context menu self.menu = QtGui.QMenu() @@ -269,7 +273,7 @@ class ServiceManager(QtGui.QWidget): self.makeLive() def onServiceItemNoteForm(self): - item, count = self.findServiceItem() + item = self.findServiceItem()[0] self.serviceNoteForm.textEdit.setPlainText( self.serviceItems[item][u'service_item'].notes) if self.serviceNoteForm.exec_(): @@ -278,7 +282,7 @@ class ServiceManager(QtGui.QWidget): self.repaintServiceList(item, 0) def onServiceItemEditForm(self): - item, count = self.findServiceItem() + item = self.findServiceItem()[0] self.serviceItemEditForm.setServiceItem( self.serviceItems[item][u'service_item']) if self.serviceItemEditForm.exec_(): @@ -477,7 +481,7 @@ class ServiceManager(QtGui.QWidget): """ Remove the current ServiceItem from the list """ - item, count = self.findServiceItem() + item = self.findServiceItem()[0] if item is not -1: self.serviceItems.remove(self.serviceItems[item]) self.repaintServiceList(0, 0) @@ -503,10 +507,10 @@ class ServiceManager(QtGui.QWidget): if serviceitem.notes: icon = QtGui.QImage(serviceitem.icon) icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio, - QtCore.Qt.SmoothTransformation) + QtCore.Qt.SmoothTransformation) overlay = QtGui.QImage(':/services/service_item_notes.png') overlay = overlay.scaled(80, 80, QtCore.Qt.KeepAspectRatio, - QtCore.Qt.SmoothTransformation) + QtCore.Qt.SmoothTransformation) painter = QtGui.QPainter(icon) painter.drawImage(0, 0, overlay) painter.end() @@ -514,7 +518,8 @@ class ServiceManager(QtGui.QWidget): else: treewidgetitem.setIcon(0, serviceitem.iconic_representation) else: - treewidgetitem.setIcon(0, build_icon(u':/general/general_delete.png')) + treewidgetitem.setIcon(0, + build_icon(u':/general/general_delete.png')) treewidgetitem.setText(0, serviceitem.title) treewidgetitem.setToolTip(0, serviceitem.notes) treewidgetitem.setData(0, QtCore.Qt.UserRole, @@ -576,7 +581,7 @@ class ServiceManager(QtGui.QWidget): cPickle.dump(service, file) file.close() zip.write(servicefile) - except: + except IOError: log.exception(u'Failed to save service to disk') finally: if file: @@ -585,7 +590,7 @@ class ServiceManager(QtGui.QWidget): zip.close() try: os.remove(servicefile) - except: + except (IOError, OSError): pass #if not present do not worry name = filename.split(os.path.sep) self.serviceName = name[-1] @@ -636,23 +641,23 @@ class ServiceManager(QtGui.QWidget): self.parent.serviceSettingsSection, os.path.split(filename)[0]) zip = None - f = None + file_to = None try: zip = zipfile.ZipFile(unicode(filename)) for file in zip.namelist(): osfile = unicode(QtCore.QDir.toNativeSeparators(file)) names = osfile.split(os.path.sep) - file_to = os.path.join(self.servicePath, + file_path = os.path.join(self.servicePath, names[len(names) - 1]) - f = open(file_to, u'wb') - f.write(zip.read(file)) - f.flush() - f.close() - if file_to.endswith(u'osd'): - p_file = file_to - f = open(p_file, u'r') - items = cPickle.load(f) - f.close() + file_to = open(file_path, u'wb') + file_to.write(zip.read(file)) + file_to.flush() + file_to.close() + if file_path.endswith(u'osd'): + p_file = file_path + file_to = open(p_file, u'r') + items = cPickle.load(file_to) + file_to.close() self.onNewService() for item in items: serviceitem = ServiceItem() @@ -663,13 +668,13 @@ class ServiceManager(QtGui.QWidget): try: if os.path.isfile(p_file): os.remove(p_file) - except: + except (IOError, OSError): log.exception(u'Failed to remove osd file') - except: + except IOError: log.exception(u'Problem loading a service file') finally: - if f: - f.close() + if file_to: + file_to.close() if zip: zip.close() self.isNew = False @@ -696,7 +701,7 @@ class ServiceManager(QtGui.QWidget): try: if os.path.isfile(file_path): os.remove(file_path) - except: + except OSError: log.exception(u'Failed to clean up servicePath') def onThemeComboBoxSelected(self, currentIndex): @@ -737,7 +742,7 @@ class ServiceManager(QtGui.QWidget): Service Item to be added """ - sitem, count = self.findServiceItem() + sitem = self.findServiceItem()[0] item.render() if replace: item.merge(self.serviceItems[sitem][u'service_item']) @@ -789,7 +794,7 @@ class ServiceManager(QtGui.QWidget): """ Send the current item to the Preview slide controller """ - item, count = self.findServiceItem() + item = self.findServiceItem()[0] if item == -1: return False else: @@ -825,7 +830,7 @@ class ServiceManager(QtGui.QWidget): """ Posts a remote edit message to a plugin to allow item to be edited. """ - item, count = self.findServiceItem() + item = self.findServiceItem()[0] if self.serviceItems[item][u'service_item']\ .is_capable(ItemCapabilities.AllowsEdit): Receiver.send_message(u'%s_edit' % @@ -942,7 +947,7 @@ class ServiceManager(QtGui.QWidget): def onThemeChangeAction(self): theme = unicode(self.sender().text()) - item, count = self.findServiceItem() + item = self.findServiceItem()[0] self.serviceItems[item][u'service_item'].theme = theme self.regenerateServiceItems() @@ -955,7 +960,7 @@ class ServiceManager(QtGui.QWidget): def listRequest(self, message=None): data = [] - curindex, count = self.findServiceItem() + curindex = self.findServiceItem()[0] if curindex >= 0 and curindex < len(self.serviceItems): curitem = self.serviceItems[curindex] else: @@ -969,3 +974,4 @@ class ServiceManager(QtGui.QWidget): data_item[u'selected'] = (item == curitem) data.append(data_item) Receiver.send_message(u'servicemanager_list_response', data) + diff --git a/openlp/core/ui/servicenotedialog.py b/openlp/core/ui/servicenotedialog.py index b21adce8d..707cc383f 100644 --- a/openlp/core/ui/servicenotedialog.py +++ b/openlp/core/ui/servicenotedialog.py @@ -39,7 +39,8 @@ class Ui_ServiceNoteEdit(object): self.textEdit.setObjectName(u'textEdit') self.verticalLayout.addWidget(self.textEdit) self.buttonBox = QtGui.QDialogButtonBox(self.widget) - self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save) + self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | + QtGui.QDialogButtonBox.Save) self.buttonBox.setObjectName(u'buttonBox') self.verticalLayout.addWidget(self.buttonBox) @@ -47,4 +48,6 @@ class Ui_ServiceNoteEdit(object): QtCore.QMetaObject.connectSlotsByName(ServiceNoteEdit) def retranslateUi(self, ServiceNoteEdit): - ServiceNoteEdit.setWindowTitle(translate('ServiceNoteForm', 'Service Item Notes')) + ServiceNoteEdit.setWindowTitle( + translate('ServiceNoteForm', 'Service Item Notes')) + diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index f9dd89daf..014498767 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -377,9 +377,9 @@ class SlideController(QtGui.QWidget): width = self.parent.ControlSplitter.sizes()[self.split] height = width * self.parent.RenderManager.screen_ratio self.PreviewListWidget.setColumnWidth(0, width) - #Sort out image hights (Songs , bibles excluded) + #Sort out image heights (Songs, bibles excluded) if self.serviceItem and not self.serviceItem.is_text(): - for framenumber, frame in enumerate(self.serviceItem.get_frames()): + for framenumber in range(len(self.serviceItem.get_frames())): self.PreviewListWidget.setRowHeight(framenumber, height) def trackSplitter(self, tab, pos): @@ -777,7 +777,8 @@ class SlideController(QtGui.QWidget): def updatePreview(self): rm = self.parent.RenderManager if not rm.screens.current[u'primary']: - # Grab now, but try again in a couple of seconds if slide change is slow + # Grab now, but try again in a couple of seconds if slide change + # is slow QtCore.QTimer.singleShot(0.5, self.grabMainDisplay) QtCore.QTimer.singleShot(2.5, self.grabMainDisplay) else: diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index d908311b3..1a81a8384 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -184,16 +184,14 @@ class ThemeManager(QtGui.QWidget): else: for plugin in self.parent.plugin_manager.plugins: if not plugin.can_delete_theme(theme): - QtGui.QMessageBox.critical( - self, self.trUtf8('Error'), - self.trUtf8('Theme %s is use in %s plugin' % (theme, plugin.name)), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + QtGui.QMessageBox.critical(self, self.trUtf8('Error'), + self.trUtf8('Theme %s is use in %s plugin' % (theme, + plugin.name))) return if unicode(self.parent.ServiceManagerContents.ThemeComboBox.currentText()) == theme: - QtGui.QMessageBox.critical( - self, self.trUtf8('Error'), - self.trUtf8('Theme %s is use by Service Manager' % theme), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + QtGui.QMessageBox.critical(self, self.trUtf8('Error'), + self.trUtf8('Theme %s is use by Service Manager' % + theme)) return self.themelist.remove(theme) th = theme + u'.png' @@ -203,7 +201,7 @@ class ThemeManager(QtGui.QWidget): os.remove(os.path.join(self.path, th)) os.remove(os.path.join(self.thumbPath, th)) shutil.rmtree(os.path.join(self.path, theme)) - except: + except OSError: #if not present do not worry pass # As we do not reload the themes push out the change @@ -233,12 +231,12 @@ class ThemeManager(QtGui.QWidget): try: zip = zipfile.ZipFile(themePath, u'w') source = os.path.join(self.path, theme) - for root, dirs, files in os.walk(source): + for files in os.walk(source)[2]: for name in files: zip.write( os.path.join(source, name), os.path.join(theme, name)) - except: + except (IOError, OSError): log.exception(u'Export Theme Failed') finally: if zip: @@ -272,11 +270,9 @@ class ThemeManager(QtGui.QWidget): #check to see file is in theme root directory theme = os.path.join(self.path, name) if os.path.exists(theme): - (path, filename) = os.path.split(unicode(file)) textName = os.path.splitext(name)[0] if textName == self.global_theme: - name = u'%s (%s)' % (textName, - self.trUtf8('default')) + name = u'%s (%s)' % (textName, self.trUtf8('default')) else: name = textName thumb = os.path.join(self.thumbPath, u'%s.png' % textName) @@ -360,11 +356,10 @@ class ThemeManager(QtGui.QWidget): outfile = open(fullpath, u'wb') outfile.write(zip.read(file)) self.generateAndSaveImage(dir, themename, filexml) - except: + except IOError: QtGui.QMessageBox.critical( self, self.trUtf8('Error'), - self.trUtf8('File is not a valid theme.'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + self.trUtf8('File is not a valid theme.')) log.exception(u'Importing theme from zip file failed %s' % filename) finally: if zip: @@ -456,7 +451,7 @@ class ThemeManager(QtGui.QWidget): try: outfile = open(theme_file, u'w') outfile.write(theme_pretty_xml) - except: + except IOError: log.exception(u'Saving theme to file failed') finally: if outfile: @@ -464,7 +459,7 @@ class ThemeManager(QtGui.QWidget): if image_from and image_from != image_to: try: shutil.copyfile(image_from, image_to) - except: + except IOError: log.exception(u'Failed to save theme image') self.generateAndSaveImage(self.path, name, theme_xml) self.loadThemes() @@ -567,3 +562,4 @@ class ThemeManager(QtGui.QWidget): #theme.theme_mode theme.theme_name = theme.theme_name.strip() #theme.theme_version + diff --git a/openlp/migration/migratebibles.py b/openlp/migration/migratebibles.py index bd94dd6a0..89bb5ffdf 100644 --- a/openlp/migration/migratebibles.py +++ b/openlp/migration/migratebibles.py @@ -27,8 +27,8 @@ import os import sys import sqlite3 -from sqlalchemy import create_engine -from sqlalchemy.orm import scoped_session, sessionmaker, mapper +from sqlalchemy.exceptions import InvalidRequestError +from sqlalchemy.orm import mapper from openlp.core.lib import BaseModel, SettingsManager from openlp.core.utils import AppLocation @@ -85,13 +85,6 @@ mapper(TTestament, temp_testament_table) mapper(TBook, temp_book_table) mapper(TVerse, temp_verse_table) -def init_models(url): - engine = create_engine(url) - metadata.bind = engine - session = scoped_session(sessionmaker(autoflush=False, - autocommit=False, bind=engine)) - return session - class MigrateBibles(object): def __init__(self, display): self.display = display @@ -105,8 +98,8 @@ class MigrateBibles(object): def process(self): self.progress(u'Bibles processing started') - for f in self.database_files: - self.v_1_9_0(f) + for db_file in self.database_files: + self.v_1_9_0(db_file) self.progress(u'Bibles processing finished') def v_1_9_0(self, database): @@ -143,7 +136,7 @@ class MigrateBibles(object): try: self.session.add(testament) self.session.commit() - except: + except InvalidRequestError: self.session.rollback() print u'Error thrown = ', sys.exc_info()[1] self.progress(u'Create book table') @@ -157,7 +150,7 @@ class MigrateBibles(object): try: self.session.add(book) self.session.commit() - except: + except InvalidRequestError: self.session.rollback() print u'Error thrown = ', sys.exc_info()[1] self.progress(u'Create verse table') @@ -171,14 +164,10 @@ class MigrateBibles(object): verse.text = verse_temp.text try: self.session.add(verse) - except: + self.session.commit() + except InvalidRequestError: self.session.rollback() print u'Error thrown = ', sys.exc_info()[1] - try: - self.session.commit() - except: - self.session.rollback() - print u'Error thrown = ', sys.exc_info()[1] self.progress(u'Create metadata table') results = self.session.query(TBibleMeta).order_by(TBibleMeta.key).all() for biblemeta_temp in results: @@ -188,7 +177,7 @@ class MigrateBibles(object): try: self.session.add(biblemeta) self.session.commit() - except: + except InvalidRequestError: self.session.rollback() print u'Error thrown = ', sys.exc_info()[1] @@ -206,3 +195,4 @@ class MigrateBibles(object): conn.commit() conn.execute(u'vacuum;') conn.commit() + diff --git a/openlp/migration/migratesongs.py b/openlp/migration/migratesongs.py index 47ddd6fe6..87d5de40b 100644 --- a/openlp/migration/migratesongs.py +++ b/openlp/migration/migratesongs.py @@ -27,8 +27,8 @@ import os import sys import sqlite3 -from sqlalchemy import * from sqlalchemy import create_engine +from sqlalchemy.exceptions import InvalidRequestError from sqlalchemy.orm import scoped_session, sessionmaker, mapper, relation from openlp.core.lib import BaseModel, SettingsManager @@ -159,7 +159,7 @@ class MigrateSongs(object): try: self.session.add(song) self.session.commit() - except: + except InvalidRequestError: self.session.rollback() print u'Error thrown = ', sys.exc_info()[1] diff --git a/openlp/plugins/alerts/forms/alertdialog.py b/openlp/plugins/alerts/forms/alertdialog.py index 2dc117655..e23ba3d3e 100644 --- a/openlp/plugins/alerts/forms/alertdialog.py +++ b/openlp/plugins/alerts/forms/alertdialog.py @@ -24,6 +24,7 @@ ############################################################################### from PyQt4 import QtCore, QtGui + from openlp.core.lib import translate class Ui_AlertDialog(object): @@ -31,7 +32,8 @@ class Ui_AlertDialog(object): AlertDialog.setObjectName(u'AlertDialog') AlertDialog.resize(567, 440) icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(u':/icon/openlp.org-icon-32.bmp'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon.addPixmap(QtGui.QPixmap(u':/icon/openlp.org-icon-32.bmp'), + QtGui.QIcon.Normal, QtGui.QIcon.Off) AlertDialog.setWindowIcon(icon) self.AlertDialogLayout = QtGui.QVBoxLayout(AlertDialog) self.AlertDialogLayout.setSpacing(8) @@ -42,22 +44,28 @@ class Ui_AlertDialog(object): self.AlertTextLayout.setSpacing(8) self.AlertTextLayout.setObjectName(u'AlertTextLayout') self.AlertEntryLabel = QtGui.QLabel(AlertDialog) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, + QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.AlertEntryLabel.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.AlertEntryLabel.sizePolicy().hasHeightForWidth()) self.AlertEntryLabel.setSizePolicy(sizePolicy) self.AlertEntryLabel.setObjectName(u'AlertEntryLabel') - self.AlertTextLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.AlertEntryLabel) + self.AlertTextLayout.setWidget(0, QtGui.QFormLayout.LabelRole, + self.AlertEntryLabel) self.AlertParameter = QtGui.QLabel(AlertDialog) self.AlertParameter.setObjectName(u'AlertParameter') - self.AlertTextLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.AlertParameter) + self.AlertTextLayout.setWidget(1, QtGui.QFormLayout.LabelRole, + self.AlertParameter) self.ParameterEdit = QtGui.QLineEdit(AlertDialog) self.ParameterEdit.setObjectName(u'ParameterEdit') - self.AlertTextLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.ParameterEdit) + self.AlertTextLayout.setWidget(1, QtGui.QFormLayout.FieldRole, + self.ParameterEdit) self.AlertTextEdit = QtGui.QLineEdit(AlertDialog) self.AlertTextEdit.setObjectName(u'AlertTextEdit') - self.AlertTextLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.AlertTextEdit) + self.AlertTextLayout.setWidget(0, QtGui.QFormLayout.FieldRole, + self.AlertTextEdit) self.AlertDialogLayout.addLayout(self.AlertTextLayout) self.ManagementLayout = QtGui.QHBoxLayout() self.ManagementLayout.setSpacing(8) @@ -72,24 +80,28 @@ class Ui_AlertDialog(object): self.ManageButtonLayout.setObjectName(u'ManageButtonLayout') self.NewButton = QtGui.QPushButton(AlertDialog) icon1 = QtGui.QIcon() - icon1.addPixmap(QtGui.QPixmap(u':/general/general_new.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon1.addPixmap(QtGui.QPixmap(u':/general/general_new.png'), + QtGui.QIcon.Normal, QtGui.QIcon.Off) self.NewButton.setIcon(icon1) self.NewButton.setObjectName(u'NewButton') self.ManageButtonLayout.addWidget(self.NewButton) self.SaveButton = QtGui.QPushButton(AlertDialog) self.SaveButton.setEnabled(False) icon2 = QtGui.QIcon() - icon2.addPixmap(QtGui.QPixmap(u':/general/general_save.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon2.addPixmap(QtGui.QPixmap(u':/general/general_save.png'), + QtGui.QIcon.Normal, QtGui.QIcon.Off) self.SaveButton.setIcon(icon2) self.SaveButton.setObjectName(u'SaveButton') self.ManageButtonLayout.addWidget(self.SaveButton) self.DeleteButton = QtGui.QPushButton(AlertDialog) icon3 = QtGui.QIcon() - icon3.addPixmap(QtGui.QPixmap(u':/general/general_delete.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon3.addPixmap(QtGui.QPixmap(u':/general/general_delete.png'), + QtGui.QIcon.Normal, QtGui.QIcon.Off) self.DeleteButton.setIcon(icon3) self.DeleteButton.setObjectName(u'DeleteButton') self.ManageButtonLayout.addWidget(self.DeleteButton) - spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, + QtGui.QSizePolicy.Expanding) self.ManageButtonLayout.addItem(spacerItem) self.ManagementLayout.addLayout(self.ManageButtonLayout) self.AlertDialogLayout.addLayout(self.ManagementLayout) @@ -122,7 +134,8 @@ class Ui_AlertDialog(object): self.AlertParameter.setBuddy(self.ParameterEdit) self.retranslateUi(AlertDialog) - QtCore.QObject.connect(self.CloseButton, QtCore.SIGNAL(u'clicked()'), AlertDialog.close) + QtCore.QObject.connect(self.CloseButton, QtCore.SIGNAL(u'clicked()'), + AlertDialog.close) QtCore.QMetaObject.connectSlotsByName(AlertDialog) AlertDialog.setTabOrder(self.AlertTextEdit, self.ParameterEdit) AlertDialog.setTabOrder(self.ParameterEdit, self.AlertListWidget) @@ -141,6 +154,7 @@ class Ui_AlertDialog(object): self.SaveButton.setText(translate('AlertForm', '&Save')) self.DeleteButton.setText(translate('AlertForm', '&Delete')) self.DisplayButton.setText(translate('AlertForm', 'Displ&ay')) - self.DisplayCloseButton.setText(translate('AlertForm', 'Display && Cl&ose')) + self.DisplayCloseButton.setText( + translate('AlertForm', 'Display && Cl&ose')) self.CloseButton.setText(translate('AlertForm', '&Close')) diff --git a/openlp/plugins/alerts/lib/manager.py b/openlp/plugins/alerts/lib/manager.py index 9d9c87fbb..088f0cbae 100644 --- a/openlp/plugins/alerts/lib/manager.py +++ b/openlp/plugins/alerts/lib/manager.py @@ -26,6 +26,7 @@ import logging from PyQt4 import QtCore +from sqlalchemy.exceptions import InvalidRequestError from openlp.core.utils import AppLocation from openlp.plugins.alerts.lib.models import init_models, metadata, AlertItem @@ -80,7 +81,7 @@ class DBManager(object): self.session.commit() log.debug(u'Alert saved') return True - except: + except InvalidRequestError: self.session.rollback() log.exception(u'Alert save failed') return False @@ -104,7 +105,7 @@ class DBManager(object): self.session.delete(alert_item) self.session.commit() return True - except: + except InvalidRequestError: self.session.rollback() log.exception(u'Alert deleton failed') return False diff --git a/openlp/plugins/alerts/lib/models.py b/openlp/plugins/alerts/lib/models.py index d95ebce5d..f222345f1 100644 --- a/openlp/plugins/alerts/lib/models.py +++ b/openlp/plugins/alerts/lib/models.py @@ -34,6 +34,6 @@ def init_models(url): engine = create_engine(url) metadata.bind = engine session = scoped_session(sessionmaker(autoflush=True, autocommit=False, - bind=engine)) + bind=engine)) mapper(AlertItem, alerts_table) return session diff --git a/openlp/plugins/bibles/forms/bibleimportwizard.py b/openlp/plugins/bibles/forms/bibleimportwizard.py index c2aa2dde4..bfb340503 100644 --- a/openlp/plugins/bibles/forms/bibleimportwizard.py +++ b/openlp/plugins/bibles/forms/bibleimportwizard.py @@ -308,29 +308,41 @@ class Ui_BibleImportWizard(object): QtCore.QMetaObject.connectSlotsByName(BibleImportWizard) def retranslateUi(self, BibleImportWizard): - BibleImportWizard.setWindowTitle(translate('ImportWizardForm', 'Bible Import Wizard')) + BibleImportWizard.setWindowTitle( + translate('ImportWizardForm', 'Bible Import Wizard')) self.TitleLabel.setText( u'%s' % \ translate('ImportWizardForm', 'Welcome to the Bible Import Wizard')) self.InformationLabel.setText( - translate('ImportWizardForm', 'This wizard will help you to import Bibles from a ' + translate('ImportWizardForm', + 'This wizard will help you to import Bibles from a ' 'variety of formats. Click the next button below to start the ' 'process by selecting a format to import from.')) - self.SelectPage.setTitle(translate('ImportWizardForm', 'Select Import Source')) - self.SelectPage.setSubTitle( - translate('ImportWizardForm', 'Select the import format, and where to import from.')) + self.SelectPage.setTitle( + translate('ImportWizardForm', 'Select Import Source')) + self.SelectPage.setSubTitle(translate('ImportWizardForm', + 'Select the import format, and where to import from.')) self.FormatLabel.setText(translate('ImportWizardForm', 'Format:')) - self.FormatComboBox.setItemText(0, translate('ImportWizardForm', 'OSIS')) + self.FormatComboBox.setItemText(0, + translate('ImportWizardForm', 'OSIS')) self.FormatComboBox.setItemText(1, translate('ImportWizardForm', 'CSV')) - self.FormatComboBox.setItemText(2, translate('ImportWizardForm', 'OpenSong')) - self.FormatComboBox.setItemText(3, translate('ImportWizardForm', 'Web Download')) - self.OsisLocationLabel.setText(translate('ImportWizardForm', 'File Location:')) - self.BooksLocationLabel.setText(translate('ImportWizardForm', 'Books Location:')) - self.VerseLocationLabel.setText(translate('ImportWizardForm', 'Verse Location:')) - self.OpenSongFileLabel.setText(translate('ImportWizardForm', 'Bible Filename:')) + self.FormatComboBox.setItemText(2, + translate('ImportWizardForm', 'OpenSong')) + self.FormatComboBox.setItemText(3, + translate('ImportWizardForm', 'Web Download')) + self.OsisLocationLabel.setText( + translate('ImportWizardForm', 'File Location:')) + self.BooksLocationLabel.setText( + translate('ImportWizardForm', 'Books Location:')) + self.VerseLocationLabel.setText( + translate('ImportWizardForm', 'Verse Location:')) + self.OpenSongFileLabel.setText( + translate('ImportWizardForm', 'Bible Filename:')) self.LocationLabel.setText(translate('ImportWizardForm', 'Location:')) - self.LocationComboBox.setItemText(0, translate('ImportWizardForm', 'Crosswalk')) - self.LocationComboBox.setItemText(1, translate('ImportWizardForm', 'BibleGateway')) + self.LocationComboBox.setItemText(0, + translate('ImportWizardForm', 'Crosswalk')) + self.LocationComboBox.setItemText(1, + translate('ImportWizardForm', 'BibleGateway')) self.BibleLabel.setText(translate('ImportWizardForm', 'Bible:')) self.WebDownloadTabWidget.setTabText( self.WebDownloadTabWidget.indexOf(self.DownloadOptionsTab), @@ -341,16 +353,19 @@ class Ui_BibleImportWizard(object): self.WebDownloadTabWidget.setTabText( self.WebDownloadTabWidget.indexOf(self.ProxyServerTab), translate('ImportWizardForm', 'Proxy Server (Optional)')) - self.LicenseDetailsPage.setTitle(translate('ImportWizardForm', 'License Details')) - self.LicenseDetailsPage.setSubTitle( - translate('ImportWizardForm', 'Set up the Bible\'s license details.')) - self.VersionNameLabel.setText(translate('ImportWizardForm', 'Version Name:')) + self.LicenseDetailsPage.setTitle( + translate('ImportWizardForm', 'License Details')) + self.LicenseDetailsPage.setSubTitle(translate('ImportWizardForm', + 'Set up the Bible\'s license details.')) + self.VersionNameLabel.setText( + translate('ImportWizardForm', 'Version Name:')) self.CopyrightLabel.setText(translate('ImportWizardForm', 'Copyright:')) - self.PermissionLabel.setText(translate('ImportWizardForm', 'Permission:')) + self.PermissionLabel.setText( + translate('ImportWizardForm', 'Permission:')) self.ImportPage.setTitle(translate('ImportWizardForm', 'Importing')) - self.ImportPage.setSubTitle( - translate('ImportWizardForm', 'Please wait while your Bible is imported.')) - self.ImportProgressLabel.setText(translate('ImportWizardForm', 'Ready.')) + self.ImportPage.setSubTitle(translate('ImportWizardForm', + 'Please wait while your Bible is imported.')) + self.ImportProgressLabel.setText( + translate('ImportWizardForm', 'Ready.')) self.ImportProgressBar.setFormat(u'%p%') - diff --git a/openlp/plugins/bibles/forms/importwizardform.py b/openlp/plugins/bibles/forms/importwizardform.py index 011bf264a..8ff0b4b61 100644 --- a/openlp/plugins/bibles/forms/importwizardform.py +++ b/openlp/plugins/bibles/forms/importwizardform.py @@ -146,7 +146,8 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard): QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) self.CsvVerseLocationEdit.setFocus() return False - elif self.field(u'source_format').toInt()[0] == BibleFormat.OpenSong: + elif self.field(u'source_format').toInt()[0] == \ + BibleFormat.OpenSong: if self.field(u'opensong_file').toString() == u'': QtGui.QMessageBox.critical(self, self.trUtf8('Invalid OpenSong Bible'), @@ -159,7 +160,8 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard): elif self.currentId() == 2: # License details license_version = variant_to_unicode(self.field(u'license_version')) - license_copyright = variant_to_unicode(self.field(u'license_copyright')) + license_copyright = variant_to_unicode( + self.field(u'license_copyright')) if license_version == u'': QtGui.QMessageBox.critical(self, self.trUtf8('Empty Version Name'), @@ -317,7 +319,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard): if not isinstance(name, unicode): name = unicode(name, u'utf8') self.web_bible_list[WebDownload.Crosswalk][ver] = name.strip() - except: + except IOError: log.exception(u'Crosswalk resources missing') finally: if books_file: @@ -336,8 +338,9 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard): ver = unicode(ver, u'utf8') if not isinstance(name, unicode): name = unicode(name, u'utf8') - self.web_bible_list[WebDownload.BibleGateway][ver] = name.strip() - except: + self.web_bible_list[WebDownload.BibleGateway][ver] = \ + name.strip() + except IOError: log.exception(u'Biblegateway resources missing') finally: if books_file: @@ -399,16 +402,19 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard): if not isinstance(bible_version, unicode): bible_version = unicode(bible_version, u'utf8') if download_location == WebDownload.Crosswalk: - bible = self.web_bible_list[WebDownload.Crosswalk][bible_version] + bible = \ + self.web_bible_list[WebDownload.Crosswalk][bible_version] elif download_location == WebDownload.BibleGateway: - bible = self.web_bible_list[WebDownload.BibleGateway][bible_version] + bible = \ + self.web_bible_list[WebDownload.BibleGateway][bible_version] importer = self.manager.import_bible( BibleFormat.WebDownload, name=license_version, download_source=WebDownload.get_name(download_location), download_name=bible, proxy_server=variant_to_unicode(self.field(u'proxy_server')), - proxy_username=variant_to_unicode(self.field(u'proxy_username')), + proxy_username=variant_to_unicode( + self.field(u'proxy_username')), proxy_password=variant_to_unicode(self.field(u'proxy_password')) ) success = importer.do_import() @@ -428,4 +434,3 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard): self.cancelButton.setVisible(False) Receiver.send_message(u'openlp_process_events') - diff --git a/openlp/plugins/bibles/lib/common.py b/openlp/plugins/bibles/lib/common.py index 94d83ce3d..8313354c2 100644 --- a/openlp/plugins/bibles/lib/common.py +++ b/openlp/plugins/bibles/lib/common.py @@ -30,7 +30,8 @@ import chardet import htmlentitydefs only_verses = re.compile(r'([\w .]+)[ ]+([0-9]+)[ ]*[:|v|V][ ]*([0-9]+)' - r'(?:[ ]*-[ ]*([0-9]+|end))?(?:[ ]*,[ ]*([0-9]+)(?:[ ]*-[ ]*([0-9]+|end))?)?', + r'(?:[ ]*-[ ]*([0-9]+|end))?(?:[ ]*,[ ]*([0-9]+)' + r'(?:[ ]*-[ ]*([0-9]+|end))?)?', re.UNICODE) chapter_range = re.compile(r'([\w .]+)[ ]+([0-9]+)[ ]*[:|v|V][ ]*' r'([0-9]+|end)[ ]*-[ ]*([0-9]+)[ ]*[:|v|V][ ]*([0-9]+|end)', diff --git a/openlp/plugins/bibles/lib/csvbible.py b/openlp/plugins/bibles/lib/csvbible.py index 54775bd35..faaccf303 100644 --- a/openlp/plugins/bibles/lib/csvbible.py +++ b/openlp/plugins/bibles/lib/csvbible.py @@ -80,7 +80,7 @@ class CSVBible(BibleDB): self.create_book(unicode(line[1], details['encoding']), line[2], int(line[0])) Receiver.send_message(u'openlp_process_events') - except: + except IOError: log.exception(u'Loading books from file failed') success = False finally: @@ -109,7 +109,7 @@ class CSVBible(BibleDB): unicode(line[3], details['encoding'])) Receiver.send_message(u'openlp_process_events') self.commit() - except: + except IOError: log.exception(u'Loading verses from file failed') success = False finally: diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index 79a650541..02b0a82aa 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -87,8 +87,8 @@ class BibleDB(QtCore.QObject): unicode(settings.value(u'db hostname').toString()), unicode(settings.value(u'db database').toString())) settings.endGroup() - self.metadata, self.session = init_models(db_url) - self.metadata.create_all(checkfirst=True) + self.session = init_models(db_url) + metadata.create_all(checkfirst=True) if u'file' in kwargs: self.get_name() @@ -123,7 +123,7 @@ class BibleDB(QtCore.QObject): try: os.remove(self.db_file) return True - except: + except OSError: return False def register(self, wizard): @@ -320,12 +320,14 @@ class BibleDB(QtCore.QObject): verses = self.session.query(Verse) if text.find(u',') > -1: or_clause = [] - keywords = [u'%%%s%%' % keyword.strip() for keyword in text.split(u',')] + keywords = [u'%%%s%%' % keyword.strip() + for keyword in text.split(u',')] for keyword in keywords: or_clause.append(Verse.text.like(keyword)) verses = verses.filter(or_(*or_clause)) else: - keywords = [u'%%%s%%' % keyword.strip() for keyword in text.split(u' ')] + keywords = [u'%%%s%%' % keyword.strip() + for keyword in text.split(u' ')] for keyword in keywords: verses = verses.filter(Verse.text.like(keyword)) verses = verses.all() diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index 6cb7fe75b..eb86ec4ae 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -33,8 +33,9 @@ from BeautifulSoup import BeautifulSoup, Tag, NavigableString from openlp.core.lib import Receiver from openlp.core.utils import AppLocation -from common import BibleCommon, SearchResults, unescape -from db import BibleDB +from openlp.plugins.bibles.lib.common import BibleCommon, SearchResults, \ + unescape +from openlp.plugins.bibles.lib.db import BibleDB from openlp.plugins.bibles.lib.models import Book log = logging.getLogger(__name__) @@ -462,7 +463,8 @@ class HTTPBible(BibleDB): """ Return the list of books. """ - return [Book.populate(name=book['name']) for book in HTTPBooks.get_books()] + return [Book.populate(name=book['name']) + for book in HTTPBooks.get_books()] def lookup_book(self, book): """ diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 8a87288f3..7ef18a604 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -181,7 +181,7 @@ class BibleManager(object): Returns a list of the names of available Bibles. """ log.debug(u'get_bibles') - return [name for name, bible in self.db_cache.iteritems()] + return self.db_cache.keys() def get_books(self, bible): """ diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 469d53640..0356f44e7 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -460,10 +460,14 @@ class BibleMediaItem(MediaManagerItem): if bible2: bible2_verses = [] for scripture in self.lastReference: - bible2_verses.extend(self.parent.manager.get_verses(bible2, scripture)) - bible2_version = self.parent.manager.get_meta_data(bible2, u'Version') - bible2_copyright = self.parent.manager.get_meta_data(bible2, u'Copyright') - bible2_permission = self.parent.manager.get_meta_data(bible2, u'Permissions') + bible2_verses.extend(self.parent.manager.get_verses(bible2, + scripture)) + bible2_version = self.parent.manager.get_meta_data(bible2, + u'Version') + bible2_copyright = self.parent.manager.get_meta_data(bible2, + u'Copyright') + bible2_permission = self.parent.manager.get_meta_data(bible2, + u'Permissions') if bible2_version: bible2_version = bible2_version.value else: @@ -491,25 +495,30 @@ class BibleMediaItem(MediaManagerItem): copyright = self._decodeQtObject(reference, 'copyright') permission = self._decodeQtObject(reference, 'permission') if self.parent.settings_tab.display_style == 1: - verse_text = self.formatVerse(old_chapter, chapter, verse, u'(u', u')') + verse_text = self.formatVerse(old_chapter, chapter, verse, + u'(u', u')') elif self.parent.settings_tab.display_style == 2: - verse_text = self.formatVerse(old_chapter, chapter, verse, u'{', u'}') + verse_text = self.formatVerse(old_chapter, chapter, verse, + u'{', u'}') elif self.parent.settings_tab.display_style == 3: - verse_text = self.formatVerse(old_chapter, chapter, verse, u'[', u']') + verse_text = self.formatVerse(old_chapter, chapter, verse, + u'[', u']') else: - verse_text = self.formatVerse(old_chapter, chapter, verse, u'', u'') + verse_text = self.formatVerse(old_chapter, chapter, verse, + u'', u'') old_chapter = chapter footer = u'%s (%s %s)' % (book, version, copyright) #If not found add to footer if footer not in raw_footer: raw_footer.append(footer) if bible2: - footer = u'%s (%s %s)' % (book, bible2_version, bible2_copyright) + footer = u'%s (%s %s)' % (book, bible2_version, + bible2_copyright) #If not found add second version and copyright to footer if footer not in raw_footer: raw_footer.append(footer) - bible_text = u'%s %s \n\n %s %s' % \ - (verse_text, text, verse_text, bible2_verses[item.row()].text) + bible_text = u'%s %s \n\n %s %s' % (verse_text, text, + verse_text, bible2_verses[item.row()].text) raw_slides.append(bible_text) bible_text = u'' else: diff --git a/openlp/plugins/bibles/lib/models.py b/openlp/plugins/bibles/lib/models.py index 011a216d2..d970bce08 100644 --- a/openlp/plugins/bibles/lib/models.py +++ b/openlp/plugins/bibles/lib/models.py @@ -60,10 +60,9 @@ class Verse(BaseModel): def init_models(db_url): engine = create_engine(db_url) metadata.bind = engine - session = scoped_session(sessionmaker(autoflush=True, - autocommit=False, - bind=engine)) - return metadata, session + session = scoped_session(sessionmaker(autoflush=True, autocommit=False, + bind=engine)) + return session metadata = MetaData() meta_table = Table(u'metadata', metadata, diff --git a/openlp/plugins/bibles/lib/opensong.py b/openlp/plugins/bibles/lib/opensong.py index 048b569d0..4f42579d5 100644 --- a/openlp/plugins/bibles/lib/opensong.py +++ b/openlp/plugins/bibles/lib/opensong.py @@ -97,7 +97,7 @@ class OpenSongBible(BibleDB): QtCore.QString('%s %s %s' % (self.trUtf8('Importing'),\ db_book.name, chapter.attrib[u'n']))) self.commit() - except: + except IOError: log.exception(u'Loading bible from OpenSong file failed') success = False finally: diff --git a/openlp/plugins/bibles/lib/osis.py b/openlp/plugins/bibles/lib/osis.py index 9763ff24b..c6779c132 100644 --- a/openlp/plugins/bibles/lib/osis.py +++ b/openlp/plugins/bibles/lib/osis.py @@ -78,7 +78,7 @@ class OSISBible(BibleDB): book = line.split(u',') self.books[book[0]] = (book[1].lstrip().rstrip(), book[2].lstrip().rstrip()) - except: + except IOError: log.exception(u'OSIS bible import failed') finally: if fbibles: @@ -104,7 +104,7 @@ class OSISBible(BibleDB): try: detect_file = open(self.filename, u'r') details = chardet.detect(detect_file.read()) - except: + except IOError: log.exception(u'Failed to detect OSIS file encoding') return finally: @@ -173,7 +173,7 @@ class OSISBible(BibleDB): self.wizard.incrementProgressBar(u'Finishing import...') if match_count == 0: success = False - except: + except (ValueError, IOError): log.exception(u'Loading bible from OSIS file failed') success = False finally: @@ -185,4 +185,3 @@ class OSISBible(BibleDB): else: return success - diff --git a/openlp/plugins/custom/lib/manager.py b/openlp/plugins/custom/lib/manager.py index b5e0e8411..793cd8699 100644 --- a/openlp/plugins/custom/lib/manager.py +++ b/openlp/plugins/custom/lib/manager.py @@ -26,6 +26,7 @@ import logging from PyQt4 import QtCore +from sqlalchemy.exceptions import InvalidRequestError from openlp.core.utils import AppLocation from openlp.plugins.custom.lib.models import init_models, metadata, CustomSlide @@ -80,7 +81,7 @@ class CustomManager(object): self.session.commit() log.debug(u'Custom Slide saved') return True - except: + except InvalidRequestError: self.session.rollback() log.exception(u'Custom Slide save failed') return False @@ -104,7 +105,7 @@ class CustomManager(object): self.session.delete(customslide) self.session.commit() return True - except: + except InvalidRequestError: self.session.rollback() log.exception(u'Custom Slide deleton failed') return False diff --git a/openlp/plugins/custom/lib/models.py b/openlp/plugins/custom/lib/models.py index d75968882..3bd2886bd 100644 --- a/openlp/plugins/custom/lib/models.py +++ b/openlp/plugins/custom/lib/models.py @@ -34,6 +34,6 @@ def init_models(url): engine = create_engine(url) metadata.bind = engine session = scoped_session(sessionmaker(autoflush=True, autocommit=False, - bind=engine)) + bind=engine)) mapper(CustomSlide, custom_slide_table) return session diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 35151d86e..e432e5c61 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -117,7 +117,7 @@ class ImageMediaItem(MediaManagerItem): try: os.remove( os.path.join(self.servicePath, unicode(text.text()))) - except: + except OSError: #if not present do not worry pass self.ListView.takeItem(item.row()) @@ -126,7 +126,7 @@ class ImageMediaItem(MediaManagerItem): def loadList(self, list): for file in list: - (path, filename) = os.path.split(unicode(file)) + filename = os.path.split(unicode(file))[1] thumb = os.path.join(self.servicePath, filename) if os.path.exists(thumb): if self.validate(file, thumb): diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 05175632d..8d1ce9e04 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -143,7 +143,7 @@ class MediaMediaItem(MediaManagerItem): def loadList(self, list): for file in list: - (path, filename) = os.path.split(unicode(file)) + filename = os.path.split(unicode(file))[1] item_name = QtGui.QListWidgetItem(filename) img = QtGui.QPixmap(u':/media/media_video.png').toImage() item_name.setIcon(build_icon(img)) diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py index d79062a2a..d75136e21 100644 --- a/openlp/plugins/presentations/lib/impresscontroller.py +++ b/openlp/plugins/presentations/lib/impresscontroller.py @@ -176,14 +176,12 @@ class ImpressController(PresentationController): return doc class ImpressDocument(PresentationDocument): - def __init__(self, controller, presentation): log.debug(u'Init Presentation OpenOffice') - self.controller = controller + PresentationDocument.__init__(controller, presentation) self.document = None self.presentation = None self.control = None - self.store_filename(presentation) def load_presentation(self): """ diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index cf25a76d3..11f837b12 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -131,7 +131,7 @@ class PresentationMediaItem(MediaManagerItem): for file in list: if currlist.count(file) > 0: continue - (path, filename) = os.path.split(unicode(file)) + filename = os.path.split(unicode(file))[1] if titles.count(filename) > 0: QtGui.QMessageBox.critical( self, self.trUtf8('File exists'), self.trUtf8( diff --git a/openlp/plugins/presentations/lib/messagelistener.py b/openlp/plugins/presentations/lib/messagelistener.py index b5b6b6879..0e98b377a 100644 --- a/openlp/plugins/presentations/lib/messagelistener.py +++ b/openlp/plugins/presentations/lib/messagelistener.py @@ -256,35 +256,35 @@ class MessageListener(object): self.previewHandler.slide(slide, isLive) def first(self, message): - isLive, item = self.decode_message(message) + isLive = self.decode_message(message)[0] if isLive: self.liveHandler.first() else: self.previewHandler.first() def last(self, message): - isLive, item = self.decode_message(message) + isLive = self.decode_message(message)[0] if isLive: self.liveHandler.last() else: self.previewHandler.last() def next(self, message): - isLive, item = self.decode_message(message) + isLive = self.decode_message(message)[0] if isLive: self.liveHandler.next() else: self.previewHandler.next() def previous(self, message): - isLive, item = self.decode_message(message) + isLive = self.decode_message(message)[0] if isLive: self.liveHandler.previous() else: self.previewHandler.previous() def shutdown(self, message): - isLive, item = self.decode_message(message) + isLive = self.decode_message(message)[0] if isLive: Receiver.send_message(u'maindisplay_show') self.liveHandler.shutdown() @@ -292,17 +292,17 @@ class MessageListener(object): self.previewHandler.shutdown() def hide(self, message): - isLive, item = self.decode_message(message) + isLive = self.decode_message(message)[0] if isLive: self.liveHandler.stop() def blank(self, message): - isLive, item = self.decode_message(message) + isLive = self.decode_message(message)[0] if isLive: self.liveHandler.blank() def unblank(self, message): - isLive, item = self.decode_message(message) + isLive = self.decode_message(message)[0] if isLive: self.liveHandler.unblank() diff --git a/openlp/plugins/presentations/lib/powerpointcontroller.py b/openlp/plugins/presentations/lib/powerpointcontroller.py index 3ea95f509..05ef7e4f1 100644 --- a/openlp/plugins/presentations/lib/powerpointcontroller.py +++ b/openlp/plugins/presentations/lib/powerpointcontroller.py @@ -102,12 +102,10 @@ class PowerpointController(PresentationController): return doc class PowerpointDocument(PresentationDocument): - def __init__(self, controller, presentation): log.debug(u'Init Presentation Powerpoint') + PresentationDocument.__init__(controller, presentation) self.presentation = None - self.controller = controller - self.store_filename(presentation) def load_presentation(self): """ diff --git a/openlp/plugins/presentations/lib/pptviewcontroller.py b/openlp/plugins/presentations/lib/pptviewcontroller.py index b4102f5fe..59cf1ff3b 100644 --- a/openlp/plugins/presentations/lib/pptviewcontroller.py +++ b/openlp/plugins/presentations/lib/pptviewcontroller.py @@ -102,11 +102,10 @@ class PptviewController(PresentationController): class PptviewDocument(PresentationDocument): def __init__(self, controller, presentation): log.debug(u'Init Presentation PowerPoint') + PresentationDocument.__init__(controller, presentation) self.presentation = None self.pptid = None self.blanked = False - self.controller = controller - self.store_filename(presentation) def load_presentation(self): """ diff --git a/openlp/plugins/presentations/lib/presentationcontroller.py b/openlp/plugins/presentations/lib/presentationcontroller.py index c0eb7e5f1..3d2836041 100644 --- a/openlp/plugins/presentations/lib/presentationcontroller.py +++ b/openlp/plugins/presentations/lib/presentationcontroller.py @@ -100,16 +100,17 @@ class PresentationController(object): self.docs = [] self.plugin = plugin self.name = name - self.settingsSection = self.plugin.settingsSection + self.settings_section = self.plugin.settingsSection self.available = self.check_available() if self.available: self.enabled = QtCore.QSettings().value( - self.settingsSection + u'/' + name, - QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0] == QtCore.Qt.Checked + self.settings_section + u'/' + name, + QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0] == \ + QtCore.Qt.Checked else: self.enabled = False self.thumbnailroot = os.path.join( - AppLocation.get_section_data_path(self.settingsSection), + AppLocation.get_section_data_path(self.settings_section), name, u'thumbnails') self.thumbnailprefix = u'slide' if not os.path.isdir(self.thumbnailroot): @@ -123,7 +124,8 @@ class PresentationController(object): def start_process(self): """ - Loads a running version of the presentation application in the background. + Loads a running version of the presentation application in the + background. """ pass @@ -231,7 +233,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 +393,4 @@ class PresentationDocument(object): The slide the notes are required for, starting at 1 """ return '' + diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index 0ac21b924..36515df16 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -191,7 +191,7 @@ class HttpConnection(object): path = os.path.normpath(os.path.join(self.parent.html_dir, filename)) if not path.startswith(self.parent.html_dir): return None - (fileroot, ext) = os.path.splitext(filename) + ext = os.path.splitext(filename)[1] if ext == u'.html': mimetype = u'text/html' elif ext == u'.css': diff --git a/openlp/plugins/songs/forms/authorsdialog.py b/openlp/plugins/songs/forms/authorsdialog.py index dbd7af077..9834e3606 100644 --- a/openlp/plugins/songs/forms/authorsdialog.py +++ b/openlp/plugins/songs/forms/authorsdialog.py @@ -74,7 +74,9 @@ class Ui_AuthorsDialog(object): QtCore.QMetaObject.connectSlotsByName(AuthorsDialog) def retranslateUi(self, AuthorsDialog): - AuthorsDialog.setWindowTitle(translate('AuthorsForm', 'Author Maintenance')) + AuthorsDialog.setWindowTitle( + translate('AuthorsForm', 'Author Maintenance')) self.DisplayLabel.setText(translate('AuthorsForm', 'Display name:')) self.FirstNameLabel.setText(translate('AuthorsForm', 'First name:')) self.LastNameLabel.setText(translate('AuthorsForm', 'Last name:')) + diff --git a/openlp/plugins/songs/forms/authorsform.py b/openlp/plugins/songs/forms/authorsform.py index d1cb24761..873d6ba28 100644 --- a/openlp/plugins/songs/forms/authorsform.py +++ b/openlp/plugins/songs/forms/authorsform.py @@ -37,11 +37,13 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog): """ QtGui.QDialog.__init__(self, parent) self.setupUi(self) - self.autoDisplayName = False + self._autoDisplayName = False QtCore.QObject.connect(self.FirstNameEdit, - QtCore.SIGNAL(u'textEdited(QString)'), self.onFirstNameEditTextEdited) + QtCore.SIGNAL(u'textEdited(QString)'), + self.onFirstNameEditTextEdited) QtCore.QObject.connect(self.LastNameEdit, - QtCore.SIGNAL(u'textEdited(QString)'), self.onLastNameEditTextEdited) + QtCore.SIGNAL(u'textEdited(QString)'), + self.onLastNameEditTextEdited) def exec_(self, clear=True): if clear: @@ -52,7 +54,7 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog): return QtGui.QDialog.exec_(self) def onFirstNameEditTextEdited(self, text): - if not self.autoDisplayName: + if not self._autoDisplayName: return display_name = text if self.LastNameEdit.text() != u'': @@ -60,7 +62,7 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog): self.DisplayEdit.setText(display_name) def onLastNameEditTextEdited(self, text): - if not self.autoDisplayName: + if not self._autoDisplayName: return display_name = text if self.FirstNameEdit.text() != u'': @@ -68,24 +70,20 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog): self.DisplayEdit.setText(display_name) def autoDisplayName(self): - return self.autoDisplayName + return self._autoDisplayName def setAutoDisplayName(self, on): - self.autoDisplayName = on + self._autoDisplayName = on def accept(self): if not self.FirstNameEdit.text(): - QtGui.QMessageBox.critical( - self, self.trUtf8('Error'), - self.trUtf8('You need to type in the first name of the author.'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + QtGui.QMessageBox.critical(self, self.trUtf8('Error'), self.trUtf8( + 'You need to type in the first name of the author.')) self.FirstNameEdit.setFocus() return False elif not self.LastNameEdit.text(): - QtGui.QMessageBox.critical( - self, self.trUtf8('Error'), - self.trUtf8('You need to type in the last name of the author.'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + QtGui.QMessageBox.critical(self, self.trUtf8('Error'), + self.trUtf8('You need to type in the last name of the author.')) self.LastNameEdit.setFocus() return False elif not self.DisplayEdit.text(): @@ -105,3 +103,4 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog): return False else: return QtGui.QDialog.accept(self) + diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 561bf9aa2..cf94e18cf 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -569,7 +569,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): verseId = unicode((item.data(QtCore.Qt.UserRole)).toString()) bits = verseId.split(u':') sxml.add_verse_to_lyrics(bits[0], bits[1], unicode(item.text())) - text = text + unicode(self.VerseListWidget.item(i, 0).text()) + u' ' + text = text + unicode(self.VerseListWidget.item(i, 0).text()) \ + + u' ' text = text.replace(u'\'', u'') text = text.replace(u',', u'') text = text.replace(u';', u'') diff --git a/openlp/plugins/songs/lib/manager.py b/openlp/plugins/songs/lib/manager.py index 7147f4d79..43b10aeec 100644 --- a/openlp/plugins/songs/lib/manager.py +++ b/openlp/plugins/songs/lib/manager.py @@ -26,6 +26,7 @@ import logging from PyQt4 import QtCore +from sqlalchemy.exceptions import InvalidRequestError from openlp.core.utils import AppLocation from openlp.plugins.songs.lib.models import init_models, metadata, Song, \ @@ -161,7 +162,7 @@ class SongManager(object): self.session.add(song) self.session.commit() return True - except: + except InvalidRequestError: log.exception(u'Could not save song to song database') self.session.rollback() return False @@ -172,7 +173,7 @@ class SongManager(object): self.session.delete(song) self.session.commit() return True - except: + except InvalidRequestError: self.session.rollback() log.exception(u'Could not delete song from song database') return False @@ -203,7 +204,7 @@ class SongManager(object): self.session.add(author) self.session.commit() return True - except: + except InvalidRequestError: self.session.rollback() log.exception(u'Could not save author to song database') return False @@ -217,7 +218,7 @@ class SongManager(object): self.session.delete(author) self.session.commit() return True - except: + except InvalidRequestError: self.session.rollback() log.exception(u'Could not delete author from song database') return False @@ -248,7 +249,7 @@ class SongManager(object): self.session.add(topic) self.session.commit() return True - except: + except InvalidRequestError: self.session.rollback() log.exception(u'Could not save topic to song database') return False @@ -262,7 +263,7 @@ class SongManager(object): self.session.delete(topic) self.session.commit() return True - except: + except InvalidRequestError: self.session.rollback() log.exception(u'Could not delete topic from song database') return False @@ -293,7 +294,7 @@ class SongManager(object): self.session.add(book) self.session.commit() return True - except: + except InvalidRequestError: self.session.rollback() log.exception(u'Could not save book to song database') return False @@ -307,10 +308,11 @@ class SongManager(object): self.session.delete(book) self.session.commit() return True - except: + except InvalidRequestError: self.session.rollback() log.exception(u'Could not delete book from song database') return False def get_songs_for_theme(self, theme): return self.session.query(Song).filter(Song.theme_name == theme).all() + diff --git a/openlp/plugins/songs/lib/models.py b/openlp/plugins/songs/lib/models.py index 400bd7477..272981d20 100644 --- a/openlp/plugins/songs/lib/models.py +++ b/openlp/plugins/songs/lib/models.py @@ -33,15 +33,16 @@ from openlp.plugins.songs.lib.classes import * def init_models(url): engine = create_engine(url) metadata.bind = engine - session = scoped_session(sessionmaker(autoflush=False, - autocommit=False, bind=engine)) + session = scoped_session(sessionmaker(autoflush=False, autocommit=False, + bind=engine)) mapper(Author, authors_table) mapper(Book, song_books_table) mapper(Song, songs_table, - properties={'authors': relation(Author, backref='songs', - secondary=authors_songs_table), - 'book': relation(Book, backref='songs'), - 'topics': relation(Topic, backref='songs', - secondary=songs_topics_table)}) + properties={'authors': relation(Author, backref='songs', + secondary=authors_songs_table), + 'book': relation(Book, backref='songs'), + 'topics': relation(Topic, backref='songs', + secondary=songs_topics_table)}) mapper(Topic, topics_table) return session + diff --git a/openlp/plugins/songs/lib/oooimport.py b/openlp/plugins/songs/lib/oooimport.py index 403738973..a2a75a872 100644 --- a/openlp/plugins/songs/lib/oooimport.py +++ b/openlp/plugins/songs/lib/oooimport.py @@ -24,7 +24,9 @@ ############################################################################### import os + from PyQt4 import QtCore + from songimport import SongImport if os.name == u'nt': @@ -35,9 +37,11 @@ if os.name == u'nt': else: try: import uno - from com.sun.star.style.BreakType import PAGE_BEFORE, PAGE_AFTER, PAGE_BOTH - except: + from com.sun.star.style.BreakType import PAGE_BEFORE, PAGE_AFTER, \ + PAGE_BOTH + except ImportError: pass + class OooImport(object): """ Import songs from Impress/Powerpoint docs using Impress @@ -75,7 +79,8 @@ class OooImport(object): """ if os.name == u'nt': self.start_ooo_process() - self.desktop = self.manager.createInstance(u'com.sun.star.frame.Desktop') + self.desktop = self.manager.createInstance( + u'com.sun.star.frame.Desktop') else: context = uno.getComponentContext() resolver = context.ServiceManager.createInstanceWithContext( @@ -101,8 +106,8 @@ class OooImport(object): self.manager._FlagAsMethod(u'Bridge_GetStruct') self.manager._FlagAsMethod(u'Bridge_GetValueObject') else: - cmd = u'openoffice.org -nologo -norestore -minimized -invisible ' \ - + u'-nofirststartwizard ' \ + cmd = u'openoffice.org -nologo -norestore -minimized ' \ + + u'-invisible -nofirststartwizard ' \ + '-accept="socket,host=localhost,port=2002;urp;"' process = QtCore.QProcess() process.startDetached(cmd) diff --git a/openlp/plugins/songs/lib/songxml.py b/openlp/plugins/songs/lib/songxml.py index 0979eb2b8..336fc080e 100644 --- a/openlp/plugins/songs/lib/songxml.py +++ b/openlp/plugins/songs/lib/songxml.py @@ -60,7 +60,7 @@ class SongFeatureError(SongException): # TODO: Song: Import ChangingSong # TODO: Song: Export ChangingSong -_blankOpenSongXml = \ +_BLANK_OPENSONG_XML = \ ''' @@ -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""" @@ -288,7 +288,7 @@ class Song(object): osfile.close() xml = "".join(list) self.from_opensong_buffer(xml) - except: + except IOError: log.exception(u'Failed to load opensong xml file') finally: if osfile: @@ -394,7 +394,7 @@ class Song(object): ccli_file = open(textFileName, 'r') lines = [orgline.rstrip() for orgline in ccli_file] self.from_ccli_text_buffer(lines) - except: + except IOError: log.exception(u'Failed to load CCLI text file') finally: if ccli_file: diff --git a/openlp/plugins/songs/lib/xml.py b/openlp/plugins/songs/lib/xml.py index 51fbad6b0..2be9573a2 100644 --- a/openlp/plugins/songs/lib/xml.py +++ b/openlp/plugins/songs/lib/xml.py @@ -24,6 +24,7 @@ ############################################################################### from lxml import objectify +from lxml.etree import XMLSyntaxError class LyricsXML(object): """ @@ -73,7 +74,7 @@ class LyricsXML(object): }) self.lyrics.append(language) return True - except: + except XMLSyntaxError: return False def extract(self, text): diff --git a/openlp/plugins/songusage/forms/songusagedetailform.py b/openlp/plugins/songusage/forms/songusagedetailform.py index 21d6d29c5..e568c35da 100644 --- a/openlp/plugins/songusage/forms/songusagedetailform.py +++ b/openlp/plugins/songusage/forms/songusagedetailform.py @@ -85,7 +85,7 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog): (instance.usagedate,instance.usagetime, instance.title, instance.copyright, instance.ccl_number , instance.authors) file.write(record) - except: + except IOError: log.exception(u'Failed to write out song usage records') finally: if file: diff --git a/openlp/plugins/songusage/lib/manager.py b/openlp/plugins/songusage/lib/manager.py index cb8ea91bf..b830fdafd 100644 --- a/openlp/plugins/songusage/lib/manager.py +++ b/openlp/plugins/songusage/lib/manager.py @@ -26,6 +26,7 @@ import logging from PyQt4 import QtCore +from sqlalchemy.exceptions import InvalidRequestError from openlp.core.utils import AppLocation from openlp.plugins.songusage.lib.models import init_models, metadata, \ @@ -87,7 +88,7 @@ class SongUsageManager(object): self.session.add(songusageitem) self.session.commit() return True - except: + except InvalidRequestError: self.session.rollback() log.exception(u'SongUsage item failed to save') return False @@ -111,7 +112,7 @@ class SongUsageManager(object): self.session.delete(songusageitem) self.session.commit() return True - except: + except InvalidRequestError: self.session.rollback() log.exception(u'SongUsage Item failed to delete') return False @@ -126,7 +127,7 @@ class SongUsageManager(object): self.session.query(SongUsageItem).delete(synchronize_session=False) self.session.commit() return True - except: + except InvalidRequestError: self.session.rollback() log.exception(u'Failed to delete all Song Usage items') return False @@ -141,7 +142,8 @@ class SongUsageManager(object): .delete(synchronize_session=False) self.session.commit() return True - except: + except InvalidRequestError: self.session.rollback() log.exception(u'Failed to delete all Song Usage items to %s' % date) return False + diff --git a/openlp/plugins/songusage/lib/models.py b/openlp/plugins/songusage/lib/models.py index a053ffc34..a7babbaed 100644 --- a/openlp/plugins/songusage/lib/models.py +++ b/openlp/plugins/songusage/lib/models.py @@ -34,6 +34,6 @@ def init_models(url): engine = create_engine(url) metadata.bind = engine session = scoped_session(sessionmaker(autoflush=True, autocommit=False, - bind=engine)) + bind=engine)) mapper(SongUsageItem, songusage_table) return session