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

Proposed by Tim Bentley
Status: Merged
Merged at revision: not available
Proposed branch: lp:~trb143/openlp/audit
Merge into: lp:openlp
Diff against target: 784 lines
18 files modified
openlp/core/lib/mediamanageritem.py (+1/-2)
openlp/core/lib/plugin.py (+53/-14)
openlp/core/lib/pluginmanager.py (+28/-17)
openlp/core/ui/mainwindow.py (+3/-8)
openlp/core/ui/plugindialoglistform.py (+27/-5)
openlp/core/ui/settingsform.py (+11/-2)
openlp/plugins/audit/auditplugin.py (+20/-19)
openlp/plugins/audit/lib/__init__.py (+0/-1)
openlp/plugins/audit/lib/audittab.py (+0/-61)
openlp/plugins/bibles/bibleplugin.py (+2/-4)
openlp/plugins/custom/customplugin.py (+1/-2)
openlp/plugins/images/imageplugin.py (+14/-4)
openlp/plugins/images/lib/mediaitem.py (+2/-0)
openlp/plugins/media/mediaplugin.py (+2/-4)
openlp/plugins/presentations/presentationplugin.py (+2/-4)
openlp/plugins/remotes/lib/remotetab.py (+0/-14)
openlp/plugins/remotes/remoteplugin.py (+5/-16)
openlp/plugins/songs/songsplugin.py (+2/-2)
To merge this branch: bzr merge lp:~trb143/openlp/audit
Reviewer Review Type Date Requested Status
Raoul Snyman Approve
Review via email: mp+12828@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) wrote :

Ok this one is big and messy.

We now have the ability to make plugins inactive. That is hide them from view.
In reality they need to be created then deleted and removed quickly.

To get this to work I have needed to restructure the Plugin initialisation code which was inconsistent. It now al works the same way.

3 plugins have been migrated to this scheme (image , audit and remote) more will follow.

Enjoy

BTW I'm looking forward to doing the Presentation plugin!!!!

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

We'll pick up the pieces later :-P

review: Approve
lp:~trb143/openlp/audit updated
611. By Tim Bentley

Fix int issue

612. By Tim Bentley

