← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~meths/openlp/trivialfixes into lp:openlp

 

Jon Tibble has proposed merging lp:~meths/openlp/trivialfixes into lp:openlp.

    Requested reviews:
    OpenLP Core (openlp-core)


Fix Python imports

Fix OpenLP theme importing:
- File paths for both v1 and v2 themes
- Background colour translation for v1 themes
- V1 font colour translation after background colour translation fix broke them!
- Fix unzipping for the nonXML files
-- 
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/19883
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/rendermanager.py'
--- openlp/core/lib/rendermanager.py	2010-01-26 19:16:47 +0000
+++ openlp/core/lib/rendermanager.py	2010-02-22 17:01:11 +0000
@@ -25,10 +25,10 @@
 
 import logging
 
-from PyQt4 import QtGui, QtCore
+from PyQt4 import QtCore
 
 from renderer import Renderer
-from openlp.core.lib import ThemeLevel, resize_image
+from openlp.core.lib import ThemeLevel
 
 class RenderManager(object):
     """

=== modified file 'openlp/core/theme/theme.py'
--- openlp/core/theme/theme.py	2009-12-31 12:52:01 +0000
+++ openlp/core/theme/theme.py	2010-02-22 17:01:11 +0000
@@ -30,7 +30,7 @@
 
 DelphiColors={"clRed":0xFF0000,
                 "clBlue":0x0000FF,
-                "clYellow":0x0FFFF00,
+                "clYellow":0xFFFF00,
                "clBlack":0x000000,
                "clWhite":0xFFFFFF}
 
@@ -113,6 +113,7 @@
         root = ElementTree(element=XML(xml))
         iter = root.getiterator()
         for element in iter:
+            delphiColorChange = False
             if element.tag != u'Theme':
                 t = element.text
                 val = 0
@@ -128,6 +129,7 @@
                             pass
                     elif DelphiColors.has_key(t):
                         val = DelphiColors[t]
+                        delphiColorChange = True
                     else:
                         try:
                             val = int(t)
@@ -136,7 +138,10 @@
                 if (element.tag.find(u'Color') > 0 or
                     (element.tag.find(u'BackgroundParameter') == 0 and type(val) == type(0))):
                     # convert to a wx.Colour
-                    val = QtGui.QColor((val>>16) & 0xFF, (val>>8)&0xFF, val&0xFF)
+                        if not delphiColorChange:
+                            val = QtGui.QColor(val&0xFF, (val>>8)&0xFF, (val>>16)&0xFF)
+                        else:
+                            val = QtGui.QColor((val>>16)&0xFF, (val>>8)&0xFF, val&0xFF)
                 setattr(self, element.tag, val)
 
     def __str__(self):

=== modified file 'openlp/core/ui/aboutform.py'
--- openlp/core/ui/aboutform.py	2009-12-31 12:52:01 +0000
+++ openlp/core/ui/aboutform.py	2010-02-22 17:01:11 +0000
@@ -25,7 +25,6 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.lib import build_icon
 from aboutdialog import Ui_AboutDialog
 
 class AboutForm(QtGui.QDialog, Ui_AboutDialog):

=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2010-02-17 20:17:33 +0000
+++ openlp/core/ui/maindisplay.py	2010-02-22 17:01:11 +0000
@@ -25,7 +25,6 @@
 
 import logging
 import os
-import time
 
 from PyQt4 import QtCore, QtGui
 from PyQt4.phonon import Phonon

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2010-02-04 19:25:32 +0000
+++ openlp/core/ui/servicemanager.py	2010-02-22 17:01:11 +0000
@@ -30,8 +30,8 @@
 
 from PyQt4 import QtCore, QtGui
 from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, \
-    ServiceItemType, contextMenuAction, contextMenuSeparator, contextMenu, \
-    Receiver, contextMenu, str_to_bool
+    contextMenuAction, contextMenuSeparator, contextMenu, Receiver, \
+    contextMenu, str_to_bool
 
 class ServiceManagerList(QtGui.QTreeWidget):
 

=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py	2010-02-16 17:40:41 +0000
+++ openlp/core/ui/thememanager.py	2010-02-22 17:01:11 +0000
@@ -34,8 +34,8 @@
 from openlp.core.ui import AmendThemeForm
 from openlp.core.theme import Theme
 from openlp.core.lib import PluginConfig, OpenLPToolbar, contextMenuAction, \
-    ThemeXML, ThemeLevel, str_to_bool, get_text_file_string, build_icon, \
-    Receiver, contextMenuSeparator
+    ThemeXML, str_to_bool, get_text_file_string, build_icon, Receiver, \
+    contextMenuSeparator
 from openlp.core.utils import ConfigHelper
 
 class ThemeManager(QtGui.QWidget):
@@ -313,17 +313,23 @@
             filexml = None
             themename = None
             for file in zip.namelist():
-                if file.endswith(os.path.sep):
-                    theme_dir = os.path.join(dir, file)
+                osfile = unicode(QtCore.QDir.toNativeSeparators(file))
+                theme_dir = None
+                if osfile.endswith(os.path.sep):
+                    theme_dir = os.path.join(dir, osfile)
                     if not os.path.exists(theme_dir):
-                        os.mkdir(os.path.join(dir, file))
+                        os.mkdir(os.path.join(dir, osfile))
                 else:
-                    fullpath = os.path.join(dir, file)
-                    names = file.split(os.path.sep)
+                    fullpath = os.path.join(dir, osfile)
+                    names = osfile.split(os.path.sep)
                     if len(names) > 1:
                         # not preview file
                         if themename is None:
                             themename = names[0]
+                        if theme_dir is None:
+                            theme_dir = os.path.join(dir, names[0])
+                            if not os.path.exists(theme_dir):
+                                os.mkdir(os.path.join(dir, names[0]))
                         xml_data = zip.read(file)
                         if os.path.splitext(file)[1].lower() in [u'.xml']:
                             if self.checkVersion1(xml_data):
@@ -335,7 +341,7 @@
                             outfile = open(fullpath, u'w')
                             outfile.write(filexml)
                         else:
-                            outfile = open(fullpath, u'w')
+                            outfile = open(fullpath, u'wb')
                             outfile.write(zip.read(file))
             self.generateAndSaveImage(dir, themename, filexml)
         except:
@@ -384,7 +390,6 @@
                 unicode(theme.BackgroundParameter2.name()), direction)
         else:
             newtheme.add_background_image(unicode(theme.BackgroundParameter1))
-
         newtheme.add_font(unicode(theme.FontName),
             unicode(theme.FontColor.name()),
             unicode(theme.FontProportion * 3), u'False')
@@ -397,9 +402,14 @@
             shadow = True
         if theme.Outline == 1:
             outline = True
+        vAlignCorrection = 0
+        if theme.VerticalAlign == 2:
+            vAlignCorrection = 1
+        elif theme.VerticalAlign == 1:
+            vAlignCorrection = 2
         newtheme.add_display(unicode(shadow), unicode(theme.ShadowColor.name()),
             unicode(outline), unicode(theme.OutlineColor.name()),
-            unicode(theme.HorizontalAlign), unicode(theme.VerticalAlign),
+            unicode(theme.HorizontalAlign), unicode(vAlignCorrection),
             unicode(theme.WrapStyle), unicode(0))
         return newtheme.extract_xml()
 

=== modified file 'openlp/plugins/alerts/alertsplugin.py'
--- openlp/plugins/alerts/alertsplugin.py	2010-02-16 18:47:26 +0000
+++ openlp/plugins/alerts/alertsplugin.py	2010-02-22 17:01:11 +0000
@@ -23,12 +23,11 @@
 # Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
 ###############################################################################
 
-from datetime import datetime
 import logging
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.lib import Plugin, Receiver, str_to_bool, build_icon, PluginStatus
+from openlp.core.lib import Plugin, build_icon, PluginStatus
 from openlp.plugins.alerts.lib import AlertsManager, DBManager
 from openlp.plugins.alerts.forms import AlertsTab, AlertForm, AlertEditForm
 

=== modified file 'openlp/plugins/alerts/forms/alerteditform.py'
--- openlp/plugins/alerts/forms/alerteditform.py	2010-02-14 20:19:57 +0000
+++ openlp/plugins/alerts/forms/alerteditform.py	2010-02-22 17:01:11 +0000
@@ -23,8 +23,6 @@
 # Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
 ###############################################################################
 
-from datetime import date
-
 from PyQt4 import QtGui, QtCore
 from openlp.plugins.alerts.lib.models import AlertItem
 

=== modified file 'openlp/plugins/alerts/forms/alertform.py'
--- openlp/plugins/alerts/forms/alertform.py	2010-02-14 20:19:57 +0000
+++ openlp/plugins/alerts/forms/alertform.py	2010-02-22 17:01:11 +0000
@@ -23,9 +23,8 @@
 # Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
 ###############################################################################
 
-from datetime import date
-
 from PyQt4 import QtGui, QtCore
+
 from openlp.plugins.alerts.lib.models import AlertItem
 
 from alertdialog import Ui_AlertDialog

=== modified file 'openlp/plugins/alerts/lib/alertsmanager.py'
--- openlp/plugins/alerts/lib/alertsmanager.py	2010-02-17 20:17:33 +0000
+++ openlp/plugins/alerts/lib/alertsmanager.py	2010-02-22 17:01:11 +0000
@@ -1,10 +1,33 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael      #
+# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble,   #
+# Carsten Tinggaard                                                           #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
 
 import logging
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.lib import str_to_bool, Receiver
-from openlp.core.lib import SettingsTab
+from openlp.core.lib import Receiver
 
 class AlertsManager(QtCore.QObject):
     """

