openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #29685
[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:
Tim Bentley (trb143)
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/294957
* 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
--
Your team OpenLP Core is subscribed to branch lp:openlp.
=== 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-05-17 19:32:55 +0000
@@ -53,15 +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.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)
- self.version_number_label.setObjectName('version_number_label')
- self.plugin_info_layout.addRow(self.version_label, self.version_number_label)
+ 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.about_label = QtWidgets.QLabel(self.plugin_info_group_box)
self.about_label.setObjectName('about_label')
self.about_text_browser = QtWidgets.QTextBrowser(self.plugin_info_group_box)
@@ -80,8 +74,6 @@
"""
plugin_view_dialog.setWindowTitle(translate('OpenLP.PluginForm', 'Manage Plugins'))
self.plugin_info_group_box.setTitle(translate('OpenLP.PluginForm', 'Plugin Details'))
- 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 2016-01-09 16:26:14 +0000
+++ openlp/core/ui/pluginform.py 2016-05-17 19:32:55 +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,24 +86,23 @@
"""
Clear the plugin details widgets
"""
- self.status_combo_box.setCurrentIndex(-1)
- self.version_number_label.setText('')
+ self.status_checkbox.setChecked(False)
self.about_text_browser.setHtml('')
- self.status_combo_box.setEnabled(False)
+ self.status_checkbox.setEnabled(False)
def _set_details(self):
"""
Set the details of the currently selected plugin
"""
log.debug('PluginStatus: %s', str(self.active_plugin.status))
- 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)
+ if self.active_plugin.status != PluginStatus.Disabled:
+ self.status_checkbox.setChecked(self.active_plugin.status == PluginStatus.Active)
+ self.status_checkbox.setEnabled(True)
+ else:
+ self.status_checkbox.setChecked(False)
+ self.status_checkbox.setEnabled(False)
self.programatic_change = False
def on_plugin_list_widget_selection_changed(self):
@@ -116,22 +115,21 @@
plugin_name_singular = self.plugin_list_widget.currentItem().text().split('(')[0][:-1]
self.active_plugin = None
for plugin in self.plugin_manager.plugins:
- if plugin.status != PluginStatus.Disabled:
- if plugin.name_strings['singular'] == plugin_name_singular:
- self.active_plugin = plugin
- break
+ if plugin.name_strings['singular'] == plugin_name_singular:
+ self.active_plugin = plugin
+ break
if self.active_plugin:
self._set_details()
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 or self.active_plugin is None:
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 'tests/functional/openlp_core_common/test_actions.py'
--- tests/functional/openlp_core_common/test_actions.py 2016-03-31 16:34:22 +0000
+++ tests/functional/openlp_core_common/test_actions.py 2016-05-17 19:32:55 +0000
@@ -111,6 +111,17 @@
self.assertEqual(self.list.actions[0], (41, self.action2))
self.assertEqual(self.list.actions[1], (42, self.action1))
+ def iterator_test(self):
+ """
+ Test the __iter__ and __next__ methods
+ """
+ self.list.add(self.action1)
+ self.list.add(self.action2)
+
+ l = [a for a in self.list]
+ self.assertIs(l[0], self.action1)
+ self.assertIs(l[1], self.action2)
+
def remove_test(self):
"""
Test the remove() method
Follow ups