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

Proposed by Simon Hanna
Status: Merged
Approved by: Tim Bentley
Approved revision: 2598
Merged at revision: 2662
Proposed branch: lp:~thelinuxguy/openlp/change-dropdown-to-checkbox
Merge into: lp:openlp
Diff against target: 133 lines (+34/-29)
3 files modified
openlp/core/ui/plugindialog.py (+4/-12)
openlp/core/ui/pluginform.py (+15/-17)
tests/functional/openlp_core_common/test_actions.py (+15/-0)
To merge this branch: bzr merge lp:~thelinuxguy/openlp/change-dropdown-to-checkbox
Reviewer Review Type Date Requested Status
Tim Bentley Approve
Raoul Snyman Approve
Review via email: mp+294957@code.launchpad.net

This proposal supersedes a proposal from 2016-05-17.

Description of the change

* Change the Combobox used for the state of plugins to a checkbox.
* Do not show the plugins version numbers as they provide no additional information
* Show the plugin details (about text) even if the plugin is disabled

To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

Disable means the plugin cannot work due to missing dependencies like Impress or Powerpoint.
Inactive means that the plugin is not to be used i.e you do not want it running in most cases this would be remote.

Looking at the code the combo box needs to support three states not two so this change is not valid as a check box can only have 2 states so this is not a valid change.

The change to about looks valid but why only one plugin why not all of them?

Wew have a test, good but it seems a bit lite!

review: Disapprove
Revision history for this message
Simon Hanna (thelinuxguy) wrote : Posted in a previous version of this proposal

But the third state doesn't allow the user to change anything.
I guess the third state could be emulated by either disabling the checkbox or replacing it with a label saying it's missing a dependency.

About the change to about:
I only changed about because I was looking for something to test and came across this function.
I can go through the others and change them as well...

about the lite test:
I know it's lite. But I'm not sure what else to test for the about function

Revision history for this message
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

No the third state is there because the machine cannot support the plugin, just disabling the check box is not a good indication ofthat state.

Revision history for this message
Simon Hanna (thelinuxguy) wrote : Posted in a previous version of this proposal

and replacing it with a label?

Revision history for this message
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

Not in my opinion.

Revision history for this message
Simon Hanna (thelinuxguy) wrote : Posted in a previous version of this proposal
Revision history for this message
Simon Hanna (thelinuxguy) wrote : Posted in a previous version of this proposal

I just checked, when a plugin is disabled (you can just replace the songs.sqlite with a normal file)
The whole entry becomes disabled. So there really is no reason for the dropdown. Currently the branch throws an Exception when a plugin is disabled, but that can be fixed. What do you think?

Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

Hey Simon, do you want to update your branch and re-propose?

Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

(I mean, merge from trunk)

Revision history for this message
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

Great code but we do need a test as all merges require tests.

Sorry.

review: Needs Fixing
2598. By Simon Hanna

Add comments to test

