← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol/openlp/clean-up into lp:openlp

 

Andreas Preikschat has proposed merging lp:~googol/openlp/clean-up into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~googol/openlp/clean-up/+merge/144608

Hello,

- removed not needed imports
- added missing lines
- use 'isinstance' instead of 'type'
- removed old openlp-remoteclient.py
-- 
https://code.launchpad.net/~googol/openlp/clean-up/+merge/144608
Your team OpenLP Core is requested to review the proposed merge of lp:~googol/openlp/clean-up into lp:openlp.
=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py	2013-01-23 20:30:59 +0000
+++ openlp/core/lib/__init__.py	2013-01-23 23:30:34 +0000
@@ -35,8 +35,10 @@
 
 from PyQt4 import QtCore, QtGui, Qt
 
+
 log = logging.getLogger(__name__)
 
+
 class ServiceItemContext(object):
     """
     The context in which a Service Item is being generated

=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py	2013-01-18 18:50:46 +0000
+++ openlp/core/lib/mediamanageritem.py	2013-01-23 23:30:34 +0000
@@ -35,7 +35,7 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.lib import SettingsManager, OpenLPToolbar, ServiceItem, StringContent, build_icon, translate, \
+from openlp.core.lib import OpenLPToolbar, ServiceItem, StringContent, build_icon, translate, \
     Receiver, ListWidgetWithDnD, ServiceItemContext, Settings, UiStrings
 from openlp.core.lib.searchedit import SearchEdit
 from openlp.core.lib.ui import create_widget_action, critical_error_message_box
@@ -43,6 +43,7 @@
 
 log = logging.getLogger(__name__)
 
+
 class MediaManagerItem(QtGui.QWidget):
     """
     MediaManagerItem is a helper widget for plugins.

=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py	2013-01-21 19:47:53 +0000
+++ openlp/core/lib/serviceitem.py	2013-01-23 23:30:34 +0000
@@ -41,8 +41,10 @@
 
 from openlp.core.lib import build_icon, clean_tags, expand_tags, translate, ImageSource, Settings
 
+
 log = logging.getLogger(__name__)
 
+
 class ServiceItemType(object):
     """
     Defines the type of service item

=== modified file 'openlp/core/lib/settingsmanager.py'
--- openlp/core/lib/settingsmanager.py	2013-01-18 18:50:46 +0000
+++ openlp/core/lib/settingsmanager.py	2013-01-23 23:30:34 +0000
@@ -33,9 +33,6 @@
 """
 import os
 
-from PyQt4 import QtCore
-
-from openlp.core.lib import Settings
 from openlp.core.utils import AppLocation
 
 

=== modified file 'openlp/core/ui/__init__.py'
--- openlp/core/ui/__init__.py	2013-01-20 12:23:22 +0000
+++ openlp/core/ui/__init__.py	2013-01-23 23:30:34 +0000
@@ -31,7 +31,6 @@
 """
 
 
-
 class HideMode(object):
     """
     This is an enumeration class which specifies the different modes of hiding the display.

=== modified file 'openlp/core/ui/aboutdialog.py'
--- openlp/core/ui/aboutdialog.py	2013-01-11 00:19:11 +0000
+++ openlp/core/ui/aboutdialog.py	2013-01-23 23:30:34 +0000
@@ -260,7 +260,7 @@
             u'\n    '.join(documentors)))
         self.aboutNotebook.setTabText(self.aboutNotebook.indexOf(self.creditsTab),
             translate('OpenLP.AboutForm', 'Credits'))
