Merge lp:~trb143/openlp/audit into lp:openlp

Proposed by Tim Bentley
Status: Superseded
Proposed branch: lp:~trb143/openlp/audit
Merge into: lp:openlp
Diff against target: 547 lines
15 files modified
openlp/core/lib/plugin.py (+8/-20)
openlp/core/lib/pluginmanager.py (+7/-7)
openlp/core/ui/__init__.py (+2/-1)
openlp/core/ui/mainwindow.py (+7/-4)
openlp/core/ui/mediadockmanager.py (+51/-0)
openlp/core/ui/settingsform.py (+27/-14)
openlp/plugins/bibles/bibleplugin.py (+24/-2)
openlp/plugins/bibles/lib/mediaitem.py (+2/-1)
openlp/plugins/images/lib/imagetab.py (+1/-1)
openlp/plugins/media/lib/mediaitem.py (+3/-2)
openlp/plugins/media/mediaplugin.py (+17/-0)
openlp/plugins/presentations/presentationplugin.py (+13/-0)
openlp/plugins/remotes/remoteplugin.py (+3/-0)
openlp/plugins/songs/lib/mediaitem.py (+1/-1)
openlp/plugins/songs/songsplugin.py (+23/-5)
To merge this branch: bzr merge lp:~trb143/openlp/audit
Reviewer Review Type Date Requested Status
OpenLP Core Pending
Review via email: mp+13005@code.launchpad.net

This proposal has been superseded by a proposal from 2009-10-08.

Commit message

Fixed up all plugins except Presentations cos it's complex.
Sorted out issues with current trunk.

Enjoy

To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) wrote :

Following the last merge made some cleanups and simplifications to the process.

The hiding has been stopped for now and I just disable the Media Dock.

lp:~trb143/openlp/audit updated
617. By Tim Bentley

More cleanups, Bibles and media done

618. By Tim Bentley

Songs now play hide and seek

619. By Tim Bentley

Presentations add code but leave for now - Angels fear to tread

620. By Tim Bentley

Fix Bible plugin rendering

621. By Tim Bentley

Bible New features and Clean up

622. By Tim Bentley

More dock hiding work

623. By Tim Bentley

Head

624. By Tim Bentley

More hiding changes

625. By Tim Bentley

Head

626. By Tim Bentley

Plugins now hide and reappear correctly

627. By Tim Bentley

Remove all print statements

628. By Tim Bentley

Theme improvements

629. By Tim Bentley

Latest Version checking added

630. By Tim Bentley

Correct Theme name for Export if default

631. By Tim Bentley

Quick code cleanup and fix test for version checking

632. By Tim Bentley

Servie Manager DnD part 1

633. By Tim Bentley

Servie Manager DnD part 2

634. By Tim Bentley

Audit Cleanup - part 1

635. By Tim Bentley

Small fix ups and corrections. Plugin list obeys can_be_diabled

636. By Tim Bentley