=== modified file 'openlp/plugins/bibles/forms/importwizardform.py'
--- openlp/plugins/bibles/forms/importwizardform.py	2010-02-04 17:38:21 +0000
+++ openlp/plugins/bibles/forms/importwizardform.py	2010-02-22 17:01:11 +0000
@@ -23,11 +23,10 @@
 # Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
 ###############################################################################
 
+import csv
 import logging
 import os
 import os.path
-from time import sleep
-import csv
 
 from PyQt4 import QtCore, QtGui
 
@@ -46,8 +45,8 @@
     }
 
     @classmethod
-    def get_name(class_, id):
-        return class_.Names[id]
+    def get_name(cls, id):
+        return cls.Names[id]
 
 
 class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):

=== modified file 'openlp/plugins/bibles/lib/common.py'
--- openlp/plugins/bibles/lib/common.py	2010-02-06 10:22:20 +0000
+++ openlp/plugins/bibles/lib/common.py	2010-02-22 17:01:11 +0000
@@ -27,7 +27,6 @@
 import chardet
 import logging
 import re
-import sqlite3
 
 only_verses = re.compile(r'([\w .]+)[ ]+([0-9]+)[ ]*[:|v|V][ ]*([0-9]+)'
     r'(?:[ ]*-[ ]*([0-9]+|end))?(?:[ ]*,[ ]*([0-9]+)(?:[ ]*-[ ]*([0-9]+|end))?)?',

=== modified file 'openlp/plugins/bibles/lib/manager.py'
--- openlp/plugins/bibles/lib/manager.py	2010-02-06 10:22:20 +0000
+++ openlp/plugins/bibles/lib/manager.py	2010-02-22 17:01:11 +0000
@@ -25,7 +25,6 @@
 
 import logging
 import os
-import csv
 
 from common import parse_reference
 from opensong import OpenSongBible

=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py	2010-02-06 13:22:26 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py	2010-02-22 17:01:11 +0000
@@ -31,8 +31,6 @@
 from openlp.core.lib import MediaManagerItem, Receiver, str_to_bool, \
     BaseListWithDnD
 from openlp.plugins.bibles.forms import ImportWizardForm
-from openlp.plugins.bibles.lib.manager import BibleMode
-from openlp.plugins.bibles.lib.common import parse_reference
 
 class BibleListView(BaseListWithDnD):
     """

=== modified file 'openlp/plugins/bibles/lib/opensong.py'
--- openlp/plugins/bibles/lib/opensong.py	2010-02-06 15:33:23 +0000
+++ openlp/plugins/bibles/lib/opensong.py	2010-02-22 17:01:11 +0000
@@ -23,13 +23,9 @@
 # Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
 ###############################################################################
 
-import os
-import os.path
 import logging
-import chardet
-import codecs
+
 from lxml import objectify
-
 from PyQt4 import QtCore
 
 from openlp.core.lib import Receiver

=== modified file 'openlp/plugins/bibles/lib/osis.py'
--- openlp/plugins/bibles/lib/osis.py	2010-02-06 16:51:18 +0000
+++ openlp/plugins/bibles/lib/osis.py	2010-02-22 17:01:11 +0000
@@ -30,8 +30,6 @@
 import codecs
 import re
 
-from PyQt4 import QtCore
-
 from openlp.core.lib import Receiver
 from db import BibleDB
 

=== modified file 'openlp/plugins/songusage/forms/songusagedeleteform.py'
--- openlp/plugins/songusage/forms/songusagedeleteform.py	2010-02-11 18:39:28 +0000
+++ openlp/plugins/songusage/forms/songusagedeleteform.py	2010-02-22 17:01:11 +0000
@@ -23,8 +23,6 @@
 # Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
 ###############################################################################
 
-from datetime import date
-
 from PyQt4 import QtGui
 
 from songusagedeletedialog import Ui_SongUsageDeleteDialog

=== modified file 'openlpcnv.pyw'
--- openlpcnv.pyw	2009-12-31 12:52:01 +0000
+++ openlpcnv.pyw	2010-02-22 17:01:11 +0000
@@ -147,4 +147,4 @@
     newdb = os.path.join(newpath, u'songs.sqlite')
     mig.convert_sqlite2_to_3(olddb, newdb)
     mig.process()
-    #mig.move_log_file()
\ No newline at end of file
+    #mig.move_log_file()

=== modified file 'scripts/bible-1to2-converter.py'
--- scripts/bible-1to2-converter.py	2010-01-27 12:35:42 +0000
+++ scripts/bible-1to2-converter.py	2010-02-22 17:01:11 +0000
@@ -28,7 +28,7 @@
 import os
 import sqlite
 import sqlite3
-import re
+
 from optparse import OptionParser
 from traceback import format_tb as get_traceback
 


References