← 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)

For more details, see:
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/84342

Normal variety of cleanups including whitespace, unused import, indentation, long lines, etc.

Don't use a list comprehension when you don't want the list, just overcomplicates a simple piece of code (and generates needless pylint warnings).

[Now hopefully without stray ancient leftovers]
-- 
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/84342
Your team OpenLP Core is requested to review the proposed merge of lp:~meths/openlp/trivialfixes into lp:openlp.
=== modified file 'openlp/core/lib/listwidgetwithdnd.py'
--- openlp/core/lib/listwidgetwithdnd.py	2011-08-03 15:52:29 +0000
+++ openlp/core/lib/listwidgetwithdnd.py	2011-12-02 22:29:26 +0000
@@ -104,7 +104,7 @@
                 elif os.path.isdir(localFile):
                     listing = os.listdir(localFile)
                     for file in listing:
-                        files.append(os.path.join(localFile,file))
-            Receiver.send_message(u'%s_dnd' % self.mimeDataText,files)
+                        files.append(os.path.join(localFile, file))
+            Receiver.send_message(u'%s_dnd' % self.mimeDataText, files)
         else:
             event.ignore()

=== modified file 'openlp/core/ui/firsttimeform.py'
--- openlp/core/ui/firsttimeform.py	2011-09-17 22:33:03 +0000
+++ openlp/core/ui/firsttimeform.py	2011-12-02 22:29:26 +0000
@@ -65,7 +65,7 @@
         self.downloadCanceled = False
         self.downloading = unicode(translate('OpenLP.FirstTimeWizard',
             'Downloading %s...'))
