forked from openlp/openlp
* 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 bzr-revno: 2662 Fixes: https://launchpad.net/bugs/1530073
This commit is contained in:
commit
63f478d910
@ -53,15 +53,9 @@ class Ui_PluginViewDialog(object):
|
||||
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 @@ class Ui_PluginViewDialog(object):
|
||||
"""
|
||||
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'))
|
||||
|
@ -49,7 +49,7 @@ class PluginForm(QtWidgets.QDialog, Ui_PluginViewDialog, RegistryProperties):
|
||||
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 @@ class PluginForm(QtWidgets.QDialog, Ui_PluginViewDialog, RegistryProperties):
|
||||
"""
|
||||
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,7 +115,6 @@ class PluginForm(QtWidgets.QDialog, Ui_PluginViewDialog, RegistryProperties):
|
||||
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
|
||||
@ -125,13 +123,13 @@ class PluginForm(QtWidgets.QDialog, Ui_PluginViewDialog, RegistryProperties):
|
||||
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()
|
||||
|
@ -111,6 +111,21 @@ class TestCategoryActionList(TestCase):
|
||||
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
|
||||
"""
|
||||
# GIVEN: The list including two actions
|
||||
self.list.add(self.action1)
|
||||
self.list.add(self.action2)
|
||||
|
||||
# WHEN: Iterating over the list
|
||||
l = [a for a in self.list]
|
||||
# THEN: Make sure they are returned in correct order
|
||||
self.assertEquals(len(self.list), 2)
|
||||
self.assertIs(l[0], self.action1)
|
||||
self.assertIs(l[1], self.action2)
|
||||
|
||||
def remove_test(self):
|
||||
"""
|
||||
Test the remove() method
|
||||
|
Loading…
Reference in New Issue
Block a user