Remove "Can_be_disabled" as no longer require

Sort out status handling in plugin form.
This commit is contained in:
Tim Bentley 2009-11-07 07:42:18 +00:00
parent 6148d845ae
commit 2e02f1c94f
11 changed files with 7 additions and 46 deletions

View File

@ -139,14 +139,6 @@ class Plugin(QtCore.QObject):
""" """
return True return True
def can_be_disabled(self):
"""
Indicates whether the plugin can be disabled by the plugin list.
Returns True or False.
"""
return False
def set_status(self): def set_status(self):
""" """
Sets the status of the plugin Sets the status of the plugin

View File

@ -105,10 +105,7 @@ class PluginManager(object):
for plugin in plugins_list: for plugin in plugins_list:
if plugin.check_pre_conditions(): if plugin.check_pre_conditions():
log.debug(u'Plugin %s active', unicode(plugin.name)) log.debug(u'Plugin %s active', unicode(plugin.name))
if plugin.can_be_disabled(): plugin.set_status()
plugin.set_status()
else:
plugin.status = PluginStatus.Active
else: else:
plugin.status = PluginStatus.Disabled plugin.status = PluginStatus.Disabled
self.plugins.append(plugin) self.plugins.append(plugin)

View File

@ -79,17 +79,16 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
self.StatusComboBox.setCurrentIndex(-1) self.StatusComboBox.setCurrentIndex(-1)
self.VersionNumberLabel.setText(u'') self.VersionNumberLabel.setText(u'')
self.AboutTextBrowser.setHtml(u'') self.AboutTextBrowser.setHtml(u'')
self.StatusComboBox.setEnabled(False)
def _setDetails(self): def _setDetails(self):
log.debug('PluginStatus: %s', str(self.activePlugin.status)) log.debug('PluginStatus: %s', str(self.activePlugin.status))
self.VersionNumberLabel.setText(self.activePlugin.version) self.VersionNumberLabel.setText(self.activePlugin.version)
self.AboutTextBrowser.setHtml(self.activePlugin.about()) self.AboutTextBrowser.setHtml(self.activePlugin.about())
if self.activePlugin.can_be_disabled(): self.programaticChange = True
self.programaticChange = True self.StatusComboBox.setCurrentIndex(int(self.activePlugin.status))
self.StatusComboBox.setCurrentIndex(int(self.activePlugin.status)) self.StatusComboBox.setEnabled(True)
self.StatusComboBox.setEnabled(True) self.programaticChange = False
else:
self.StatusComboBox.setEnabled(False)
def onPluginListWidgetSelectionChanged(self): def onPluginListWidgetSelectionChanged(self):
if self.PluginListWidget.currentItem() is None: if self.PluginListWidget.currentItem() is None:
@ -107,9 +106,6 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
self._clearDetails() self._clearDetails()
def onStatusComboBoxChanged(self, status): def onStatusComboBoxChanged(self, status):
if self.programaticChange:
self.programaticChange = False
return
self.activePlugin.toggle_status(status) self.activePlugin.toggle_status(status)
if status == PluginStatus.Active: if status == PluginStatus.Active:
self.activePlugin.initialise() self.activePlugin.initialise()

View File

@ -41,9 +41,6 @@ class BiblePlugin(Plugin):
#Register the bible Manager #Register the bible Manager
self.biblemanager = None self.biblemanager = None
def can_be_disabled(self):
return True
def initialise(self): def initialise(self):
log.info(u'bibles Initialising') log.info(u'bibles Initialising')
if self.biblemanager is None: if self.biblemanager is None:

View File

@ -54,9 +54,6 @@ class CustomPlugin(Plugin):
# Create the CustomManagerItem object # Create the CustomManagerItem object
return CustomMediaItem(self, self.icon, self.name) return CustomMediaItem(self, self.icon, self.name)
def can_be_disabled(self):
return True
def initialise(self): def initialise(self):
log.info(u'Plugin Initialising') log.info(u'Plugin Initialising')
Plugin.initialise(self) Plugin.initialise(self)

View File

@ -37,9 +37,6 @@ class ImagePlugin(Plugin):
self.weight = -7 self.weight = -7
self.icon = buildIcon(u':/media/media_image.png') self.icon = buildIcon(u':/media/media_image.png')
def can_be_disabled(self):
return True
def initialise(self): def initialise(self):
log.info(u'Plugin Initialising') log.info(u'Plugin Initialising')
Plugin.initialise(self) Plugin.initialise(self)
@ -60,7 +57,7 @@ class ImagePlugin(Plugin):
about_text = self.trUtf8(u'<b>Image Plugin</b><br>Allows images of ' about_text = self.trUtf8(u'<b>Image Plugin</b><br>Allows images of '
u'all types to be displayed. If a number of images are selected ' u'all types to be displayed. If a number of images are selected '
u'together and presented on the live controller it is possible ' u'together and presented on the live controller it is possible '
u'to turn them into a timed loop.<br>From the plugin if the ' u'to turn them into a timed loop.<br<br>From the plugin if the '
u'<i>Override background</i> is chosen and an image is selected ' u'<i>Override background</i> is chosen and an image is selected '
u'any somgs which are rendered will use the selected image from ' u'any somgs which are rendered will use the selected image from '
u'the background instead of the one provied by the theme.<br>') u'the background instead of the one provied by the theme.<br>')

View File

@ -42,9 +42,6 @@ class MediaPlugin(Plugin):
def get_settings_tab(self): def get_settings_tab(self):
return MediaTab(self.name) return MediaTab(self.name)
def can_be_disabled(self):
return True
def initialise(self): def initialise(self):
log.info(u'Plugin Initialising') log.info(u'Plugin Initialising')
Plugin.initialise(self) Plugin.initialise(self)

View File

@ -46,9 +46,6 @@ class PresentationPlugin(Plugin):
""" """
return PresentationTab(self.name, self.controllers) return PresentationTab(self.name, self.controllers)
def can_be_disabled(self):
return True
def initialise(self): def initialise(self):
log.info(u'Presentations Initialising') log.info(u'Presentations Initialising')
Plugin.initialise(self) Plugin.initialise(self)

View File

@ -40,9 +40,6 @@ class RemotesPlugin(Plugin):
self.weight = -1 self.weight = -1
self.server = None self.server = None
def can_be_disabled(self):
return True
def initialise(self): def initialise(self):
log.debug(u'initialise') log.debug(u'initialise')
Plugin.initialise(self) Plugin.initialise(self)

View File

@ -57,9 +57,6 @@ class SongsPlugin(Plugin):
self.opensong_export_form = OpenSongExportForm() self.opensong_export_form = OpenSongExportForm()
self.icon = buildIcon(u':/media/media_song.png') self.icon = buildIcon(u':/media/media_song.png')
def can_be_disabled(self):
return True
def get_settings_tab(self): def get_settings_tab(self):
return SongsTab(self.name) return SongsTab(self.name)

View File

@ -44,9 +44,6 @@ class SongUsagePlugin(Plugin):
self.songusagemanager = None self.songusagemanager = None
self.songusageActive = False self.songusageActive = False
def can_be_disabled(self):
return True
def add_tools_menu_item(self, tools_menu): def add_tools_menu_item(self, tools_menu):
""" """
Give the SongUsage plugin the opportunity to add items to the Give the SongUsage plugin the opportunity to add items to the