-        QtCore.QObject.connect(self.cancelButton,QtCore.SIGNAL('clicked()'),
+        QtCore.QObject.connect(self.cancelButton, QtCore.SIGNAL('clicked()'),
             self.onCancelButtonClicked)
         QtCore.QObject.connect(self.noInternetFinishButton,
             QtCore.SIGNAL('clicked()'), self.onNoInternetFinishButtonClicked)

=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2011-12-01 18:07:15 +0000
+++ openlp/core/ui/maindisplay.py	2011-12-02 22:29:26 +0000
@@ -29,7 +29,6 @@
 and play multimedia within OpenLP.
 """
 import logging
-import os
 
 from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL
 from PyQt4.phonon import Phonon

=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2011-10-26 20:11:15 +0000
+++ openlp/core/ui/mainwindow.py	2011-12-02 22:29:26 +0000
@@ -35,8 +35,7 @@
 from PyQt4 import QtCore, QtGui
 
 from openlp.core.lib import Renderer, build_icon, OpenLPDockWidget, \
-    PluginManager, Receiver, translate, ImageManager, PluginStatus, \
-    SettingsManager
+    PluginManager, Receiver, translate, ImageManager, PluginStatus
 from openlp.core.lib.ui import UiStrings, base_action, checkable_action, \
     icon_action, shortcut_action
 from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \
@@ -44,7 +43,7 @@
     ShortcutListForm, FormattingTagForm
 from openlp.core.ui.media import MediaController
 from openlp.core.utils import AppLocation, add_actions, LanguageManager, \
-    get_application_version, delete_file
+    get_application_version
 from openlp.core.utils.actions import ActionList, CategoryOrder
 from openlp.core.ui.firsttimeform import FirstTimeForm
 from openlp.core.ui import ScreenList
@@ -504,7 +503,8 @@
         self.toolsFirstTimeWizard.setText(
             translate('OpenLP.MainWindow', 'Re-run First Time Wizard'))
         self.toolsFirstTimeWizard.setStatusTip(translate('OpenLP.MainWindow',
-            'Re-run the First Time Wizard, importing songs, Bibles and themes.'))
+            'Re-run the First Time Wizard, importing songs, Bibles and '
+            'themes.'))
         self.updateThemeImages.setText(
             translate('OpenLP.MainWindow', 'Update Theme Images'))
         self.updateThemeImages.setStatusTip(

=== modified file 'openlp/core/ui/media/mediacontroller.py'
--- openlp/core/ui/media/mediacontroller.py	2011-12-01 18:08:12 +0000
+++ openlp/core/ui/media/mediacontroller.py	2011-12-02 22:29:26 +0000
@@ -26,13 +26,12 @@
 ###############################################################################
 
 import logging
-
-import sys, os,time
-from PyQt4 import QtCore, QtGui, QtWebKit
+import os
+from PyQt4 import QtCore, QtGui
 
 from openlp.core.lib import OpenLPToolbar, Receiver, translate
 from openlp.core.lib.mediaplayer import MediaPlayer
-from openlp.core.lib.ui import UiStrings, critical_error_message_box
+from openlp.core.lib.ui import critical_error_message_box
 from openlp.core.ui.media import MediaState, MediaInfo, MediaType
 from openlp.core.utils import AppLocation
 
@@ -136,8 +135,9 @@
             savedPlayers = playerSettings.split(u',')
             invalidMediaPlayers = [mediaPlayer for mediaPlayer in savedPlayers \
                 if not mediaPlayer in self.mediaPlayers]
-            if len(invalidMediaPlayers)>0:
-                [savedPlayers.remove(invalidPlayer) for invalidPlayer in invalidMediaPlayers]
+            if len(invalidMediaPlayers) > 0:
+                for invalidPlayer in invalidMediaPlayers:
+                    savedPlayers.remove(invalidPlayer)
                 newPlayerSetting = u','.join(savedPlayers)
                 QtCore.QSettings().setValue(u'media/players',
                     QtCore.QVariant(newPlayerSetting))
@@ -346,7 +346,7 @@
 
     def check_file_type(self, controller, display):
         """
-        Used to choose the right media Player type from the prioritized Player list
+        Select the correct media Player type from the prioritized Player list
         """
         playerSettings = str(QtCore.QSettings().value(u'media/players',
             QtCore.QVariant(u'webkit')).toString())
@@ -356,17 +356,19 @@
             if self.overridenPlayer != '':
                 usedPlayers = [self.overridenPlayer]
         if controller.media_info.file_info.isFile():
-            suffix = u'*.%s' % controller.media_info.file_info.suffix().toLower()
+            suffix = u'*.%s' % \
+                controller.media_info.file_info.suffix().toLower()
             for title in usedPlayers:
                 player = self.mediaPlayers[title]
                 if suffix in player.video_extensions_list:
                     if not controller.media_info.is_background or \
-                        controller.media_info.is_background and player.canBackground:
-                            self.resize(controller, display, player)
-                            if player.load(display):
-                                self.curDisplayMediaPlayer[display] = player
-                                controller.media_info.media_type = MediaType.Video
-                                return True
+                        controller.media_info.is_background and \
+                        player.canBackground:
+                        self.resize(controller, display, player)
+                        if player.load(display):
+                            self.curDisplayMediaPlayer[display] = player
+                            controller.media_info.media_type = MediaType.Video
+                            return True
                 if suffix in player.audio_extensions_list:
                     if player.load(display):
                         self.curDisplayMediaPlayer[display] = player
@@ -399,7 +401,8 @@
                     return False
                 if status:
                     display.frame.evaluateJavaScript(u'show_blank("desktop");')
-                    self.curDisplayMediaPlayer[display].set_visible(display, True)
+                    self.curDisplayMediaPlayer[display].set_visible(display,
+                        True)
                     if controller.isLive:
                         if controller.hideMenu.defaultAction().isChecked():
                             controller.hideMenu.defaultAction().trigger()

=== modified file 'openlp/core/ui/media/phononplayer.py'
--- openlp/core/ui/media/phononplayer.py	2011-11-24 21:10:37 +0000
+++ openlp/core/ui/media/phononplayer.py	2011-12-02 22:29:26 +0000
@@ -29,7 +29,6 @@
 import mimetypes
 from datetime import datetime
 
-from PyQt4 import QtCore, QtGui
 from PyQt4.phonon import Phonon
 
 from openlp.core.lib import Receiver

=== modified file 'openlp/core/ui/media/webkitplayer.py'
--- openlp/core/ui/media/webkitplayer.py	2011-12-01 18:07:15 +0000
+++ openlp/core/ui/media/webkitplayer.py	2011-12-02 22:29:26 +0000
@@ -27,9 +27,6 @@
 
 import logging
 
-from PyQt4 import QtCore, QtGui, QtWebKit
-
-from openlp.core.lib import OpenLPToolbar, translate
 from openlp.core.lib.mediaplayer import MediaPlayer
 from openlp.core.ui.media import MediaState
 

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2011-12-02 06:59:32 +0000
+++ openlp/core/ui/slidecontroller.py	2011-12-02 22:29:26 +0000
@@ -27,12 +27,10 @@
 
 import os
 import logging
-import time
 import copy
 from collections import deque
 
 from PyQt4 import QtCore, QtGui
-from PyQt4.phonon import Phonon
 
 from openlp.core.lib import OpenLPToolbar, Receiver, ItemCapabilities, \
     translate, build_icon, ServiceItem, build_html, PluginManager, ServiceItem
@@ -68,7 +66,8 @@
         created from within other plugins
         This function is needed to catch the current controller
         """
-        sender = self.sender().objectName() if self.sender().objectName() else self.sender().text()
+        sender = self.sender().objectName() if self.sender().objectName() \
+            else self.sender().text()
         controller = self
         Receiver.send_message('%s' % sender, [controller, args])
 
@@ -573,7 +572,6 @@
         """
         self.keypress_queue.append(u'previous')
         self._process_queue()
-        
 
     def serviceNext(self):
         """
@@ -581,21 +579,20 @@
         """
         self.keypress_queue.append(u'next')
         self._process_queue()
-        
+
     def _process_queue(self):
         """
-        Process the service item request queue.  The key presses can arrive 
-        faster than the processing so implement a FIFO queue. 
+        Process the service item request queue.  The key presses can arrive
+        faster than the processing so implement a FIFO queue.
         """
         if len(self.keypress_queue):
             while len(self.keypress_queue) and not self.keypress_loop:
-                self.keypress_loop = True                
+                self.keypress_loop = True
                 if self.keypress_queue.popleft() == u'previous':
-                    Receiver.send_message('servicemanager_previous_item')                    
+                    Receiver.send_message('servicemanager_previous_item')
                 else:
                     Receiver.send_message('servicemanager_next_item')
             self.keypress_loop = False
-     
 
     def screenSizeChanged(self):
         """
@@ -640,11 +637,12 @@
             self.previewFrame.height()):
             # We have to take the height as limit.
             max_height = self.previewFrame.height() - self.grid.margin() * 2
