Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Merged at revision: | not available | ||||||||
Proposed branch: | lp:~trb143/openlp/bugfixes | ||||||||
Merge into: | lp:openlp | ||||||||
Diff against target: | None lines | ||||||||
To merge this branch: | bzr merge lp:~trb143/openlp/bugfixes | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Raoul Snyman | Approve | ||
Review via email:
|
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Tim Bentley (trb143) wrote : | # |
lp:~trb143/openlp/bugfixes
updated
- 512. By Tim Bentley
-
Clean up Event Processing
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'openlp/core/lib/__init__.py' | |||
2 | --- openlp/core/lib/__init__.py 2009-07-08 17:18:48 +0000 | |||
3 | +++ openlp/core/lib/__init__.py 2009-08-26 05:00:19 +0000 | |||
4 | @@ -60,12 +60,9 @@ | |||
5 | 60 | from settingsmanager import SettingsManager | 60 | from settingsmanager import SettingsManager |
6 | 61 | from pluginconfig import PluginConfig | 61 | from pluginconfig import PluginConfig |
7 | 62 | from plugin import Plugin | 62 | from plugin import Plugin |
8 | 63 | from eventmanager import EventManager | ||
9 | 64 | from pluginmanager import PluginManager | 63 | from pluginmanager import PluginManager |
10 | 65 | from settingstab import SettingsTab | 64 | from settingstab import SettingsTab |
11 | 66 | from mediamanageritem import MediaManagerItem | 65 | from mediamanageritem import MediaManagerItem |
12 | 67 | from event import Event | ||
13 | 68 | from event import EventType | ||
14 | 69 | from xmlrootclass import XmlRootClass | 66 | from xmlrootclass import XmlRootClass |
15 | 70 | from serviceitem import ServiceItem | 67 | from serviceitem import ServiceItem |
16 | 71 | from eventreceiver import Receiver | 68 | from eventreceiver import Receiver |
17 | 72 | 69 | ||
18 | === removed file 'openlp/core/lib/event.py' | |||
19 | --- openlp/core/lib/event.py 2009-08-15 07:33:01 +0000 | |||
20 | +++ openlp/core/lib/event.py 1970-01-01 00:00:00 +0000 | |||
21 | @@ -1,51 +0,0 @@ | |||
22 | 1 | # -*- coding: utf-8 -*- | ||
23 | 2 | # vim: autoindent shiftwidth=4 expandtab textwidth=80 | ||
24 | 3 | """ | ||
25 | 4 | OpenLP - Open Source Lyrics Projection | ||
26 | 5 | |||
27 | 6 | Copyright (c) 2008 Raoul Snyman | ||
28 | 7 | |||
29 | 8 | Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Scott Guerreri, | ||
30 | 9 | Carsten Tingaard, Jonathan Corwin | ||
31 | 10 | |||
32 | 11 | This program is free software; you can redistribute it and/or modify it under | ||
33 | 12 | the terms of the GNU General Public License as published by the Free Software | ||
34 | 13 | Foundation; version 2 of the License. | ||
35 | 14 | |||
36 | 15 | This program is distributed in the hope that it will be useful, but WITHOUT ANY | ||
37 | 16 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
38 | 17 | PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
39 | 18 | |||
40 | 19 | You should have received a copy of the GNU General Public License along with | ||
41 | 20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple | ||
42 | 21 | Place, Suite 330, Boston, MA 02111-1307 USA | ||
43 | 22 | """ | ||
44 | 23 | |||
45 | 24 | class EventType(object): | ||
46 | 25 | """ | ||
47 | 26 | Types of events are stored in this class. | ||
48 | 27 | """ | ||
49 | 28 | # "Default" event - a non-event | ||
50 | 29 | Default = 0 | ||
51 | 30 | TriggerAlert = 1 | ||
52 | 31 | # General application events | ||
53 | 32 | Ready = 10 | ||
54 | 33 | # Service events | ||
55 | 34 | LoadServiceItem = 20 | ||
56 | 35 | # Preview events | ||
57 | 36 | PreviewShow = 30 | ||
58 | 37 | LiveShow = 31 | ||
59 | 38 | #Theme Related Events | ||
60 | 39 | ThemeListChanged = 40 | ||
61 | 40 | #Plugin Related Events | ||
62 | 41 | LoadSongList = 50 | ||
63 | 42 | |||
64 | 43 | |||
65 | 44 | class Event(object): | ||
66 | 45 | """ | ||
67 | 46 | Provides an Event class to encapsulate events within openlp.org. | ||
68 | 47 | """ | ||
69 | 48 | def __init__(self, sender, event_type=EventType.Default, payload=None): | ||
70 | 49 | self.event_type = event_type | ||
71 | 50 | self.payload = payload | ||
72 | 51 | self.sender = sender | ||
73 | 52 | 0 | ||
74 | === removed file 'openlp/core/lib/eventmanager.py' | |||
75 | --- openlp/core/lib/eventmanager.py 2009-08-12 04:57:24 +0000 | |||
76 | +++ openlp/core/lib/eventmanager.py 1970-01-01 00:00:00 +0000 | |||
77 | @@ -1,72 +0,0 @@ | |||
78 | 1 | # -*- coding: utf-8 -*- | ||
79 | 2 | # vim: autoindent shiftwidth=4 expandtab textwidth=80 | ||
80 | 3 | """ | ||
81 | 4 | OpenLP - Open Source Lyrics Projection | ||
82 | 5 | |||
83 | 6 | Copyright (c) 2008 Raoul Snyman | ||
84 | 7 | |||
85 | 8 | Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Scott Guerreri, | ||
86 | 9 | Carsten Tingaard, Jonathan Corwin | ||
87 | 10 | |||
88 | 11 | This program is free software; you can redistribute it and/or modify it under | ||
89 | 12 | the terms of the GNU General Public License as published by the Free Software | ||
90 | 13 | Foundation; version 2 of the License. | ||
91 | 14 | |||
92 | 15 | This program is distributed in the hope that it will be useful, but WITHOUT ANY | ||
93 | 16 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
94 | 17 | PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
95 | 18 | |||
96 | 19 | You should have received a copy of the GNU General Public License along with | ||
97 | 20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple | ||
98 | 21 | Place, Suite 330, Boston, MA 02111-1307 USA | ||
99 | 22 | """ | ||
100 | 23 | import os | ||
101 | 24 | import logging | ||
102 | 25 | |||
103 | 26 | class EventManager(object): | ||
104 | 27 | """ | ||
105 | 28 | A mechanism to send events to all registered endpoints. The | ||
106 | 29 | endpoints are registered and listen with a handle_event method. | ||
107 | 30 | The endpoint will decide whether to do somthing with the event or | ||
108 | 31 | ignore it. | ||
109 | 32 | """ | ||
110 | 33 | global log | ||
111 | 34 | log = logging.getLogger(u'EventManager') | ||
112 | 35 | |||
113 | 36 | def __init__(self): | ||
114 | 37 | """ | ||
115 | 38 | Defines the class and a list of endpoints | ||
116 | 39 | """ | ||
117 | 40 | self.endpoints = [] | ||
118 | 41 | log.info(u'Initialising') | ||
119 | 42 | self.processing = False | ||
120 | 43 | self.events = [] | ||
121 | 44 | |||
122 | 45 | def register(self, plugin): | ||
123 | 46 | """ | ||
124 | 47 | Called by plugings who wish to receive event notifications | ||
125 | 48 | """ | ||
126 | 49 | log.debug(u'Class %s registered with EventManager', plugin) | ||
127 | 50 | self.endpoints.append(plugin) | ||
128 | 51 | |||
129 | 52 | def post_event(self, event): | ||
130 | 53 | """ | ||
131 | 54 | Called by any part of the system which wants send events to the plugins | ||
132 | 55 | |||
133 | 56 | ``event`` | ||
134 | 57 | The event type to be triggered | ||
135 | 58 | |||
136 | 59 | """ | ||
137 | 60 | log.debug(u'post event called for event %s (%s)', event.event_type, event.sender) | ||
138 | 61 | self.events.append(event) | ||
139 | 62 | if not self.processing: | ||
140 | 63 | self.processing = True | ||
141 | 64 | while len(self.events) > 0: | ||
142 | 65 | pEvent = self.events[0] | ||
143 | 66 | for point in self.endpoints: | ||
144 | 67 | status = point.handle_event(pEvent) | ||
145 | 68 | #if call returns true message is finished with | ||
146 | 69 | if status is not None and status : | ||
147 | 70 | break | ||
148 | 71 | self.events.remove(pEvent) | ||
149 | 72 | self.processing = False | ||
150 | 73 | 0 | ||
151 | === modified file 'openlp/core/lib/eventreceiver.py' | |||
152 | --- openlp/core/lib/eventreceiver.py 2009-08-24 05:10:04 +0000 | |||
153 | +++ openlp/core/lib/eventreceiver.py 2009-08-26 05:00:19 +0000 | |||
154 | @@ -18,6 +18,7 @@ | |||
155 | 18 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple | 18 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
156 | 19 | Place, Suite 330, Boston, MA 02111-1307 USA | 19 | Place, Suite 330, Boston, MA 02111-1307 USA |
157 | 20 | """ | 20 | """ |
158 | 21 | import logging | ||
159 | 21 | 22 | ||
160 | 22 | from PyQt4 import QtCore | 23 | from PyQt4 import QtCore |
161 | 23 | 24 | ||
162 | @@ -25,11 +26,39 @@ | |||
163 | 25 | """ | 26 | """ |
164 | 26 | Class to allow events to be passed from different parts of the system. | 27 | Class to allow events to be passed from different parts of the system. |
165 | 27 | This is a private class and should not be used directly but via the Receiver class | 28 | This is a private class and should not be used directly but via the Receiver class |
166 | 29 | |||
167 | 30 | ``stop_import`` | ||
168 | 31 | Stops the Bible Import | ||
169 | 32 | ``pre_load_bibles`` | ||
170 | 33 | Triggers the plugin to relaod the bible lists | ||
171 | 34 | ``process_events`` | ||
172 | 35 | Requests the Application to flush the events queue | ||
173 | 36 | ``{preview|live}_slide_first`` | ||
174 | 37 | display the first slide on the list | ||
175 | 38 | ``{preview|live}_slide_previous`` | ||
176 | 39 | display the previous slide on the list | ||
177 | 40 | ``{preview|live}_slide_next`` | ||
178 | 41 | display the next slide on the list | ||
179 | 42 | ``{preview|live}_slide_last`` | ||
180 | 43 | display the last slide on the list | ||
181 | 44 | ``{plugin}_add_service_item `` | ||
182 | 45 | ask the plugin to push the selected items to the service item | ||
183 | 46 | ``update_themes `` | ||
184 | 47 | send out message with new themes | ||
185 | 48 | ``update_global_theme `` | ||
186 | 49 | Tell the components we have a new global theme | ||
187 | 50 | ``load_song_list`` | ||
188 | 51 | Tells the the song plugin to reload the song list | ||
189 | 52 | |||
190 | 28 | """ | 53 | """ |
191 | 54 | global log | ||
192 | 55 | log = logging.getLogger(u'EventReceiver') | ||
193 | 56 | |||
194 | 29 | def __init__(self): | 57 | def __init__(self): |
195 | 30 | QtCore.QObject.__init__(self) | 58 | QtCore.QObject.__init__(self) |
196 | 31 | 59 | ||
197 | 32 | def send_message(self, event, msg=None): | 60 | def send_message(self, event, msg=None): |
198 | 61 | log.debug(u'Event %s passed with payload %s' % (event, msg)) | ||
199 | 33 | self.emit(QtCore.SIGNAL(event), msg) | 62 | self.emit(QtCore.SIGNAL(event), msg) |
200 | 34 | 63 | ||
201 | 35 | class Receiver(): | 64 | class Receiver(): |
202 | @@ -39,11 +68,11 @@ | |||
203 | 39 | As there is only one instance of it in the systems the QT signal/slot architecture | 68 | As there is only one instance of it in the systems the QT signal/slot architecture |
204 | 40 | can send messages across the system | 69 | can send messages across the system |
205 | 41 | 70 | ||
208 | 42 | Send message | 71 | ``Send message`` |
209 | 43 | Receiver().send_message(u'messageid',data) | 72 | Receiver().send_message(u'<<Message ID>>', data) |
210 | 44 | 73 | ||
213 | 45 | Receive Message | 74 | ``Receive Message`` |
214 | 46 | QtCore.QObject.connect(Receiver().get_receiver(),QtCore.SIGNAL(u'openlprepaint'),<<ACTION>>) | 75 | QtCore.QObject.connect(Receiver().get_receiver(),QtCore.SIGNAL(u'<<Message ID>>'),<<ACTION>>) |
215 | 47 | """ | 76 | """ |
216 | 48 | eventreceiver = EventReceiver() | 77 | eventreceiver = EventReceiver() |
217 | 49 | 78 | ||
218 | 50 | 79 | ||
219 | === modified file 'openlp/core/lib/plugin.py' | |||
220 | --- openlp/core/lib/plugin.py 2009-08-15 11:02:24 +0000 | |||
221 | +++ openlp/core/lib/plugin.py 2009-08-26 05:00:19 +0000 | |||
222 | @@ -19,12 +19,13 @@ | |||
223 | 19 | """ | 19 | """ |
224 | 20 | 20 | ||
225 | 21 | import logging | 21 | import logging |
226 | 22 | from PyQt4 import QtCore | ||
227 | 22 | 23 | ||
228 | 23 | from openlp.core.lib import PluginConfig | 24 | from openlp.core.lib import PluginConfig |
229 | 24 | # why does this not work??? | 25 | # why does this not work??? |
230 | 25 | # from openlp.core.lib import Event, EventType | 26 | # from openlp.core.lib import Event, EventType |
231 | 26 | # so I have to do this??? | 27 | # so I have to do this??? |
233 | 27 | from event import Event, EventType | 28 | from eventreceiver import Receiver |
234 | 28 | 29 | ||
235 | 29 | class Plugin(object): | 30 | class Plugin(object): |
236 | 30 | """ | 31 | """ |
237 | @@ -122,11 +123,11 @@ | |||
238 | 122 | self.log = logging.getLogger(self.name) | 123 | self.log = logging.getLogger(self.name) |
239 | 123 | self.preview_controller = plugin_helpers[u'preview'] | 124 | self.preview_controller = plugin_helpers[u'preview'] |
240 | 124 | self.live_controller = plugin_helpers[u'live'] | 125 | self.live_controller = plugin_helpers[u'live'] |
241 | 125 | self.event_manager = plugin_helpers[u'event'] | ||
242 | 126 | self.render_manager = plugin_helpers[u'render'] | 126 | self.render_manager = plugin_helpers[u'render'] |
243 | 127 | self.service_manager = plugin_helpers[u'service'] | 127 | self.service_manager = plugin_helpers[u'service'] |
244 | 128 | self.settings = plugin_helpers[u'settings'] | 128 | self.settings = plugin_helpers[u'settings'] |
246 | 129 | self.dnd_id=None | 129 | QtCore.QObject.connect(Receiver.get_receiver(), |
247 | 130 | QtCore.SIGNAL(u'%s_add_service_item'% self.name), self.process_add_service_event) | ||
248 | 130 | 131 | ||
249 | 131 | def check_pre_conditions(self): | 132 | def check_pre_conditions(self): |
250 | 132 | """ | 133 | """ |
251 | @@ -177,29 +178,13 @@ | |||
252 | 177 | """ | 178 | """ |
253 | 178 | pass | 179 | pass |
254 | 179 | 180 | ||
278 | 180 | def handle_event(self, event): | 181 | def process_add_service_event(self): |
279 | 181 | """ | 182 | """ |
280 | 182 | Handle the event contained in the event object. If you want | 183 | Proxy method as method is not defined early enough |
281 | 183 | to use this default behaviour, you must set self.dnd_id equal | 184 | in the processing |
282 | 184 | to that sent by the dnd source - eg the MediaItem | 185 | """ |
283 | 185 | 186 | log.debug(u'process_add_service_event event called for plugin %s' % self.name) | |
284 | 186 | ``event`` | 187 | self.media_item.onAddClick() |
262 | 187 | An object describing the event. | ||
263 | 188 | """ | ||
264 | 189 | # default behaviour - can be overridden if desired | ||
265 | 190 | log.debug(u'Handle event called with event %s with payload %s'%(event.event_type, event.payload)) | ||
266 | 191 | if event.event_type == EventType.LoadServiceItem and event.payload == self.dnd_id: | ||
267 | 192 | log.debug(u'Load Service Item received') | ||
268 | 193 | self.media_item.onAddClick() | ||
269 | 194 | return True | ||
270 | 195 | if event.event_type == EventType.PreviewShow and event.payload == self.dnd_id: | ||
271 | 196 | log.debug(u'Load Preview Item received') | ||
272 | 197 | self.media_item.onPreviewClick() | ||
273 | 198 | return True | ||
274 | 199 | if event.event_type == EventType.LiveShow and event.payload == self.dnd_id: | ||
275 | 200 | log.debug(u'Load Live Show Item received') | ||
276 | 201 | return True | ||
277 | 202 | self.media_item.onLiveClick() | ||
285 | 203 | 188 | ||
286 | 204 | def about(self): | 189 | def about(self): |
287 | 205 | """ | 190 | """ |
288 | @@ -208,38 +193,6 @@ | |||
289 | 208 | """ | 193 | """ |
290 | 209 | pass | 194 | pass |
291 | 210 | 195 | ||
292 | 211 | def save(self, data): | ||
293 | 212 | """ | ||
294 | 213 | Service item data is passed to this function, which should return a | ||
295 | 214 | string which can be written to the service file. | ||
296 | 215 | |||
297 | 216 | ``data`` | ||
298 | 217 | The data to be saved. | ||
299 | 218 | """ | ||
300 | 219 | pass | ||
301 | 220 | |||
302 | 221 | def load(self, string): | ||
303 | 222 | """ | ||
304 | 223 | A string from the service file is passed in. This function parses and | ||
305 | 224 | sets up the internals of the plugin. | ||
306 | 225 | |||
307 | 226 | ``string`` | ||
308 | 227 | The data to be loaded into the plugin. | ||
309 | 228 | """ | ||
310 | 229 | pass | ||
311 | 230 | |||
312 | 231 | def render(self, theme, screen=None): | ||
313 | 232 | """ | ||
314 | 233 | Render the screenth screenful of data using theme settings in theme. | ||
315 | 234 | |||
316 | 235 | ``theme`` | ||
317 | 236 | The theme to use when rendering. | ||
318 | 237 | |||
319 | 238 | ``screen`` | ||
320 | 239 | Defaults to *None*. The screen to render to. | ||
321 | 240 | """ | ||
322 | 241 | pass | ||
323 | 242 | |||
324 | 243 | def initialise(self): | 196 | def initialise(self): |
325 | 244 | """ | 197 | """ |
326 | 245 | Called by the plugin Manager to initialise anything it needs. | 198 | Called by the plugin Manager to initialise anything it needs. |
327 | 246 | 199 | ||
328 | === modified file 'openlp/core/lib/pluginmanager.py' | |||
329 | --- openlp/core/lib/pluginmanager.py 2009-08-15 07:55:16 +0000 | |||
330 | +++ openlp/core/lib/pluginmanager.py 2009-08-26 05:00:19 +0000 | |||
331 | @@ -21,7 +21,7 @@ | |||
332 | 21 | import sys | 21 | import sys |
333 | 22 | import logging | 22 | import logging |
334 | 23 | 23 | ||
336 | 24 | from openlp.core.lib import Plugin, EventManager | 24 | from openlp.core.lib import Plugin |
337 | 25 | 25 | ||
338 | 26 | class PluginManager(object): | 26 | class PluginManager(object): |
339 | 27 | """ | 27 | """ |
340 | @@ -50,7 +50,7 @@ | |||
341 | 50 | # this has to happen after the UI is sorted self.find_plugins(dir) | 50 | # this has to happen after the UI is sorted self.find_plugins(dir) |
342 | 51 | log.info(u'Plugin manager done init') | 51 | log.info(u'Plugin manager done init') |
343 | 52 | 52 | ||
345 | 53 | def find_plugins(self, dir, plugin_helpers, eventmanager): | 53 | def find_plugins(self, dir, plugin_helpers): |
346 | 54 | """ | 54 | """ |
347 | 55 | Scan the directory dir for objects inheriting from ``openlp.plugin``. | 55 | Scan the directory dir for objects inheriting from ``openlp.plugin``. |
348 | 56 | 56 | ||
349 | @@ -60,8 +60,6 @@ | |||
350 | 60 | ``plugin_helpers`` | 60 | ``plugin_helpers`` |
351 | 61 | A list of helper objects to pass to the plugins. | 61 | A list of helper objects to pass to the plugins. |
352 | 62 | 62 | ||
353 | 63 | ``eventmanager`` | ||
354 | 64 | The event manager to pass to the plugins. | ||
355 | 65 | """ | 63 | """ |
356 | 66 | self.plugin_helpers = plugin_helpers | 64 | self.plugin_helpers = plugin_helpers |
357 | 67 | startdepth = len(os.path.abspath(dir).split(os.sep)) | 65 | startdepth = len(os.path.abspath(dir).split(os.sep)) |
358 | @@ -103,11 +101,9 @@ | |||
359 | 103 | pList = {u'plugin': plugin, u'status': u'Inactive'} | 101 | pList = {u'plugin': plugin, u'status': u'Inactive'} |
360 | 104 | if plugin.check_pre_conditions(): | 102 | if plugin.check_pre_conditions(): |
361 | 105 | log.debug(u'Plugin %s active', unicode(plugin.name)) | 103 | log.debug(u'Plugin %s active', unicode(plugin.name)) |
362 | 106 | eventmanager.register(plugin) | ||
363 | 107 | pList[u'status'] = u'Active' | 104 | pList[u'status'] = u'Active' |
364 | 108 | self.plugins.append(pList) | 105 | self.plugins.append(pList) |
365 | 109 | 106 | ||
366 | 110 | |||
367 | 111 | def order_by_weight(self, x, y): | 107 | def order_by_weight(self, x, y): |
368 | 112 | """ | 108 | """ |
369 | 113 | Sort two plugins and order them by their weight. | 109 | Sort two plugins and order them by their weight. |
370 | 114 | 110 | ||
371 | === modified file 'openlp/core/ui/amendthemeform.py' | |||
372 | --- openlp/core/ui/amendthemeform.py 2009-08-07 17:19:32 +0000 | |||
373 | +++ openlp/core/ui/amendthemeform.py 2009-08-26 05:00:19 +0000 | |||
374 | @@ -32,11 +32,9 @@ | |||
375 | 32 | def __init__(self, thememanager, parent=None): | 32 | def __init__(self, thememanager, parent=None): |
376 | 33 | QtGui.QDialog.__init__(self, parent) | 33 | QtGui.QDialog.__init__(self, parent) |
377 | 34 | self.thememanager = thememanager | 34 | self.thememanager = thememanager |
378 | 35 | # Needed here as UI setup generates Events | ||
379 | 36 | self.path = None | 35 | self.path = None |
380 | 37 | self.theme = ThemeXML() | 36 | self.theme = ThemeXML() |
381 | 38 | self.setupUi(self) | 37 | self.setupUi(self) |
382 | 39 | |||
383 | 40 | #define signals | 38 | #define signals |
384 | 41 | #Buttons | 39 | #Buttons |
385 | 42 | QtCore.QObject.connect(self.Color1PushButton , | 40 | QtCore.QObject.connect(self.Color1PushButton , |
386 | 43 | 41 | ||
387 | === modified file 'openlp/core/ui/maindisplay.py' | |||
388 | --- openlp/core/ui/maindisplay.py 2009-08-24 04:30:04 +0000 | |||
389 | +++ openlp/core/ui/maindisplay.py 2009-08-26 05:00:19 +0000 | |||
390 | @@ -21,7 +21,7 @@ | |||
391 | 21 | from PyQt4 import QtCore, QtGui | 21 | from PyQt4 import QtCore, QtGui |
392 | 22 | 22 | ||
393 | 23 | from time import sleep | 23 | from time import sleep |
395 | 24 | from openlp.core.lib import translate, EventManager, Event, EventType, Receiver | 24 | from openlp.core.lib import translate, Receiver |
396 | 25 | 25 | ||
397 | 26 | class MainDisplay(QtGui.QWidget): | 26 | class MainDisplay(QtGui.QWidget): |
398 | 27 | """ | 27 | """ |
399 | @@ -58,20 +58,10 @@ | |||
400 | 58 | self.alertactive = False | 58 | self.alertactive = False |
401 | 59 | self.alertTab = None | 59 | self.alertTab = None |
402 | 60 | self.timer_id = 0 | 60 | self.timer_id = 0 |
403 | 61 | # Register the main form as an event consumer. | ||
404 | 62 | self.parent.EventManager.register(self) | ||
405 | 63 | QtCore.QObject.connect(Receiver.get_receiver(), | 61 | QtCore.QObject.connect(Receiver.get_receiver(), |
406 | 64 | QtCore.SIGNAL(u'live_slide_blank'), self.blankDisplay) | 62 | QtCore.SIGNAL(u'live_slide_blank'), self.blankDisplay) |
417 | 65 | 63 | QtCore.QObject.connect(Receiver.get_receiver(), | |
418 | 66 | def handle_event(self, event): | 64 | QtCore.SIGNAL(u'alert_text'), self.displayAlert) |
409 | 67 | """ | ||
410 | 68 | Accept Events for the system and If It's for Alert | ||
411 | 69 | action it and Return true to stop futher processing | ||
412 | 70 | """ | ||
413 | 71 | log.debug(u'MainDisplay received event %s with payload %s'%(event.event_type, event.payload)) | ||
414 | 72 | if event.event_type == EventType.TriggerAlert: | ||
415 | 73 | self.displayAlert(event.payload) | ||
416 | 74 | return True | ||
419 | 75 | 65 | ||
420 | 76 | def setup(self, screenNumber): | 66 | def setup(self, screenNumber): |
421 | 77 | """ | 67 | """ |
422 | 78 | 68 | ||
423 | === modified file 'openlp/core/ui/mainwindow.py' | |||
424 | --- openlp/core/ui/mainwindow.py 2009-08-15 11:02:24 +0000 | |||
425 | +++ openlp/core/ui/mainwindow.py 2009-08-26 05:00:19 +0000 | |||
426 | @@ -26,8 +26,8 @@ | |||
427 | 26 | ServiceManager, ThemeManager, MainDisplay, SlideController, \ | 26 | ServiceManager, ThemeManager, MainDisplay, SlideController, \ |
428 | 27 | PluginForm | 27 | PluginForm |
429 | 28 | from openlp.core.lib import translate, Plugin, MediaManagerItem, \ | 28 | from openlp.core.lib import translate, Plugin, MediaManagerItem, \ |
432 | 29 | SettingsTab, EventManager, RenderManager, PluginConfig, \ | 29 | SettingsTab, RenderManager, PluginConfig, \ |
433 | 30 | SettingsManager, PluginManager, EventType | 30 | SettingsManager, PluginManager, Receiver |
434 | 31 | 31 | ||
435 | 32 | class Ui_MainWindow(object): | 32 | class Ui_MainWindow(object): |
436 | 33 | def setupUi(self, MainWindow): | 33 | def setupUi(self, MainWindow): |
437 | @@ -416,7 +416,6 @@ | |||
438 | 416 | self.screenList = screens | 416 | self.screenList = screens |
439 | 417 | self.oosNotSaved = False | 417 | self.oosNotSaved = False |
440 | 418 | self.settingsmanager = SettingsManager(screens) | 418 | self.settingsmanager = SettingsManager(screens) |
441 | 419 | self.EventManager = EventManager() | ||
442 | 420 | self.mainDisplay = MainDisplay(self, screens) | 419 | self.mainDisplay = MainDisplay(self, screens) |
443 | 421 | self.generalConfig = PluginConfig(u'General') | 420 | self.generalConfig = PluginConfig(u'General') |
444 | 422 | self.alertForm = AlertForm(self) | 421 | self.alertForm = AlertForm(self) |
445 | @@ -458,6 +457,8 @@ | |||
446 | 458 | QtCore.SIGNAL(u'triggered()'), self.onPluginItemClicked) | 457 | QtCore.SIGNAL(u'triggered()'), self.onPluginItemClicked) |
447 | 459 | QtCore.QObject.connect(self.OptionsSettingsItem, | 458 | QtCore.QObject.connect(self.OptionsSettingsItem, |
448 | 460 | QtCore.SIGNAL(u'triggered()'), self.onOptionsSettingsItemClicked) | 459 | QtCore.SIGNAL(u'triggered()'), self.onOptionsSettingsItemClicked) |
449 | 460 | QtCore.QObject.connect(Receiver.get_receiver(), | ||
450 | 461 | QtCore.SIGNAL(u'update_global_theme'), self.defaultThemeChanged) | ||
451 | 461 | #warning cyclic dependency | 462 | #warning cyclic dependency |
452 | 462 | #RenderManager needs to call ThemeManager and | 463 | #RenderManager needs to call ThemeManager and |
453 | 463 | #ThemeManager needs to call RenderManager | 464 | #ThemeManager needs to call RenderManager |
454 | @@ -467,12 +468,10 @@ | |||
455 | 467 | #make the controllers available to the plugins | 468 | #make the controllers available to the plugins |
456 | 468 | self.plugin_helpers[u'preview'] = self.PreviewController | 469 | self.plugin_helpers[u'preview'] = self.PreviewController |
457 | 469 | self.plugin_helpers[u'live'] = self.LiveController | 470 | self.plugin_helpers[u'live'] = self.LiveController |
458 | 470 | self.plugin_helpers[u'event'] = self.EventManager | ||
459 | 471 | self.plugin_helpers[u'render'] = self.RenderManager | 471 | self.plugin_helpers[u'render'] = self.RenderManager |
460 | 472 | self.plugin_helpers[u'service'] = self.ServiceManagerContents | 472 | self.plugin_helpers[u'service'] = self.ServiceManagerContents |
461 | 473 | self.plugin_helpers[u'settings'] = self.settingsForm | 473 | self.plugin_helpers[u'settings'] = self.settingsForm |
464 | 474 | self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers, | 474 | self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers) |
463 | 475 | self.EventManager) | ||
465 | 476 | # hook methods have to happen after find_plugins. Find plugins needs the | 475 | # hook methods have to happen after find_plugins. Find plugins needs the |
466 | 477 | # controllers hence the hooks have moved from setupUI() to here | 476 | # controllers hence the hooks have moved from setupUI() to here |
467 | 478 | 477 | ||
468 | @@ -490,8 +489,6 @@ | |||
469 | 490 | # Call the initialise method to setup plugins. | 489 | # Call the initialise method to setup plugins. |
470 | 491 | log.info(u'initialise plugins') | 490 | log.info(u'initialise plugins') |
471 | 492 | self.plugin_manager.initialise_plugins() | 491 | self.plugin_manager.initialise_plugins() |
472 | 493 | # Register the main form as an event consumer. | ||
473 | 494 | self.EventManager.register(self) | ||
474 | 495 | # Once all components are initialised load the Themes | 492 | # Once all components are initialised load the Themes |
475 | 496 | log.info(u'Load Themes') | 493 | log.info(u'Load Themes') |
476 | 497 | self.ThemeManagerContents.loadThemes() | 494 | self.ThemeManagerContents.loadThemes() |
477 | @@ -593,9 +590,5 @@ | |||
478 | 593 | title = u'%s - %s*' % (self.mainTitle, service_name) | 590 | title = u'%s - %s*' % (self.mainTitle, service_name) |
479 | 594 | self.setWindowTitle(title) | 591 | self.setWindowTitle(title) |
480 | 595 | 592 | ||
487 | 596 | def handle_event(self, event): | 593 | def defaultThemeChanged(self, theme): |
488 | 597 | if event.event_type == EventType.ThemeListChanged: | 594 | self.DefaultThemeLabel.setText(self.defaultThemeText + theme) |
483 | 598 | self.ServiceManagerContents.updateThemeList(event.payload) | ||
484 | 599 | self.settingsForm.ThemesTab.updateThemeList(event.payload) | ||
485 | 600 | self.DefaultThemeLabel.setText(self.defaultThemeText + \ | ||
486 | 601 | self.ThemeManagerContents.getDefault()) | ||
489 | 602 | 595 | ||
490 | === modified file 'openlp/core/ui/servicemanager.py' | |||
491 | --- openlp/core/ui/servicemanager.py 2009-08-15 07:33:01 +0000 | |||
492 | +++ openlp/core/ui/servicemanager.py 2009-08-25 05:18:09 +0000 | |||
493 | @@ -24,9 +24,9 @@ | |||
494 | 24 | import shutil | 24 | import shutil |
495 | 25 | 25 | ||
496 | 26 | from PyQt4 import QtCore, QtGui | 26 | from PyQt4 import QtCore, QtGui |
500 | 27 | from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, Event, \ | 27 | from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, \ |
501 | 28 | RenderManager, EventType, EventManager, translate, buildIcon, \ | 28 | RenderManager, translate, buildIcon, \ |
502 | 29 | contextMenuAction, contextMenuSeparator | 29 | contextMenuAction, contextMenuSeparator, Receiver |
503 | 30 | from openlp.core.utils import ConfigHelper | 30 | from openlp.core.utils import ConfigHelper |
504 | 31 | 31 | ||
505 | 32 | class ServiceManagerList(QtGui.QTreeWidget): | 32 | class ServiceManagerList(QtGui.QTreeWidget): |
506 | @@ -66,6 +66,7 @@ | |||
507 | 66 | class Iter(QtGui.QTreeWidgetItemIterator): | 66 | class Iter(QtGui.QTreeWidgetItemIterator): |
508 | 67 | def __init__(self, *args): | 67 | def __init__(self, *args): |
509 | 68 | QtGui.QTreeWidgetItemIterator.__init__(self, *args) | 68 | QtGui.QTreeWidgetItemIterator.__init__(self, *args) |
510 | 69 | |||
511 | 69 | def next(self): | 70 | def next(self): |
512 | 70 | self.__iadd__(1) | 71 | self.__iadd__(1) |
513 | 71 | value = self.value() | 72 | value = self.value() |
514 | @@ -158,6 +159,8 @@ | |||
515 | 158 | QtCore.SIGNAL(u'itemCollapsed(QTreeWidgetItem*)'), self.collapsed) | 159 | QtCore.SIGNAL(u'itemCollapsed(QTreeWidgetItem*)'), self.collapsed) |
516 | 159 | QtCore.QObject.connect(self.ServiceManagerList, | 160 | QtCore.QObject.connect(self.ServiceManagerList, |
517 | 160 | QtCore.SIGNAL(u'itemExpanded(QTreeWidgetItem*)'), self.expanded) | 161 | QtCore.SIGNAL(u'itemExpanded(QTreeWidgetItem*)'), self.expanded) |
518 | 162 | QtCore.QObject.connect(Receiver.get_receiver(), | ||
519 | 163 | QtCore.SIGNAL(u'update_themes'), self.updateThemeList) | ||
520 | 161 | # Last little bits of setting up | 164 | # Last little bits of setting up |
521 | 162 | self.config = PluginConfig(u'ServiceManager') | 165 | self.config = PluginConfig(u'ServiceManager') |
522 | 163 | self.servicePath = self.config.get_data_path() | 166 | self.servicePath = self.config.get_data_path() |
523 | @@ -488,7 +491,7 @@ | |||
524 | 488 | link = event.mimeData() | 491 | link = event.mimeData() |
525 | 489 | if link.hasText(): | 492 | if link.hasText(): |
526 | 490 | plugin = event.mimeData().text() | 493 | plugin = event.mimeData().text() |
528 | 491 | self.parent.EventManager.post_event(Event(u'ServiceManager', EventType.LoadServiceItem, plugin)) | 494 | Receiver().send_message(u'%s_add_service_item' % plugin) |
529 | 492 | 495 | ||
530 | 493 | def updateThemeList(self, theme_list): | 496 | def updateThemeList(self, theme_list): |
531 | 494 | """ | 497 | """ |
532 | 495 | 498 | ||
533 | === modified file 'openlp/core/ui/thememanager.py' | |||
534 | --- openlp/core/ui/thememanager.py 2009-08-15 07:33:01 +0000 | |||
535 | +++ openlp/core/ui/thememanager.py 2009-08-26 05:00:19 +0000 | |||
536 | @@ -28,9 +28,9 @@ | |||
537 | 28 | 28 | ||
538 | 29 | from openlp.core.ui import AmendThemeForm, ServiceManager | 29 | from openlp.core.ui import AmendThemeForm, ServiceManager |
539 | 30 | from openlp.core.theme import Theme | 30 | from openlp.core.theme import Theme |
543 | 31 | from openlp.core.lib import PluginConfig, Event, EventType, \ | 31 | from openlp.core.lib import PluginConfig, \ |
544 | 32 | EventManager, OpenLPToolbar, ThemeXML, Renderer, translate, \ | 32 | OpenLPToolbar, ThemeXML, Renderer, translate, \ |
545 | 33 | file_to_xml, buildIcon | 33 | file_to_xml, buildIcon, Receiver |
546 | 34 | from openlp.core.utils import ConfigHelper | 34 | from openlp.core.utils import ConfigHelper |
547 | 35 | 35 | ||
548 | 36 | class ThemeManager(QtGui.QWidget): | 36 | class ThemeManager(QtGui.QWidget): |
549 | @@ -72,7 +72,9 @@ | |||
550 | 72 | self.Layout.addWidget(self.ThemeListWidget) | 72 | self.Layout.addWidget(self.ThemeListWidget) |
551 | 73 | #Signals | 73 | #Signals |
552 | 74 | QtCore.QObject.connect(self.ThemeListWidget, | 74 | QtCore.QObject.connect(self.ThemeListWidget, |
554 | 75 | QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.changeGlobal) | 75 | QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.changeGlobalFromScreen) |
555 | 76 | QtCore.QObject.connect(Receiver.get_receiver(), | ||
556 | 77 | QtCore.SIGNAL(u'update_global_theme'), self.changeGlobalFromTab) | ||
557 | 76 | #Variables | 78 | #Variables |
558 | 77 | self.themelist = [] | 79 | self.themelist = [] |
559 | 78 | self.path = os.path.join(ConfigHelper.get_data_path(), u'themes') | 80 | self.path = os.path.join(ConfigHelper.get_data_path(), u'themes') |
560 | @@ -86,7 +88,22 @@ | |||
561 | 86 | def getDefault(self): | 88 | def getDefault(self): |
562 | 87 | return self.global_theme | 89 | return self.global_theme |
563 | 88 | 90 | ||
565 | 89 | def changeGlobal(self, index): | 91 | def changeGlobalFromTab(self, themeName): |
566 | 92 | log.debug(u'changeGlobalFromTab %s', themeName) | ||
567 | 93 | for count in range (0, self.ThemeListWidget.count()): | ||
568 | 94 | #reset the old name | ||
569 | 95 | item = self.ThemeListWidget.item(count) | ||
570 | 96 | oldName = item.text() | ||
571 | 97 | newName = unicode(item.data(QtCore.Qt.UserRole).toString()) | ||
572 | 98 | if oldName != newName: | ||
573 | 99 | self.ThemeListWidget.item(count).setText(newName) | ||
574 | 100 | #Set the new name | ||
575 | 101 | if themeName == newName: | ||
576 | 102 | name = u'%s (%s)' % (newName, translate(u'ThemeManager', u'default')) | ||
577 | 103 | self.ThemeListWidget.item(count).setText(name) | ||
578 | 104 | |||
579 | 105 | def changeGlobalFromScreen(self, index): | ||
580 | 106 | log.debug(u'changeGlobalFromScreen %s', index) | ||
581 | 90 | for count in range (0, self.ThemeListWidget.count()): | 107 | for count in range (0, self.ThemeListWidget.count()): |
582 | 91 | item = self.ThemeListWidget.item(count) | 108 | item = self.ThemeListWidget.item(count) |
583 | 92 | oldName = item.text() | 109 | oldName = item.text() |
584 | @@ -99,6 +116,7 @@ | |||
585 | 99 | name = u'%s (%s)' % (self.global_theme, translate(u'ThemeManager', u'default')) | 116 | name = u'%s (%s)' % (self.global_theme, translate(u'ThemeManager', u'default')) |
586 | 100 | self.ThemeListWidget.item(count).setText(name) | 117 | self.ThemeListWidget.item(count).setText(name) |
587 | 101 | self.config.set_config(u'theme global theme', self.global_theme) | 118 | self.config.set_config(u'theme global theme', self.global_theme) |
588 | 119 | Receiver().send_message(u'update_global_theme', self.global_theme ) | ||
589 | 102 | self.pushThemes() | 120 | self.pushThemes() |
590 | 103 | 121 | ||
591 | 104 | def onAddTheme(self): | 122 | def onAddTheme(self): |
592 | @@ -184,7 +202,7 @@ | |||
593 | 184 | self.pushThemes() | 202 | self.pushThemes() |
594 | 185 | 203 | ||
595 | 186 | def pushThemes(self): | 204 | def pushThemes(self): |
597 | 187 | self.parent.EventManager.post_event(Event(u'ThemeManager', EventType.ThemeListChanged, self.getThemes())) | 205 | Receiver().send_message(u'update_themes', self.getThemes() ) |
598 | 188 | 206 | ||
599 | 189 | def getThemes(self): | 207 | def getThemes(self): |
600 | 190 | return self.themelist | 208 | return self.themelist |
601 | @@ -194,7 +212,6 @@ | |||
602 | 194 | xml_file = os.path.join(self.path, unicode(themename), unicode(themename) + u'.xml') | 212 | xml_file = os.path.join(self.path, unicode(themename), unicode(themename) + u'.xml') |
603 | 195 | try: | 213 | try: |
604 | 196 | xml = file_to_xml(xml_file) | 214 | xml = file_to_xml(xml_file) |
605 | 197 | #print xml | ||
606 | 198 | except: | 215 | except: |
607 | 199 | newtheme = ThemeXML() | 216 | newtheme = ThemeXML() |
608 | 200 | newtheme.new_document(u'New Theme') | 217 | newtheme.new_document(u'New Theme') |
609 | @@ -205,9 +222,7 @@ | |||
610 | 205 | unicode(0), unicode(0), unicode(0)) | 222 | unicode(0), unicode(0), unicode(0)) |
611 | 206 | xml = newtheme.extract_xml() | 223 | xml = newtheme.extract_xml() |
612 | 207 | theme = ThemeXML() | 224 | theme = ThemeXML() |
613 | 208 | #print theme | ||
614 | 209 | theme.parse(xml) | 225 | theme.parse(xml) |
615 | 210 | #print "A ", theme | ||
616 | 211 | theme.extend_image_filename(self.path) | 226 | theme.extend_image_filename(self.path) |
617 | 212 | return theme | 227 | return theme |
618 | 213 | 228 | ||
619 | 214 | 229 | ||
620 | === modified file 'openlp/core/ui/themestab.py' | |||
621 | --- openlp/core/ui/themestab.py 2009-08-07 19:05:00 +0000 | |||
622 | +++ openlp/core/ui/themestab.py 2009-08-25 20:04:58 +0000 | |||
623 | @@ -20,7 +20,7 @@ | |||
624 | 20 | 20 | ||
625 | 21 | from PyQt4 import QtCore, QtGui | 21 | from PyQt4 import QtCore, QtGui |
626 | 22 | 22 | ||
628 | 23 | from openlp.core.lib import SettingsTab, translate | 23 | from openlp.core.lib import SettingsTab, translate, Receiver |
629 | 24 | 24 | ||
630 | 25 | class ThemesTab(SettingsTab): | 25 | class ThemesTab(SettingsTab): |
631 | 26 | """ | 26 | """ |
632 | @@ -88,16 +88,16 @@ | |||
633 | 88 | self.LevelLayout.setWidget(2, QtGui.QFormLayout.FieldRole, | 88 | self.LevelLayout.setWidget(2, QtGui.QFormLayout.FieldRole, |
634 | 89 | self.GlobalLevelLabel) | 89 | self.GlobalLevelLabel) |
635 | 90 | self.ThemesTabLayout.addWidget(self.LevelGroupBox) | 90 | self.ThemesTabLayout.addWidget(self.LevelGroupBox) |
636 | 91 | |||
637 | 92 | QtCore.QObject.connect(self.SongLevelRadioButton, | 91 | QtCore.QObject.connect(self.SongLevelRadioButton, |
638 | 93 | QtCore.SIGNAL(u'pressed()'), self.onSongLevelButtonPressed) | 92 | QtCore.SIGNAL(u'pressed()'), self.onSongLevelButtonPressed) |
639 | 94 | QtCore.QObject.connect(self.ServiceLevelRadioButton, | 93 | QtCore.QObject.connect(self.ServiceLevelRadioButton, |
640 | 95 | QtCore.SIGNAL(u'pressed()'), self.onServiceLevelButtonPressed) | 94 | QtCore.SIGNAL(u'pressed()'), self.onServiceLevelButtonPressed) |
641 | 96 | QtCore.QObject.connect(self.GlobalLevelRadioButton, | 95 | QtCore.QObject.connect(self.GlobalLevelRadioButton, |
642 | 97 | QtCore.SIGNAL(u'pressed()'), self.onGlobalLevelButtonPressed) | 96 | QtCore.SIGNAL(u'pressed()'), self.onGlobalLevelButtonPressed) |
643 | 98 | |||
644 | 99 | QtCore.QObject.connect(self.DefaultComboBox, | 97 | QtCore.QObject.connect(self.DefaultComboBox, |
645 | 100 | QtCore.SIGNAL(u'activated(int)'), self.onDefaultComboBoxChanged) | 98 | QtCore.SIGNAL(u'activated(int)'), self.onDefaultComboBoxChanged) |
646 | 99 | QtCore.QObject.connect(Receiver.get_receiver(), | ||
647 | 100 | QtCore.SIGNAL(u'update_themes'), self.updateThemeList) | ||
648 | 101 | 101 | ||
649 | 102 | def retranslateUi(self): | 102 | def retranslateUi(self): |
650 | 103 | self.GlobalGroupBox.setTitle(translate(u'ThemesTab', u'Global theme')) | 103 | self.GlobalGroupBox.setTitle(translate(u'ThemesTab', u'Global theme')) |
651 | @@ -122,6 +122,7 @@ | |||
652 | 122 | def save(self): | 122 | def save(self): |
653 | 123 | self.config.set_config(u'theme global style', self.global_style ) | 123 | self.config.set_config(u'theme global style', self.global_style ) |
654 | 124 | self.config.set_config(u'theme global theme',self.global_theme) | 124 | self.config.set_config(u'theme global theme',self.global_theme) |
655 | 125 | Receiver().send_message(u'update_global_theme', self.global_theme ) | ||
656 | 125 | 126 | ||
657 | 126 | def onSongLevelButtonPressed(self): | 127 | def onSongLevelButtonPressed(self): |
658 | 127 | self.global_style= u'Song' | 128 | self.global_style= u'Song' |
659 | 128 | 129 | ||
660 | === modified file 'openlp/plugins/bibles/bibleplugin.py' | |||
661 | --- openlp/plugins/bibles/bibleplugin.py 2009-08-15 07:33:01 +0000 | |||
662 | +++ openlp/plugins/bibles/bibleplugin.py 2009-08-26 05:00:19 +0000 | |||
663 | @@ -22,7 +22,7 @@ | |||
664 | 22 | from PyQt4 import QtCore, QtGui | 22 | from PyQt4 import QtCore, QtGui |
665 | 23 | from PyQt4.QtCore import * | 23 | from PyQt4.QtCore import * |
666 | 24 | 24 | ||
668 | 25 | from openlp.core.lib import Plugin, Event, EventType, translate | 25 | from openlp.core.lib import Plugin, translate |
669 | 26 | 26 | ||
670 | 27 | from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem | 27 | from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem |
671 | 28 | 28 | ||
672 | @@ -41,9 +41,6 @@ | |||
673 | 41 | QtGui.QIcon.Normal, QtGui.QIcon.Off) | 41 | QtGui.QIcon.Normal, QtGui.QIcon.Off) |
674 | 42 | #Register the bible Manager | 42 | #Register the bible Manager |
675 | 43 | self.biblemanager = BibleManager(self.config) | 43 | self.biblemanager = BibleManager(self.config) |
676 | 44 | # passed with drag and drop messages | ||
677 | 45 | self.dnd_id = u'Bibles' | ||
678 | 46 | |||
679 | 47 | 44 | ||
680 | 48 | def get_settings_tab(self): | 45 | def get_settings_tab(self): |
681 | 49 | self.bibles_tab = BiblesTab() | 46 | self.bibles_tab = BiblesTab() |
682 | @@ -68,18 +65,6 @@ | |||
683 | 68 | export_menu.addAction(self.ExportBibleItem) | 65 | export_menu.addAction(self.ExportBibleItem) |
684 | 69 | self.ExportBibleItem.setText(translate(u'BiblePlugin', u'&Bible')) | 66 | self.ExportBibleItem.setText(translate(u'BiblePlugin', u'&Bible')) |
685 | 70 | 67 | ||
686 | 71 | def initialise(self): | ||
687 | 72 | pass | ||
688 | 73 | |||
689 | 74 | def onBibleNewClick(self): | 68 | def onBibleNewClick(self): |
690 | 75 | self.media_item.onBibleNewClick() | 69 | self.media_item.onBibleNewClick() |
691 | 76 | 70 | ||
692 | 77 | def handle_event(self, event): | ||
693 | 78 | """ | ||
694 | 79 | Handle the event contained in the event object. | ||
695 | 80 | """ | ||
696 | 81 | log.debug(u'Handle event called with event %s with payload %s'%(event.event_type, event.payload)) | ||
697 | 82 | if event.event_type == EventType.ThemeListChanged: | ||
698 | 83 | log.debug(u'New Theme request received') | ||
699 | 84 | self.bibles_tab.updateThemeList(event.payload) | ||
700 | 85 | return Plugin.handle_event(self, event) | ||
701 | 86 | 71 | ||
702 | === modified file 'openlp/plugins/bibles/forms/bibleimportform.py' | |||
703 | --- openlp/plugins/bibles/forms/bibleimportform.py 2009-08-15 07:55:16 +0000 | |||
704 | +++ openlp/plugins/bibles/forms/bibleimportform.py 2009-08-24 20:05:46 +0000 | |||
705 | @@ -152,9 +152,9 @@ | |||
706 | 152 | def onCancelButtonClicked(self): | 152 | def onCancelButtonClicked(self): |
707 | 153 | # tell import to stop | 153 | # tell import to stop |
708 | 154 | self.message = u'Bible import stopped' | 154 | self.message = u'Bible import stopped' |
710 | 155 | Receiver().send_message(u'openlpstopimport') | 155 | Receiver().send_message(u'stop_import') |
711 | 156 | # tell bibleplugin to reload the bibles | 156 | # tell bibleplugin to reload the bibles |
713 | 157 | Receiver().send_message(u'openlpreloadbibles') | 157 | Receiver().send_message(u'pre_load_bibles') |
714 | 158 | self.close() | 158 | self.close() |
715 | 159 | 159 | ||
716 | 160 | def onImportButtonClicked(self): | 160 | def onImportButtonClicked(self): |
717 | @@ -172,7 +172,7 @@ | |||
718 | 172 | self.MessageLabel.setText(message) | 172 | self.MessageLabel.setText(message) |
719 | 173 | self.ProgressBar.setValue(self.barmax) | 173 | self.ProgressBar.setValue(self.barmax) |
720 | 174 | # tell bibleplugin to reload the bibles | 174 | # tell bibleplugin to reload the bibles |
722 | 175 | Receiver().send_message(u'openlpreloadbibles') | 175 | Receiver().send_message(u'pre_load_bibles') |
723 | 176 | reply = QtGui.QMessageBox.information(self, | 176 | reply = QtGui.QMessageBox.information(self, |
724 | 177 | translate(u'BibleMediaItem', u'Information'), | 177 | translate(u'BibleMediaItem', u'Information'), |
725 | 178 | translate(u'BibleMediaItem', message)) | 178 | translate(u'BibleMediaItem', message)) |
726 | 179 | 179 | ||
727 | === modified file 'openlp/plugins/bibles/lib/biblestab.py' | |||
728 | --- openlp/plugins/bibles/lib/biblestab.py 2009-07-23 05:17:26 +0000 | |||
729 | +++ openlp/plugins/bibles/lib/biblestab.py 2009-08-25 05:18:09 +0000 | |||
730 | @@ -21,7 +21,7 @@ | |||
731 | 21 | 21 | ||
732 | 22 | from PyQt4 import Qt, QtCore, QtGui | 22 | from PyQt4 import Qt, QtCore, QtGui |
733 | 23 | 23 | ||
735 | 24 | from openlp.core.lib import translate, str_to_bool | 24 | from openlp.core.lib import translate, str_to_bool, Receiver |
736 | 25 | from openlp.core.lib import SettingsTab | 25 | from openlp.core.lib import SettingsTab |
737 | 26 | 26 | ||
738 | 27 | class BiblesTab(SettingsTab): | 27 | class BiblesTab(SettingsTab): |
739 | @@ -146,6 +146,8 @@ | |||
740 | 146 | QtCore.SIGNAL(u'activated(int)'), self.onBibleThemeComboBoxChanged) | 146 | QtCore.SIGNAL(u'activated(int)'), self.onBibleThemeComboBoxChanged) |
741 | 147 | QtCore.QObject.connect(self.LayoutStyleComboBox, | 147 | QtCore.QObject.connect(self.LayoutStyleComboBox, |
742 | 148 | QtCore.SIGNAL(u'activated(int)'), self.onLayoutStyleComboBoxChanged) | 148 | QtCore.SIGNAL(u'activated(int)'), self.onLayoutStyleComboBoxChanged) |
743 | 149 | QtCore.QObject.connect(Receiver.get_receiver(), | ||
744 | 150 | QtCore.SIGNAL(u'update_themes'), self.updateThemeList) | ||
745 | 149 | 151 | ||
746 | 150 | def retranslateUi(self): | 152 | def retranslateUi(self): |
747 | 151 | self.VerseDisplayGroupBox.setTitle(translate(u'SettingsForm', u'Verse Display')) | 153 | self.VerseDisplayGroupBox.setTitle(translate(u'SettingsForm', u'Verse Display')) |
748 | 152 | 154 | ||
749 | === modified file 'openlp/plugins/custom/customplugin.py' | |||
750 | --- openlp/plugins/custom/customplugin.py 2009-08-15 07:33:01 +0000 | |||
751 | +++ openlp/plugins/custom/customplugin.py 2009-08-26 05:00:19 +0000 | |||
752 | @@ -22,7 +22,7 @@ | |||
753 | 22 | from PyQt4 import QtCore, QtGui | 22 | from PyQt4 import QtCore, QtGui |
754 | 23 | 23 | ||
755 | 24 | from forms import EditCustomForm | 24 | from forms import EditCustomForm |
757 | 25 | from openlp.core.lib import Plugin, Event, EventType | 25 | from openlp.core.lib import Plugin |
758 | 26 | from openlp.plugins.custom.lib import CustomManager, CustomTab, CustomMediaItem | 26 | from openlp.plugins.custom.lib import CustomManager, CustomTab, CustomMediaItem |
759 | 27 | 27 | ||
760 | 28 | 28 | ||
761 | @@ -42,20 +42,8 @@ | |||
762 | 42 | self.icon = QtGui.QIcon() | 42 | self.icon = QtGui.QIcon() |
763 | 43 | self.icon.addPixmap(QtGui.QPixmap(u':/media/media_custom.png'), | 43 | self.icon.addPixmap(QtGui.QPixmap(u':/media/media_custom.png'), |
764 | 44 | QtGui.QIcon.Normal, QtGui.QIcon.Off) | 44 | QtGui.QIcon.Normal, QtGui.QIcon.Off) |
765 | 45 | # passed with drag and drop messages | ||
766 | 46 | self.dnd_id=u'Custom' | ||
767 | 47 | 45 | ||
768 | 48 | def get_media_manager_item(self): | 46 | def get_media_manager_item(self): |
769 | 49 | # Create the CustomManagerItem object | 47 | # Create the CustomManagerItem object |
770 | 50 | self.media_item = CustomMediaItem(self, self.icon, u'Custom Slides') | 48 | self.media_item = CustomMediaItem(self, self.icon, u'Custom Slides') |
771 | 51 | return self.media_item | 49 | return self.media_item |
772 | 52 | |||
773 | 53 | def handle_event(self, event): | ||
774 | 54 | """ | ||
775 | 55 | Handle the event contained in the event object. | ||
776 | 56 | """ | ||
777 | 57 | log.debug(u'Handle event called with event %s with payload %s'%(event.event_type, event.payload)) | ||
778 | 58 | if event.event_type == EventType.ThemeListChanged: | ||
779 | 59 | log.debug(u'New Theme request received') | ||
780 | 60 | self.edit_custom_form.loadThemes(event.payload) | ||
781 | 61 | return Plugin.handle_event(self, event) | ||
782 | 62 | 50 | ||
783 | === modified file 'openlp/plugins/custom/forms/editcustomform.py' | |||
784 | --- openlp/plugins/custom/forms/editcustomform.py 2009-06-17 05:11:16 +0000 | |||
785 | +++ openlp/plugins/custom/forms/editcustomform.py 2009-08-25 20:04:58 +0000 | |||
786 | @@ -20,7 +20,7 @@ | |||
787 | 20 | from PyQt4 import Qt, QtCore, QtGui | 20 | from PyQt4 import Qt, QtCore, QtGui |
788 | 21 | 21 | ||
789 | 22 | from editcustomdialog import Ui_customEditDialog | 22 | from editcustomdialog import Ui_customEditDialog |
791 | 23 | from openlp.core.lib import SongXMLBuilder, SongXMLParser | 23 | from openlp.core.lib import SongXMLBuilder, SongXMLParser, Receiver |
792 | 24 | from openlp.plugins.custom.lib.models import CustomSlide | 24 | from openlp.plugins.custom.lib.models import CustomSlide |
793 | 25 | 25 | ||
794 | 26 | class EditCustomForm(QtGui.QDialog, Ui_customEditDialog): | 26 | class EditCustomForm(QtGui.QDialog, Ui_customEditDialog): |
795 | @@ -50,6 +50,8 @@ | |||
796 | 50 | QtCore.SIGNAL(u'itemDoubleClicked(QListWidgetItem*)'), self.onVerseListViewSelected) | 50 | QtCore.SIGNAL(u'itemDoubleClicked(QListWidgetItem*)'), self.onVerseListViewSelected) |
797 | 51 | QtCore.QObject.connect(self.VerseListView, | 51 | QtCore.QObject.connect(self.VerseListView, |
798 | 52 | QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'), self.onVerseListViewPressed) | 52 | QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'), self.onVerseListViewPressed) |
799 | 53 | QtCore.QObject.connect(Receiver.get_receiver(), | ||
800 | 54 | QtCore.SIGNAL(u'update_themes'), self.loadThemes) | ||
801 | 53 | # Create other objects and forms | 55 | # Create other objects and forms |
802 | 54 | self.custommanager = custommanager | 56 | self.custommanager = custommanager |
803 | 55 | self.initialise() | 57 | self.initialise() |
804 | 56 | 58 | ||
805 | === modified file 'openlp/plugins/images/imageplugin.py' | |||
806 | --- openlp/plugins/images/imageplugin.py 2009-07-03 20:32:33 +0000 | |||
807 | +++ openlp/plugins/images/imageplugin.py 2009-08-26 05:00:19 +0000 | |||
808 | @@ -21,7 +21,7 @@ | |||
809 | 21 | 21 | ||
810 | 22 | from PyQt4 import QtCore, QtGui | 22 | from PyQt4 import QtCore, QtGui |
811 | 23 | 23 | ||
813 | 24 | from openlp.core.lib import Plugin, Event, EventType | 24 | from openlp.core.lib import Plugin |
814 | 25 | from openlp.plugins.images.lib import ImageMediaItem, ImageTab | 25 | from openlp.plugins.images.lib import ImageMediaItem, ImageTab |
815 | 26 | 26 | ||
816 | 27 | class ImagePlugin(Plugin): | 27 | class ImagePlugin(Plugin): |
817 | @@ -37,8 +37,6 @@ | |||
818 | 37 | self.icon = QtGui.QIcon() | 37 | self.icon = QtGui.QIcon() |
819 | 38 | self.icon.addPixmap(QtGui.QPixmap(u':/media/media_image.png'), | 38 | self.icon.addPixmap(QtGui.QPixmap(u':/media/media_image.png'), |
820 | 39 | QtGui.QIcon.Normal, QtGui.QIcon.Off) | 39 | QtGui.QIcon.Normal, QtGui.QIcon.Off) |
821 | 40 | # passed with drag and drop messages | ||
822 | 41 | self.dnd_id = u'Image' | ||
823 | 42 | 40 | ||
824 | 43 | def get_settings_tab(self): | 41 | def get_settings_tab(self): |
825 | 44 | self.ImageTab = ImageTab() | 42 | self.ImageTab = ImageTab() |
826 | 45 | 43 | ||
827 | === modified file 'openlp/plugins/images/lib/mediaitem.py' | |||
828 | --- openlp/plugins/images/lib/mediaitem.py 2009-08-24 17:43:15 +0000 | |||
829 | +++ openlp/plugins/images/lib/mediaitem.py 2009-08-25 05:18:09 +0000 | |||
830 | @@ -28,7 +28,7 @@ | |||
831 | 28 | # in order for DnD to the Service manager to work correctly. | 28 | # in order for DnD to the Service manager to work correctly. |
832 | 29 | class ImageListView(BaseListWithDnD): | 29 | class ImageListView(BaseListWithDnD): |
833 | 30 | def __init__(self, parent=None): | 30 | def __init__(self, parent=None): |
835 | 31 | self.PluginName = u'Image' | 31 | self.PluginName = u'Images' |
836 | 32 | BaseListWithDnD.__init__(self, parent) | 32 | BaseListWithDnD.__init__(self, parent) |
837 | 33 | 33 | ||
838 | 34 | class ImageMediaItem(MediaManagerItem): | 34 | class ImageMediaItem(MediaManagerItem): |
839 | 35 | 35 | ||
840 | === modified file 'openlp/plugins/presentations/presentationplugin.py' | |||
841 | --- openlp/plugins/presentations/presentationplugin.py 2009-08-15 19:10:59 +0000 | |||
842 | +++ openlp/plugins/presentations/presentationplugin.py 2009-08-24 20:05:46 +0000 | |||
843 | @@ -41,7 +41,6 @@ | |||
844 | 41 | self.icon = QtGui.QIcon() | 41 | self.icon = QtGui.QIcon() |
845 | 42 | self.icon.addPixmap(QtGui.QPixmap(u':/media/media_presentation.png'), | 42 | self.icon.addPixmap(QtGui.QPixmap(u':/media/media_presentation.png'), |
846 | 43 | QtGui.QIcon.Normal, QtGui.QIcon.Off) | 43 | QtGui.QIcon.Normal, QtGui.QIcon.Off) |
847 | 44 | self.dnd_id = u'Presentations' | ||
848 | 45 | 44 | ||
849 | 46 | def get_settings_tab(self): | 45 | def get_settings_tab(self): |
850 | 47 | """ | 46 | """ |
851 | 48 | 47 | ||
852 | === modified file 'openlp/plugins/remotes/remoteplugin.py' | |||
853 | --- openlp/plugins/remotes/remoteplugin.py 2009-08-24 05:10:04 +0000 | |||
854 | +++ openlp/plugins/remotes/remoteplugin.py 2009-08-26 05:00:19 +0000 | |||
855 | @@ -22,7 +22,7 @@ | |||
856 | 22 | 22 | ||
857 | 23 | from PyQt4 import QtNetwork, QtGui, QtCore | 23 | from PyQt4 import QtNetwork, QtGui, QtCore |
858 | 24 | 24 | ||
860 | 25 | from openlp.core.lib import Plugin, Event, EventType, Receiver | 25 | from openlp.core.lib import Plugin, Receiver |
861 | 26 | from openlp.plugins.remotes.lib import RemoteTab | 26 | from openlp.plugins.remotes.lib import RemoteTab |
862 | 27 | 27 | ||
863 | 28 | class RemotesPlugin(Plugin): | 28 | class RemotesPlugin(Plugin): |
864 | @@ -58,7 +58,7 @@ | |||
865 | 58 | event = unicode(datagram[:pos].lower()) | 58 | event = unicode(datagram[:pos].lower()) |
866 | 59 | 59 | ||
867 | 60 | if event == u'alert': | 60 | if event == u'alert': |
869 | 61 | self.event_manager.post_event(Event(u'RemotePlugin', EventType.TriggerAlert , unicode(datagram[pos + 1:]))) | 61 | Receiver().send_message(u'alert_text', unicode(datagram[pos + 1:])) |
870 | 62 | if event == u'next_slide': | 62 | if event == u'next_slide': |
871 | 63 | Receiver().send_message(u'live_slide_next') | 63 | Receiver().send_message(u'live_slide_next') |
872 | 64 | 64 | ||
873 | 65 | 65 | ||
874 | === modified file 'openlp/plugins/songs/forms/editsongform.py' | |||
875 | --- openlp/plugins/songs/forms/editsongform.py 2009-08-15 19:19:34 +0000 | |||
876 | +++ openlp/plugins/songs/forms/editsongform.py 2009-08-26 05:00:19 +0000 | |||
877 | @@ -22,8 +22,8 @@ | |||
878 | 22 | 22 | ||
879 | 23 | from PyQt4 import Qt, QtCore, QtGui | 23 | from PyQt4 import Qt, QtCore, QtGui |
880 | 24 | 24 | ||
883 | 25 | from openlp.core.lib import SongXMLBuilder, SongXMLParser, Event, \ | 25 | from openlp.core.lib import SongXMLBuilder, SongXMLParser, \ |
884 | 26 | EventType, EventManager, translate | 26 | translate, Receiver |
885 | 27 | from openlp.plugins.songs.forms import EditVerseForm | 27 | from openlp.plugins.songs.forms import EditVerseForm |
886 | 28 | from openlp.plugins.songs.lib.models import Song | 28 | from openlp.plugins.songs.lib.models import Song |
887 | 29 | from editsongdialog import Ui_EditSongDialog | 29 | from editsongdialog import Ui_EditSongDialog |
888 | @@ -36,7 +36,7 @@ | |||
889 | 36 | log = logging.getLogger(u'EditSongForm') | 36 | log = logging.getLogger(u'EditSongForm') |
890 | 37 | log.info(u'Song Editor loaded') | 37 | log.info(u'Song Editor loaded') |
891 | 38 | 38 | ||
893 | 39 | def __init__(self, songmanager, eventmanager, parent=None): | 39 | def __init__(self, songmanager, parent=None): |
894 | 40 | """ | 40 | """ |
895 | 41 | Constructor | 41 | Constructor |
896 | 42 | """ | 42 | """ |
897 | @@ -71,9 +71,10 @@ | |||
898 | 71 | QtCore.SIGNAL(u'activated(int)'), self.onThemeComboChanged) | 71 | QtCore.SIGNAL(u'activated(int)'), self.onThemeComboChanged) |
899 | 72 | QtCore.QObject.connect(self.MaintenanceButton, | 72 | QtCore.QObject.connect(self.MaintenanceButton, |
900 | 73 | QtCore.SIGNAL(u'clicked()'), self.onMaintenanceButtonClicked) | 73 | QtCore.SIGNAL(u'clicked()'), self.onMaintenanceButtonClicked) |
901 | 74 | QtCore.QObject.connect(Receiver.get_receiver(), | ||
902 | 75 | QtCore.SIGNAL(u'update_themes'), self.loadThemes) | ||
903 | 74 | # Create other objects and forms | 76 | # Create other objects and forms |
904 | 75 | self.songmanager = songmanager | 77 | self.songmanager = songmanager |
905 | 76 | self.eventmanager = eventmanager | ||
906 | 77 | self.parent = parent | 78 | self.parent = parent |
907 | 78 | self.verse_form = EditVerseForm() | 79 | self.verse_form = EditVerseForm() |
908 | 79 | self.initialise() | 80 | self.initialise() |
909 | @@ -364,7 +365,7 @@ | |||
910 | 364 | self.processTitle() | 365 | self.processTitle() |
911 | 365 | self.songmanager.save_song(self.song) | 366 | self.songmanager.save_song(self.song) |
912 | 366 | if self.title_change: | 367 | if self.title_change: |
914 | 367 | self.eventmanager.post_event(Event(u'EditSongForm', EventType.LoadSongList)) | 368 | Receiver().send_message(u'load_song_list') |
915 | 368 | self.close() | 369 | self.close() |
916 | 369 | 370 | ||
917 | 370 | def processLyrics(self): | 371 | def processLyrics(self): |
918 | 371 | 372 | ||
919 | === modified file 'openlp/plugins/songs/lib/mediaitem.py' | |||
920 | --- openlp/plugins/songs/lib/mediaitem.py 2009-08-15 11:02:24 +0000 | |||
921 | +++ openlp/plugins/songs/lib/mediaitem.py 2009-08-26 05:00:19 +0000 | |||
922 | @@ -22,12 +22,13 @@ | |||
923 | 22 | from PyQt4 import QtCore, QtGui | 22 | from PyQt4 import QtCore, QtGui |
924 | 23 | 23 | ||
925 | 24 | from openlp.core.lib import MediaManagerItem, translate, ServiceItem, \ | 24 | from openlp.core.lib import MediaManagerItem, translate, ServiceItem, \ |
927 | 25 | SongXMLParser, contextMenuAction, contextMenuSeparator, BaseListWithDnD | 25 | SongXMLParser, contextMenuAction, contextMenuSeparator, BaseListWithDnD, \ |
928 | 26 | Receiver | ||
929 | 26 | from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm | 27 | from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm |
930 | 27 | 28 | ||
931 | 28 | class SongListView(BaseListWithDnD): | 29 | class SongListView(BaseListWithDnD): |
932 | 29 | def __init__(self, parent=None): | 30 | def __init__(self, parent=None): |
934 | 30 | self.PluginName = u'Song' | 31 | self.PluginName = u'Songs' |
935 | 31 | BaseListWithDnD.__init__(self, parent) | 32 | BaseListWithDnD.__init__(self, parent) |
936 | 32 | 33 | ||
937 | 33 | class SongMediaItem(MediaManagerItem): | 34 | class SongMediaItem(MediaManagerItem): |
938 | @@ -43,7 +44,7 @@ | |||
939 | 43 | self.PluginTextShort = u'Song' | 44 | self.PluginTextShort = u'Song' |
940 | 44 | self.ConfigSection = u'song' | 45 | self.ConfigSection = u'song' |
941 | 45 | MediaManagerItem.__init__(self, parent, icon, title) | 46 | MediaManagerItem.__init__(self, parent, icon, title) |
943 | 46 | self.edit_song_form = EditSongForm(self.parent.songmanager, self.parent.event_manager, self) | 47 | self.edit_song_form = EditSongForm(self.parent.songmanager, self) |
944 | 47 | self.song_maintenance_form = SongMaintenanceForm(self.parent.songmanager, self) | 48 | self.song_maintenance_form = SongMaintenanceForm(self.parent.songmanager, self) |
945 | 48 | 49 | ||
946 | 49 | def setupUi(self): | 50 | def setupUi(self): |
947 | @@ -127,6 +128,9 @@ | |||
948 | 127 | QtCore.SIGNAL(u'textChanged(const QString&)'), self.onSearchTextEditChanged) | 128 | QtCore.SIGNAL(u'textChanged(const QString&)'), self.onSearchTextEditChanged) |
949 | 128 | QtCore.QObject.connect(self.ListView, | 129 | QtCore.QObject.connect(self.ListView, |
950 | 129 | QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onSongPreviewClick) | 130 | QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onSongPreviewClick) |
951 | 131 | QtCore.QObject.connect(Receiver.get_receiver(), | ||
952 | 132 | QtCore.SIGNAL(u'load_song_list'), self.onSearchTextButtonClick) | ||
953 | 133 | |||
954 | 130 | #define and add the context menu | 134 | #define and add the context menu |
955 | 131 | self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) | 135 | self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) |
956 | 132 | self.ListView.addAction(contextMenuAction(self.ListView, | 136 | self.ListView.addAction(contextMenuAction(self.ListView, |
957 | 133 | 137 | ||
958 | === modified file 'openlp/plugins/songs/songsplugin.py' | |||
959 | --- openlp/plugins/songs/songsplugin.py 2009-08-15 07:33:01 +0000 | |||
960 | +++ openlp/plugins/songs/songsplugin.py 2009-08-26 05:00:19 +0000 | |||
961 | @@ -22,7 +22,7 @@ | |||
962 | 22 | 22 | ||
963 | 23 | from PyQt4 import QtCore, QtGui | 23 | from PyQt4 import QtCore, QtGui |
964 | 24 | 24 | ||
966 | 25 | from openlp.core.lib import Plugin, Event, EventType, translate | 25 | from openlp.core.lib import Plugin, translate |
967 | 26 | from openlp.plugins.songs.lib import SongManager, SongsTab, SongMediaItem | 26 | from openlp.plugins.songs.lib import SongManager, SongsTab, SongMediaItem |
968 | 27 | from openlp.plugins.songs.forms import OpenLPImportForm, OpenSongExportForm, \ | 27 | from openlp.plugins.songs.forms import OpenLPImportForm, OpenSongExportForm, \ |
969 | 28 | OpenSongImportForm, OpenLPExportForm | 28 | OpenSongImportForm, OpenLPExportForm |
970 | @@ -46,8 +46,6 @@ | |||
971 | 46 | self.icon = QtGui.QIcon() | 46 | self.icon = QtGui.QIcon() |
972 | 47 | self.icon.addPixmap(QtGui.QPixmap(u':/media/media_song.png'), | 47 | self.icon.addPixmap(QtGui.QPixmap(u':/media/media_song.png'), |
973 | 48 | QtGui.QIcon.Normal, QtGui.QIcon.Off) | 48 | QtGui.QIcon.Normal, QtGui.QIcon.Off) |
974 | 49 | # passed with drag and drop messages | ||
975 | 50 | self.dnd_id=u'Song' | ||
976 | 51 | 49 | ||
977 | 52 | def get_media_manager_item(self): | 50 | def get_media_manager_item(self): |
978 | 53 | # Create the MediaManagerItem object | 51 | # Create the MediaManagerItem object |
979 | @@ -128,16 +126,3 @@ | |||
980 | 128 | 126 | ||
981 | 129 | def onExportOpenSongItemClicked(self): | 127 | def onExportOpenSongItemClicked(self): |
982 | 130 | self.opensong_export_form.show() | 128 | self.opensong_export_form.show() |
983 | 131 | |||
984 | 132 | def handle_event(self, event): | ||
985 | 133 | """ | ||
986 | 134 | Handle the event contained in the event object. | ||
987 | 135 | """ | ||
988 | 136 | log.debug(u'Handle event called with event %s' % event.event_type) | ||
989 | 137 | if event.event_type == EventType.ThemeListChanged: | ||
990 | 138 | log.debug(u'New Theme request received') | ||
991 | 139 | self.media_item.edit_song_form.loadThemes(event.payload) | ||
992 | 140 | if event.event_type == EventType.LoadSongList : | ||
993 | 141 | log.debug(u'Load Load Song List Item received') | ||
994 | 142 | self.media_item.displayResultsSong(self.songmanager.get_songs()) | ||
995 | 143 | return Plugin.handle_event(self, event) |
Complete removal of EventManager.
With 2 event mechanisms in the application it has been agreed we only need one.
Remove the home grown one and replace it with the QT Slot version.
All references have been converted and tested.