From 2c5475e8fa81a396bab9580e84d4d063cc4268bb Mon Sep 17 00:00:00 2001 From: Simon Hanna Date: Fri, 8 Jan 2016 14:47:52 +0100 Subject: [PATCH] Fix some pep issues in the changed files --- openlp/core/lib/plugin.py | 3 ++- openlp/plugins/custom/customplugin.py | 1 + openlp/plugins/images/imageplugin.py | 3 +-- openlp/plugins/presentations/presentationplugin.py | 4 +++- tests/functional/openlp_plugins/media/test_mediaplugin.py | 4 ++-- tests/functional/openlp_plugins/songusage/test_songusage.py | 1 + 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index adeacd81b..4e58fcdba 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -263,7 +263,8 @@ class Plugin(QtCore.QObject, RegistryProperties): else: self.media_item.on_add_click() - def about(self): + @staticmethod + def about(): """ Show a dialog when the user clicks on the 'About' button in the plugin manager. """ diff --git a/openlp/plugins/custom/customplugin.py b/openlp/plugins/custom/customplugin.py index d9b3369af..5c0de049c 100644 --- a/openlp/plugins/custom/customplugin.py +++ b/openlp/plugins/custom/customplugin.py @@ -74,6 +74,7 @@ class CustomPlugin(Plugin): Called to find out if the custom plugin is currently using a theme. Returns count of the times the theme is used. + :param theme: Theme to be queried """ return len(self.db_manager.get_all_objects(CustomSlide, CustomSlide.theme_name == theme)) diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py index f3b84943d..26cba5a20 100644 --- a/openlp/plugins/images/imageplugin.py +++ b/openlp/plugins/images/imageplugin.py @@ -23,9 +23,8 @@ from PyQt5 import QtGui import logging -import os -from openlp.core.common import Registry, Settings, translate +from openlp.core.common import Settings, translate from openlp.core.lib import Plugin, StringContent, ImageSource, build_icon from openlp.core.lib.db import Manager from openlp.plugins.images.lib import ImageMediaItem, ImageTab diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index e076922cd..ff14d821c 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -28,7 +28,7 @@ import logging from PyQt5 import QtCore -from openlp.core.common import AppLocation, Settings, translate +from openlp.core.common import AppLocation, translate from openlp.core.lib import Plugin, StringContent, build_icon from openlp.plugins.presentations.lib import PresentationController, PresentationMediaItem, PresentationTab @@ -71,6 +71,7 @@ class PresentationPlugin(Plugin): def create_settings_tab(self, parent): """ Create the settings Tab. + :param parent: parent UI Element """ visible_name = self.get_string(StringContent.VisibleName) self.settings_tab = PresentationTab(parent, self.name, visible_name['title'], self.controllers, self.icon_path) @@ -112,6 +113,7 @@ class PresentationPlugin(Plugin): def register_controllers(self, controller): """ Register each presentation controller (Impress, PPT etc) and store for later use. + :param controller: controller to register """ self.controllers[controller.name] = controller diff --git a/tests/functional/openlp_plugins/media/test_mediaplugin.py b/tests/functional/openlp_plugins/media/test_mediaplugin.py index 99fa61f82..9bc53dee1 100644 --- a/tests/functional/openlp_plugins/media/test_mediaplugin.py +++ b/tests/functional/openlp_plugins/media/test_mediaplugin.py @@ -40,7 +40,7 @@ class MediaPluginTest(TestCase, TestMixin): @patch(u'openlp.plugins.media.mediaplugin.Plugin.initialise') @patch(u'openlp.plugins.media.mediaplugin.Settings') - def initialise_test(self, MockedSettings, mocked_initialise): + def initialise_test(self, mocked_settings, mocked_initialise): """ Test that the initialise() method overwrites the built-in one, but still calls it """ @@ -48,7 +48,7 @@ class MediaPluginTest(TestCase, TestMixin): media_plugin = MediaPlugin() mocked_settings = MagicMock() mocked_settings.get_files_from_config.return_value = True # Not the real value, just need something "true-ish" - MockedSettings.return_value = mocked_settings + mocked_settings.return_value = mocked_settings # WHEN: initialise() is called media_plugin.initialise() diff --git a/tests/functional/openlp_plugins/songusage/test_songusage.py b/tests/functional/openlp_plugins/songusage/test_songusage.py index 25f6cd5ac..04efd03cb 100644 --- a/tests/functional/openlp_plugins/songusage/test_songusage.py +++ b/tests/functional/openlp_plugins/songusage/test_songusage.py @@ -25,6 +25,7 @@ This module contains tests for the Songusage plugin. from unittest import TestCase from openlp.plugins.songusage.songusageplugin import SongUsagePlugin + class TestSongUsage(TestCase): def test_about_text(self):