← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~thelinuxguy/openlp/change-dropdown-to-checkbox into lp:openlp

 

Simon Hanna has proposed merging lp:~thelinuxguy/openlp/change-dropdown-to-checkbox into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1530073 in OpenLP: "Dropdown in 'Manage plugins' should be a checkbox"
  https://bugs.launchpad.net/openlp/+bug/1530073

For more details, see:
https://code.launchpad.net/~thelinuxguy/openlp/change-dropdown-to-checkbox/+merge/281481

Change the Combobox used for the state of plugins to a checkbox.
Also modify the about() function of SongUsagePlugin so it is static
-- 
Your team OpenLP Core is requested to review the proposed merge of lp:~thelinuxguy/openlp/change-dropdown-to-checkbox into lp:openlp.
=== modified file '.bzrignore'
--- .bzrignore	2015-05-07 21:29:43 +0000
+++ .bzrignore	2016-01-03 14:52:29 +0000
@@ -43,3 +43,4 @@
 .coverage
 cover
 *.kdev4
+coverage

=== added file '.coveragerc'
--- .coveragerc	1970-01-01 00:00:00 +0000
+++ .coveragerc	2016-01-03 14:52:29 +0000
@@ -0,0 +1,5 @@
+[run]
+source = openlp
+
+[html]
+directory = coverage

=== modified file 'openlp/core/ui/plugindialog.py'
--- openlp/core/ui/plugindialog.py	2015-12-31 22:46:06 +0000
+++ openlp/core/ui/plugindialog.py	2016-01-03 14:52:29 +0000
@@ -53,10 +53,9 @@
         self.plugin_info_layout.setObjectName('plugin_info_layout')
         self.status_label = QtWidgets.QLabel(self.plugin_info_group_box)
         self.status_label.setObjectName('status_label')
-        self.status_combo_box = QtWidgets.QComboBox(self.plugin_info_group_box)
-        self.status_combo_box.addItems(('', ''))
-        self.status_combo_box.setObjectName('status_combo_box')
-        self.plugin_info_layout.addRow(self.status_label, self.status_combo_box)
+        self.status_checkbox = QtWidgets.QCheckBox(self.plugin_info_group_box)
+        self.status_checkbox.setObjectName('status_checkbox')
+        self.plugin_info_layout.addRow(self.status_label, self.status_checkbox)
         self.version_label = QtWidgets.QLabel(self.plugin_info_group_box)
         self.version_label.setObjectName('version_label')
         self.version_number_label = QtWidgets.QLabel(self.plugin_info_group_box)
@@ -83,5 +82,4 @@
         self.version_label.setText('%s:' % UiStrings().Version)
         self.about_label.setText('%s:' % UiStrings().About)
         self.status_label.setText(translate('OpenLP.PluginForm', 'Status:'))
-        self.status_combo_box.setItemText(0, translate('OpenLP.PluginForm', 'Active'))
-        self.status_combo_box.setItemText(1, translate('OpenLP.PluginForm', 'Inactive'))
+        self.status_checkbox.setText(translate('OpenLP.PluginForm', 'Active'))

=== modified file 'openlp/core/ui/pluginform.py'
--- openlp/core/ui/pluginform.py	2015-12-31 22:46:06 +0000
+++ openlp/core/ui/pluginform.py	2016-01-03 14:52:29 +0000
@@ -49,7 +49,7 @@
         self._clear_details()
         # Right, now let's put some signals and slots together!
         self.plugin_list_widget.itemSelectionChanged.connect(self.on_plugin_list_widget_selection_changed)
-        self.status_combo_box.currentIndexChanged.connect(self.on_status_combo_box_changed)
+        self.status_checkbox.stateChanged.connect(self.on_status_checkbox_changed)
 
     def load(self):
         """
@@ -86,10 +86,10 @@
         """
         Clear the plugin details widgets
         """
-        self.status_combo_box.setCurrentIndex(-1)
+        self.status_checkbox.setChecked(False)
         self.version_number_label.setText('')
         self.about_text_browser.setHtml('')
-        self.status_combo_box.setEnabled(False)
+        self.status_checkbox.setEnabled(False)
 
     def _set_details(self):
         """
@@ -99,11 +99,8 @@
         self.version_number_label.setText(self.active_plugin.version)
         self.about_text_browser.setHtml(self.active_plugin.about())
         self.programatic_change = True
-        status = PluginStatus.Active
-        if self.active_plugin.status == PluginStatus.Active:
-            status = PluginStatus.Inactive
-        self.status_combo_box.setCurrentIndex(status)
-        self.status_combo_box.setEnabled(True)
+        self.status_checkbox.setChecked(self.active_plugin.status == PluginStatus.Active)
+        self.status_checkbox.setEnabled(True)
         self.programatic_change = False
 
     def on_plugin_list_widget_selection_changed(self):
@@ -125,13 +122,13 @@
         else:
             self._clear_details()
 
-    def on_status_combo_box_changed(self, status):
+    def on_status_checkbox_changed(self, status):
         """
         If the status of a plugin is altered, apply the change
         """
-        if self.programatic_change or status == PluginStatus.Disabled:
+        if self.programatic_change:
             return
-        if status == PluginStatus.Inactive:
+        if status:
             self.application.set_busy_cursor()
             self.active_plugin.toggle_status(PluginStatus.Active)
             self.application.set_normal_cursor()

=== 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-03 14:52:29 +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
 

=== 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-03 14:52:29 +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-03 14:52:29 +0000
@@ -0,0 +1,31 @@
+# -*- 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):
+        self.assertNotEquals(len(SongUsagePlugin.about()), 0)


Follow ups