forked from openlp/openlp
Cleanup plugins (Bug #600996)
This commit is contained in:
parent
9e1474e851
commit
45375e7442
@ -242,19 +242,22 @@ class Plugin(QtCore.QObject):
|
||||
"""
|
||||
if self.media_item:
|
||||
self.media_item.initialise()
|
||||
self.insert_toolbox_item()
|
||||
|
||||
def finalise(self):
|
||||
"""
|
||||
Called by the plugin Manager to cleanup things.
|
||||
"""
|
||||
pass
|
||||
self.remove_toolbox_item()
|
||||
|
||||
def remove_toolbox_item(self):
|
||||
"""
|
||||
Called by the plugin to remove toolbar
|
||||
"""
|
||||
self.mediadock.remove_dock(self.name)
|
||||
self.settings_form.removeTab(self.name)
|
||||
if self.media_item:
|
||||
self.mediadock.remove_dock(self.name)
|
||||
if self.settings_tab:
|
||||
self.settings_form.removeTab(self.name)
|
||||
|
||||
def insert_toolbox_item(self):
|
||||
"""
|
||||
|
@ -85,8 +85,8 @@ class alertsPlugin(Plugin):
|
||||
|
||||
def finalise(self):
|
||||
log.info(u'Plugin Finalise')
|
||||
Plugin.finalise(self)
|
||||
self.toolsAlertItem.setVisible(False)
|
||||
#stop any events being processed
|
||||
|
||||
def togglealertsState(self):
|
||||
self.alertsActive = not self.alertsActive
|
||||
|
@ -48,14 +48,12 @@ class BiblePlugin(Plugin):
|
||||
if self.manager is None:
|
||||
self.manager = BibleManager(self)
|
||||
Plugin.initialise(self)
|
||||
self.insert_toolbox_item()
|
||||
self.ImportBibleItem.setVisible(True)
|
||||
self.ExportBibleItem.setVisible(True)
|
||||
|
||||
def finalise(self):
|
||||
log.info(u'Plugin Finalise')
|
||||
Plugin.finalise(self)
|
||||
self.remove_toolbox_item()
|
||||
self.ImportBibleItem.setVisible(False)
|
||||
self.ExportBibleItem.setVisible(False)
|
||||
|
||||
|
@ -60,15 +60,6 @@ class CustomPlugin(Plugin):
|
||||
# Create the CustomManagerItem object
|
||||
return CustomMediaItem(self, self.icon, self.name)
|
||||
|
||||
def initialise(self):
|
||||
log.info(u'Plugin Initialising')
|
||||
Plugin.initialise(self)
|
||||
self.insert_toolbox_item()
|
||||
|
||||
def finalise(self):
|
||||
log.info(u'Plugin Finalise')
|
||||
self.remove_toolbox_item()
|
||||
|
||||
def about(self):
|
||||
about_text = translate('CustomPlugin',
|
||||
'<b>Custom Plugin</b><br>This plugin '
|
||||
|
@ -39,15 +39,6 @@ class ImagePlugin(Plugin):
|
||||
self.icon = build_icon(u':/plugins/plugin_images.png')
|
||||
self.status = PluginStatus.Active
|
||||
|
||||
def initialise(self):
|
||||
log.info(u'Plugin Initialising')
|
||||
Plugin.initialise(self)
|
||||
self.insert_toolbox_item()
|
||||
|
||||
def finalise(self):
|
||||
log.info(u'Plugin Finalise')
|
||||
self.remove_toolbox_item()
|
||||
|
||||
def get_settings_tab(self):
|
||||
return ImageTab(self.name)
|
||||
|
||||
|
@ -67,15 +67,6 @@ class MediaPlugin(Plugin):
|
||||
type = u''
|
||||
return list, type
|
||||
|
||||
def initialise(self):
|
||||
log.info(u'Plugin Initialising')
|
||||
Plugin.initialise(self)
|
||||
self.insert_toolbox_item()
|
||||
|
||||
def finalise(self):
|
||||
log.info(u'Plugin Finalise')
|
||||
self.remove_toolbox_item()
|
||||
|
||||
def get_media_manager_item(self):
|
||||
# Create the MediaManagerItem object
|
||||
return MediaMediaItem(self, self.icon, self.name)
|
||||
|
@ -64,7 +64,7 @@ class PresentationPlugin(Plugin):
|
||||
controller = self.controllers[key]
|
||||
if controller.enabled:
|
||||
controller.kill()
|
||||
self.remove_toolbox_item()
|
||||
Plugin.finalise(self)
|
||||
|
||||
def get_media_manager_item(self):
|
||||
"""
|
||||
|
@ -56,7 +56,7 @@ class RemotesPlugin(Plugin):
|
||||
Tidy up and close down the http server
|
||||
"""
|
||||
log.debug(u'finalise')
|
||||
self.remove_toolbox_item()
|
||||
Plugin.finalise(self)
|
||||
if self.server:
|
||||
self.server.close()
|
||||
|
||||
|
@ -166,13 +166,13 @@ class SongMediaItem(MediaManagerItem):
|
||||
if search_type == 0:
|
||||
log.debug(u'Titles Search')
|
||||
search_results = self.parent.manager.get_all_objects_filtered(Song,
|
||||
Song.search_title.like(u'%' + keywords + u'%'),
|
||||
Song.search_title.like(u'%' + search_keywords + u'%'),
|
||||
Song.search_title.asc())
|
||||
self.displayResultsSong(search_results)
|
||||
elif search_type == 1:
|
||||
log.debug(u'Lyrics Search')
|
||||
search_results = self.parent.manager.get_all_objects_filtered(Song,
|
||||
Song.search_lyrics.like(u'%' + keywords + u'%'),
|
||||
Song.search_lyrics.like(u'%' + search_keywords + u'%'),
|
||||
Song.search_lyrics.asc())
|
||||
self.displayResultsSong(search_results)
|
||||
elif search_type == 2:
|
||||
|
@ -67,15 +67,9 @@ class SongsPlugin(Plugin):
|
||||
def initialise(self):
|
||||
log.info(u'Songs Initialising')
|
||||
Plugin.initialise(self)
|
||||
self.insert_toolbox_item()
|
||||
self.media_item.displayResultsSong(
|
||||
self.manager.get_all_objects(Song, Song.title))
|
||||
|
||||
def finalise(self):
|
||||
log.info(u'Plugin Finalise')
|
||||
Plugin.finalise(self)
|
||||
self.remove_toolbox_item()
|
||||
|
||||
def get_media_manager_item(self):
|
||||
"""
|
||||
Create the MediaManagerItem object, which is displaed in the
|
||||
|
Loading…
Reference in New Issue
Block a user