-            self.slidePreview.setFixedSize(QtCore.QSize(max_height * self.ratio,
-                max_height))
-            self.previewDisplay.setFixedSize(QtCore.QSize(max_height * self.ratio,
-                max_height))
-            self.previewDisplay.screen = {u'size':self.previewDisplay.geometry()}
+            self.slidePreview.setFixedSize(QtCore.QSize(
+                max_height * self.ratio, max_height))
+            self.previewDisplay.setFixedSize(QtCore.QSize(
+                max_height * self.ratio, max_height))
+            self.previewDisplay.screen = {
+                u'size':self.previewDisplay.geometry()}
         else:
             # We have to take the width as limit.
             max_width = self.previewFrame.width() - self.grid.margin() * 2
@@ -652,7 +650,8 @@
                 max_width / self.ratio))
             self.previewDisplay.setFixedSize(QtCore.QSize(max_width,
                 max_width / self.ratio))
-            self.previewDisplay.screen = {u'size':self.previewDisplay.geometry()}
+            self.previewDisplay.screen = {
+                u'size':self.previewDisplay.geometry()}
         # Make sure that the frames have the correct size.
         self.previewListWidget.setColumnWidth(0,
             self.previewListWidget.viewport().size().width())

=== modified file 'openlp/core/ui/themelayoutdialog.py'
--- openlp/core/ui/themelayoutdialog.py	2011-10-05 17:18:56 +0000
+++ openlp/core/ui/themelayoutdialog.py	2011-12-02 22:29:26 +0000
@@ -28,7 +28,6 @@
 from PyQt4 import QtCore, QtGui
 
 from openlp.core.lib import translate
-from openlp.core.lib.ui import create_accept_reject_button_box
 
 
 class Ui_ThemeLayoutDialog(object):