Head

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/core/lib/mediamanageritem.py'
2--- openlp/core/lib/mediamanageritem.py 2009-09-26 09:11:39 +0000
3+++ openlp/core/lib/mediamanageritem.py 2009-10-03 19:10:23 +0000
4@@ -118,7 +118,7 @@
5 self.requiredIcons()
6 self.setupUi()
7 self.retranslateUi()
8- self.initialise()
9+ #self.initialise()
10
11 def requiredIcons(self):
12 """
13@@ -131,7 +131,6 @@
14 self.hasFileIcon = False
15 self.hasDeleteIcon = True
16
17-
18 def retranslateUi(self):
19 """
20 This method is called automatically to provide OpenLP with the
21
22=== modified file 'openlp/core/lib/plugin.py'
23--- openlp/core/lib/plugin.py 2009-10-01 16:56:42 +0000
24+++ openlp/core/lib/plugin.py 2009-10-03 19:10:23 +0000
25@@ -31,8 +31,9 @@
26 """
27 Defines the status of the plugin
28 """
29- Active = 1
30- Inactive = 2
31+ Active = 0
32+ Inactive = 1
33+ Disabled = 2
34
35 class Plugin(object):
36 """
37@@ -85,17 +86,6 @@
38 ``about()``
39 Used in the plugin manager, when a person clicks on the 'About' button.
40
41- ``save(data)``
42- A method to convert the plugin's data to a string to be stored in the
43- Service file.
44-
45- ``load(string)``
46- A method to convert the string from a Service file into the plugin's
47- own data format.
48-
49- ``render(theme, screen_number)``
50- A method used to render something to the screen, given the current theme
51- and screen number.
52 """
53 global log
54 log = logging.getLogger(u'Plugin')
55@@ -129,6 +119,9 @@
56 self.icon = None
57 self.config = PluginConfig(self.name)
58 self.weight = 0
59+ self.media_id = -1
60+ self.settings_id = -1
61+ self.media_active = False
62 self.status = PluginStatus.Inactive
63 # Set up logging
64 self.log = logging.getLogger(self.name)
65@@ -137,6 +130,7 @@
66 self.render_manager = plugin_helpers[u'render']
67 self.service_manager = plugin_helpers[u'service']
68 self.settings = plugin_helpers[u'settings']
69+ self.mediatoolbox = plugin_helpers[u'toolbox']
70 QtCore.QObject.connect(Receiver.get_receiver(),
71 QtCore.SIGNAL(u'%s_add_service_item'% self.name), self.process_add_service_event)
72
73@@ -157,6 +151,28 @@
74 """
75 return False
76
77+ def set_status(self):
78+ """
79+ Sets the status of the plugin
80+ """
81+ self.status = self.config.get_config(\
82+ u'%s_status' % self.name, PluginStatus.Inactive)
83+
84+ def toggle_status(self, new_status):
85+ """
86+ Changes the status of the plugin and remembers it
87+ """
88+ self.status = new_status
89+ self.config.set_config(u'%s_status' % self.name, self.status)
90+
91+ def is_active(self):
92+ """
93+ Indicates if the plugin is active
94+
95+ Returns True or False.
96+ """
97+ return int(self.status ) == int(PluginStatus.Active)
98+
99 def get_media_manager_item(self):
100 """
101 Construct a MediaManagerItem object with all the buttons and things
102@@ -224,7 +240,8 @@
103 """
104 Called by the plugin Manager to initialise anything it needs.
105 """
106- pass
107+ if self.media_item is not None:
108+ self.media_item.initialise()
109
110 def finalise(self):
111 """
112@@ -232,3 +249,25 @@
113 """
114 pass
115
116+ def remove_toolbox_item(self):
117+ """
118+ Called by the plugin to remove toolbar
119+ """
120+ if self.media_id is not -1:
121+ self.mediatoolbox.removeItem(self.media_id)
122+ if self.settings_id is not -1:
123+ self.settings.removeTab(self.settings_id)
124+ self.media_active = False
125+
126+ def insert_toolbox_item(self):
127+ """
128+ Called by plugin to replace toolbar
129+ """
130+ if not self.media_active:
131+ if self.media_id is not -1:
132+ self.mediatoolbox.insertItem(
133+ self.media_id, self.media_item, self.icon, self.media_item.title)
134+ if self.settings_id is not -1:
135+ self.settings.insertTab(
136+ self.settings_id, self.settings_tab)
137+ self.media_active = True
138
139=== modified file 'openlp/core/lib/pluginmanager.py'
140--- openlp/core/lib/pluginmanager.py 2009-09-21 17:56:36 +0000
141+++ openlp/core/lib/pluginmanager.py 2009-10-03 19:10:23 +0000
142@@ -105,7 +105,12 @@
143 for plugin in plugins_list:
144 if plugin.check_pre_conditions():
145 log.debug(u'Plugin %s active', unicode(plugin.name))
146- plugin.status = PluginStatus.Active
147+ if plugin.can_be_disabled():
148+ plugin.set_status()
149+ else:
150+ plugin.status = PluginStatus.Active
151+ else:
152+ plugin.status = PluginStatus.Disabled
153 self.plugins.append(plugin)
154
155 def order_by_weight(self, x, y):
156@@ -129,13 +134,14 @@
157 The Media Manager itself.
158 """
159 for plugin in self.plugins:
160- if plugin.status == PluginStatus.Active:
161- media_manager_item = plugin.get_media_manager_item()
162- if media_manager_item is not None:
163+ if plugin.status is not PluginStatus.Disabled:
164+ plugin.media_item = plugin.get_media_manager_item()
165+ if plugin.media_item is not None:
166 log.debug(u'Inserting media manager item from %s' % \
167 plugin.name)
168- mediatoolbox.addItem(media_manager_item, plugin.icon,
169- media_manager_item.title)
170+ plugin.media_id = mediatoolbox.addItem(
171+ plugin.media_item, plugin.icon, plugin.media_item.title)
172+ plugin.media_active = True
173
174 def hook_settings_tabs(self, settingsform=None):
175 """
176@@ -147,12 +153,13 @@
177 Defaults to *None*. The settings form to add tabs to.
178 """
179 for plugin in self.plugins:
180- settings_tab = plugin.get_settings_tab()
181- if settings_tab is not None:
182- log.debug(u'Inserting settings tab item from %s' % plugin.name)
183- settingsform.addTab(settings_tab)
184- else:
185- log.debug(u'No settings in %s' % plugin.name)
186+ if plugin.status is not PluginStatus.Disabled:
187+ plugin.settings_tab = plugin.get_settings_tab()
188+ if plugin.settings_tab is not None:
189+ log.debug(u'Inserting settings tab item from %s' % plugin.name)
190+ plugin.settings_id = settingsform.addTab(plugin.settings_tab)
191+ else:
192+ log.debug(u'No tab settings in %s' % plugin.name)
193
194 def hook_import_menu(self, import_menu):
195 """
196@@ -163,7 +170,7 @@
197 The Import menu.
198 """
199 for plugin in self.plugins:
200- if plugin.status == PluginStatus.Active:
201+ if plugin.status is not PluginStatus.Disabled:
202 plugin.add_import_menu_item(import_menu)
203
204 def hook_export_menu(self, export_menu):
205@@ -175,7 +182,7 @@
206 The Export menu.
207 """
208 for plugin in self.plugins:
209- if plugin.status == PluginStatus.Active:
210+ if plugin.status is not PluginStatus.Disabled:
211 plugin.add_export_menu_item(export_menu)
212
213 def hook_tools_menu(self, tools_menu):
214@@ -187,7 +194,7 @@
215 The Tools menu.
216 """
217 for plugin in self.plugins:
218- if plugin.status == PluginStatus.Active:
219+ if plugin.status is not PluginStatus.Disabled:
220 plugin.add_tools_menu_item(tools_menu)
221
222 def initialise_plugins(self):
223@@ -195,15 +202,19 @@
224 Loop through all the plugins and give them an opportunity to
225 initialise themselves.
226 """
227+ log.info(u'initialising plugins')
228 for plugin in self.plugins:
229- if plugin.status == PluginStatus.Active:
230+ if plugin.is_active():
231 plugin.initialise()
232+ if plugin.media_item is not None and not plugin.is_active():
233+ plugin.remove_toolbox_item()
234
235 def finalise_plugins(self):
236 """
237 Loop through all the plugins and give them an opportunity to
238 clean themselves up
239 """
240+ log.info(u'finalising plugins')
241 for plugin in self.plugins:
242- if plugin.status == PluginStatus.Active:
243+ if plugin.is_active():
244 plugin.finalise()
245
246=== modified file 'openlp/core/ui/mainwindow.py'
247--- openlp/core/ui/mainwindow.py 2009-09-29 02:54:32 +0000
248+++ openlp/core/ui/mainwindow.py 2009-10-03 19:10:23 +0000
249@@ -109,19 +109,12 @@
250 self.MediaManagerDock.setObjectName(u'MediaManagerDock')
251 self.MediaManagerDock.setMinimumWidth(
252 self.settingsmanager.mainwindow_left)
253-
254-# self.MediaManagerDock.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Ignored,
255-# QtGui.QSizePolicy.Maximum))
256-# geometry = self.MediaManagerDock.geometry()
257-# geometry.setWidth(self.settingsmanager.mainwindow_left)
258-# self.MediaManagerDock.setGeometry(geometry)
259-# self.MediaManagerDock.setMinimumWidth(10)
260-
261 self.MediaManagerContents = QtGui.QWidget()
262 self.MediaManagerContents.setObjectName(u'MediaManagerContents')
263 self.MediaManagerLayout = QtGui.QHBoxLayout(self.MediaManagerContents)
264 self.MediaManagerLayout.setContentsMargins(0, 2, 0, 0)
265 self.MediaManagerLayout.setObjectName(u'MediaManagerLayout')
266+ # Create the media toolbox
267 self.MediaToolBox = QtGui.QToolBox(self.MediaManagerContents)
268 self.MediaToolBox.setObjectName(u'MediaToolBox')
269 self.MediaManagerLayout.addWidget(self.MediaToolBox)
270@@ -503,6 +496,7 @@
271 self.plugin_helpers[u'render'] = self.RenderManager
272 self.plugin_helpers[u'service'] = self.ServiceManagerContents
273 self.plugin_helpers[u'settings'] = self.settingsForm
274+ self.plugin_helpers[u'toolbox'] = self.MediaToolBox
275 self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers)
276 # hook methods have to happen after find_plugins. Find plugins needs
277 # the controllers hence the hooks have moved from setupUI() to here
278@@ -528,6 +522,7 @@
279 log.info(u'Load data from Settings')
280 self.settingsForm.postSetUp()
281
282+
283 def getMonitorNumber(self):
284 """
285 Set up the default behaviour of the monitor configuration in
286
287=== modified file 'openlp/core/ui/plugindialoglistform.py'
288--- openlp/core/ui/plugindialoglistform.py 2009-10-02 14:19:36 +0000
289+++ openlp/core/ui/plugindialoglistform.py 2009-10-03 19:10:23 +0000
290@@ -11,6 +11,20 @@
291 from PyQt4 import QtCore, QtGui
292 from openlp.core.lib import translate, PluginStatus, buildIcon
293
294+class PluginCombo(QtGui.QComboBox):
295+ """
296+ Customised version of QTableWidget which can respond to keyboard
297+ events.
298+ """
299+ def __init__(self, parent=None, plugin=None):
300+ QtGui.QComboBox.__init__(self, parent)
301+ self.parent = parent
302+ self.plugin = plugin
303+
304+ def enterEvent(self, event):
305+ self.parent.activePlugin = self.plugin
306+ event.ignore()
307+
308 class PluginForm(QtGui.QDialog):
309 global log
310 log = logging.getLogger(u'PluginForm')
311@@ -18,6 +32,7 @@
312 def __init__(self, parent=None):
313 QtGui.QDialog.__init__(self, parent)
314 self.parent = parent
315+ self.activePlugin = None
316 self.setupUi(self)
317 log.debug(u'Defined')
318
319@@ -57,7 +72,6 @@
320 self.AboutTextLabel.setWordWrap(True)
321 self.AboutTextLabel.setObjectName("AboutTextLabel")
322
323-
324 self.retranslateUi(PluginForm)
325 QtCore.QObject.connect(self.ButtonBox,
326 QtCore.SIGNAL(u'accepted()'), PluginForm.close)
327@@ -92,19 +106,20 @@
328 self.PluginViewList.setItem(row, 0, item1)
329 self.PluginViewList.setItem(row, 1, item2)
330 if plugin.can_be_disabled():
331- combo = QtGui.QComboBox()
332+ combo = PluginCombo(self, plugin)
333 self.PluginViewList.setCellWidget(row, 2, combo)
334 combo.addItem(translate(u'PluginForm', u'Active'))
335 combo.addItem(translate(u'PluginForm', u'Inactive'))
336-# if plugin.status == PluginStatus.Active:
337- self.PluginViewList.setRowHeight(row, 25)
338+ combo.setCurrentIndex(int(plugin.status))
339+ QtCore.QObject.connect(combo,
340+ QtCore.SIGNAL(u'currentIndexChanged(int)'), self.statusComboChanged)
341 else:
342 item3 = QtGui.QTableWidgetItem(
343 translate(u'PluginForm', u'Active'))
344 item3.setTextAlignment(QtCore.Qt.AlignVCenter)
345 item3.setFlags(QtCore.Qt.ItemIsSelectable)
346 self.PluginViewList.setItem(row, 2, item3)
347- self.PluginViewList.setRowHeight(row, 15)
348+ self.PluginViewList.setRowHeight(row, 25)
349
350 def displayAbout(self, item):
351 if item is None:
352@@ -114,3 +129,10 @@
353 if text is not None:
354 self.AboutTextLabel.setText(translate(u'PluginList', text))
355
356+ def statusComboChanged(self, status):
357+ log.debug(u'Combo status changed %s for plugin %s' %(status, self.activePlugin.name))
358+ self.activePlugin.toggle_status(status)
359+ if status == PluginStatus.Active:
360+ self.activePlugin.initialise()
361+ else:
362+ self.activePlugin.finalise()
363
364=== modified file 'openlp/core/ui/settingsform.py'
365--- openlp/core/ui/settingsform.py 2009-09-25 00:43:42 +0000
366+++ openlp/core/ui/settingsform.py 2009-10-03 19:10:23 +0000
367@@ -47,8 +47,17 @@
368 self.addTab(self.AlertsTab)
369
370 def addTab(self, tab):
371- log.info(u'Inserting %s' % tab.title())
372- self.SettingsTabWidget.addTab(tab, tab.title())
373+ log.info(u'Adding %s tab' % tab.title())
374+ return self.SettingsTabWidget.addTab(tab, tab.title())
375+
376+ def insertTab(self, id, tab):
377+ log.debug(u'Inserting %s tab' % tab.title())
378+ self.SettingsTabWidget.insertTab(id, tab, tab.title())
379+
380+ def removeTab(self, id):
381+ log.debug(u'remove %s no tab' % unicode(id))
382+ self.SettingsTabWidget.removeTab(id)
383+
384
385 def accept(self):
386 for tab_index in range(0, self.SettingsTabWidget.count()):
387
388=== modified file 'openlp/plugins/audit/auditplugin.py'
389--- openlp/plugins/audit/auditplugin.py 2009-10-01 16:56:42 +0000
390+++ openlp/plugins/audit/auditplugin.py 2009-10-03 19:10:24 +0000
391@@ -28,7 +28,7 @@
392 from PyQt4 import QtCore, QtGui
393
394 from openlp.core.lib import Plugin, Receiver, translate, str_to_bool, buildIcon
395-from openlp.plugins.audit.lib import AuditTab, AuditManager
396+from openlp.plugins.audit.lib import AuditManager
397 from openlp.plugins.audit.forms import AuditDetailForm, AuditDeleteForm
398 from openlp.plugins.audit.lib.models import AuditItem
399
400@@ -43,18 +43,11 @@
401 self.weight = -4
402 # Create the plugin icon
403 self.icon = buildIcon(u':/media/media_image.png')
404- self.auditfile = None
405+ self.auditmanager = None
406+ self.auditActive = False
407
408- def check_pre_conditions(self):
409- """
410- Check to see if auditing is required
411- """
412- log.debug(u'check_pre_conditions')
413- #Lets see if audit is required
414- if int(self.config.get_config(u'startup', 0)) == QtCore.Qt.Checked:
415- return True
416- else:
417- return False
418+ def can_be_disabled(self):
419+ return True
420
421 def add_tools_menu_item(self, tools_menu):
422 """
423@@ -65,6 +58,8 @@
424 The actual **Tools** menu item, so that your actions can
425 use it as their parent.
426 """
427+ log.info(u'add tools menu')
428+ self.toolsMenu = tools_menu
429 self.AuditMenu = QtGui.QMenu(tools_menu)
430 self.AuditMenu.setObjectName(u'AuditMenu')
431 self.AuditMenu.setTitle(
432@@ -102,7 +97,7 @@
433 self.AuditStatus.setShortcut(translate(u'AuditPlugin', u'F4'))
434 self.AuditStatus.setObjectName(u'AuditStatus')
435 #Add Menus together
436- tools_menu.addAction(self.AuditMenu.menuAction())
437+ self.toolsMenu.addAction(self.AuditMenu.menuAction())
438 self.AuditMenu.addAction(self.AuditStatus)
439 self.AuditMenu.addSeparator()
440 self.AuditMenu.addAction(self.AuditDeleteAll)
441@@ -122,13 +117,11 @@
442 QtCore.SIGNAL(u'triggered()'), self.onAuditDelete)
443 QtCore.QObject.connect(self.AuditReport,
444 QtCore.SIGNAL(u'triggered()'), self.onAuditReport)
445-
446- def get_settings_tab(self):
447- self.AuditTab = AuditTab()
448- return self.AuditTab
449+ self.AuditMenu.menuAction().setVisible(False)
450
451 def initialise(self):
452- log.info(u'Plugin Initialising')
453+ log.info(u'audit Initialising')
454+ Plugin.initialise(self)
455 QtCore.QObject.connect(Receiver.get_receiver(),
456 QtCore.SIGNAL(u'audit_live'), self.onReceiveAudit)
457 QtCore.QObject.connect(Receiver.get_receiver(),
458@@ -136,9 +129,17 @@
459 self.auditActive = str_to_bool(
460 self.config.get_config(u'audit active', False))
461 self.AuditStatus.setChecked(self.auditActive)
462- self.auditmanager = AuditManager(self.config)
463+ if self.auditmanager is None:
464+ self.auditmanager = AuditManager(self.config)
465 self.auditdeleteform = AuditDeleteForm(self.auditmanager)
466 self.auditdetailform = AuditDetailForm(self.auditmanager)
467+ self.AuditMenu.menuAction().setVisible(True)
468+
469+ def finalise(self):
470+ log.info(u'Plugin Finalise')
471+ self.AuditMenu.menuAction().setVisible(False)
472+ #stop any events being processed
473+ self.auditActive = False
474
475 def toggleAuditState(self):
476 self.auditActive = not self.auditActive
477
478=== modified file 'openlp/plugins/audit/lib/__init__.py'
479--- openlp/plugins/audit/lib/__init__.py 2009-09-23 16:33:30 +0000
480+++ openlp/plugins/audit/lib/__init__.py 2009-10-03 19:10:24 +0000
481@@ -22,5 +22,4 @@
482 # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
483 ###############################################################################
484
485-from audittab import AuditTab
486 from manager import AuditManager
487
488=== removed file 'openlp/plugins/audit/lib/audittab.py'
489--- openlp/plugins/audit/lib/audittab.py 2009-09-25 00:43:42 +0000
490+++ openlp/plugins/audit/lib/audittab.py 1970-01-01 00:00:00 +0000
491@@ -1,61 +0,0 @@
492-# -*- coding: utf-8 -*-
493-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
494-
495-###############################################################################
496-# OpenLP - Open Source Lyrics Projection #
497-# --------------------------------------------------------------------------- #
498-# Copyright (c) 2008-2009 Raoul Snyman #
499-# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten #
500-# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri #
501-# --------------------------------------------------------------------------- #
502-# This program is free software; you can redistribute it and/or modify it #
503-# under the terms of the GNU General Public License as published by the Free #
504-# Software Foundation; version 2 of the License. #
505-# #
506-# This program is distributed in the hope that it will be useful, but WITHOUT #
507-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
508-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
509-# more details. #
510-# #
511-# You should have received a copy of the GNU General Public License along #
512-# with this program; if not, write to the Free Software Foundation, Inc., 59 #
513-# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
514-###############################################################################
515-
516-from PyQt4 import QtGui
517-
518-from openlp.core.lib import SettingsTab, translate, Receiver
519-
520-class AuditTab(SettingsTab):
521- """
522- AuditTab is the Audit settings tab in the settings dialog.
523- """
524- def __init__(self):
525- SettingsTab.__init__(self, translate(u'AuditTab', u'Audit'), u'Audit')
526-
527- def setupUi(self):
528- self.setObjectName(u'AuditTab')
529- self.AuditModeGroupBox = QtGui.QGroupBox(self)
530- self.AuditModeGroupBox.setObjectName(u'AuditModeGroupBox')
531- self.verticalLayout = QtGui.QVBoxLayout(self.AuditModeGroupBox)
532- self.verticalLayout.setObjectName("verticalLayout")
533- self.AuditActive = QtGui.QCheckBox(self)
534- self.AuditActive.setObjectName("AuditActive")
535- self.verticalLayout.addWidget(self.AuditActive)
536- self.WarningLabel = QtGui.QLabel(self)
537- self.WarningLabel.setObjectName("WarningLabel")
538- self.verticalLayout.addWidget(self.WarningLabel)
539-
540- def retranslateUi(self):
541- self.AuditModeGroupBox.setTitle(translate(u'AuditTab', u'Audit File'))
542- self.AuditActive.setText(translate(u'AuditTab', 'Audit available:'))
543- self.WarningLabel.setText(translate(u'AuditTab',
544- u'A restart is needed for this change to become effective'))
545-
546- def load(self):
547- self.AuditActive.setChecked(int(self.config.get_config(u'startup', 0)))
548-
549- def save(self):
550- self.config.set_config(
551- u'startup', unicode(self.AuditActive.checkState()))
552- Receiver().send_message(u'audit_changed')
553
554=== modified file 'openlp/plugins/bibles/bibleplugin.py'
555--- openlp/plugins/bibles/bibleplugin.py 2009-10-01 16:56:42 +0000
556+++ openlp/plugins/bibles/bibleplugin.py 2009-10-03 19:10:24 +0000
557@@ -44,13 +44,11 @@
558 self.biblemanager = BibleManager(self.config)
559
560 def get_settings_tab(self):
561- self.bibles_tab = BiblesTab()
562- return self.bibles_tab
563+ return BiblesTab()
564
565 def get_media_manager_item(self):
566 # Create the BibleManagerItem object
567- self.media_item = BibleMediaItem(self, self.icon, u'Bible Verses')
568- return self.media_item
569+ return BibleMediaItem(self, self.icon, u'Bible Verses')
570
571 def add_import_menu_item(self, import_menu):
572 self.ImportBibleItem = QtGui.QAction(import_menu)
573
574=== modified file 'openlp/plugins/custom/customplugin.py'
575--- openlp/plugins/custom/customplugin.py 2009-10-01 16:56:42 +0000
576+++ openlp/plugins/custom/customplugin.py 2009-10-03 19:10:24 +0000
577@@ -54,8 +54,7 @@
578
579 def get_media_manager_item(self):
580 # Create the CustomManagerItem object
581- self.media_item = CustomMediaItem(self, self.icon, u'Custom Slides')
582- return self.media_item
583+ return CustomMediaItem(self, self.icon, u'Custom Slides')
584
585 def about(self):
586 return u'<b>Custom Plugin</b> <br>This plugin allows slides to be displayed on the screen in the same way songs are. The difference between this plugin and songs is this plugin provides greater freedom.<br><br>This is a core plugin and cannot be made inactive</b>'
587
588=== modified file 'openlp/plugins/images/imageplugin.py'
589--- openlp/plugins/images/imageplugin.py 2009-10-01 16:56:42 +0000
590+++ openlp/plugins/images/imageplugin.py 2009-10-03 19:10:24 +0000
591@@ -39,14 +39,24 @@
592 # Create the plugin icon
593 self.icon = buildIcon(u':/media/media_image.png')
594
595+ def can_be_disabled(self):
596+ return True
597+
598+ def initialise(self):
599+ log.info(u'Plugin Initialising')
600+ Plugin.initialise(self)
601+ self.insert_toolbox_item()
602+
603+ def finalise(self):
604+ log.info(u'Plugin Finalise')
605+ self.remove_toolbox_item()
606+
607 def get_settings_tab(self):
608- self.ImageTab = ImageTab()
609- return self.ImageTab
610+ return ImageTab()
611
612 def get_media_manager_item(self):
613 # Create the MediaManagerItem object
614- self.media_item = ImageMediaItem(self, self.icon, u'Images')
615- return self.media_item
616+ return ImageMediaItem(self, self.icon, u'Images')
617
618 def about(self):
619 return u'<b>Image Plugin</b><br>Allows images of all types to be displayed. If a number of images are selected together and presented on the live controller it is possible to turn them into a timed loop.<br> From the plugin if the <i>Override background</i> is chosen and an image is selected any somgs which are rendered will use the selected image from the background instead of the one provied by the theme.<br>'
620
621=== modified file 'openlp/plugins/images/lib/mediaitem.py'
622--- openlp/plugins/images/lib/mediaitem.py 2009-09-26 09:11:39 +0000
623+++ openlp/plugins/images/lib/mediaitem.py 2009-10-03 19:10:24 +0000
624@@ -65,6 +65,8 @@
625 self.hasEditIcon = False
626
627 def initialise(self):
628+ log.debug(u'initialise')
629+ self.ListView.clear()
630 self.ListView.setSelectionMode(
631 QtGui.QAbstractItemView.ExtendedSelection)
632 self.ListView.setIconSize(QtCore.QSize(88,50))
633
634=== modified file 'openlp/plugins/media/mediaplugin.py'
635--- openlp/plugins/media/mediaplugin.py 2009-10-01 16:56:42 +0000
636+++ openlp/plugins/media/mediaplugin.py 2009-10-03 19:10:24 +0000
637@@ -37,13 +37,11 @@
638 self.dnd_id = u'Media'
639
640 def get_settings_tab(self):
641- self.MediaTab = MediaTab()
642- return self.MediaTab
643+ return MediaTab()
644
645 def get_media_manager_item(self):
646 # Create the MediaManagerItem object
647- self.media_item = MediaMediaItem(self, self.icon, u'Media')
648- return self.media_item
649+ return MediaMediaItem(self, self.icon, u'Media')
650
651 def about(self):
652 return u'<b>Media Plugin</b> <br> One day this may provide access to video and audio clips'
653
654=== modified file 'openlp/plugins/presentations/presentationplugin.py'
655--- openlp/plugins/presentations/presentationplugin.py 2009-10-01 17:19:46 +0000
656+++ openlp/plugins/presentations/presentationplugin.py 2009-10-03 19:10:24 +0000
657@@ -50,16 +50,14 @@
658 """
659 Create the settings Tab
660 """
661- self.presentation_tab = PresentationTab(self.controllers)
662- return self.presentation_tab
663+ return PresentationTab(self.controllers)
664
665 def get_media_manager_item(self):
666 """
667 Create the Media Manager List
668 """
669- self.media_item = PresentationMediaItem(
670+ return PresentationMediaItem(
671 self, self.icon, u'Presentations', self.controllers)
672- return self.media_item
673
674 def registerControllers(self, controller):
675 self.controllers[controller.name] = controller
676
677=== modified file 'openlp/plugins/remotes/lib/remotetab.py'
678--- openlp/plugins/remotes/lib/remotetab.py 2009-09-25 00:43:42 +0000
679+++ openlp/plugins/remotes/lib/remotetab.py 2009-10-03 19:10:24 +0000
680@@ -44,31 +44,17 @@
681 self.RemotePortSpinBox.setObjectName(u'RemotePortSpinBox')
682 self.RemotePortSpinBox.setMaximum(32767)
683 self.RemoteModeLayout.addWidget(self.RemotePortSpinBox)
684- self.RemoteActive = QtGui.QCheckBox(self.RemoteModeGroupBox)
685- self.RemoteActive.setObjectName(u'RemotePortSpinBox')
686- self.RemoteModeLayout.addWidget(self.RemoteActive)
687- self.WarningLabel = QtGui.QLabel(self.RemoteModeGroupBox)
688- self.WarningLabel.setObjectName(u'WarningLabel')
689- self.RemoteModeLayout.addWidget(self.WarningLabel)
690 self.RemoteLayout.setWidget(
691 0, QtGui.QFormLayout.LabelRole, self.RemoteModeGroupBox)
692
693 def retranslateUi(self):
694 self.RemoteModeGroupBox.setTitle(
695 translate(u'RemoteTab', u'Remotes Receiver Port'))
696- self.RemoteActive.setText(translate(u'RemoteTab', 'Remote available:'))
697- self.WarningLabel.setText(translate(u'RemoteTab',
698- u'A restart is needed for this change to become effective'))
699
700 def load(self):
701 self.RemotePortSpinBox.setValue(
702 int(self.config.get_config(u'remote port', 4316)))
703- self.RemoteActive.setChecked(
704- int(self.config.get_config(u'startup', 0)))
705
706 def save(self):
707 self.config.set_config(
708 u'remote port', unicode(self.RemotePortSpinBox.value()))
709- self.config.set_config(
710- u'startup', unicode(self.RemoteActive.checkState()))
711-
712
713=== modified file 'openlp/plugins/remotes/remoteplugin.py'
714--- openlp/plugins/remotes/remoteplugin.py 2009-10-01 16:56:42 +0000
715+++ openlp/plugins/remotes/remoteplugin.py 2009-10-03 19:10:24 +0000
716@@ -34,29 +34,22 @@
717 # Call the parent constructor
718 Plugin.__init__(self, u'Remotes', u'1.9.0', plugin_helpers)
719 self.weight = -1
720+ self.server = None
721
722 def can_be_disabled(self):
723 return True
724
725- def check_pre_conditions(self):
726- """
727- Check to see if remotes is required
728- """
729- log.debug(u'check_pre_conditions')
730- #Lets see if Remote is required
731- if int(self.config.get_config(u'startup', 0)) == QtCore.Qt.Checked:
732- return True
733- else:
734- return False
735-
736 def initialise(self):
737+ log.debug(u'initialise')
738 self.server = QtNetwork.QUdpSocket()
739 self.server.bind(int(self.config.get_config(u'remote port', 4316)))
740 QtCore.QObject.connect(self.server,
741 QtCore.SIGNAL(u'readyRead()'), self.readData)
742
743 def finalise(self):
744- pass
745+ log.debug(u'finalise')
746+ if self.server is not None:
747+ self.server.close()
748
749 def about(self):
750 return u'<b>Remote Plugin</b> <br>This plugin provides the ability to send messages to a running version of openlp on a different computer.<br> The Primary use for this would be to send alerts from a creche'
751@@ -78,11 +71,7 @@
752 log.info(u'Sending event %s ', datagram)
753 pos = datagram.find(u':')
754 event = unicode(datagram[:pos].lower())
755-
756 if event == u'alert':
757 Receiver().send_message(u'alert_text', unicode(datagram[pos + 1:]))
758 if event == u'next_slide':
759 Receiver().send_message(u'live_slide_next')
760-
761-
762-
763
764=== modified file 'openlp/plugins/songs/songsplugin.py'
765--- openlp/plugins/songs/songsplugin.py 2009-10-01 16:56:42 +0000
766+++ openlp/plugins/songs/songsplugin.py 2009-10-03 19:10:24 +0000
767@@ -64,8 +64,7 @@
768 Create the MediaManagerItem object, which is displaed in the
769 Media Manager.
770 """
771- self.media_item = SongMediaItem(self, self.icon, 'Songs')
772- return self.media_item
773+ return SongMediaItem(self, self.icon, 'Songs')
774
775 def add_import_menu_item(self, import_menu):
776 """
777@@ -146,6 +145,7 @@
778 QtCore.SIGNAL(u'triggered()'), self.onExportOpenSongItemClicked)
779
780 def initialise(self):
781+ Plugin.initialise(self)
782 self.media_item.displayResultsSong(self.songmanager.get_songs())
783
784 def onImportOpenlp1ItemClick(self):