forked from openlp/openlp
fixes
This commit is contained in:
parent
7f799b09d2
commit
df3bbc1ec0
@ -46,7 +46,7 @@ class PluginForm(QtWidgets.QDialog, Ui_PluginViewDialog, RegistryProperties):
|
|||||||
super(PluginForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint |
|
super(PluginForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint |
|
||||||
QtCore.Qt.WindowCloseButtonHint)
|
QtCore.Qt.WindowCloseButtonHint)
|
||||||
self.active_plugin = None
|
self.active_plugin = None
|
||||||
self.programatic_change = False
|
self.programmatic_change = False
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
self.load()
|
self.load()
|
||||||
self._clear_details()
|
self._clear_details()
|
||||||
@ -59,30 +59,31 @@ class PluginForm(QtWidgets.QDialog, Ui_PluginViewDialog, RegistryProperties):
|
|||||||
Load the plugin details into the screen
|
Load the plugin details into the screen
|
||||||
"""
|
"""
|
||||||
self.plugin_list_widget.clear()
|
self.plugin_list_widget.clear()
|
||||||
self.programatic_change = True
|
self.programmatic_change = True
|
||||||
self._clear_details()
|
self._clear_details()
|
||||||
self.programatic_change = True
|
self.programmatic_change = True
|
||||||
plugin_list_width = 0
|
plugin_list_width = 0
|
||||||
for plugin in State().list_plugins():
|
for plugin in State().list_plugins():
|
||||||
item = QtWidgets.QListWidgetItem(self.plugin_list_widget)
|
if plugin:
|
||||||
# We do this just to make 100% sure the status is an integer as
|
item = QtWidgets.QListWidgetItem(self.plugin_list_widget)
|
||||||
# sometimes when it's loaded from the config, it isn't cast to int.
|
# We do this just to make 100% sure the status is an integer as
|
||||||
plugin.status = int(plugin.status)
|
# sometimes when it's loaded from the config, it isn't cast to int.
|
||||||
# Set the little status text in brackets next to the plugin name.
|
plugin.status = int(plugin.status)
|
||||||
if plugin.status == PluginStatus.Disabled:
|
# Set the little status text in brackets next to the plugin name.
|
||||||
status_text = translate('OpenLP.PluginForm', '{name} (Disabled)')
|
if plugin.status == PluginStatus.Disabled:
|
||||||
elif plugin.status == PluginStatus.Active:
|
status_text = translate('OpenLP.PluginForm', '{name} (Disabled)')
|
||||||
status_text = translate('OpenLP.PluginForm', '{name} (Active)')
|
elif plugin.status == PluginStatus.Active:
|
||||||
else:
|
status_text = translate('OpenLP.PluginForm', '{name} (Active)')
|
||||||
# PluginStatus.Inactive
|
else:
|
||||||
status_text = translate('OpenLP.PluginForm', '{name} (Inactive)')
|
# PluginStatus.Inactive
|
||||||
item.setText(status_text.format(name=plugin.name_strings['singular']))
|
status_text = translate('OpenLP.PluginForm', '{name} (Inactive)')
|
||||||
# If the plugin has an icon, set it!
|
item.setText(status_text.format(name=plugin.name_strings['singular']))
|
||||||
if plugin.icon:
|
# If the plugin has an icon, set it!
|
||||||
item.setIcon(plugin.icon)
|
if plugin.icon:
|
||||||
self.plugin_list_widget.addItem(item)
|
item.setIcon(plugin.icon)
|
||||||
plugin_list_width = max(plugin_list_width, self.fontMetrics().width(
|
self.plugin_list_widget.addItem(item)
|
||||||
translate('OpenLP.PluginForm', '{name} (Inactive)').format(name=plugin.name_strings['singular'])))
|
plugin_list_width = max(plugin_list_width, self.fontMetrics().width(
|
||||||
|
translate('OpenLP.PluginForm', '{name} (Inactive)').format(name=plugin.name_strings['singular'])))
|
||||||
self.plugin_list_widget.setFixedWidth(plugin_list_width + self.plugin_list_widget.iconSize().width() + 48)
|
self.plugin_list_widget.setFixedWidth(plugin_list_width + self.plugin_list_widget.iconSize().width() + 48)
|
||||||
|
|
||||||
def _clear_details(self):
|
def _clear_details(self):
|
||||||
@ -99,14 +100,14 @@ class PluginForm(QtWidgets.QDialog, Ui_PluginViewDialog, RegistryProperties):
|
|||||||
"""
|
"""
|
||||||
log.debug('PluginStatus: {status}'.format(status=str(self.active_plugin.status)))
|
log.debug('PluginStatus: {status}'.format(status=str(self.active_plugin.status)))
|
||||||
self.about_text_browser.setHtml(self.active_plugin.about())
|
self.about_text_browser.setHtml(self.active_plugin.about())
|
||||||
self.programatic_change = True
|
self.programmatic_change = True
|
||||||
if self.active_plugin.status != PluginStatus.Disabled:
|
if self.active_plugin.status != PluginStatus.Disabled:
|
||||||
self.status_checkbox.setChecked(self.active_plugin.status == PluginStatus.Active)
|
self.status_checkbox.setChecked(self.active_plugin.status == PluginStatus.Active)
|
||||||
self.status_checkbox.setEnabled(True)
|
self.status_checkbox.setEnabled(True)
|
||||||
else:
|
else:
|
||||||
self.status_checkbox.setChecked(False)
|
self.status_checkbox.setChecked(False)
|
||||||
self.status_checkbox.setEnabled(False)
|
self.status_checkbox.setEnabled(False)
|
||||||
self.programatic_change = False
|
self.programmatic_change = False
|
||||||
|
|
||||||
def on_plugin_list_widget_selection_changed(self):
|
def on_plugin_list_widget_selection_changed(self):
|
||||||
"""
|
"""
|
||||||
@ -130,7 +131,7 @@ class PluginForm(QtWidgets.QDialog, Ui_PluginViewDialog, RegistryProperties):
|
|||||||
"""
|
"""
|
||||||
If the status of a plugin is altered, apply the change
|
If the status of a plugin is altered, apply the change
|
||||||
"""
|
"""
|
||||||
if self.programatic_change or self.active_plugin is None:
|
if self.programmatic_change or self.active_plugin is None:
|
||||||
return
|
return
|
||||||
if status:
|
if status:
|
||||||
self.application.set_busy_cursor()
|
self.application.set_busy_cursor()
|
||||||
|
Loading…
Reference in New Issue
Block a user