Revision history for this message
Raoul Snyman (raoul-snyman) :
review: Approve
Revision history for this message
Tim Bentley (trb143) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/core/ui/plugindialog.py'
2--- openlp/core/ui/plugindialog.py 2015-12-31 22:46:06 +0000
3+++ openlp/core/ui/plugindialog.py 2016-05-17 19:35:55 +0000
4@@ -53,15 +53,9 @@
5 self.plugin_info_layout.setObjectName('plugin_info_layout')
6 self.status_label = QtWidgets.QLabel(self.plugin_info_group_box)
7 self.status_label.setObjectName('status_label')
8- self.status_combo_box = QtWidgets.QComboBox(self.plugin_info_group_box)
9- self.status_combo_box.addItems(('', ''))
10- self.status_combo_box.setObjectName('status_combo_box')
11- self.plugin_info_layout.addRow(self.status_label, self.status_combo_box)
12- self.version_label = QtWidgets.QLabel(self.plugin_info_group_box)
13- self.version_label.setObjectName('version_label')
14- self.version_number_label = QtWidgets.QLabel(self.plugin_info_group_box)
15- self.version_number_label.setObjectName('version_number_label')
16- self.plugin_info_layout.addRow(self.version_label, self.version_number_label)
17+ self.status_checkbox = QtWidgets.QCheckBox(self.plugin_info_group_box)
18+ self.status_checkbox.setObjectName('status_checkbox')
19+ self.plugin_info_layout.addRow(self.status_label, self.status_checkbox)
20 self.about_label = QtWidgets.QLabel(self.plugin_info_group_box)
21 self.about_label.setObjectName('about_label')
22 self.about_text_browser = QtWidgets.QTextBrowser(self.plugin_info_group_box)
23@@ -80,8 +74,6 @@
24 """
25 plugin_view_dialog.setWindowTitle(translate('OpenLP.PluginForm', 'Manage Plugins'))
26 self.plugin_info_group_box.setTitle(translate('OpenLP.PluginForm', 'Plugin Details'))
27- self.version_label.setText('%s:' % UiStrings().Version)
28 self.about_label.setText('%s:' % UiStrings().About)
29 self.status_label.setText(translate('OpenLP.PluginForm', 'Status:'))
30- self.status_combo_box.setItemText(0, translate('OpenLP.PluginForm', 'Active'))
31- self.status_combo_box.setItemText(1, translate('OpenLP.PluginForm', 'Inactive'))
32+ self.status_checkbox.setText(translate('OpenLP.PluginForm', 'Active'))
33
34=== modified file 'openlp/core/ui/pluginform.py'
35--- openlp/core/ui/pluginform.py 2016-01-09 16:26:14 +0000
36+++ openlp/core/ui/pluginform.py 2016-05-17 19:35:55 +0000
37@@ -49,7 +49,7 @@
38 self._clear_details()
39 # Right, now let's put some signals and slots together!
40 self.plugin_list_widget.itemSelectionChanged.connect(self.on_plugin_list_widget_selection_changed)
41- self.status_combo_box.currentIndexChanged.connect(self.on_status_combo_box_changed)
42+ self.status_checkbox.stateChanged.connect(self.on_status_checkbox_changed)
43
44 def load(self):
45 """
46@@ -86,24 +86,23 @@
47 """
48 Clear the plugin details widgets
49 """
50- self.status_combo_box.setCurrentIndex(-1)
51- self.version_number_label.setText('')
52+ self.status_checkbox.setChecked(False)
53 self.about_text_browser.setHtml('')
54- self.status_combo_box.setEnabled(False)
55+ self.status_checkbox.setEnabled(False)
56
57 def _set_details(self):
58 """
59 Set the details of the currently selected plugin
60 """
61 log.debug('PluginStatus: %s', str(self.active_plugin.status))
62- self.version_number_label.setText(self.active_plugin.version)
63 self.about_text_browser.setHtml(self.active_plugin.about())
64 self.programatic_change = True
65- status = PluginStatus.Active
66- if self.active_plugin.status == PluginStatus.Active:
67- status = PluginStatus.Inactive
68- self.status_combo_box.setCurrentIndex(status)
69- self.status_combo_box.setEnabled(True)
70+ if self.active_plugin.status != PluginStatus.Disabled:
71+ self.status_checkbox.setChecked(self.active_plugin.status == PluginStatus.Active)
72+ self.status_checkbox.setEnabled(True)
73+ else:
74+ self.status_checkbox.setChecked(False)
75+ self.status_checkbox.setEnabled(False)
76 self.programatic_change = False
77
78 def on_plugin_list_widget_selection_changed(self):
79@@ -116,22 +115,21 @@
80 plugin_name_singular = self.plugin_list_widget.currentItem().text().split('(')[0][:-1]
81 self.active_plugin = None
82 for plugin in self.plugin_manager.plugins:
83- if plugin.status != PluginStatus.Disabled:
84- if plugin.name_strings['singular'] == plugin_name_singular:
85- self.active_plugin = plugin
86- break
87+ if plugin.name_strings['singular'] == plugin_name_singular:
88+ self.active_plugin = plugin
89+ break
90 if self.active_plugin:
91 self._set_details()
92 else:
93 self._clear_details()
94
95- def on_status_combo_box_changed(self, status):
96+ def on_status_checkbox_changed(self, status):
97 """
98 If the status of a plugin is altered, apply the change
99 """
100- if self.programatic_change or status == PluginStatus.Disabled:
101+ if self.programatic_change or self.active_plugin is None:
102 return
103- if status == PluginStatus.Inactive:
104+ if status:
105 self.application.set_busy_cursor()
106 self.active_plugin.toggle_status(PluginStatus.Active)
107 self.application.set_normal_cursor()
108
109=== modified file 'tests/functional/openlp_core_common/test_actions.py'
110--- tests/functional/openlp_core_common/test_actions.py 2016-03-31 16:34:22 +0000
111+++ tests/functional/openlp_core_common/test_actions.py 2016-05-17 19:35:55 +0000
112@@ -111,6 +111,21 @@
113 self.assertEqual(self.list.actions[0], (41, self.action2))
114 self.assertEqual(self.list.actions[1], (42, self.action1))
115
116+ def iterator_test(self):
117+ """
118+ Test the __iter__ and __next__ methods
119+ """
120+ # GIVEN: The list including two actions
121+ self.list.add(self.action1)
122+ self.list.add(self.action2)
123+
124+ # WHEN: Iterating over the list
125+ l = [a for a in self.list]
126+ # THEN: Make sure they are returned in correct order
127+ self.assertEquals(len(self.list), 2)
128+ self.assertIs(l[0], self.action1)
129+ self.assertIs(l[1], self.action2)
130+
131 def remove_test(self):
132 """
133 Test the remove() method