From 8fb086134e1297a3db6ff27cd698669e6c026027 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 1 May 2014 19:49:43 +0200 Subject: [PATCH] dead code, not used variables, docs, unused imports --- openlp/core/lib/__init__.py | 3 +-- openlp/core/lib/screen.py | 9 ++++----- openlp/core/ui/aboutform.py | 2 +- openlp/core/ui/exceptiondialog.py | 2 +- openlp/core/ui/firsttimeform.py | 13 +++++-------- openlp/core/ui/media/mediaplayer.py | 2 -- openlp/core/ui/media/phononplayer.py | 2 -- openlp/plugins/bibles/lib/manager.py | 12 ++++++------ openlp/plugins/bibles/lib/mediaitem.py | 1 - openlp/plugins/custom/forms/editcustomform.py | 1 - openlp/plugins/images/lib/db.py | 2 +- openlp/plugins/media/lib/mediaitem.py | 1 - openlp/plugins/songs/forms/songselectform.py | 2 -- 13 files changed, 19 insertions(+), 33 deletions(-) diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 9561baff4..a7cba33a0 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -296,8 +296,7 @@ def create_separated_list(string_list): :param string_list: List of unicode strings """ - if LooseVersion(Qt.PYQT_VERSION_STR) >= LooseVersion('4.9') and \ - LooseVersion(Qt.qVersion()) >= LooseVersion('4.8'): + if LooseVersion(Qt.PYQT_VERSION_STR) >= LooseVersion('4.9') and LooseVersion(Qt.qVersion()) >= LooseVersion('4.8'): return QtCore.QLocale().createSeparatedList(string_list) if not string_list: return '' diff --git a/openlp/core/lib/screen.py b/openlp/core/lib/screen.py index 17ead5346..8f03d9ab2 100644 --- a/openlp/core/lib/screen.py +++ b/openlp/core/lib/screen.py @@ -63,8 +63,7 @@ class ScreenList(object): """ Initialise the screen list. - ``desktop`` - A ``QDesktopWidget`` object. + :param desktop: A QDesktopWidget object. """ screen_list = cls() screen_list.desktop = desktop @@ -153,9 +152,9 @@ class ScreenList(object): :param screen: A dict with the screen properties:: { - u'primary': True, - u'number': 0, - u'size': PyQt4.QtCore.QRect(0, 0, 1024, 768) + 'primary': True, + 'number': 0, + 'size': PyQt4.QtCore.QRect(0, 0, 1024, 768) } """ log.info('Screen %d found with resolution %s' % (screen['number'], screen['size'])) diff --git a/openlp/core/ui/aboutform.py b/openlp/core/ui/aboutform.py index e971bbec4..3825312bd 100644 --- a/openlp/core/ui/aboutform.py +++ b/openlp/core/ui/aboutform.py @@ -30,7 +30,7 @@ The About dialog. """ -from PyQt4 import QtCore, QtGui +from PyQt4 import QtGui from .aboutdialog import Ui_AboutDialog from openlp.core.lib import translate diff --git a/openlp/core/ui/exceptiondialog.py b/openlp/core/ui/exceptiondialog.py index 212fee4cd..b8b3941cd 100644 --- a/openlp/core/ui/exceptiondialog.py +++ b/openlp/core/ui/exceptiondialog.py @@ -30,7 +30,7 @@ The GUI widgets of the exception dialog. """ -from PyQt4 import QtCore, QtGui +from PyQt4 import QtGui from openlp.core.lib import translate from openlp.core.lib.ui import create_button, create_button_box diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index b9b5f5997..a98d7861a 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -170,6 +170,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard, RegistryProperties): elif self.currentId() == FirstTimePage.Progress: return -1 elif self.currentId() == FirstTimePage.NoInternet: + print(1111) return FirstTimePage.Progress elif self.currentId() == FirstTimePage.Themes: self.application.set_busy_cursor() @@ -199,8 +200,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard, RegistryProperties): self.no_internet_label.setText(self.no_internet_text + self.cancelWizardText) elif page_id == FirstTimePage.Defaults: self.theme_combo_box.clear() - for iter in range(self.themes_list_widget.count()): - item = self.themes_list_widget.item(iter) + for index in range(self.themes_list_widget.count()): + item = self.themes_list_widget.item(index) if item.checkState() == QtCore.Qt.Checked: self.theme_combo_box.addItem(item.text()) if self.has_run_wizard: @@ -292,13 +293,9 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard, RegistryProperties): """ themes = self.config.get('themes', 'files') themes = themes.split(',') - for theme in themes: - filename = self.config.get('theme_%s' % theme, 'filename') + for index, theme in enumerate(themes): screenshot = self.config.get('theme_%s' % theme, 'screenshot') - for index in range(self.themes_list_widget.count()): - item = self.themes_list_widget.item(index) - if item.data(QtCore.Qt.UserRole) == filename: - break + item = self.themes_list_widget.item(index) item.setIcon(build_icon(os.path.join(gettempdir(), 'openlp', screenshot))) def _get_file_size(self, url): diff --git a/openlp/core/ui/media/mediaplayer.py b/openlp/core/ui/media/mediaplayer.py index 3246d58c4..22ea7ecfc 100644 --- a/openlp/core/ui/media/mediaplayer.py +++ b/openlp/core/ui/media/mediaplayer.py @@ -29,8 +29,6 @@ """ The :mod:`~openlp.core.ui.media.mediaplayer` module contains the MediaPlayer class. """ -import os - from openlp.core.common import RegistryProperties from openlp.core.ui.media import MediaState diff --git a/openlp/core/ui/media/phononplayer.py b/openlp/core/ui/media/phononplayer.py index 5e94dbd0e..b343755a0 100644 --- a/openlp/core/ui/media/phononplayer.py +++ b/openlp/core/ui/media/phononplayer.py @@ -33,10 +33,8 @@ import logging import mimetypes from datetime import datetime -from PyQt4 import QtGui from PyQt4.phonon import Phonon -from openlp.core.common import Settings from openlp.core.lib import translate from openlp.core.ui.media import MediaState diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 8ad446ab4..c57fc117e 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -54,19 +54,19 @@ class BibleFormat(object): WebDownload = 3 @staticmethod - def get_class(format): + def get_class(bible_format): """ Return the appropriate implementation class. - :param format: The Bible format. + :param bible_format: The Bible format. """ - if format == BibleFormat.OSIS: + if bible_format == BibleFormat.OSIS: return OSISBible - elif format == BibleFormat.CSV: + elif bible_format == BibleFormat.CSV: return CSVBible - elif format == BibleFormat.OpenSong: + elif bible_format == BibleFormat.OpenSong: return OpenSongBible - elif format == BibleFormat.WebDownload: + elif bible_format == BibleFormat.WebDownload: return HTTPBible else: return None diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index a2cb1b594..c13448a4a 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -837,7 +837,6 @@ class BibleMediaItem(MediaManagerItem): # If there are no more items we check whether we have to add bible_text. if bible_text: raw_slides.append(bible_text.lstrip()) - bible_text = '' # Service Item: Capabilities if self.settings.layout_style == LayoutStyle.Continuous and not second_bible: # Split the line but do not replace line breaks in renderer. diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index 010f7d1bc..9c7a080aa 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -197,7 +197,6 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.slide_list_view.clear() self.slide_list_view.addItems(slides) else: - old_slides = [] old_row = self.slide_list_view.currentRow() # Create a list with all (old/unedited) slides. old_slides = [self.slide_list_view.item(row).text() for row in range(self.slide_list_view.count())] diff --git a/openlp/plugins/images/lib/db.py b/openlp/plugins/images/lib/db.py index 68ca3d11d..896f93b17 100644 --- a/openlp/plugins/images/lib/db.py +++ b/openlp/plugins/images/lib/db.py @@ -31,7 +31,7 @@ The :mod:`db` module provides the database and schema that is the backend for th """ from sqlalchemy import Column, ForeignKey, Table, types -from sqlalchemy.orm import mapper, relation, reconstructor +from sqlalchemy.orm import mapper from openlp.core.lib.db import BaseModel, init_db diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 87d8e3311..92426334a 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -314,7 +314,6 @@ class MediaMediaItem(MediaManagerItem, RegistryProperties): def get_list(self, type=MediaType.Audio): media = Settings().value(self.settings_section + '/media files') media.sort(key=lambda filename: get_locale_key(os.path.split(str(filename))[1])) - extension = [] if type == MediaType.Audio: extension = self.media_controller.audio_extensions_list else: diff --git a/openlp/plugins/songs/forms/songselectform.py b/openlp/plugins/songs/forms/songselectform.py index d3ff5ab52..f9f658c5b 100755 --- a/openlp/plugins/songs/forms/songselectform.py +++ b/openlp/plugins/songs/forms/songselectform.py @@ -319,8 +319,6 @@ class SongSelectForm(QtGui.QDialog, Ui_SongSelectDialog): def on_search_finished(self): """ Slot which is called when the search is completed. - - :param songs: """ self.application.process_events() self.search_progress_bar.setVisible(False)