forked from openlp/openlp
Change Combobox to Checkbox for plugin states
This commit is contained in:
parent
607371a6d7
commit
6d0e006b09
@ -53,10 +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.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 @@ class Ui_PluginViewDialog(object):
|
||||
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,10 +86,10 @@ class PluginForm(QtWidgets.QDialog, Ui_PluginViewDialog, RegistryProperties):
|
||||
"""
|
||||
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 @@ class PluginForm(QtWidgets.QDialog, Ui_PluginViewDialog, RegistryProperties):
|
||||
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 @@ 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:
|
||||
return
|
||||
if status == PluginStatus.Inactive:
|
||||
if status:
|
||||
self.application.set_busy_cursor()
|
||||
self.active_plugin.toggle_status(PluginStatus.Active)
|
||||
self.application.set_normal_cursor()
|
||||
|
Loading…
Reference in New Issue
Block a user