define appStartup() in plugin.py

remove hassattr(plugin, appStartup)
This commit is contained in:
Armin Köhler 2011-06-05 20:46:00 +02:00
parent 5505644176
commit 17209fcc29
3 changed files with 8 additions and 4 deletions

View File

@ -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.

View File

@ -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')

View File

@ -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(