From 17209fcc293dd99cce386241d6c9a87a2f43ae42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Armin=20K=C3=B6hler?= Date: Sun, 5 Jun 2011 20:46:00 +0200 Subject: [PATCH] define appStartup() in plugin.py remove hassattr(plugin, appStartup) --- openlp/core/lib/plugin.py | 6 ++++++ openlp/core/ui/mainwindow.py | 2 +- openlp/core/ui/pluginform.py | 4 +--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index 65ed76dfe..910c52d2c 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -300,6 +300,12 @@ class Plugin(QtCore.QObject): if self.mediaItem: self.mediadock.remove_dock(self.mediaItem) + def appStartup(self): + """ + Perform tasks on application starup + """ + pass + def usesTheme(self, theme): """ Called to find out if a plugin is currently using a theme. diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index bacbff073..b4a3b3640 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -655,7 +655,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): # Give all the plugins a chance to perform some tasks at startup Receiver.send_message(u'openlp_process_events') for plugin in self.pluginManager.plugins: - if plugin.isActive() and hasattr(plugin, u'appStartup'): + if plugin.isActive(): Receiver.send_message(u'openlp_process_events') plugin.appStartup() Receiver.send_message(u'openlp_process_events') diff --git a/openlp/core/ui/pluginform.py b/openlp/core/ui/pluginform.py index 37c6c8d63..b4c87488c 100644 --- a/openlp/core/ui/pluginform.py +++ b/openlp/core/ui/pluginform.py @@ -132,9 +132,7 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog): Receiver.send_message(u'cursor_busy') self.activePlugin.toggleStatus(PluginStatus.Active) Receiver.send_message(u'cursor_normal') - if hasattr(self.activePlugin, u'appStartup'): - Receiver.send_message(u'openlp_process_events') - self.activePlugin.appStartup() + self.activePlugin.appStartup() else: self.activePlugin.toggleStatus(PluginStatus.Inactive) status_text = unicode(