← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~thelinuxguy/openlp/make-methods-static into lp:openlp

 

Simon Hanna has proposed merging lp:~thelinuxguy/openlp/make-methods-static into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~thelinuxguy/openlp/make-methods-static/+merge/281488

Make some methods static where possible

Add .coveragerc so that local html reports can be generated
-- 
Your team OpenLP Core is requested to review the proposed merge of lp:~thelinuxguy/openlp/make-methods-static into lp:openlp.
=== modified file '.bzrignore'
--- .bzrignore	2015-05-07 21:29:43 +0000
+++ .bzrignore	2016-01-04 00:33:09 +0000
@@ -43,3 +43,4 @@
 .coverage
 cover
 *.kdev4
+coverage

=== added file '.coveragerc'
--- .coveragerc	1970-01-01 00:00:00 +0000
+++ .coveragerc	2016-01-04 00:33:09 +0000
@@ -0,0 +1,5 @@
+[run]
+source = openlp
+
+[html]
+directory = coverage

=== modified file 'openlp/plugins/alerts/alertsplugin.py'
--- openlp/plugins/alerts/alertsplugin.py	2015-12-31 22:46:06 +0000
+++ openlp/plugins/alerts/alertsplugin.py	2016-01-04 00:33:09 +0000
@@ -191,7 +191,8 @@
         self.alert_form.load_list()
         self.alert_form.exec()
 
-    def about(self):
+    @staticmethod
+    def about():
         """
         Plugin Alerts about method
 
@@ -215,7 +216,8 @@
             'title': translate('AlertsPlugin', 'Alerts', 'container title')
         }
 
-    def get_display_javascript(self):
+    @staticmethod
+    def get_display_javascript():
         """
         Add Javascript to the main display.
         """
@@ -229,7 +231,8 @@
         return CSS % (align, self.settings_tab.font_face, self.settings_tab.font_size, self.settings_tab.font_color,
                       self.settings_tab.background_color)
 
-    def get_display_html(self):
+    @staticmethod
+    def get_display_html():
         """
         Add HTML to the main display.
         """

=== modified file 'openlp/plugins/bibles/bibleplugin.py'
--- openlp/plugins/bibles/bibleplugin.py	2015-12-31 22:46:06 +0000
+++ openlp/plugins/bibles/bibleplugin.py	2016-01-04 00:33:09 +0000
@@ -167,7 +167,8 @@
         if self.media_item:
             self.media_item.on_import_click()
 
-    def about(self):
+    @staticmethod
+    def about():
         """
         Return the about text for the plugin manager
         """

=== modified file 'openlp/plugins/custom/customplugin.py'
--- openlp/plugins/custom/customplugin.py	2015-12-31 22:46:06 +0000
+++ openlp/plugins/custom/customplugin.py	2016-01-04 00:33:09 +0000
@@ -62,7 +62,8 @@
         self.icon_path = ':/plugins/plugin_custom.png'
         self.icon = build_icon(self.icon_path)
 
-    def about(self):
+    @staticmethod
+    def about():
         about_text = translate('CustomPlugin', '<strong>Custom Slide Plugin </strong><br />The custom slide plugin '
                                'provides the ability to set up custom text slides that can be displayed on the screen '
                                'the same way songs are. This plugin provides greater freedom over the songs plugin.')

=== modified file 'openlp/plugins/images/imageplugin.py'
--- openlp/plugins/images/imageplugin.py	2015-12-31 22:46:06 +0000
+++ openlp/plugins/images/imageplugin.py	2016-01-04 00:33:09 +0000
@@ -53,7 +53,8 @@
         self.icon_path = ':/plugins/plugin_images.png'
         self.icon = build_icon(self.icon_path)
 
-    def about(self):
+    @staticmethod
+    def about():
         about_text = translate('ImagePlugin', '<strong>Image Plugin</strong>'
                                '<br />The image plugin provides displaying of images.<br />One '
                                'of the distinguishing features of this plugin is the ability to '

=== modified file 'openlp/plugins/media/mediaplugin.py'
--- openlp/plugins/media/mediaplugin.py	2015-12-31 22:46:06 +0000
+++ openlp/plugins/media/mediaplugin.py	2016-01-04 00:33:09 +0000
@@ -84,7 +84,8 @@
         visible_name = self.get_string(StringContent.VisibleName)
         self.settings_tab = MediaTab(parent, self.name, visible_name['title'], self.icon_path)
 
-    def about(self):
+    @staticmethod
+    def about():
         """
         Return the about text for the plugin manager
         """

=== modified file 'openlp/plugins/presentations/presentationplugin.py'
--- openlp/plugins/presentations/presentationplugin.py	2015-12-31 22:46:06 +0000
+++ openlp/plugins/presentations/presentationplugin.py	2016-01-04 00:33:09 +0000
@@ -137,7 +137,8 @@
             self.register_controllers(controller)
         return bool(self.controllers)
 
-    def about(self):
+    @staticmethod
+    def about():
         """
         Return information about this plugin.
         """

=== modified file 'openlp/plugins/remotes/remoteplugin.py'
--- openlp/plugins/remotes/remoteplugin.py	2015-12-31 22:46:06 +0000
+++ openlp/plugins/remotes/remoteplugin.py	2016-01-04 00:33:09 +0000
@@ -88,7 +88,8 @@
             self.server.stop_server()
             self.server = None
 
-    def about(self):
+    @staticmethod
+    def about():
         """
         Information about this plugin
         """

=== modified file 'openlp/plugins/songs/songsplugin.py'
--- openlp/plugins/songs/songsplugin.py	2015-12-31 22:46:06 +0000
+++ openlp/plugins/songs/songsplugin.py	2016-01-04 00:33:09 +0000
@@ -211,7 +211,8 @@
         if self.media_item:
             self.media_item.on_export_click()
 
-    def about(self):
+    @staticmethod
+    def about():
         """
         Provides information for the plugin manager to display.
 