Fixes to last merge request

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/core/lib/plugin.py'
2--- openlp/core/lib/plugin.py 2009-10-03 19:02:40 +0000
3+++ openlp/core/lib/plugin.py 2009-10-08 17:33:11 +0000
4@@ -119,9 +119,6 @@
5 self.icon = None
6 self.config = PluginConfig(self.name)
7 self.weight = 0
8- self.media_id = -1
9- self.settings_id = -1
10- self.media_active = False
11 self.status = PluginStatus.Inactive
12 # Set up logging
13 self.log = logging.getLogger(self.name)
14@@ -130,7 +127,7 @@
15 self.render_manager = plugin_helpers[u'render']
16 self.service_manager = plugin_helpers[u'service']
17 self.settings = plugin_helpers[u'settings']
18- self.mediatoolbox = plugin_helpers[u'toolbox']
19+ self.mediadock = plugin_helpers[u'toolbox']
20 QtCore.QObject.connect(Receiver.get_receiver(),
21 QtCore.SIGNAL(u'%s_add_service_item'% self.name), self.process_add_service_event)
22
23@@ -155,8 +152,8 @@
24 """
25 Sets the status of the plugin
26 """
27- self.status = self.config.get_config(\
28- u'%s_status' % self.name, PluginStatus.Inactive)
29+ self.status = int(self.config.get_config(\
30+ u'%s_status' % self.name, PluginStatus.Inactive))
31
32 def toggle_status(self, new_status):
33 """
34@@ -171,7 +168,7 @@
35
36 Returns True or False.
37 """
38- return int(self.status ) == int(PluginStatus.Active)
39+ return self.status == PluginStatus.Active
40
41 def get_media_manager_item(self):
42 """
43@@ -253,21 +250,12 @@
44 """
45 Called by the plugin to remove toolbar
46 """
47- if self.media_id is not -1:
48- self.mediatoolbox.removeItem(self.media_id)
49- if self.settings_id is not -1:
50- self.settings.removeTab(self.settings_id)
51- self.media_active = False
52+ self.mediadock.removeDock(self.name)
53+ self.settings.removeTab(self.name)
54
55 def insert_toolbox_item(self):
56 """
57 Called by plugin to replace toolbar
58 """
59- if not self.media_active:
60- if self.media_id is not -1:
61- self.mediatoolbox.insertItem(
62- self.media_id, self.media_item, self.icon, self.media_item.title)
63- if self.settings_id is not -1:
64- self.settings.insertTab(
65- self.settings_id, self.settings_tab)
66- self.media_active = True
67+ self.mediadock.insertDock(self.name)
68+ self.settings.insertTab(self.name)
69
70=== modified file 'openlp/core/lib/pluginmanager.py'
71--- openlp/core/lib/pluginmanager.py 2009-10-03 19:02:40 +0000
72+++ openlp/core/lib/pluginmanager.py 2009-10-08 17:33:11 +0000
73@@ -125,7 +125,7 @@
74 """
75 return cmp(x.weight, y.weight)
76
77- def hook_media_manager(self, mediatoolbox):
78+ def hook_media_manager(self, mediadock):
79 """
80 Loop through all the plugins. If a plugin has a valid media manager
81 item, add it to the media manager.
82@@ -139,9 +139,8 @@
83 if plugin.media_item is not None:
84 log.debug(u'Inserting media manager item from %s' % \
85 plugin.name)
86- plugin.media_id = mediatoolbox.addItem(
87- plugin.media_item, plugin.icon, plugin.media_item.title)
88- plugin.media_active = True
89+ mediadock.addDock(plugin.name,
90+ plugin.media_item, plugin.icon)
91
92 def hook_settings_tabs(self, settingsform=None):
93 """
94@@ -157,7 +156,7 @@
95 plugin.settings_tab = plugin.get_settings_tab()
96 if plugin.settings_tab is not None:
97 log.debug(u'Inserting settings tab item from %s' % plugin.name)
98- plugin.settings_id = settingsform.addTab(plugin.settings_tab)
99+ settingsform.addTab(plugin.name, plugin.settings_tab)
100 else:
101 log.debug(u'No tab settings in %s' % plugin.name)
102
103@@ -202,11 +201,12 @@
104 Loop through all the plugins and give them an opportunity to
105 initialise themselves.
106 """
107- log.info(u'initialising plugins')
108 for plugin in self.plugins:
109+ log.info(u'initialising plugins %s in a %s state'
110+ % (plugin.name, plugin.is_active()))
111 if plugin.is_active():
112 plugin.initialise()
113- if plugin.media_item is not None and not plugin.is_active():
114+ if not plugin.is_active():
115 plugin.remove_toolbox_item()
116
117 def finalise_plugins(self):
118
119=== modified file 'openlp/core/ui/__init__.py'
120--- openlp/core/ui/__init__.py 2009-09-25 00:43:42 +0000
121+++ openlp/core/ui/__init__.py 2009-10-08 17:33:11 +0000
122@@ -34,10 +34,11 @@
123 from alertform import AlertForm
124 from plugindialoglistform import PluginForm
125 from settingsform import SettingsForm
126+from mediadockmanager import MediaDockManager
127 from servicemanager import ServiceManager
128 from thememanager import ThemeManager
129 from mainwindow import MainWindow
130
131 __all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'MainWindow',
132 'MainDisplay', 'SlideController', 'ServiceManager', 'ThemeManager',
133- 'AmendThemeForm']
134+ 'AmendThemeForm', 'MediaDockManager']
135
136=== modified file 'openlp/core/ui/mainwindow.py'
137--- openlp/core/ui/mainwindow.py 2009-10-03 18:39:44 +0000
138+++ openlp/core/ui/mainwindow.py 2009-10-08 17:33:11 +0000
139@@ -29,9 +29,10 @@
140
141 from openlp.core.ui import AboutForm, SettingsForm, AlertForm, \
142 ServiceManager, ThemeManager, MainDisplay, SlideController, \
143- PluginForm
144+ PluginForm, MediaDockManager
145 from openlp.core.lib import translate, RenderManager, PluginConfig, \
146- OpenLPDockWidget, SettingsManager, PluginManager, Receiver, buildIcon
147+ OpenLPDockWidget, SettingsManager, PluginManager, Receiver, \
148+ buildIcon
149
150
151 class Ui_MainWindow(object):
152@@ -489,6 +490,8 @@
153 #ThemeManager needs to call RenderManager
154 self.RenderManager = RenderManager(self.ThemeManagerContents,
155 self.screenList, self.getMonitorNumber())
156+ #Define the media Dock Manager
157+ self.mediaDockManager = MediaDockManager(self.MediaToolBox)
158 log.info(u'Load Plugins')
159 #make the controllers available to the plugins
160 self.plugin_helpers[u'preview'] = self.PreviewController
161@@ -496,7 +499,7 @@
162 self.plugin_helpers[u'render'] = self.RenderManager
163 self.plugin_helpers[u'service'] = self.ServiceManagerContents
164 self.plugin_helpers[u'settings'] = self.settingsForm
165- self.plugin_helpers[u'toolbox'] = self.MediaToolBox
166+ self.plugin_helpers[u'toolbox'] = self.mediaDockManager
167 self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers)
168 # hook methods have to happen after find_plugins. Find plugins needs
169 # the controllers hence the hooks have moved from setupUI() to here
170@@ -505,7 +508,7 @@
171 self.plugin_manager.hook_settings_tabs(self.settingsForm)
172 # Find and insert media manager items
173 log.info(u'hook media')
174- self.plugin_manager.hook_media_manager(self.MediaToolBox)
175+ self.plugin_manager.hook_media_manager(self.mediaDockManager)
176 # Call the hook method to pull in import menus.
177 log.info(u'hook menus')
178 self.plugin_manager.hook_import_menu(self.FileImportMenu)
179
180=== added file 'openlp/core/ui/mediadockmanager.py'
181--- openlp/core/ui/mediadockmanager.py 1970-01-01 00:00:00 +0000
182+++ openlp/core/ui/mediadockmanager.py 2009-10-08 17:33:11 +0000
183@@ -0,0 +1,51 @@
184+# -*- coding: utf-8 -*-
185+# vim: autoindent shiftwidth=4 expanddock textwidth=80 dockstop=4 softdockstop=4
186+
187+###############################################################################
188+# OpenLP - Open Source Lyrics Projection #
189+# --------------------------------------------------------------------------- #
190+# Copyright (c) 2008-2009 Raoul Snyman #
191+# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten #
192+# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri #
193+# --------------------------------------------------------------------------- #
194+# This program is free software; you can redistribute it and/or modify it #
195+# under the terms of the GNU General Public License as published by the Free #
196+# Software Foundation; version 2 of the License. #
197+# #
198+# This program is distributed in the hope that it will be useful, but WITHOUT #
199+# ANY WARRANTY; without even the implied warranty of MERCHANdockILITY or #
200+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
201+# more details. #
202+# #
203+# You should have received a copy of the GNU General Public License along #
204+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
205+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
206+###############################################################################
207+
208+import logging
209+
210+log = logging.getLogger(u'MediaDockManager')
211+
212+class MediaDockManager(object):
213+
214+ def __init__(self, mediaDock):
215+ self.mediaDock = mediaDock
216+
217+ def addDock(self, name, media_item, icon):
218+ log.info(u'Adding %s dock' % name)
219+ id = self.mediaDock.addItem(
220+ media_item, icon, media_item.title)
221+
222+ def insertDock(self, name):
223+ log.debug(u'Inserting %s dock' % name)
224+ for tab_index in range(0, self.mediaDock.count()):
225+ #print self.mediaDock.widget(tab_index).ConfigSection, name
226+ if self.mediaDock.widget(tab_index).ConfigSection == name.lower():
227+ self.mediaDock.setItemEnabled(tab_index, True)
228+
229+ def removeDock(self, name):
230+ log.debug(u'remove %s dock' % name)
231+ for tab_index in range(0, self.mediaDock.count()):
232+ #print "rd", self.mediaDock.widget(tab_index).ConfigSection, name
233+ if self.mediaDock.widget(tab_index).ConfigSection == name.lower():
234+ self.mediaDock.setItemEnabled(tab_index, False)
235
236=== modified file 'openlp/core/ui/settingsform.py'
237--- openlp/core/ui/settingsform.py 2009-10-03 19:02:40 +0000
238+++ openlp/core/ui/settingsform.py 2009-10-08 17:33:11 +0000
239@@ -38,26 +38,39 @@
240 self.setupUi(self)
241 # General tab
242 self.GeneralTab = GeneralTab(screen_list)
243- self.addTab(self.GeneralTab)
244+ self.addTab(u'General', self.GeneralTab)
245 # Themes tab
246 self.ThemesTab = ThemesTab(mainWindow)
247- self.addTab(self.ThemesTab)
248+ self.addTab(u'Themes', self.ThemesTab)
249 # Alert tab
250 self.AlertsTab = AlertsTab()
251- self.addTab(self.AlertsTab)
252+ self.addTab(u'Alerts', self.AlertsTab)
253
254- def addTab(self, tab):
255+ def addTab(self, name, tab):
256 log.info(u'Adding %s tab' % tab.title())
257- return self.SettingsTabWidget.addTab(tab, tab.title())
258-
259- def insertTab(self, id, tab):
260- log.debug(u'Inserting %s tab' % tab.title())
261- self.SettingsTabWidget.insertTab(id, tab, tab.title())
262-
263- def removeTab(self, id):
264- log.debug(u'remove %s no tab' % unicode(id))
265- self.SettingsTabWidget.removeTab(id)
266-
267+ id = self.SettingsTabWidget.addTab(tab, tab.title())
268+
269+ def insertTab(self, name):
270+ log.debug(u'Inserting %s tab' % name)
271+ for tab_index in range(0, self.SettingsTabWidget.count()):
272+ #print self.SettingsTabWidget.widget(tab_index).title()
273+ if self.SettingsTabWidget.widget(tab_index).title() == name:
274+ #print "Insert match"
275+ #print self.SettingsTabWidget.widget(tab_index).isVisible()
276+ self.SettingsTabWidget.setTabEnabled(tab_index, True)
277+ #print self.SettingsTabWidget.widget(tab_index).isVisible()
278+
279+
280+ def removeTab(self, name):
281+ log.debug(u'remove %s tab' % name)
282+ #print ">>>>>>>>>>> remove settings"
283+ for tab_index in range(0, self.SettingsTabWidget.count()):
284+ #print "rt", self.SettingsTabWidget.widget(tab_index).title(), name
285+ if self.SettingsTabWidget.widget(tab_index).title() == name:
286+ #print "remove match"
287+ #print self.SettingsTabWidget.widget(tab_index).isVisible()
288+ self.SettingsTabWidget.setTabEnabled(tab_index, False)
289+ #print self.SettingsTabWidget.widget(tab_index).isVisible()
290
291 def accept(self):
292 for tab_index in range(0, self.SettingsTabWidget.count()):
293
294=== modified file 'openlp/plugins/bibles/bibleplugin.py'
295--- openlp/plugins/bibles/bibleplugin.py 2009-10-03 19:02:40 +0000
296+++ openlp/plugins/bibles/bibleplugin.py 2009-10-08 17:33:11 +0000
297@@ -41,7 +41,26 @@
298 # Create the plugin icon
299 self.icon = buildIcon(u':/media/media_bible.png')
300 #Register the bible Manager
301- self.biblemanager = BibleManager(self.config)
302+ self.biblemanager = None
303+
304+ def can_be_disabled(self):
305+ return True
306+
307+ def initialise(self):
308+ log.info(u'bibles Initialising')
309+ if self.biblemanager is None:
310+ self.biblemanager = BibleManager(self.config)
311+ Plugin.initialise(self)
312+ self.insert_toolbox_item()
313+ self.ImportBibleItem.setVisible(True)
314+ self.ExportBibleItem.setVisible(True)
315+
316+ def finalise(self):
317+ log.info(u'Plugin Finalise')
318+ Plugin.finalise(self)
319+ self.remove_toolbox_item()
320+ self.ImportBibleItem.setVisible(False)
321+ self.ExportBibleItem.setVisible(False)
322
323 def get_settings_tab(self):
324 return BiblesTab()
325@@ -58,15 +77,18 @@
326 # Signals and slots
327 QtCore.QObject.connect(self.ImportBibleItem,
328 QtCore.SIGNAL(u'triggered()'), self.onBibleNewClick)
329+ self.ImportBibleItem.setVisible(False)
330
331 def add_export_menu_item(self, export_menu):
332 self.ExportBibleItem = QtGui.QAction(export_menu)
333 self.ExportBibleItem.setObjectName(u'ExportBibleItem')
334 export_menu.addAction(self.ExportBibleItem)
335 self.ExportBibleItem.setText(translate(u'BiblePlugin', u'&Bible'))
336+ self.ExportBibleItem.setVisible(False)
337
338 def onBibleNewClick(self):
339- self.media_item.onBibleNewClick()
340+ if self.media_item is not None:
341+ self.media_item.onNewClick()
342
343 def about(self):
344 return u'<b>Bible Plugin</b> <br>This plugin allows bible verse from different sources to be displayed on the screen during the service.<br><br>This is a core plugin and cannot be made inactive</b>'
345
346=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
347--- openlp/plugins/bibles/lib/mediaitem.py 2009-09-29 17:05:34 +0000
348+++ openlp/plugins/bibles/lib/mediaitem.py 2009-10-08 17:33:11 +0000
349@@ -226,9 +226,10 @@
350 translate(u'BibleMediaItem', u'Keep'))
351
352 def initialise(self):
353- log.debug(u'initialise')
354+ log.debug(u'bible manager initialise')
355 self.loadBibles()
356 self.parent.biblemanager.set_media_manager(self)
357+ log.debug(u'bible manager initialise complete')
358
359 def setQuickMessage(self, text):
360 self.QuickMessage.setText(translate(u'BibleMediaItem', unicode(text)))
361
362=== modified file 'openlp/plugins/images/lib/imagetab.py'
363--- openlp/plugins/images/lib/imagetab.py 2009-09-25 00:43:42 +0000
364+++ openlp/plugins/images/lib/imagetab.py 2009-10-08 17:33:11 +0000
365@@ -31,7 +31,7 @@
366 ImageTab is the Image settings tab in the settings dialog.
367 """
368 def __init__(self):
369- SettingsTab.__init__(self, translate(u'ImageTab', u'Image'), u'Image')
370+ SettingsTab.__init__(self, translate(u'ImageTab', u'Images'), u'Image')
371
372 def setupUi(self):
373 self.setObjectName(u'ImageTab')
374
375=== modified file 'openlp/plugins/media/lib/mediaitem.py'
376--- openlp/plugins/media/lib/mediaitem.py 2009-09-26 09:11:39 +0000
377+++ openlp/plugins/media/lib/mediaitem.py 2009-10-08 17:33:11 +0000
378@@ -46,9 +46,10 @@
379 self.TranslationContext = u'MediaPlugin'
380 self.IconPath = u'images/image'
381 self.PluginTextShort = u'Media'
382- self.ConfigSection = u'images'
383+ self.ConfigSection = u'media'
384 self.OnNewPrompt = u'Select Media(s)'
385- self.OnNewFileMasks = u'Videos (*.avi *.mpeg *.mpg *.mp4);;Audio (*.ogg *.mp3 *.wma);;All files (*)'
386+ self.OnNewFileMasks = \
387+ u'Videos (*.avi *.mpeg *.mpg *.mp4);;Audio (*.ogg *.mp3 *.wma);;All files (*)'
388 # this next is a class, not an instance of a class - it will
389 # be instanced by the base MediaManagerItem
390 self.ListViewWithDnD_class = MediaListView
391
392=== modified file 'openlp/plugins/media/mediaplugin.py'
393--- openlp/plugins/media/mediaplugin.py 2009-10-03 19:02:40 +0000
394+++ openlp/plugins/media/mediaplugin.py 2009-10-08 17:33:11 +0000
395@@ -22,10 +22,15 @@
396 # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
397 ###############################################################################
398
399+import logging
400+
401 from openlp.core.lib import Plugin, buildIcon
402 from openlp.plugins.media.lib import MediaTab, MediaMediaItem
403
404 class MediaPlugin(Plugin):
405+ global log
406+ log = logging.getLogger(u'MediaPlugin')
407+ log.info(u'Media Plugin loaded')
408
409 def __init__(self, plugin_helpers):
410 # Call the parent constructor
411@@ -39,6 +44,18 @@
412 def get_settings_tab(self):
413 return MediaTab()
414
415+ def can_be_disabled(self):
416+ return True
417+
418+ def initialise(self):
419+ log.info(u'Plugin Initialising')
420+ Plugin.initialise(self)
421+ self.insert_toolbox_item()
422+
423+ def finalise(self):
424+ log.info(u'Plugin Finalise')
425+ self.remove_toolbox_item()
426+
427 def get_media_manager_item(self):
428 # Create the MediaManagerItem object
429 return MediaMediaItem(self, self.icon, u'Media')
430
431=== modified file 'openlp/plugins/presentations/presentationplugin.py'
432--- openlp/plugins/presentations/presentationplugin.py 2009-10-03 19:02:40 +0000
433+++ openlp/plugins/presentations/presentationplugin.py 2009-10-08 17:33:11 +0000
434@@ -51,6 +51,19 @@
435 Create the settings Tab
436 """
437 return PresentationTab(self.controllers)
438+#
439+# def can_be_disabled(self):
440+# return True
441+#
442+# def initialise(self):
443+# log.info(u'Presentations Initialising')
444+# Plugin.initialise(self)
445+# self.insert_toolbox_item()
446+#
447+# def finalise(self):
448+# log.info(u'Plugin Finalise')
449+# Plugin.finalise(self)
450+# self.remove_toolbox_item()
451
452 def get_media_manager_item(self):
453 """
454
455=== modified file 'openlp/plugins/remotes/remoteplugin.py'
456--- openlp/plugins/remotes/remoteplugin.py 2009-10-03 07:25:41 +0000
457+++ openlp/plugins/remotes/remoteplugin.py 2009-10-08 17:33:11 +0000
458@@ -41,6 +41,8 @@
459
460 def initialise(self):
461 log.debug(u'initialise')
462+ Plugin.initialise(self)
463+ self.insert_toolbox_item()
464 self.server = QtNetwork.QUdpSocket()
465 self.server.bind(int(self.config.get_config(u'remote port', 4316)))
466 QtCore.QObject.connect(self.server,
467@@ -48,6 +50,7 @@
468
469 def finalise(self):
470 log.debug(u'finalise')
471+ self.remove_toolbox_item()
472 if self.server is not None:
473 self.server.close()
474
475
476=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
477--- openlp/plugins/songs/lib/mediaitem.py 2009-09-29 02:54:32 +0000
478+++ openlp/plugins/songs/lib/mediaitem.py 2009-10-08 17:33:11 +0000
479@@ -46,7 +46,7 @@
480 def __init__(self, parent, icon, title):
481 self.TranslationContext = u'SongPlugin'
482 self.PluginTextShort = u'Song'
483- self.ConfigSection = u'song'
484+ self.ConfigSection = u'songs'
485 self.IconPath = u'songs/song'
486 self.ListViewWithDnD_class = SongListView
487 self.ServiceItemIconName = u':/media/song_image.png'
488
489=== modified file 'openlp/plugins/songs/songsplugin.py'
490--- openlp/plugins/songs/songsplugin.py 2009-10-03 18:39:44 +0000
491+++ openlp/plugins/songs/songsplugin.py 2009-10-08 17:33:11 +0000
492@@ -51,7 +51,7 @@
493 # Call the parent constructor
494 Plugin.__init__(self, u'Songs', u'1.9.0', plugin_helpers)
495 self.weight = -10
496- self.songmanager = SongManager(self.config)
497+ self.songmanager = None
498 self.openlp_import_form = OpenLPImportForm()
499 self.opensong_import_form = OpenSongImportForm()
500 self.openlp_export_form = OpenLPExportForm()
501@@ -59,6 +59,26 @@
502 # Create the plugin icon
503 self.icon = buildIcon(u':/media/media_song.png')
504
505+ def can_be_disabled(self):
506+ return True
507+
508+ def initialise(self):
509+ log.info(u'Songs Initialising')
510+ if self.songmanager is None:
511+ self.songmanager = SongManager(self.config)
512+ Plugin.initialise(self)
513+ self.insert_toolbox_item()
514+ self.ImportSongMenu.menuAction().setVisible(True)
515+ self.ExportSongMenu.menuAction().setVisible(True)
516+ self.media_item.displayResultsSong(self.songmanager.get_songs())
517+
518+ def finalise(self):
519+ log.info(u'Plugin Finalise')
520+ Plugin.finalise(self)
521+ self.remove_toolbox_item()
522+ self.ImportSongMenu.menuAction().setVisible(False)
523+ self.ExportSongMenu.menuAction().setVisible(False)
524+
525 def get_media_manager_item(self):
526 """
527 Create the MediaManagerItem object, which is displaed in the
528@@ -109,6 +129,7 @@
529 QtCore.SIGNAL(u'triggered()'), self.onImportOpenlp1ItemClick)
530 QtCore.QObject.connect(self.ImportOpenSongItem,
531 QtCore.SIGNAL(u'triggered()'), self.onImportOpenSongItemClick)
532+ self.ImportSongMenu.menuAction().setVisible(False)
533
534 def add_export_menu_item(self, export_menu):
535 """
536@@ -143,10 +164,7 @@
537 QtCore.SIGNAL(u'triggered()'), self.onExportOpenlp1ItemClicked)
538 QtCore.QObject.connect(self.ExportOpenSongItem,
539 QtCore.SIGNAL(u'triggered()'), self.onExportOpenSongItemClicked)
540-
541- def initialise(self):
542- Plugin.initialise(self)
543- self.media_item.displayResultsSong(self.songmanager.get_songs())
544+ self.ExportSongMenu.menuAction().setVisible(False)
545
546 def onImportOpenlp1ItemClick(self):
547 self.openlp_import_form.show()