=== modified file 'openlp/core/ui/themelayoutform.py'
--- openlp/core/ui/themelayoutform.py	2011-10-02 16:38:05 +0000
+++ openlp/core/ui/themelayoutform.py	2011-12-02 22:29:26 +0000
@@ -29,9 +29,6 @@
 
 from themelayoutdialog import Ui_ThemeLayoutDialog
 
-from openlp.core.lib import translate
-from openlp.core.lib.ui import UiStrings, critical_error_message_box
-
 class ThemeLayoutForm(QtGui.QDialog, Ui_ThemeLayoutDialog):
     """
     The exception dialog

=== modified file 'openlp/plugins/alerts/lib/alertstab.py'
--- openlp/plugins/alerts/lib/alertstab.py	2011-10-29 19:13:11 +0000
+++ openlp/plugins/alerts/lib/alertstab.py	2011-12-02 22:29:26 +0000
@@ -192,7 +192,7 @@
         settings.setValue(u'location', QtCore.QVariant(self.location))
         settings.endGroup()
         if self.changed:
-             Receiver.send_message(u'update_display_css')
+            Receiver.send_message(u'update_display_css')
         self.changed = False
 
     def updateDisplay(self):

=== modified file 'openlp/plugins/bibles/lib/versereferencelist.py'
--- openlp/plugins/bibles/lib/versereferencelist.py	2011-06-12 16:02:52 +0000
+++ openlp/plugins/bibles/lib/versereferencelist.py	2011-12-02 22:29:26 +0000
@@ -72,7 +72,8 @@
                 continue
             prev = index - 1
             if self.verse_list[prev][u'version'] != verse[u'version']:
-                result = u'%s (%s)' % (result, self.verse_list[prev][u'version'])
+                result = u'%s (%s)' % (result,
+                    self.verse_list[prev][u'version'])
             result = result + u', '
             if self.verse_list[prev][u'book'] != verse[u'book']:
                 result = u'%s%s %s:' % (result, verse[u'book'],

=== modified file 'openlp/plugins/custom/forms/editcustomform.py'
--- openlp/plugins/custom/forms/editcustomform.py	2011-09-01 19:45:36 +0000
+++ openlp/plugins/custom/forms/editcustomform.py	2011-12-02 22:29:26 +0000
@@ -30,7 +30,8 @@
 from PyQt4 import QtCore, QtGui
 
 from openlp.core.lib import Receiver, translate
-from openlp.core.lib.ui import critical_error_message_box, find_and_set_in_combo_box
+from openlp.core.lib.ui import critical_error_message_box, \
+    find_and_set_in_combo_box
 from openlp.plugins.custom.lib import CustomXMLBuilder, CustomXMLParser
 from openlp.plugins.custom.lib.db import CustomSlide
 from editcustomdialog import Ui_CustomEditDialog

=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py	2011-12-01 18:07:15 +0000
+++ openlp/plugins/media/lib/mediaitem.py	2011-12-02 22:29:26 +0000
@@ -30,7 +30,6 @@
 import locale
 
 from PyQt4 import QtCore, QtGui
-from PyQt4.phonon import Phonon
 
 from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \
     SettingsManager, translate, check_item_selected, Receiver, MediaType, \
@@ -139,7 +138,8 @@
         # Add the Media widget to the page layout
         self.pageLayout.addWidget(self.mediaWidget)
         QtCore.QObject.connect(self.displayTypeComboBox,
-            QtCore.SIGNAL(u'currentIndexChanged (int)'), self.overridePlayerChanged)
+            QtCore.SIGNAL(u'currentIndexChanged (int)'),
+            self.overridePlayerChanged)
 
     def overridePlayerChanged(self, index):
         Receiver.send_message(u'media_override_player', \

=== modified file 'openlp/plugins/media/lib/mediatab.py'
--- openlp/plugins/media/lib/mediatab.py	2011-11-30 17:06:57 +0000
+++ openlp/plugins/media/lib/mediatab.py	2011-12-02 22:29:26 +0000
@@ -28,7 +28,7 @@
 from PyQt4 import QtCore, QtGui
 
 from openlp.core.lib import SettingsTab, translate, Receiver
-from openlp.core.lib.ui import UiStrings, critical_error_message_box
+from openlp.core.lib.ui import UiStrings
 
 class MediaTab(SettingsTab):
     """