@@ -343,7 +344,8 @@
         for song in songs:
             self.manager.delete_object(Song, song.id)
 
-    def _count_songs(self, db_file):
+    @staticmethod
+    def _count_songs(db_file):
         """
         Provide a count of the songs in the database
 

=== modified file 'openlp/plugins/songusage/songusageplugin.py'
--- openlp/plugins/songusage/songusageplugin.py	2015-12-31 22:46:06 +0000
+++ openlp/plugins/songusage/songusageplugin.py	2016-01-04 00:33:09 +0000
@@ -226,8 +226,9 @@
         """
         self.song_usage_detail_form.initialise()
         self.song_usage_detail_form.exec()
-
-    def about(self):
+    
+    @staticmethod
+    def about():
         """
         The plugin about text
 

=== modified file 'tests/functional/openlp_plugins/media/test_mediaplugin.py'
--- tests/functional/openlp_plugins/media/test_mediaplugin.py	2015-12-31 22:46:06 +0000
+++ tests/functional/openlp_plugins/media/test_mediaplugin.py	2016-01-04 00:33:09 +0000
@@ -57,3 +57,11 @@
         mocked_settings.get_files_from_config.assert_called_with(media_plugin)
         mocked_settings.setValue.assert_called_with('media/media files', True)
         mocked_initialise.assert_called_with()
+
+    def test_about_text(self):
+        # GIVEN: The MediaPlugin
+        # WHEN: Retrieving the about text
+        # THEN: about() should return a string object
+        self.assertIsInstance(MediaPlugin.about(), str)
+        # THEN: about() should return a non-empty string
+        self.assertNotEquals(len(MediaPlugin.about()), 0)

=== added directory 'tests/functional/openlp_plugins/songusage'
=== added file 'tests/functional/openlp_plugins/songusage/__init__.py'
--- tests/functional/openlp_plugins/songusage/__init__.py	1970-01-01 00:00:00 +0000
+++ tests/functional/openlp_plugins/songusage/__init__.py	2016-01-04 00:33:09 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2016 OpenLP Developers                                   #
+# --------------------------------------------------------------------------- #
+# 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                          #
+###############################################################################
+"""
+Tests for the Songusage plugin
+"""

=== added file 'tests/functional/openlp_plugins/songusage/test_songusage.py'
--- tests/functional/openlp_plugins/songusage/test_songusage.py	1970-01-01 00:00:00 +0000
+++ tests/functional/openlp_plugins/songusage/test_songusage.py	2016-01-04 00:33:09 +0000
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2016 OpenLP Developers                                   #
+# --------------------------------------------------------------------------- #
+# 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                          #
+###############################################################################
+"""
+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):
+        # GIVEN: The SongUsagePlugin
+        # WHEN: Retrieving the about text
+        # THEN: about() should return a string object
+        self.assertIsInstance(SongUsagePlugin.about(), str)
+        # THEN: about() should return a non-empty string
+        self.assertNotEquals(len(SongUsagePlugin.about()), 0)
+        self.assertNotEquals(len(SongUsagePlugin.about()), 0)


Follow ups