-        copyright = translate('OpenLP.AboutForm',
+        openlp_copyright = translate('OpenLP.AboutForm',
             'Copyright \xa9 2004-2013 %s\n'
             'Portions copyright \xa9 2004-2013 %s') % (u'Raoul Snyman',
             u'Tim Bentley, Gerald Britton, Jonathan Corwin, Samuel Findlay, '
@@ -652,7 +652,7 @@
             'linking proprietary applications with the library. If this is '
             'what you want to do, use the GNU Lesser General Public License '
             'instead of this License.')
-        self.licenseTextEdit.setPlainText(u'%s\n\n%s\n\n%s\n\n\n%s' % (copyright, licence, disclaimer, gpltext))
+        self.licenseTextEdit.setPlainText(u'%s\n\n%s\n\n%s\n\n\n%s' % (openlp_copyright, licence, disclaimer, gpltext))
         self.aboutNotebook.setTabText(self.aboutNotebook.indexOf(self.licenseTab),
             translate('OpenLP.AboutForm', 'License'))
         self.volunteerButton.setText(translate('OpenLP.AboutForm', 'Volunteer'))

=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2013-01-10 23:07:48 +0000
+++ openlp/core/ui/maindisplay.py	2013-01-23 23:30:34 +0000
@@ -32,7 +32,6 @@
 """
 import cgi
 import logging
-import os
 import sys
 
 from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL
@@ -50,6 +49,7 @@
 #http://www.steveheffernan.com/html5-video-player/demo-video-player.html
 #http://html5demos.com/two-videos
 
+
 class Display(QtGui.QGraphicsView):
     """
     This is a general display screen class. Here the general display settings

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2013-01-21 19:47:53 +0000
+++ openlp/core/ui/servicemanager.py	2013-01-23 23:30:34 +0000
@@ -35,8 +35,6 @@
 from tempfile import mkstemp
 from datetime import datetime, timedelta
 
-log = logging.getLogger(__name__)
-
 from PyQt4 import QtCore, QtGui
 
 from openlp.core.lib import OpenLPToolbar, ServiceItem, Receiver, build_icon, ItemCapabilities, \
@@ -48,6 +46,10 @@
 from openlp.core.utils import AppLocation, delete_file, split_filename, format_time
 from openlp.core.utils.actions import ActionList, CategoryOrder
 
+
+log = logging.getLogger(__name__)
+
+
 class ServiceManagerList(QtGui.QTreeWidget):
     """
     Set up key bindings and mouse behaviour for the service list

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2013-01-21 19:47:53 +0000
+++ openlp/core/ui/slidecontroller.py	2013-01-23 23:30:34 +0000
@@ -37,7 +37,6 @@
 from openlp.core.lib import OpenLPToolbar, Receiver, ItemCapabilities, translate, build_icon, build_html, \
     PluginManager, ServiceItem, ImageSource, SlideLimits, ServiceItemAction, Settings, ScreenList, UiStrings
 from openlp.core.lib.ui import create_action
-from openlp.core.lib import SlideLimits, ServiceItemAction
 from openlp.core.ui import HideMode, MainDisplay, Display, DisplayControllerType
 from openlp.core.utils.actions import ActionList, CategoryOrder
 

=== modified file 'openlp/core/ui/themelayoutform.py'
--- openlp/core/ui/themelayoutform.py	2012-12-29 20:56:56 +0000
+++ openlp/core/ui/themelayoutform.py	2013-01-23 23:30:34 +0000
@@ -43,7 +43,6 @@
         """
         Run the Dialog with correct heading.
         """
-        pixmap = image.scaledToHeight(400, QtCore.Qt.SmoothTransformation)
         self.themeDisplayLabel.setPixmap(image)
         displayAspectRatio = float(image.width()) / image.height()
         self.themeDisplayLabel.setFixedSize(400, 400 / displayAspectRatio )

=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py	2013-01-17 22:14:06 +0000
+++ openlp/core/ui/thememanager.py	2013-01-23 23:30:34 +0000
@@ -44,8 +44,10 @@
 from openlp.core.ui import FileRenameForm, ThemeForm
 from openlp.core.utils import AppLocation, delete_file, locale_compare, get_filesystem_encoding
 
+
 log = logging.getLogger(__name__)
 
+
 class ThemeManager(QtGui.QWidget):
     """
     Manages the orders of Theme.

=== modified file 'openlp/core/utils/__init__.py'
--- openlp/core/utils/__init__.py	2013-01-23 20:30:59 +0000
+++ openlp/core/utils/__init__.py	2013-01-23 23:30:34 +0000
@@ -29,7 +29,7 @@
 """
 The :mod:`openlp.core.utils` module provides the utility libraries for OpenLP.
 """
-from datetime import datetime, timedelta
+from datetime import datetime
 from distutils.version import LooseVersion
 import logging
 import locale
@@ -53,7 +53,10 @@
 import openlp
 from openlp.core.lib import Receiver, translate, check_directory_exists
 
+
 log = logging.getLogger(__name__)
+
+
 APPLICATION_VERSION = {}
 IMAGES_FILTER = None
 UNO_CONNECTION_TYPE = u'pipe'
@@ -61,6 +64,7 @@
 CONTROL_CHARS = re.compile(r'[\x00-\x1F\x7F-\x9F]', re.UNICODE)
 INVALID_FILE_CHARS = re.compile(r'[\\/:\*\?"<>\|\+\[\]%]', re.UNICODE)
 
+
 class VersionThread(QtCore.QThread):
     """
     A special Qt thread class to fetch the version of OpenLP from the website.

=== modified file 'scripts/check_dependencies.py'
--- scripts/check_dependencies.py	2013-01-07 09:18:29 +0000
+++ scripts/check_dependencies.py	2013-01-23 23:30:34 +0000
@@ -89,10 +89,11 @@
 
 w = sys.stdout.write
 
+
 def check_vers(version, required, text):
-    if type(version) is not str:
+    if not isinstance(version, str):
         version = '.'.join(map(str, version))
-    if type(required) is not str:
+    if not isinstance(required, str):
         required = '.'.join(map(str, required))
     w('  %s >= %s ...    ' % (text, required))
     if LooseVersion(version) >= LooseVersion(required):
@@ -102,13 +103,16 @@
         w('FAIL' + os.linesep)
         return False
 
+
 def print_vers_fail(required, text):
     print('  %s >= %s ...    FAIL' % (text, required))
 
+
 def verify_python():
     if not check_vers(list(sys.version_info), VERS['Python'], text='Python'):
         exit(1)
 
+
 def verify_versions():
     print('Verifying version of modules...')
     try:
@@ -129,6 +133,7 @@
     except ImportError:
         print_vers_fail(VERS['enchant'], 'enchant')
 
+
 def check_module(mod, text='', indent='  '):
     space = (30 - len(mod) - len(text)) * ' '
     w(indent + '%s%s...  ' % (mod, text) + space)
@@ -139,6 +144,7 @@
         w('FAIL')
     w(os.linesep)
 
+
 def verify_pyenchant():
     w('Enchant (spell checker)... ')
     try:
@@ -151,20 +157,20 @@
     except ImportError:
         w('FAIL' + os.linesep)
 
+
 def verify_pyqt():
     w('Qt4 image formats... ')
     try:
         from PyQt4 import QtGui
-        read_f = ', '.join([unicode(format).lower()
-           for format in QtGui.QImageReader.supportedImageFormats()])
-        write_f = ', '.join([unicode(format).lower()
-            for format in QtGui.QImageWriter.supportedImageFormats()])
+        read_f = ', '.join([unicode(format).lower() for format in QtGui.QImageReader.supportedImageFormats()])
+        write_f = ', '.join([unicode(format).lower() for format in QtGui.QImageWriter.supportedImageFormats()])
         w(os.linesep)
         print('  read: %s' % read_f)
         print('  write: %s' % write_f)
     except ImportError:
         w('FAIL' + os.linesep)
 
+
 def main():
     verify_python()
 

=== removed file 'scripts/openlp-remoteclient.py'
--- scripts/openlp-remoteclient.py	2012-12-29 20:56:56 +0000
+++ scripts/openlp-remoteclient.py	1970-01-01 00:00:00 +0000
@@ -1,70 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection                                      #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2013 Raoul Snyman                                        #
-# Portions copyright (c) 2008-2013 Tim Bentley, Gerald Britton, Jonathan      #
-# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
-# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
-# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
-# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
-# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
-# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
-# --------------------------------------------------------------------------- #
-# 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 urllib
-import sys
-from optparse import OptionParser
-
-def sendData(options):
-    addr = 'http://%s:%s/send/%s?q=%s' % (options.address, options.port,
-        options.event, options.message)
-    try:
-        urllib.urlopen(addr)
-        print u'Message sent ', addr
-    except:
-        print u'Error thrown ', sys.exc_info()[1]
-
-def main():
-    usage = "usage: %prog [-a address] [-p port] [-e event] [-m message]"
-    parser = OptionParser(usage=usage)
-    parser.add_option("-p", "--port", default=4316,
-                      help="IP Port number %default ")
-    parser.add_option("-a", "--address",
-                      help="Recipient address ",
-                      default="localhost")
-    parser.add_option("-e", "--event",
-                      help="Action to be performed",
-                      default="alerts_text")
-    parser.add_option("-m", "--message",
-                      help="Message to be passed for the action",
-                      default="")
-
-    (options, args) = parser.parse_args()
-    if args:
-        parser.print_help()
-        parser.error("incorrect number of arguments")
-    elif options.address is None:
-        parser.print_help()
-        parser.error("IP address missing")
-    else:
-        sendData(options)
-
-if __name__ == u'__main__':
-    main()

=== modified file 'scripts/translation_utils.py'
--- scripts/translation_utils.py	2012-12-29 20:56:56 +0000
+++ scripts/translation_utils.py	2013-01-23 23:30:34 +0000
@@ -53,8 +53,6 @@
 """
 import os
 import urllib2
-import re
-from shutil import copy
 from getpass import getpass
 import base64
 import json
@@ -62,7 +60,6 @@
 
 from optparse import OptionParser
 from PyQt4 import QtCore
-from BeautifulSoup import BeautifulSoup
 
 SERVER_URL = u'http://www.transifex.net/api/2/project/openlp/'
 IGNORED_PATHS = [u'scripts']
@@ -73,6 +70,7 @@
 username = ''
 password = ''
 
+
 class Command(object):
     """
     Provide an enumeration of commands.
@@ -83,6 +81,7 @@
     Update = 4
     Generate = 5
 
+
 class CommandStack(object):
     """
     This class provides an iterable stack.
@@ -137,6 +136,7 @@
                 results.append(str((item[u'command'], )))
         return u'[%s]' % u', '.join(results)
 
+
 def print_quiet(text, linefeed=True):
     """
     This method checks to see if we are in quiet mode, and if not prints
@@ -152,6 +152,7 @@
         else:
             print text,
 
+
 def print_verbose(text):
     """
     This method checks to see if we are in verbose mode, and if so prints
@@ -164,6 +165,7 @@
     if not quiet_mode and verbose_mode:
         print u'    %s' % text
 
+
 def run(command):
     """
     This method runs an external application.
@@ -179,6 +181,7 @@
     print_verbose(u'Error(s):\n%s' % process.readAllStandardError())
     print_verbose(u'Output:\n%s' % process.readAllStandardOutput())
 
+
 def download_translations():
     """
     This method downloads the translation files from the Pootle server.
@@ -220,6 +223,7 @@
     print_quiet(u'   Done.')
     return True
 
+
 def prepare_project():
     """
     This method creates the project file needed to update the translation files
@@ -261,11 +265,12 @@
                 print_verbose(u'Parsing "%s"' % line)
                 lines.append(u'TRANSLATIONS += %s' % line)
     lines.sort()
-    file = open(os.path.join(start_dir, u'openlp.pro'), u'w')
-    file.write(u'\n'.join(lines).encode('utf8'))
-    file.close()
+    pro_file = open(os.path.join(start_dir, u'openlp.pro'), u'w')
+    pro_file.write(u'\n'.join(lines).encode('utf8'))
+    pro_file.close()
     print_quiet(u'   Done.')
 
+
 def update_translations():
     print_quiet(u'Update the translation files')
     if not os.path.exists(os.path.join(os.path.abspath(u'..'), u'openlp.pro')):
@@ -277,6 +282,7 @@
         run(u'pylupdate4 -verbose -noobsolete openlp.pro')
         os.chdir(os.path.abspath(u'scripts'))
 
+
 def generate_binaries():
     print_quiet(u'Generate the related *.qm files')
     if not os.path.exists(os.path.join(os.path.abspath(u'..'), u'openlp.pro')):
@@ -302,6 +308,7 @@
         'resource/ents/')
     print_quiet(u'Opening browser to OpenLP project...')
 
+
 def process_stack(command_stack):
     """
     This method looks at the commands in the command stack, and processes them
@@ -329,6 +336,7 @@
     else:
         print_quiet(u'No commands to process.')
 
+
 def main():
     global verbose_mode, quiet_mode, username, password
     # Set up command line options.

=== modified file 'tests/test_app.py'
--- tests/test_app.py	2012-12-08 08:40:41 +0000
+++ tests/test_app.py	2013-01-23 23:30:34 +0000
@@ -32,6 +32,6 @@
 
 
 def test_start_app(openlpapp):
-    assert type(openlpapp) == OpenLP
-    assert type(openlpapp.mainWindow) == MainWindow
+    assert isinstance(openlpapp, OpenLP)
+    assert isinstance(openlpapp.mainWindow, MainWindow)
     assert unicode(openlpapp.mainWindow.windowTitle()) == u'OpenLP 2.1'


Follow ups