Fix double loading

This commit is contained in:
Jon Tibble 2009-10-30 20:34:11 +00:00
parent 68a7fbcf56
commit 28a223bc06
11 changed files with 13 additions and 7 deletions

View File

@ -256,7 +256,6 @@ class Plugin(QtCore.QObject):
""" """
Called by plugin to replace toolbar Called by plugin to replace toolbar
""" """
# Not sure self.media_item is being set properly
if self.media_item is not None: if self.media_item is not None:
self.mediadock.insert_dock(self.media_item, self.icon, self.weight) self.mediadock.insert_dock(self.media_item, self.icon, self.weight)
if self.settings_tab is not None: if self.settings_tab is not None:

View File

@ -136,10 +136,6 @@ class PluginManager(object):
for plugin in self.plugins: for plugin in self.plugins:
if plugin.status is not PluginStatus.Disabled: if plugin.status is not PluginStatus.Disabled:
plugin.media_item = plugin.get_media_manager_item() plugin.media_item = plugin.get_media_manager_item()
if plugin.media_item is not None:
log.debug(u'Inserting media manager item from %s' % \
plugin.name)
mediadock.add_dock(plugin.media_item, plugin.icon, plugin.weight)
def hook_settings_tabs(self, settingsform=None): def hook_settings_tabs(self, settingsform=None):
""" """

View File

@ -55,6 +55,6 @@ class MediaDockManager(object):
log.debug(u'remove %s dock' % name) log.debug(u'remove %s dock' % name)
for dock_index in range(0, self.media_dock.count()): for dock_index in range(0, self.media_dock.count()):
if self.media_dock.widget(dock_index) is not None: if self.media_dock.widget(dock_index) is not None:
if self.media_dock.widget(dock_index).ConfigSection == name.lower(): if self.media_dock.widget(dock_index).ConfigSection == name:
self.media_dock.widget(dock_index).hide() self.media_dock.widget(dock_index).hide()
self.media_dock.removeItem(dock_index) self.media_dock.removeItem(dock_index)

View File

@ -37,6 +37,7 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
QtGui.QDialog.__init__(self, parent) QtGui.QDialog.__init__(self, parent)
self.parent = parent self.parent = parent
self.activePlugin = None self.activePlugin = None
self.programaticChange = False
self.setupUi(self) self.setupUi(self)
self.load() self.load()
self._clearDetails() self._clearDetails()
@ -84,6 +85,7 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
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(): if self.activePlugin.can_be_disabled():
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)
else: else:
@ -105,6 +107,9 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
self._clearDetails() self._clearDetails()
def onStatusComboBoxChanged(self, status): def onStatusComboBoxChanged(self, status):
if self.programaticChange is True:
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()
@ -119,4 +124,3 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
status_text = 'Disabled' status_text = 'Disabled'
self.PluginListWidget.currentItem().setText( self.PluginListWidget.currentItem().setText(
u'%s (%s)' % (self.activePlugin.name, status_text)) u'%s (%s)' % (self.activePlugin.name, status_text))

View File

@ -49,6 +49,7 @@ class BiblePlugin(Plugin):
if self.biblemanager is None: if self.biblemanager is None:
self.biblemanager = BibleManager(self.config) self.biblemanager = BibleManager(self.config)
Plugin.initialise(self) Plugin.initialise(self)
self.insert_toolbox_item()
self.ImportBibleItem.setVisible(True) self.ImportBibleItem.setVisible(True)
self.ExportBibleItem.setVisible(True) self.ExportBibleItem.setVisible(True)

View File

@ -60,6 +60,7 @@ class CustomPlugin(Plugin):
def initialise(self): def initialise(self):
log.info(u'Plugin Initialising') log.info(u'Plugin Initialising')
Plugin.initialise(self) Plugin.initialise(self)
self.insert_toolbox_item()
def finalise(self): def finalise(self):
log.info(u'Plugin Finalise') log.info(u'Plugin Finalise')

View File

@ -43,6 +43,7 @@ class ImagePlugin(Plugin):
def initialise(self): def initialise(self):
log.info(u'Plugin Initialising') log.info(u'Plugin Initialising')
Plugin.initialise(self) Plugin.initialise(self)
self.insert_toolbox_item()
def finalise(self): def finalise(self):
log.info(u'Plugin Finalise') log.info(u'Plugin Finalise')

View File

@ -48,6 +48,7 @@ class MediaPlugin(Plugin):
def initialise(self): def initialise(self):
log.info(u'Plugin Initialising') log.info(u'Plugin Initialising')
Plugin.initialise(self) Plugin.initialise(self)
self.insert_toolbox_item()
def finalise(self): def finalise(self):
log.info(u'Plugin Finalise') log.info(u'Plugin Finalise')

View File

@ -52,6 +52,7 @@ class PresentationPlugin(Plugin):
def initialise(self): def initialise(self):
log.info(u'Presentations Initialising') log.info(u'Presentations Initialising')
Plugin.initialise(self) Plugin.initialise(self)
self.insert_toolbox_item()
def finalise(self): def finalise(self):
log.info(u'Plugin Finalise') log.info(u'Plugin Finalise')

View File

@ -46,6 +46,7 @@ class RemotesPlugin(Plugin):
def initialise(self): def initialise(self):
log.debug(u'initialise') log.debug(u'initialise')
Plugin.initialise(self) Plugin.initialise(self)
self.insert_toolbox_item()
self.server = QtNetwork.QUdpSocket() self.server = QtNetwork.QUdpSocket()
self.server.bind(int(self.config.get_config(u'remote port', 4316))) self.server.bind(int(self.config.get_config(u'remote port', 4316)))
QtCore.QObject.connect(self.server, QtCore.QObject.connect(self.server,

View File

@ -68,6 +68,7 @@ class SongsPlugin(Plugin):
#if self.songmanager is None: #if self.songmanager is None:
# self.songmanager = SongManager(self.config) # self.songmanager = SongManager(self.config)
Plugin.initialise(self) Plugin.initialise(self)
self.insert_toolbox_item()
self.ImportSongMenu.menuAction().setVisible(True) self.ImportSongMenu.menuAction().setVisible(True)
self.ExportSongMenu.menuAction().setVisible(True) self.ExportSongMenu.menuAction().setVisible(True)
self.media_item.displayResultsSong(self.songmanager.get_songs()) self.media_item.displayResultsSong(self.songmanager.get_songs())