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
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py 2009-09-26 09:11:39 +0000
+++ openlp/core/lib/mediamanageritem.py 2009-10-03 19:10:23 +0000
@@ -118,7 +118,7 @@
118 self.requiredIcons()118 self.requiredIcons()
119 self.setupUi()119 self.setupUi()
120 self.retranslateUi()120 self.retranslateUi()
121 self.initialise()121 #self.initialise()
122122
123 def requiredIcons(self):123 def requiredIcons(self):
124 """124 """
@@ -131,7 +131,6 @@
131 self.hasFileIcon = False131 self.hasFileIcon = False
132 self.hasDeleteIcon = True132 self.hasDeleteIcon = True
133133
134
135 def retranslateUi(self):134 def retranslateUi(self):
136 """135 """
137 This method is called automatically to provide OpenLP with the136 This method is called automatically to provide OpenLP with the
138137
=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py 2009-10-01 16:56:42 +0000
+++ openlp/core/lib/plugin.py 2009-10-03 19:10:23 +0000
@@ -31,8 +31,9 @@
31 """31 """
32 Defines the status of the plugin32 Defines the status of the plugin
33 """33 """
34 Active = 134 Active = 0
35 Inactive = 235 Inactive = 1
36 Disabled = 2
3637
37class Plugin(object):38class Plugin(object):
38 """39 """
@@ -85,17 +86,6 @@
85 ``about()``86 ``about()``
86 Used in the plugin manager, when a person clicks on the 'About' button.87 Used in the plugin manager, when a person clicks on the 'About' button.
8788
88 ``save(data)``
89 A method to convert the plugin's data to a string to be stored in the
90 Service file.
91
92 ``load(string)``
93 A method to convert the string from a Service file into the plugin's
94 own data format.
95
96 ``render(theme, screen_number)``
97 A method used to render something to the screen, given the current theme
98 and screen number.
99 """89 """
100 global log90 global log
101 log = logging.getLogger(u'Plugin')91 log = logging.getLogger(u'Plugin')
@@ -129,6 +119,9 @@
129 self.icon = None119 self.icon = None
130 self.config = PluginConfig(self.name)120 self.config = PluginConfig(self.name)
131 self.weight = 0121 self.weight = 0
122 self.media_id = -1
123 self.settings_id = -1
124 self.media_active = False
132 self.status = PluginStatus.Inactive125 self.status = PluginStatus.Inactive
133 # Set up logging126 # Set up logging
134 self.log = logging.getLogger(self.name)127 self.log = logging.getLogger(self.name)
@@ -137,6 +130,7 @@
137 self.render_manager = plugin_helpers[u'render']130 self.render_manager = plugin_helpers[u'render']
138 self.service_manager = plugin_helpers[u'service']131 self.service_manager = plugin_helpers[u'service']
139 self.settings = plugin_helpers[u'settings']132 self.settings = plugin_helpers[u'settings']
133 self.mediatoolbox = plugin_helpers[u'toolbox']
140 QtCore.QObject.connect(Receiver.get_receiver(),134 QtCore.QObject.connect(Receiver.get_receiver(),
141 QtCore.SIGNAL(u'%s_add_service_item'% self.name), self.process_add_service_event)135 QtCore.SIGNAL(u'%s_add_service_item'% self.name), self.process_add_service_event)
142136
@@ -157,6 +151,28 @@
157 """151 """
158 return False152 return False
159153
154 def set_status(self):
155 """
156 Sets the status of the plugin
157 """
158 self.status = self.config.get_config(\
159 u'%s_status' % self.name, PluginStatus.Inactive)
160
161 def toggle_status(self, new_status):
162 """
163 Changes the status of the plugin and remembers it
164 """
165 self.status = new_status
166 self.config.set_config(u'%s_status' % self.name, self.status)
167
168 def is_active(self):
169 """
170 Indicates if the plugin is active
171
172 Returns True or False.
173 """
174 return int(self.status ) == int(PluginStatus.Active)
175
160 def get_media_manager_item(self):176 def get_media_manager_item(self):
161 """177 """
162 Construct a MediaManagerItem object with all the buttons and things178 Construct a MediaManagerItem object with all the buttons and things
@@ -224,7 +240,8 @@
224 """240 """
225 Called by the plugin Manager to initialise anything it needs.241 Called by the plugin Manager to initialise anything it needs.
226 """242 """
227 pass243 if self.media_item is not None:
244 self.media_item.initialise()
228245
229 def finalise(self):246 def finalise(self):
230 """247 """
@@ -232,3 +249,25 @@
232 """249 """
233 pass250 pass
234251
252 def remove_toolbox_item(self):
253 """
254 Called by the plugin to remove toolbar
255 """
256 if self.media_id is not -1:
257 self.mediatoolbox.removeItem(self.media_id)
258 if self.settings_id is not -1:
259 self.settings.removeTab(self.settings_id)
260 self.media_active = False
261
262 def insert_toolbox_item(self):
263 """
264 Called by plugin to replace toolbar
265 """
266 if not self.media_active:
267 if self.media_id is not -1:
268 self.mediatoolbox.insertItem(
269 self.media_id, self.media_item, self.icon, self.media_item.title)
270 if self.settings_id is not -1:
271 self.settings.insertTab(
272 self.settings_id, self.settings_tab)
273 self.media_active = True
235274
=== modified file 'openlp/core/lib/pluginmanager.py'
--- openlp/core/lib/pluginmanager.py 2009-09-21 17:56:36 +0000
+++ openlp/core/lib/pluginmanager.py 2009-10-03 19:10:23 +0000
@@ -105,7 +105,12 @@
105 for plugin in plugins_list:105 for plugin in plugins_list:
106 if plugin.check_pre_conditions():106 if plugin.check_pre_conditions():
107 log.debug(u'Plugin %s active', unicode(plugin.name))107 log.debug(u'Plugin %s active', unicode(plugin.name))
108 plugin.status = PluginStatus.Active108 if plugin.can_be_disabled():
109 plugin.set_status()
110 else:
111 plugin.status = PluginStatus.Active
112 else:
113 plugin.status = PluginStatus.Disabled
109 self.plugins.append(plugin)114 self.plugins.append(plugin)
110115
111 def order_by_weight(self, x, y):116 def order_by_weight(self, x, y):
@@ -129,13 +134,14 @@
129 The Media Manager itself.134 The Media Manager itself.
130 """135 """
131 for plugin in self.plugins:136 for plugin in self.plugins:
132 if plugin.status == PluginStatus.Active:137 if plugin.status is not PluginStatus.Disabled:
133 media_manager_item = plugin.get_media_manager_item()138 plugin.media_item = plugin.get_media_manager_item()
134 if media_manager_item is not None:139 if plugin.media_item is not None:
135 log.debug(u'Inserting media manager item from %s' % \140 log.debug(u'Inserting media manager item from %s' % \
136 plugin.name)141 plugin.name)
137 mediatoolbox.addItem(media_manager_item, plugin.icon,142 plugin.media_id = mediatoolbox.addItem(
138 media_manager_item.title)143 plugin.media_item, plugin.icon, plugin.media_item.title)
144 plugin.media_active = True
139145
140 def hook_settings_tabs(self, settingsform=None):146 def hook_settings_tabs(self, settingsform=None):
141 """147 """
@@ -147,12 +153,13 @@
147 Defaults to *None*. The settings form to add tabs to.153 Defaults to *None*. The settings form to add tabs to.
148 """154 """
149 for plugin in self.plugins:155 for plugin in self.plugins:
150 settings_tab = plugin.get_settings_tab()156 if plugin.status is not PluginStatus.Disabled:
151 if settings_tab is not None:157 plugin.settings_tab = plugin.get_settings_tab()
152 log.debug(u'Inserting settings tab item from %s' % plugin.name)158 if plugin.settings_tab is not None:
153 settingsform.addTab(settings_tab)159 log.debug(u'Inserting settings tab item from %s' % plugin.name)
154 else:160 plugin.settings_id = settingsform.addTab(plugin.settings_tab)
155 log.debug(u'No settings in %s' % plugin.name)161 else:
162 log.debug(u'No tab settings in %s' % plugin.name)
156163
157 def hook_import_menu(self, import_menu):164 def hook_import_menu(self, import_menu):
158 """165 """
@@ -163,7 +170,7 @@
163 The Import menu.170 The Import menu.
164 """171 """
165 for plugin in self.plugins:172 for plugin in self.plugins:
166 if plugin.status == PluginStatus.Active:173 if plugin.status is not PluginStatus.Disabled:
167 plugin.add_import_menu_item(import_menu)174 plugin.add_import_menu_item(import_menu)
168175
169 def hook_export_menu(self, export_menu):176 def hook_export_menu(self, export_menu):
@@ -175,7 +182,7 @@
175 The Export menu.182 The Export menu.
176 """183 """
177 for plugin in self.plugins:184 for plugin in self.plugins:
178 if plugin.status == PluginStatus.Active:185 if plugin.status is not PluginStatus.Disabled:
179 plugin.add_export_menu_item(export_menu)186 plugin.add_export_menu_item(export_menu)
180187
181 def hook_tools_menu(self, tools_menu):188 def hook_tools_menu(self, tools_menu):
@@ -187,7 +194,7 @@
187 The Tools menu.194 The Tools menu.
188 """195 """
189 for plugin in self.plugins:196 for plugin in self.plugins:
190 if plugin.status == PluginStatus.Active:197 if plugin.status is not PluginStatus.Disabled:
191 plugin.add_tools_menu_item(tools_menu)198 plugin.add_tools_menu_item(tools_menu)
192199
193 def initialise_plugins(self):200 def initialise_plugins(self):
@@ -195,15 +202,19 @@
195 Loop through all the plugins and give them an opportunity to202 Loop through all the plugins and give them an opportunity to
196 initialise themselves.203 initialise themselves.
197 """204 """
205 log.info(u'initialising plugins')
198 for plugin in self.plugins:206 for plugin in self.plugins:
199 if plugin.status == PluginStatus.Active:207 if plugin.is_active():
200 plugin.initialise()208 plugin.initialise()
209 if plugin.media_item is not None and not plugin.is_active():
210 plugin.remove_toolbox_item()
201211
202 def finalise_plugins(self):212 def finalise_plugins(self):
203 """213 """
204 Loop through all the plugins and give them an opportunity to214 Loop through all the plugins and give them an opportunity to
205 clean themselves up215 clean themselves up
206 """216 """
217 log.info(u'finalising plugins')
207 for plugin in self.plugins:218 for plugin in self.plugins:
208 if plugin.status == PluginStatus.Active:219 if plugin.is_active():
209 plugin.finalise()220 plugin.finalise()
210221
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2009-09-29 02:54:32 +0000
+++ openlp/core/ui/mainwindow.py 2009-10-03 19:10:23 +0000
@@ -109,19 +109,12 @@
109 self.MediaManagerDock.setObjectName(u'MediaManagerDock')109 self.MediaManagerDock.setObjectName(u'MediaManagerDock')
110 self.MediaManagerDock.setMinimumWidth(110 self.MediaManagerDock.setMinimumWidth(
111 self.settingsmanager.mainwindow_left)111 self.settingsmanager.mainwindow_left)
112
113# self.MediaManagerDock.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Ignored,
114# QtGui.QSizePolicy.Maximum))
115# geometry = self.MediaManagerDock.geometry()
116# geometry.setWidth(self.settingsmanager.mainwindow_left)
117# self.MediaManagerDock.setGeometry(geometry)
118# self.MediaManagerDock.setMinimumWidth(10)
119
120 self.MediaManagerContents = QtGui.QWidget()112 self.MediaManagerContents = QtGui.QWidget()
121 self.MediaManagerContents.setObjectName(u'MediaManagerContents')113 self.MediaManagerContents.setObjectName(u'MediaManagerContents')
122 self.MediaManagerLayout = QtGui.QHBoxLayout(self.MediaManagerContents)114 self.MediaManagerLayout = QtGui.QHBoxLayout(self.MediaManagerContents)
123 self.MediaManagerLayout.setContentsMargins(0, 2, 0, 0)115 self.MediaManagerLayout.setContentsMargins(0, 2, 0, 0)
124 self.MediaManagerLayout.setObjectName(u'MediaManagerLayout')116 self.MediaManagerLayout.setObjectName(u'MediaManagerLayout')
117 # Create the media toolbox
125 self.MediaToolBox = QtGui.QToolBox(self.MediaManagerContents)118 self.MediaToolBox = QtGui.QToolBox(self.MediaManagerContents)
126 self.MediaToolBox.setObjectName(u'MediaToolBox')119 self.MediaToolBox.setObjectName(u'MediaToolBox')
127 self.MediaManagerLayout.addWidget(self.MediaToolBox)120 self.MediaManagerLayout.addWidget(self.MediaToolBox)
@@ -503,6 +496,7 @@
503 self.plugin_helpers[u'render'] = self.RenderManager496 self.plugin_helpers[u'render'] = self.RenderManager
504 self.plugin_helpers[u'service'] = self.ServiceManagerContents497 self.plugin_helpers[u'service'] = self.ServiceManagerContents
505 self.plugin_helpers[u'settings'] = self.settingsForm498 self.plugin_helpers[u'settings'] = self.settingsForm
499 self.plugin_helpers[u'toolbox'] = self.MediaToolBox
506 self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers)500 self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers)
507 # hook methods have to happen after find_plugins. Find plugins needs501 # hook methods have to happen after find_plugins. Find plugins needs
508 # the controllers hence the hooks have moved from setupUI() to here502 # the controllers hence the hooks have moved from setupUI() to here
@@ -528,6 +522,7 @@
528 log.info(u'Load data from Settings')522 log.info(u'Load data from Settings')
529 self.settingsForm.postSetUp()523 self.settingsForm.postSetUp()
530524
525
531 def getMonitorNumber(self):526 def getMonitorNumber(self):
532 """527 """
533 Set up the default behaviour of the monitor configuration in528 Set up the default behaviour of the monitor configuration in
534529
=== modified file 'openlp/core/ui/plugindialoglistform.py'
--- openlp/core/ui/plugindialoglistform.py 2009-10-02 14:19:36 +0000
+++ openlp/core/ui/plugindialoglistform.py 2009-10-03 19:10:23 +0000
@@ -11,6 +11,20 @@
11from PyQt4 import QtCore, QtGui11from PyQt4 import QtCore, QtGui
12from openlp.core.lib import translate, PluginStatus, buildIcon12from openlp.core.lib import translate, PluginStatus, buildIcon
1313
14class PluginCombo(QtGui.QComboBox):
15 """
16 Customised version of QTableWidget which can respond to keyboard
17 events.
18 """
19 def __init__(self, parent=None, plugin=None):
20 QtGui.QComboBox.__init__(self, parent)
21 self.parent = parent
22 self.plugin = plugin
23
24 def enterEvent(self, event):
25 self.parent.activePlugin = self.plugin
26 event.ignore()
27
14class PluginForm(QtGui.QDialog):28class PluginForm(QtGui.QDialog):
15 global log29 global log
16 log = logging.getLogger(u'PluginForm')30 log = logging.getLogger(u'PluginForm')
@@ -18,6 +32,7 @@
18 def __init__(self, parent=None):32 def __init__(self, parent=None):
19 QtGui.QDialog.__init__(self, parent)33 QtGui.QDialog.__init__(self, parent)
20 self.parent = parent34 self.parent = parent
35 self.activePlugin = None
21 self.setupUi(self)36 self.setupUi(self)
22 log.debug(u'Defined')37 log.debug(u'Defined')
2338
@@ -57,7 +72,6 @@
57 self.AboutTextLabel.setWordWrap(True)72 self.AboutTextLabel.setWordWrap(True)
58 self.AboutTextLabel.setObjectName("AboutTextLabel")73 self.AboutTextLabel.setObjectName("AboutTextLabel")
5974
60
61 self.retranslateUi(PluginForm)75 self.retranslateUi(PluginForm)
62 QtCore.QObject.connect(self.ButtonBox,76 QtCore.QObject.connect(self.ButtonBox,
63 QtCore.SIGNAL(u'accepted()'), PluginForm.close)77 QtCore.SIGNAL(u'accepted()'), PluginForm.close)
@@ -92,19 +106,20 @@
92 self.PluginViewList.setItem(row, 0, item1)106 self.PluginViewList.setItem(row, 0, item1)
93 self.PluginViewList.setItem(row, 1, item2)107 self.PluginViewList.setItem(row, 1, item2)
94 if plugin.can_be_disabled():108 if plugin.can_be_disabled():
95 combo = QtGui.QComboBox()109 combo = PluginCombo(self, plugin)
96 self.PluginViewList.setCellWidget(row, 2, combo)110 self.PluginViewList.setCellWidget(row, 2, combo)
97 combo.addItem(translate(u'PluginForm', u'Active'))111 combo.addItem(translate(u'PluginForm', u'Active'))
98 combo.addItem(translate(u'PluginForm', u'Inactive'))112 combo.addItem(translate(u'PluginForm', u'Inactive'))
99# if plugin.status == PluginStatus.Active:113 combo.setCurrentIndex(int(plugin.status))
100 self.PluginViewList.setRowHeight(row, 25)114 QtCore.QObject.connect(combo,
115 QtCore.SIGNAL(u'currentIndexChanged(int)'), self.statusComboChanged)
101 else:116 else:
102 item3 = QtGui.QTableWidgetItem(117 item3 = QtGui.QTableWidgetItem(
103 translate(u'PluginForm', u'Active'))118 translate(u'PluginForm', u'Active'))
104 item3.setTextAlignment(QtCore.Qt.AlignVCenter)119 item3.setTextAlignment(QtCore.Qt.AlignVCenter)
105 item3.setFlags(QtCore.Qt.ItemIsSelectable)120 item3.setFlags(QtCore.Qt.ItemIsSelectable)
106 self.PluginViewList.setItem(row, 2, item3)121 self.PluginViewList.setItem(row, 2, item3)
107 self.PluginViewList.setRowHeight(row, 15)122 self.PluginViewList.setRowHeight(row, 25)
108123
109 def displayAbout(self, item):124 def displayAbout(self, item):
110 if item is None:125 if item is None:
@@ -114,3 +129,10 @@
114 if text is not None:129 if text is not None:
115 self.AboutTextLabel.setText(translate(u'PluginList', text))130 self.AboutTextLabel.setText(translate(u'PluginList', text))
116131
132 def statusComboChanged(self, status):
133 log.debug(u'Combo status changed %s for plugin %s' %(status, self.activePlugin.name))
134 self.activePlugin.toggle_status(status)
135 if status == PluginStatus.Active:
136 self.activePlugin.initialise()
137 else:
138 self.activePlugin.finalise()
117139
=== modified file 'openlp/core/ui/settingsform.py'
--- openlp/core/ui/settingsform.py 2009-09-25 00:43:42 +0000
+++ openlp/core/ui/settingsform.py 2009-10-03 19:10:23 +0000
@@ -47,8 +47,17 @@
47 self.addTab(self.AlertsTab)47 self.addTab(self.AlertsTab)
4848
49 def addTab(self, tab):49 def addTab(self, tab):
50 log.info(u'Inserting %s' % tab.title())50 log.info(u'Adding %s tab' % tab.title())
51 self.SettingsTabWidget.addTab(tab, tab.title())51 return self.SettingsTabWidget.addTab(tab, tab.title())
52
53 def insertTab(self, id, tab):
54 log.debug(u'Inserting %s tab' % tab.title())
55 self.SettingsTabWidget.insertTab(id, tab, tab.title())
56
57 def removeTab(self, id):
58 log.debug(u'remove %s no tab' % unicode(id))
59 self.SettingsTabWidget.removeTab(id)
60
5261
53 def accept(self):62 def accept(self):
54 for tab_index in range(0, self.SettingsTabWidget.count()):63 for tab_index in range(0, self.SettingsTabWidget.count()):
5564
=== modified file 'openlp/plugins/audit/auditplugin.py'
--- openlp/plugins/audit/auditplugin.py 2009-10-01 16:56:42 +0000
+++ openlp/plugins/audit/auditplugin.py 2009-10-03 19:10:24 +0000
@@ -28,7 +28,7 @@
28from PyQt4 import QtCore, QtGui28from PyQt4 import QtCore, QtGui
2929
30from openlp.core.lib import Plugin, Receiver, translate, str_to_bool, buildIcon30from openlp.core.lib import Plugin, Receiver, translate, str_to_bool, buildIcon
31from openlp.plugins.audit.lib import AuditTab, AuditManager31from openlp.plugins.audit.lib import AuditManager
32from openlp.plugins.audit.forms import AuditDetailForm, AuditDeleteForm32from openlp.plugins.audit.forms import AuditDetailForm, AuditDeleteForm
33from openlp.plugins.audit.lib.models import AuditItem33from openlp.plugins.audit.lib.models import AuditItem
3434
@@ -43,18 +43,11 @@
43 self.weight = -443 self.weight = -4
44 # Create the plugin icon44 # Create the plugin icon
45 self.icon = buildIcon(u':/media/media_image.png')45 self.icon = buildIcon(u':/media/media_image.png')
46 self.auditfile = None46 self.auditmanager = None
47 self.auditActive = False
4748
48 def check_pre_conditions(self):49 def can_be_disabled(self):
49 """50 return True
50 Check to see if auditing is required
51 """
52 log.debug(u'check_pre_conditions')
53 #Lets see if audit is required
54 if int(self.config.get_config(u'startup', 0)) == QtCore.Qt.Checked:
55 return True
56 else:
57 return False
5851
59 def add_tools_menu_item(self, tools_menu):52 def add_tools_menu_item(self, tools_menu):
60 """53 """
@@ -65,6 +58,8 @@
65 The actual **Tools** menu item, so that your actions can58 The actual **Tools** menu item, so that your actions can
66 use it as their parent.59 use it as their parent.
67 """60 """
61 log.info(u'add tools menu')
62 self.toolsMenu = tools_menu
68 self.AuditMenu = QtGui.QMenu(tools_menu)63 self.AuditMenu = QtGui.QMenu(tools_menu)
69 self.AuditMenu.setObjectName(u'AuditMenu')64 self.AuditMenu.setObjectName(u'AuditMenu')
70 self.AuditMenu.setTitle(65 self.AuditMenu.setTitle(
@@ -102,7 +97,7 @@
102 self.AuditStatus.setShortcut(translate(u'AuditPlugin', u'F4'))97 self.AuditStatus.setShortcut(translate(u'AuditPlugin', u'F4'))
103 self.AuditStatus.setObjectName(u'AuditStatus')98 self.AuditStatus.setObjectName(u'AuditStatus')
104 #Add Menus together99 #Add Menus together
105 tools_menu.addAction(self.AuditMenu.menuAction())100 self.toolsMenu.addAction(self.AuditMenu.menuAction())
106 self.AuditMenu.addAction(self.AuditStatus)101 self.AuditMenu.addAction(self.AuditStatus)
107 self.AuditMenu.addSeparator()102 self.AuditMenu.addSeparator()
108 self.AuditMenu.addAction(self.AuditDeleteAll)103 self.AuditMenu.addAction(self.AuditDeleteAll)
@@ -122,13 +117,11 @@
122 QtCore.SIGNAL(u'triggered()'), self.onAuditDelete)117 QtCore.SIGNAL(u'triggered()'), self.onAuditDelete)
123 QtCore.QObject.connect(self.AuditReport,118 QtCore.QObject.connect(self.AuditReport,
124 QtCore.SIGNAL(u'triggered()'), self.onAuditReport)119 QtCore.SIGNAL(u'triggered()'), self.onAuditReport)
125120 self.AuditMenu.menuAction().setVisible(False)
126 def get_settings_tab(self):
127 self.AuditTab = AuditTab()
128 return self.AuditTab
129121
130 def initialise(self):122 def initialise(self):
131 log.info(u'Plugin Initialising')123 log.info(u'audit Initialising')
124 Plugin.initialise(self)
132 QtCore.QObject.connect(Receiver.get_receiver(),125 QtCore.QObject.connect(Receiver.get_receiver(),
133 QtCore.SIGNAL(u'audit_live'), self.onReceiveAudit)126 QtCore.SIGNAL(u'audit_live'), self.onReceiveAudit)
134 QtCore.QObject.connect(Receiver.get_receiver(),127 QtCore.QObject.connect(Receiver.get_receiver(),
@@ -136,9 +129,17 @@
136 self.auditActive = str_to_bool(129 self.auditActive = str_to_bool(
137 self.config.get_config(u'audit active', False))130 self.config.get_config(u'audit active', False))
138 self.AuditStatus.setChecked(self.auditActive)131 self.AuditStatus.setChecked(self.auditActive)
139 self.auditmanager = AuditManager(self.config)132 if self.auditmanager is None:
133 self.auditmanager = AuditManager(self.config)
140 self.auditdeleteform = AuditDeleteForm(self.auditmanager)134 self.auditdeleteform = AuditDeleteForm(self.auditmanager)
141 self.auditdetailform = AuditDetailForm(self.auditmanager)135 self.auditdetailform = AuditDetailForm(self.auditmanager)
136 self.AuditMenu.menuAction().setVisible(True)
137
138 def finalise(self):
139 log.info(u'Plugin Finalise')
140 self.AuditMenu.menuAction().setVisible(False)
141 #stop any events being processed
142 self.auditActive = False
142143
143 def toggleAuditState(self):144 def toggleAuditState(self):
144 self.auditActive = not self.auditActive145 self.auditActive = not self.auditActive
145146
=== modified file 'openlp/plugins/audit/lib/__init__.py'
--- openlp/plugins/audit/lib/__init__.py 2009-09-23 16:33:30 +0000
+++ openlp/plugins/audit/lib/__init__.py 2009-10-03 19:10:24 +0000
@@ -22,5 +22,4 @@
22# Temple Place, Suite 330, Boston, MA 02111-1307 USA #22# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
23###############################################################################23###############################################################################
2424
25from audittab import AuditTab
26from manager import AuditManager25from manager import AuditManager
2726
=== removed file 'openlp/plugins/audit/lib/audittab.py'
--- openlp/plugins/audit/lib/audittab.py 2009-09-25 00:43:42 +0000
+++ openlp/plugins/audit/lib/audittab.py 1970-01-01 00:00:00 +0000
@@ -1,61 +0,0 @@
1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
3
4###############################################################################
5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #
7# Copyright (c) 2008-2009 Raoul Snyman #
8# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten #
9# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri #
10# --------------------------------------------------------------------------- #
11# This program is free software; you can redistribute it and/or modify it #
12# under the terms of the GNU General Public License as published by the Free #
13# Software Foundation; version 2 of the License. #
14# #
15# This program is distributed in the hope that it will be useful, but WITHOUT #
16# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
17# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
18# more details. #
19# #
20# You should have received a copy of the GNU General Public License along #
21# with this program; if not, write to the Free Software Foundation, Inc., 59 #
22# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
23###############################################################################
24
25from PyQt4 import QtGui
26
27from openlp.core.lib import SettingsTab, translate, Receiver
28
29class AuditTab(SettingsTab):
30 """
31 AuditTab is the Audit settings tab in the settings dialog.
32 """
33 def __init__(self):
34 SettingsTab.__init__(self, translate(u'AuditTab', u'Audit'), u'Audit')
35
36 def setupUi(self):
37 self.setObjectName(u'AuditTab')
38 self.AuditModeGroupBox = QtGui.QGroupBox(self)
39 self.AuditModeGroupBox.setObjectName(u'AuditModeGroupBox')
40 self.verticalLayout = QtGui.QVBoxLayout(self.AuditModeGroupBox)
41 self.verticalLayout.setObjectName("verticalLayout")
42 self.AuditActive = QtGui.QCheckBox(self)
43 self.AuditActive.setObjectName("AuditActive")
44 self.verticalLayout.addWidget(self.AuditActive)
45 self.WarningLabel = QtGui.QLabel(self)
46 self.WarningLabel.setObjectName("WarningLabel")
47 self.verticalLayout.addWidget(self.WarningLabel)
48
49 def retranslateUi(self):
50 self.AuditModeGroupBox.setTitle(translate(u'AuditTab', u'Audit File'))
51 self.AuditActive.setText(translate(u'AuditTab', 'Audit available:'))
52 self.WarningLabel.setText(translate(u'AuditTab',
53 u'A restart is needed for this change to become effective'))
54
55 def load(self):
56 self.AuditActive.setChecked(int(self.config.get_config(u'startup', 0)))
57
58 def save(self):
59 self.config.set_config(
60 u'startup', unicode(self.AuditActive.checkState()))
61 Receiver().send_message(u'audit_changed')
620
=== modified file 'openlp/plugins/bibles/bibleplugin.py'
--- openlp/plugins/bibles/bibleplugin.py 2009-10-01 16:56:42 +0000
+++ openlp/plugins/bibles/bibleplugin.py 2009-10-03 19:10:24 +0000
@@ -44,13 +44,11 @@
44 self.biblemanager = BibleManager(self.config)44 self.biblemanager = BibleManager(self.config)
4545
46 def get_settings_tab(self):46 def get_settings_tab(self):
47 self.bibles_tab = BiblesTab()47 return BiblesTab()
48 return self.bibles_tab
4948
50 def get_media_manager_item(self):49 def get_media_manager_item(self):
51 # Create the BibleManagerItem object50 # Create the BibleManagerItem object
52 self.media_item = BibleMediaItem(self, self.icon, u'Bible Verses')51 return BibleMediaItem(self, self.icon, u'Bible Verses')
53 return self.media_item
5452
55 def add_import_menu_item(self, import_menu):53 def add_import_menu_item(self, import_menu):
56 self.ImportBibleItem = QtGui.QAction(import_menu)54 self.ImportBibleItem = QtGui.QAction(import_menu)
5755
=== modified file 'openlp/plugins/custom/customplugin.py'
--- openlp/plugins/custom/customplugin.py 2009-10-01 16:56:42 +0000
+++ openlp/plugins/custom/customplugin.py 2009-10-03 19:10:24 +0000
@@ -54,8 +54,7 @@
5454
55 def get_media_manager_item(self):55 def get_media_manager_item(self):
56 # Create the CustomManagerItem object56 # Create the CustomManagerItem object
57 self.media_item = CustomMediaItem(self, self.icon, u'Custom Slides')57 return CustomMediaItem(self, self.icon, u'Custom Slides')
58 return self.media_item
5958
60 def about(self):59 def about(self):
61 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>'60 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>'
6261
=== modified file 'openlp/plugins/images/imageplugin.py'
--- openlp/plugins/images/imageplugin.py 2009-10-01 16:56:42 +0000
+++ openlp/plugins/images/imageplugin.py 2009-10-03 19:10:24 +0000
@@ -39,14 +39,24 @@
39 # Create the plugin icon39 # Create the plugin icon
40 self.icon = buildIcon(u':/media/media_image.png')40 self.icon = buildIcon(u':/media/media_image.png')
4141
42 def can_be_disabled(self):
43 return True
44
45 def initialise(self):
46 log.info(u'Plugin Initialising')
47 Plugin.initialise(self)
48 self.insert_toolbox_item()
49
50 def finalise(self):
51 log.info(u'Plugin Finalise')
52 self.remove_toolbox_item()
53
42 def get_settings_tab(self):54 def get_settings_tab(self):
43 self.ImageTab = ImageTab()55 return ImageTab()
44 return self.ImageTab
4556
46 def get_media_manager_item(self):57 def get_media_manager_item(self):
47 # Create the MediaManagerItem object58 # Create the MediaManagerItem object
48 self.media_item = ImageMediaItem(self, self.icon, u'Images')59 return ImageMediaItem(self, self.icon, u'Images')
49 return self.media_item
5060
51 def about(self):61 def about(self):
52 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>'62 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>'
5363
=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py 2009-09-26 09:11:39 +0000
+++ openlp/plugins/images/lib/mediaitem.py 2009-10-03 19:10:24 +0000
@@ -65,6 +65,8 @@
65 self.hasEditIcon = False65 self.hasEditIcon = False
6666
67 def initialise(self):67 def initialise(self):
68 log.debug(u'initialise')
69 self.ListView.clear()
68 self.ListView.setSelectionMode(70 self.ListView.setSelectionMode(
69 QtGui.QAbstractItemView.ExtendedSelection)71 QtGui.QAbstractItemView.ExtendedSelection)
70 self.ListView.setIconSize(QtCore.QSize(88,50))72 self.ListView.setIconSize(QtCore.QSize(88,50))
7173
=== modified file 'openlp/plugins/media/mediaplugin.py'
--- openlp/plugins/media/mediaplugin.py 2009-10-01 16:56:42 +0000
+++ openlp/plugins/media/mediaplugin.py 2009-10-03 19:10:24 +0000
@@ -37,13 +37,11 @@
37 self.dnd_id = u'Media'37 self.dnd_id = u'Media'
3838
39 def get_settings_tab(self):39 def get_settings_tab(self):
40 self.MediaTab = MediaTab()40 return MediaTab()
41 return self.MediaTab
4241
43 def get_media_manager_item(self):42 def get_media_manager_item(self):
44 # Create the MediaManagerItem object43 # Create the MediaManagerItem object
45 self.media_item = MediaMediaItem(self, self.icon, u'Media')44 return MediaMediaItem(self, self.icon, u'Media')
46 return self.media_item
4745
48 def about(self):46 def about(self):
49 return u'<b>Media Plugin</b> <br> One day this may provide access to video and audio clips'47 return u'<b>Media Plugin</b> <br> One day this may provide access to video and audio clips'
5048
=== modified file 'openlp/plugins/presentations/presentationplugin.py'
--- openlp/plugins/presentations/presentationplugin.py 2009-10-01 17:19:46 +0000
+++ openlp/plugins/presentations/presentationplugin.py 2009-10-03 19:10:24 +0000
@@ -50,16 +50,14 @@
50 """50 """
51 Create the settings Tab51 Create the settings Tab
52 """52 """
53 self.presentation_tab = PresentationTab(self.controllers)53 return PresentationTab(self.controllers)
54 return self.presentation_tab
5554
56 def get_media_manager_item(self):55 def get_media_manager_item(self):
57 """56 """
58 Create the Media Manager List57 Create the Media Manager List
59 """58 """
60 self.media_item = PresentationMediaItem(59 return PresentationMediaItem(
61 self, self.icon, u'Presentations', self.controllers)60 self, self.icon, u'Presentations', self.controllers)
62 return self.media_item
6361
64 def registerControllers(self, controller):62 def registerControllers(self, controller):
65 self.controllers[controller.name] = controller63 self.controllers[controller.name] = controller
6664
=== modified file 'openlp/plugins/remotes/lib/remotetab.py'
--- openlp/plugins/remotes/lib/remotetab.py 2009-09-25 00:43:42 +0000
+++ openlp/plugins/remotes/lib/remotetab.py 2009-10-03 19:10:24 +0000
@@ -44,31 +44,17 @@
44 self.RemotePortSpinBox.setObjectName(u'RemotePortSpinBox')44 self.RemotePortSpinBox.setObjectName(u'RemotePortSpinBox')
45 self.RemotePortSpinBox.setMaximum(32767)45 self.RemotePortSpinBox.setMaximum(32767)
46 self.RemoteModeLayout.addWidget(self.RemotePortSpinBox)46 self.RemoteModeLayout.addWidget(self.RemotePortSpinBox)
47 self.RemoteActive = QtGui.QCheckBox(self.RemoteModeGroupBox)
48 self.RemoteActive.setObjectName(u'RemotePortSpinBox')
49 self.RemoteModeLayout.addWidget(self.RemoteActive)
50 self.WarningLabel = QtGui.QLabel(self.RemoteModeGroupBox)
51 self.WarningLabel.setObjectName(u'WarningLabel')
52 self.RemoteModeLayout.addWidget(self.WarningLabel)
53 self.RemoteLayout.setWidget(47 self.RemoteLayout.setWidget(
54 0, QtGui.QFormLayout.LabelRole, self.RemoteModeGroupBox)48 0, QtGui.QFormLayout.LabelRole, self.RemoteModeGroupBox)
5549
56 def retranslateUi(self):50 def retranslateUi(self):
57 self.RemoteModeGroupBox.setTitle(51 self.RemoteModeGroupBox.setTitle(
58 translate(u'RemoteTab', u'Remotes Receiver Port'))52 translate(u'RemoteTab', u'Remotes Receiver Port'))
59 self.RemoteActive.setText(translate(u'RemoteTab', 'Remote available:'))
60 self.WarningLabel.setText(translate(u'RemoteTab',
61 u'A restart is needed for this change to become effective'))
6253
63 def load(self):54 def load(self):
64 self.RemotePortSpinBox.setValue(55 self.RemotePortSpinBox.setValue(
65 int(self.config.get_config(u'remote port', 4316)))56 int(self.config.get_config(u'remote port', 4316)))
66 self.RemoteActive.setChecked(
67 int(self.config.get_config(u'startup', 0)))
6857
69 def save(self):58 def save(self):
70 self.config.set_config(59 self.config.set_config(
71 u'remote port', unicode(self.RemotePortSpinBox.value()))60 u'remote port', unicode(self.RemotePortSpinBox.value()))
72 self.config.set_config(
73 u'startup', unicode(self.RemoteActive.checkState()))
74
7561
=== modified file 'openlp/plugins/remotes/remoteplugin.py'
--- openlp/plugins/remotes/remoteplugin.py 2009-10-01 16:56:42 +0000
+++ openlp/plugins/remotes/remoteplugin.py 2009-10-03 19:10:24 +0000
@@ -34,29 +34,22 @@
34 # Call the parent constructor34 # Call the parent constructor
35 Plugin.__init__(self, u'Remotes', u'1.9.0', plugin_helpers)35 Plugin.__init__(self, u'Remotes', u'1.9.0', plugin_helpers)
36 self.weight = -136 self.weight = -1
37 self.server = None
3738
38 def can_be_disabled(self):39 def can_be_disabled(self):
39 return True40 return True
4041
41 def check_pre_conditions(self):
42 """
43 Check to see if remotes is required
44 """
45 log.debug(u'check_pre_conditions')
46 #Lets see if Remote is required
47 if int(self.config.get_config(u'startup', 0)) == QtCore.Qt.Checked:
48 return True
49 else:
50 return False
51
52 def initialise(self):42 def initialise(self):
43 log.debug(u'initialise')
53 self.server = QtNetwork.QUdpSocket()44 self.server = QtNetwork.QUdpSocket()
54 self.server.bind(int(self.config.get_config(u'remote port', 4316)))45 self.server.bind(int(self.config.get_config(u'remote port', 4316)))
55 QtCore.QObject.connect(self.server,46 QtCore.QObject.connect(self.server,
56 QtCore.SIGNAL(u'readyRead()'), self.readData)47 QtCore.SIGNAL(u'readyRead()'), self.readData)
5748
58 def finalise(self):49 def finalise(self):
59 pass50 log.debug(u'finalise')
51 if self.server is not None:
52 self.server.close()
6053
61 def about(self):54 def about(self):
62 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'55 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'
@@ -78,11 +71,7 @@
78 log.info(u'Sending event %s ', datagram)71 log.info(u'Sending event %s ', datagram)
79 pos = datagram.find(u':')72 pos = datagram.find(u':')
80 event = unicode(datagram[:pos].lower())73 event = unicode(datagram[:pos].lower())
81
82 if event == u'alert':74 if event == u'alert':
83 Receiver().send_message(u'alert_text', unicode(datagram[pos + 1:]))75 Receiver().send_message(u'alert_text', unicode(datagram[pos + 1:]))
84 if event == u'next_slide':76 if event == u'next_slide':
85 Receiver().send_message(u'live_slide_next')77 Receiver().send_message(u'live_slide_next')
86
87
88
8978
=== modified file 'openlp/plugins/songs/songsplugin.py'
--- openlp/plugins/songs/songsplugin.py 2009-10-01 16:56:42 +0000
+++ openlp/plugins/songs/songsplugin.py 2009-10-03 19:10:24 +0000
@@ -64,8 +64,7 @@
64 Create the MediaManagerItem object, which is displaed in the64 Create the MediaManagerItem object, which is displaed in the
65 Media Manager.65 Media Manager.
66 """66 """
67 self.media_item = SongMediaItem(self, self.icon, 'Songs')67 return SongMediaItem(self, self.icon, 'Songs')
68 return self.media_item
6968
70 def add_import_menu_item(self, import_menu):69 def add_import_menu_item(self, import_menu):
71 """70 """
@@ -146,6 +145,7 @@
146 QtCore.SIGNAL(u'triggered()'), self.onExportOpenSongItemClicked)145 QtCore.SIGNAL(u'triggered()'), self.onExportOpenSongItemClicked)
147146
148 def initialise(self):147 def initialise(self):
148 Plugin.initialise(self)
149 self.media_item.displayResultsSong(self.songmanager.get_songs())149 self.media_item.displayResultsSong(self.songmanager.get_songs())
150150
151 def onImportOpenlp1ItemClick(self):151 def onImportOpenlp1ItemClick(self):