=== modified file 'openlp/plugins/media/mediaplugin.py'
--- openlp/plugins/media/mediaplugin.py	2011-11-11 16:45:25 +0000
+++ openlp/plugins/media/mediaplugin.py	2011-12-02 22:29:26 +0000
@@ -26,7 +26,6 @@
 ###############################################################################
 
 import logging
-import os
 
 from openlp.core.lib import Plugin, StringContent, build_icon, translate
 from openlp.plugins.media.lib import MediaMediaItem, MediaTab

=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py	2011-10-01 07:28:45 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py	2011-12-02 22:29:26 +0000
@@ -285,7 +285,8 @@
                             critical_error_message_box(
                                 translate('PresentationPlugin.MediaItem',
                                 'Missing Presentation'),
-                                unicode(translate('PresentationPlugin.MediaItem',
+                                unicode(translate(
+                                'PresentationPlugin.MediaItem',
                                 'The Presentation %s is incomplete,'
                                 ' please reload.')) % filename)
                         return False

=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py	2011-11-24 22:34:27 +0000
+++ openlp/plugins/songs/forms/editsongform.py	2011-12-02 22:29:26 +0000
@@ -330,8 +330,10 @@
             self.topicsListView.addItem(topic_name)
         self.audioListWidget.clear()
         for media in self.song.media_files:
-            media_file = QtGui.QListWidgetItem(os.path.split(media.file_name)[1])
-            media_file.setData(QtCore.Qt.UserRole, QtCore.QVariant(media.file_name))
+            media_file = QtGui.QListWidgetItem(
+                os.path.split(media.file_name)[1])
+            media_file.setData(QtCore.Qt.UserRole,
+                QtCore.QVariant(media.file_name))
             self.audioListWidget.addItem(media_file)
         self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
         # Hide or show the preview button.
@@ -720,7 +722,8 @@
         """
         if self.mediaForm.exec_():
             for filename in self.mediaForm.getSelectedFiles():
-                item = QtGui.QListWidgetItem(os.path.split(unicode(filename))[1])
+                item = QtGui.QListWidgetItem(
+                    os.path.split(unicode(filename))[1])
                 item.setData(QtCore.Qt.UserRole, filename)
                 self.audioListWidget.addItem(item)
 
@@ -875,7 +878,6 @@
                     os.remove(audio)
                 except:
                     log.exception('Could not remove file: %s', audio)
-                    pass
         if not files:
             try:
                 os.rmdir(save_path)

=== modified file 'openlp/plugins/songs/lib/olpimport.py'
--- openlp/plugins/songs/lib/olpimport.py	2011-12-01 19:01:57 +0000
+++ openlp/plugins/songs/lib/olpimport.py	2011-12-02 22:29:26 +0000
@@ -39,7 +39,7 @@
 from openlp.core.lib.db import BaseModel
 from openlp.core.ui.wizard import WizardStrings
 from openlp.plugins.songs.lib import clean_song
-from openlp.plugins.songs.lib.db import Author, Book, Song, Topic #, MediaFile
+from openlp.plugins.songs.lib.db import Author, Book, MediaFile, Song, Topic
 from songimport import SongImport
 
 log = logging.getLogger(__name__)

=== modified file 'openlp/plugins/songs/lib/upgrade.py'
--- openlp/plugins/songs/lib/upgrade.py	2011-11-27 21:24:35 +0000
+++ openlp/plugins/songs/lib/upgrade.py	2011-12-02 22:29:26 +0000
@@ -31,7 +31,6 @@
 
 from sqlalchemy import Column, Table, types
 from sqlalchemy.sql.expression import func
-from migrate import changeset
 from migrate.changeset.constraint import ForeignKeyConstraint
 
 __version__ = 2

=== modified file 'openlp/plugins/songusage/lib/upgrade.py'
--- openlp/plugins/songusage/lib/upgrade.py	2011-08-27 18:43:05 +0000
+++ openlp/plugins/songusage/lib/upgrade.py	2011-12-02 22:29:26 +0000
@@ -30,7 +30,6 @@
 """
 
 from sqlalchemy import Column, Table, types
-from migrate import changeset
 
 __version__ = 1
 


Follow ups