Status: | Superseded |
---|---|
Proposed branch: | lp:~trb143/openlp/trb143 |
Merge into: | lp:openlp |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~trb143/openlp/trb143 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Raoul Snyman | Needs Fixing | ||
Michael Gorven (community) | Approve | ||
OpenLP Core | Pending | ||
Review via email: mp+4756@code.launchpad.net |
This proposal has been superseded by a proposal from 2009-03-26.
Commit message
Description of the change
Tim Bentley (trb143) wrote : | # |
Michael Gorven (mgorven) wrote : | # |
Just two minor suggestions. The get_payload() and set_payload() methods aren't really necessary. If you later want to control access to payload you can always use a property to do so. Secondly, I think there should be blank lines between the methods in the ThemeData class.
- 429. By Tim Bentley
-
Continue fixing the EventManager usage
Use Mainwindow to trigger the loading of the themes by the ServiceManager
Tim Bentley (trb143) wrote : | # |
Add more changes in revision 429 to deal with Theme Management and use of events,
Raoul Snyman (raoul-snyman) wrote : | # |
Just noticed a few things (yes, the code monster is here)...
- Various places:
* Incorrect spacing:
foo=bar
Should be:
foo = bar
* All classes inherited from Qt classes must use Qt naming conventions.
- In openlp/
if plugin_helpers != None:
Better:
if plugin_helpers is not None:
- In openlp/
* You have:
log.
It's got a " that shouldn't be there...
* Method initialise_plugins needs it's documentation updated.
- In openlp/
* This whole dialog needs to be redone in the same format as the other dialogs, with multiple inheritance.
- 430. By Tim Bentley
-
Clean up Plugin Interface to be more Generic
Clean up Mainwindow for adding plugins
Add ThemeManager to Main window and pass to plugins
Add event Manager code to plugins and define some listners
Revert changes to Alert Form. - 431. By Tim Bentley
-
Final changes following a revert and removal.
Finish plugin.py
Add getThemes hook to thememanager.py - 432. By Tim Bentley
-
More corrections following revert
- 433. By Tim Bentley
-
Fixed duplicate Image plugin loading
Fixed error in Custom Plugin stopping it load
Unmerged revisions
Preview Diff
1 | === modified file 'openlp/core/lib/__init__.py' |
2 | --- openlp/core/lib/__init__.py 2009-03-19 17:36:06 +0000 |
3 | +++ openlp/core/lib/__init__.py 2009-03-22 07:11:05 +0000 |
4 | @@ -22,6 +22,7 @@ |
5 | from settingstab import SettingsTab |
6 | from mediamanageritem import MediaManagerItem |
7 | from event import Event |
8 | +from eventmanager import EventManager |
9 | from xmlrootclass import XmlRootClass |
10 | from serviceitem import ServiceItem |
11 | from eventreceiver import Receiver |
12 | @@ -32,4 +33,4 @@ |
13 | |
14 | __all__ = ['PluginConfig', 'Plugin', 'SettingsTab', 'MediaManagerItem', 'Event', |
15 | 'XmlRootClass', 'ServiceItem', 'Receiver', 'OpenLPToolbar', 'SongXMLBuilder', |
16 | - 'SongXMLParser'] |
17 | + 'SongXMLParser', 'EventManager'] |
18 | |
19 | === modified file 'openlp/core/lib/event.py' |
20 | --- openlp/core/lib/event.py 2008-12-01 09:33:16 +0000 |
21 | +++ openlp/core/lib/event.py 2009-03-22 07:13:34 +0000 |
22 | @@ -3,7 +3,7 @@ |
23 | """ |
24 | OpenLP - Open Source Lyrics Projection |
25 | Copyright (c) 2008 Raoul Snyman |
26 | -Portions copyright (c) 2008 Martin Thompson, Tim Bentley, Scott Guerreri, |
27 | +Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Scott Guerreri, |
28 | Carsten Tingaard, Jonathan Corwin |
29 | |
30 | This program is free software; you can redistribute it and/or modify it under |
31 | @@ -46,6 +46,15 @@ |
32 | """ |
33 | Provides an Event class to encapsulate events within openlp.org. |
34 | """ |
35 | - |
36 | def __init__(self, event_type=EventType.Default): |
37 | self.type = event_type |
38 | + self.payload = None |
39 | + |
40 | + def get_payload(self): |
41 | + return self.payload |
42 | + |
43 | + def set_payload(self, payload): |
44 | + self.payload = payload |
45 | + |
46 | + def get_type(self): |
47 | + return self.type |
48 | |
49 | === added file 'openlp/core/lib/eventmanager.py' |
50 | --- openlp/core/lib/eventmanager.py 1970-01-01 00:00:00 +0000 |
51 | +++ openlp/core/lib/eventmanager.py 2009-03-22 07:11:05 +0000 |
52 | @@ -0,0 +1,46 @@ |
53 | +# -*- coding: utf-8 -*- |
54 | +# vim: autoindent shiftwidth=4 expandtab textwidth=80 |
55 | +""" |
56 | +OpenLP - Open Source Lyrics Projection |
57 | +Copyright (c) 2008 Raoul Snyman |
58 | +Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Scott Guerreri, |
59 | + Carsten Tingaard, Jonathan Corwin |
60 | + |
61 | +This program is free software; you can redistribute it and/or modify it under |
62 | +the terms of the GNU General Public License as published by the Free Software |
63 | +Foundation; version 2 of the License. |
64 | + |
65 | +This program is distributed in the hope that it will be useful, but WITHOUT ANY |
66 | +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
67 | +PARTICULAR PURPOSE. See the GNU General Public License for more details. |
68 | + |
69 | +You should have received a copy of the GNU General Public License along with |
70 | +this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
71 | +Place, Suite 330, Boston, MA 02111-1307 USA |
72 | +""" |
73 | +import os |
74 | +import logging |
75 | + |
76 | +class EventManager(object): |
77 | + """ |
78 | + A mechanism to send events to all registered endpoints |
79 | + the endpoints are registered and listen with a handle_event method |
80 | + the endpoint will decide whether to do somthing with the event or ignore it |
81 | + |
82 | + """ |
83 | + global log |
84 | + log=logging.getLogger(u'EventManager') |
85 | + |
86 | + def __init__(self): |
87 | + self.endpoints=[] |
88 | + log.info(u'Starting') |
89 | + |
90 | + def register(self, plugin): |
91 | + log.debug(u'plugin %s registered with EventManager'%plugin) |
92 | + self.endpoints.append(plugin) |
93 | + |
94 | + def post_event(self, event): |
95 | + log.debug(u'post event called for event %s'%event.get_type) |
96 | + for point in self.endpoints: |
97 | + point.handle_event(event) |
98 | + |
99 | |
100 | === modified file 'openlp/core/lib/plugin.py' |
101 | --- openlp/core/lib/plugin.py 2009-03-01 09:13:27 +0000 |
102 | +++ openlp/core/lib/plugin.py 2009-03-22 07:13:34 +0000 |
103 | @@ -67,7 +67,7 @@ |
104 | and screen number. |
105 | """ |
106 | |
107 | - def __init__(self, name=None, version=None, preview_controller=None, live_controller=None): |
108 | + def __init__(self, name=None, version=None, plugin_helpers=None): |
109 | """ |
110 | This is the constructor for the plugin object. This provides an easy |
111 | way for descendent plugins to populate common data. This method *must* |
112 | @@ -88,8 +88,9 @@ |
113 | self.weight = 0 |
114 | # Set up logging |
115 | self.log = logging.getLogger(self.name) |
116 | - self.preview_controller=preview_controller |
117 | - self.live_controller=live_controller |
118 | + if plugin_helpers != None: |
119 | + self.preview_controller=plugin_helpers[u'preview'] |
120 | + self.live_controller=plugin_helpers[u'preview'] |
121 | |
122 | def check_pre_conditions(self): |
123 | """ |
124 | |
125 | === modified file 'openlp/core/pluginmanager.py' |
126 | --- openlp/core/pluginmanager.py 2009-03-12 20:19:24 +0000 |
127 | +++ openlp/core/pluginmanager.py 2009-03-22 07:13:34 +0000 |
128 | @@ -3,7 +3,7 @@ |
129 | """ |
130 | OpenLP - Open Source Lyrics Projection |
131 | Copyright (c) 2008 Raoul Snyman |
132 | -Portions copyright (c) 2008 Martin Thompson, Tim Bentley, |
133 | +Portions copyright (c) 2008 - 2009 Martin Thompson, Tim Bentley, |
134 | |
135 | This program is free software; you can redistribute it and/or modify it under |
136 | the terms of the GNU General Public License as published by the Free Software |
137 | @@ -22,7 +22,7 @@ |
138 | import sys |
139 | import logging |
140 | |
141 | -from openlp.core.lib import Plugin |
142 | +from openlp.core.lib import Plugin, EventManager |
143 | |
144 | class PluginManager(object): |
145 | """ |
146 | @@ -30,15 +30,15 @@ |
147 | and executes all the hooks, as and when necessary. |
148 | """ |
149 | global log |
150 | - log=logging.getLogger("PluginMgr") |
151 | - log.info("Plugin manager loaded") |
152 | + log=logging.getLogger(u'PluginMgr') |
153 | + log.info(u'"Plugin manager loaded') |
154 | |
155 | def __init__(self, dir): |
156 | """ |
157 | The constructor for the plugin manager. |
158 | Passes the controllers on to the plugins for them to interact with via their ServiceItems |
159 | """ |
160 | - log.info("Plugin manager initing") |
161 | + log.info(u'Plugin manager initing') |
162 | if not dir in sys.path: |
163 | log.debug("Inserting %s into sys.path", dir) |
164 | sys.path.insert(0, dir) |
165 | @@ -48,12 +48,11 @@ |
166 | # this has to happen after the UI is sorted self.find_plugins(dir) |
167 | log.info("Plugin manager done init") |
168 | |
169 | - def find_plugins(self, dir, preview_controller, live_controller): # xxx shouldn't dir come from self.basepath |
170 | + def find_plugins(self, dir, plugin_helpers, eventmanager): # TODO shouldn't dir come from self.basepath |
171 | """ |
172 | Scan the directory dir for objects inheriting from openlp.plugin |
173 | """ |
174 | - self.preview_controller=preview_controller |
175 | - self.live_controller=live_controller |
176 | + self.plugin_helpers = plugin_helpers |
177 | startdepth=len(os.path.abspath(dir).split(os.sep)) |
178 | log.debug("find plugins %s at depth %d" %( str(dir), startdepth)) |
179 | |
180 | @@ -80,16 +79,15 @@ |
181 | plugin_objects = [] |
182 | for p in self.plugin_classes: |
183 | try: |
184 | - plugin = p(self.preview_controller, self.live_controller) |
185 | - log.debug('loaded plugin' + str(p) + ' with controllers'+str(self.preview_controller)+str(self.live_controller)) |
186 | + plugin = p(self.plugin_helpers) |
187 | + log.debug(u'loaded plugin %s with helpers'%str(p)) |
188 | except TypeError: |
189 | - # TODO: need to get rid of this once all plugins are up to date |
190 | - plugin = p() |
191 | - log.debug('loaded plugin' + str(p) + ' with no controllers') |
192 | + log.error(u'loaded plugin %s has no helpers'%str(p)) |
193 | log.debug("Plugin="+str(p)) |
194 | if plugin.check_pre_conditions(): |
195 | log.debug("Appending "+str(p)) |
196 | plugin_objects.append(plugin) |
197 | + eventmanager.register(plugin) |
198 | self.plugins = sorted(plugin_objects, self.order_by_weight) |
199 | |
200 | def order_by_weight(self, x, y): |
201 | @@ -106,7 +104,7 @@ |
202 | log.debug('Inserting media manager item from %s' % plugin.name) |
203 | mediatoolbox.addItem(media_manager_item, plugin.icon, media_manager_item.title) |
204 | # TODO: These shouldn't be called here... |
205 | - plugin.initialise() |
206 | + #plugin.initialise() |
207 | |
208 | def hook_settings_tabs(self, settingsform=None): |
209 | """ |
210 | @@ -137,5 +135,19 @@ |
211 | for plugin in self.plugins: |
212 | plugin.add_export_menu_item(export_menu) |
213 | |
214 | - def hook_handle_event(self, event): |
215 | - pass |
216 | + def hook_handle_event(self, eventmanager): |
217 | + for plugin in self.plugins: |
218 | + handle_event = plugin.handle_event(None) |
219 | + print plugin, handle_event |
220 | +# if settings_tab is not None: |
221 | +# log.debug('Inserting settings tab item from %s' % plugin.name) |
222 | +# settingsform.addTab(settings_tab) |
223 | +# else: |
224 | +# log.debug('No settings in %s' % plugin.name) |
225 | + def initialise_plugins(self): |
226 | + """ |
227 | + Loop through all the plugins and give them an opportunity to add an item |
228 | + to the export menu. |
229 | + """ |
230 | + for plugin in self.plugins: |
231 | + plugin.initialise() |
232 | |
233 | === modified file 'openlp/core/render.py' |
234 | --- openlp/core/render.py 2009-03-12 20:19:24 +0000 |
235 | +++ openlp/core/render.py 2009-03-22 07:13:34 +0000 |
236 | @@ -44,8 +44,10 @@ |
237 | self._theme=None |
238 | self._bg_image_filename=None |
239 | self._paint=None |
240 | + |
241 | def set_debug(self, debug): |
242 | self._debug=debug |
243 | + |
244 | def set_theme(self, theme): |
245 | self._theme=theme |
246 | if theme.BackgroundType == 2: |
247 | @@ -56,6 +58,7 @@ |
248 | self._bg_image_filename=filename |
249 | if self._paint is not None: |
250 | self.scale_bg_image() |
251 | + |
252 | def scale_bg_image(self): |
253 | assert self._paint |
254 | i=QtGui.QImage(self._bg_image_filename) |
255 | @@ -81,6 +84,7 @@ |
256 | self._paint=p |
257 | if self._bg_image_filename is not None: |
258 | self.scale_bg_image() |
259 | + |
260 | def set_words_openlp(self, words): |
261 | # print "set words openlp", words |
262 | verses=[] |
263 | @@ -95,6 +99,7 @@ |
264 | verses_text.append('\n'.join(v).lstrip()) # remove first \n |
265 | |
266 | return verses_text |
267 | + |
268 | def render_screen(self, screennum): |
269 | print "render screen\n", screennum, self.words[screennum] |
270 | import time |
271 | @@ -106,6 +111,7 @@ |
272 | def set_text_rectangle(self, rect): |
273 | """ Sets the rectangle within which text should be rendered""" |
274 | self._rect=rect |
275 | + |
276 | def _render_background(self): |
277 | # xxx may have to prerender to a memdc when set theme is called for use on slow machines |
278 | # takes 26ms on mijiti's machine! |
279 | @@ -149,6 +155,7 @@ |
280 | p.drawPixmap(self.background_offsetx,self.background_offsety, self.img) |
281 | p.end() |
282 | print "render background done" |
283 | + |
284 | def split_set_of_lines(self, lines): |
285 | |
286 | """Given a list of lines, decide how to split them best if they don't all fit on the screen |
287 | @@ -212,7 +219,6 @@ |
288 | |
289 | return retval |
290 | |
291 | - |
292 | def _render_lines(self, lines): |
293 | """render a set of lines according to the theme, return bounding box""" |
294 | print "_render_lines", lines |
295 | @@ -234,6 +240,7 @@ |
296 | print "render lines DONE" |
297 | |
298 | return bbox |
299 | + |
300 | def _render_lines_unaligned(self, lines, tlcorner=(0,0)): |
301 | |
302 | """Given a list of lines to render, render each one in turn |
303 | @@ -265,7 +272,6 @@ |
304 | |
305 | return retval |
306 | |
307 | - |
308 | def _render_single_line(self, line, tlcorner=(0,0)): |
309 | |
310 | """render a single line of words onto the DC, top left corner |
311 | @@ -402,8 +408,3 @@ |
312 | p.drawText(x,y+metrics.height()-metrics.descent()-1, line) |
313 | p.end() |
314 | return (w, h) |
315 | - |
316 | - |
317 | - |
318 | - |
319 | - |
320 | |
321 | === modified file 'openlp/core/theme/theme.py' |
322 | --- openlp/core/theme/theme.py 2009-03-12 20:19:24 +0000 |
323 | +++ openlp/core/theme/theme.py 2009-03-22 07:13:34 +0000 |
324 | @@ -15,7 +15,8 @@ |
325 | '''<?xml version="1.0" encoding="iso-8859-1"?> |
326 | <Theme> |
327 | <Name>BlankStyle</Name> |
328 | - <BackgroundType>0</BackgroundType> |
329 | + <BackgroundMode>1</BackgroundMode> |
330 | + <BackgroundType>0</BackgroundType> |
331 | <BackgroundParameter1>$000000</BackgroundParameter1> |
332 | <BackgroundParameter2/> |
333 | <BackgroundParameter3/> |
334 | @@ -37,6 +38,9 @@ |
335 | attributes: |
336 | name : theme name |
337 | |
338 | + BackgroundMode : 1 - Transparent |
339 | + 1 - Opaque |
340 | + |
341 | BackgroundType : 0 - solid color |
342 | 1 - gradient color |
343 | 2 - image |
344 | |
345 | === modified file 'openlp/core/ui/__init__.py' |
346 | --- openlp/core/ui/__init__.py 2009-03-01 09:13:27 +0000 |
347 | +++ openlp/core/ui/__init__.py 2009-03-22 07:11:05 +0000 |
348 | @@ -27,7 +27,8 @@ |
349 | from alertform import AlertForm |
350 | from settingsform import SettingsForm |
351 | from servicemanager import ServiceManager |
352 | +from thememanager import ThemeManager |
353 | from mainwindow import MainWindow |
354 | |
355 | __all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', |
356 | - 'MainWindow', 'SlideController', 'ServiceManager'] |
357 | + 'MainWindow', 'SlideController', 'ServiceManager', 'ThemeManager'] |
358 | |
359 | === modified file 'openlp/core/ui/alertform.py' |
360 | --- openlp/core/ui/alertform.py 2009-03-01 09:13:27 +0000 |
361 | +++ openlp/core/ui/alertform.py 2009-03-22 07:13:34 +0000 |
362 | @@ -17,22 +17,32 @@ |
363 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
364 | Place, Suite 330, Boston, MA 02111-1307 USA |
365 | """ |
366 | - |
367 | +import logging |
368 | from PyQt4 import QtCore, QtGui |
369 | from PyQt4.QtGui import QDialog |
370 | |
371 | from openlp.core import translate |
372 | from openlp.core.resources import * |
373 | +from openlp.core.ui import AlertsTab |
374 | +from openlp.core.lib import EventManager, Event |
375 | |
376 | class AlertForm(QDialog): |
377 | - |
378 | - def __init__(self, parent=None): |
379 | + global log |
380 | + log=logging.getLogger(u'AlertForm') |
381 | + |
382 | + def __init__(self, eventmanager, parent=None): |
383 | QDialog.__init__(self, parent) |
384 | + self.alertsTab = AlertsTab() |
385 | + self.eventmanager = eventmanager |
386 | self.setupUi(self) |
387 | + log.info(u'Defined') |
388 | + |
389 | + def get_settings_tab(self): |
390 | + return self.alertsTab |
391 | |
392 | def setupUi(self, AlertForm): |
393 | AlertForm.setObjectName("AlertForm") |
394 | - AlertForm.resize(370, 105) |
395 | + AlertForm.resize(370, 110) |
396 | icon = QtGui.QIcon() |
397 | icon.addPixmap(QtGui.QPixmap(":/icon/openlp.org-icon-32.bmp"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
398 | AlertForm.setWindowIcon(icon) |
399 | @@ -56,7 +66,7 @@ |
400 | self.AlertEntryLabel.setSizePolicy(sizePolicy) |
401 | self.AlertEntryLabel.setObjectName("AlertEntryLabel") |
402 | self.AlertEntryEditItem = QtGui.QLineEdit(self.AlertEntryWidget) |
403 | - self.AlertEntryEditItem.setGeometry(QtCore.QRect(0, 20, 353, 21)) |
404 | + self.AlertEntryEditItem.setGeometry(QtCore.QRect(0, 20, 353, 26)) |
405 | self.AlertEntryEditItem.setObjectName("AlertEntryEditItem") |
406 | self.AlertFormLayout.addWidget(self.AlertEntryWidget) |
407 | self.ButtonBoxWidget = QtGui.QWidget(AlertForm) |
408 | @@ -83,20 +93,29 @@ |
409 | self.retranslateUi(AlertForm) |
410 | |
411 | QtCore.QObject.connect(self.CancelButton, QtCore.SIGNAL("clicked()"), AlertForm.close) |
412 | + QtCore.QObject.connect(self.DisplayButton, QtCore.SIGNAL("clicked()"), self.onDisplayClicked) |
413 | QtCore.QMetaObject.connectSlotsByName(AlertForm) |
414 | |
415 | def retranslateUi(self, AlertForm): |
416 | - AlertForm.setWindowTitle(translate("AlertForm", "Alert Message")) |
417 | - self.AlertEntryLabel.setText(translate("AlertForm", "Alert Text:")) |
418 | - self.DisplayButton.setText(translate("AlertForm", "Display")) |
419 | - self.CancelButton.setText(translate("AlertForm", "Cancel")) |
420 | + AlertForm.setWindowTitle(translate("AlertForm", u'Alert Message')) |
421 | + self.AlertEntryLabel.setText(translate("AlertForm", u'Alert Text:')) |
422 | + self.DisplayButton.setText(translate("AlertForm", u'Display')) |
423 | + self.CancelButton.setText(translate("AlertForm", u'Cancel')) |
424 | |
425 | # def show(self): |
426 | # self.AlertForm.show() |
427 | - |
428 | + |
429 | + def handle_event(self, event): |
430 | + """ |
431 | + Handle the event contained in the event object. |
432 | + """ |
433 | + log.debug(u'Handle event called with event %s' %event.get_type()) |
434 | |
435 | def load_settings(self): |
436 | pass |
437 | |
438 | def save_settings(self): |
439 | pass |
440 | + |
441 | + def onDisplayClicked(self): |
442 | + self.eventmanager.post_event(Event()) |
443 | |
444 | === modified file 'openlp/core/ui/mainwindow.py' |
445 | --- openlp/core/ui/mainwindow.py 2009-03-05 10:52:55 +0000 |
446 | +++ openlp/core/ui/mainwindow.py 2009-03-22 07:13:34 +0000 |
447 | @@ -3,7 +3,7 @@ |
448 | """ |
449 | OpenLP - Open Source Lyrics Projection |
450 | Copyright (c) 2008 Raoul Snyman |
451 | -Portions copyright (c) 2008 Martin Thompson, Tim Bentley, |
452 | +Portions copyright (c) 2008 - 2009 Martin Thompson, Tim Bentley, |
453 | |
454 | This program is free software; you can redistribute it and/or modify it under |
455 | the terms of the GNU General Public License as published by the Free Software |
456 | @@ -18,54 +18,74 @@ |
457 | Place, Suite 330, Boston, MA 02111-1307 USA |
458 | """ |
459 | import os |
460 | - |
461 | +import logging |
462 | from time import sleep |
463 | + |
464 | from PyQt4 import * |
465 | from PyQt4 import QtCore, QtGui |
466 | |
467 | from openlp.core.resources import * |
468 | |
469 | from openlp.core.ui import AboutForm, SettingsForm, AlertForm, \ |
470 | - SlideController, ServiceManager |
471 | -from openlp.core.lib import Plugin, MediaManagerItem, SettingsTab |
472 | + SlideController, ServiceManager, ThemeManager |
473 | +from openlp.core.lib import Plugin, MediaManagerItem, SettingsTab, EventManager |
474 | |
475 | from openlp.core import PluginManager |
476 | -import logging |
477 | + |
478 | class MainWindow(object): |
479 | global log |
480 | - log=logging.getLogger("MainWindow") |
481 | - log.info("MainWindow loaded") |
482 | + log=logging.getLogger(u'MainWindow') |
483 | + log.info(u'MainWindow loaded') |
484 | |
485 | def __init__(self): |
486 | self.main_window = QtGui.QMainWindow() |
487 | - self.alert_form = AlertForm() |
488 | + self.EventManager = EventManager() |
489 | + self.alert_form = AlertForm(self.EventManager) |
490 | self.about_form = AboutForm() |
491 | self.settings_form = SettingsForm() |
492 | + self.settings_form.addTab(self.alert_form.get_settings_tab()) |
493 | + |
494 | pluginpath = os.path.split(os.path.abspath(__file__))[0] |
495 | pluginpath = os.path.abspath(os.path.join(pluginpath, '..', '..','plugins')) |
496 | self.plugin_manager = PluginManager(pluginpath) |
497 | + self.plugin_helpers = {} |
498 | + |
499 | self.setupUi() |
500 | |
501 | - log.info('') |
502 | - self.plugin_manager.find_plugins(pluginpath, self.PreviewController, self.LiveController) |
503 | + log.info(u'Load Plugins') |
504 | + self.plugin_helpers[u'preview'] = self.PreviewController |
505 | + self.plugin_helpers[u'live'] = self.LiveController |
506 | + self.plugin_helpers[u'event'] = self.EventManager |
507 | + self.plugin_helpers[u'theme'] = self.ThemeManagerContents # Theme manger |
508 | + |
509 | + self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers, self.EventManager) |
510 | # hook methods have to happen after find_plugins. Find plugins needs the controllers |
511 | # hence the hooks have moved from setupUI() to here |
512 | |
513 | # Find and insert media manager items |
514 | - log.info("hook media") |
515 | + log.info(u'hook media') |
516 | self.plugin_manager.hook_media_manager(self.MediaToolBox) |
517 | |
518 | # Find and insert settings tabs |
519 | - log.info("hook settings") |
520 | + log.info(u'hook settings') |
521 | self.plugin_manager.hook_settings_tabs(self.settings_form) |
522 | |
523 | # Call the hook method to pull in import menus. |
524 | - log.info("hook menus") |
525 | + log.info(u'hook menus') |
526 | self.plugin_manager.hook_import_menu(self.FileImportMenu) |
527 | |
528 | # Call the hook method to pull in export menus. |
529 | - self.plugin_manager.hook_import_menu(self.FileExportMenu) |
530 | - |
531 | + self.plugin_manager.hook_export_menu(self.FileExportMenu) |
532 | + |
533 | + # Call the initialise method to setup plugins. |
534 | + log.info(u'initialise plugins') |
535 | + self.plugin_manager.initialise_plugins() |
536 | + |
537 | + # Register the different UI components with Event Manager |
538 | + self.EventManager.register(self.ServiceManagerContents) |
539 | + self.EventManager.register(self.ThemeManagerContents) |
540 | + self.EventManager.register(self.alert_form) |
541 | + |
542 | def setupUi(self): |
543 | self.main_window.setObjectName("main_window") |
544 | self.main_window.resize(1087, 847) |
545 | @@ -151,7 +171,7 @@ |
546 | self.MediaManagerLayout.addWidget(self.MediaToolBox) |
547 | self.MediaManagerDock.setWidget(self.MediaManagerContents) |
548 | self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.MediaManagerDock) |
549 | - |
550 | + #Sevice Manager Defined |
551 | self.ServiceManagerDock = QtGui.QDockWidget(self.main_window) |
552 | ServiceManagerIcon = QtGui.QIcon() |
553 | ServiceManagerIcon.addPixmap(QtGui.QPixmap(":/system/system_servicemanager.png"), |
554 | @@ -162,6 +182,7 @@ |
555 | self.ServiceManagerContents = ServiceManager(self) |
556 | self.ServiceManagerDock.setWidget(self.ServiceManagerContents) |
557 | self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.ServiceManagerDock) |
558 | + #Theme Manager Defined |
559 | self.ThemeManagerDock = QtGui.QDockWidget(self.main_window) |
560 | ThemeManagerIcon = QtGui.QIcon() |
561 | ThemeManagerIcon.addPixmap(QtGui.QPixmap(":/system/system_thememanager.png"), |
562 | @@ -169,41 +190,46 @@ |
563 | self.ThemeManagerDock.setWindowIcon(ThemeManagerIcon) |
564 | self.ThemeManagerDock.setFloating(False) |
565 | self.ThemeManagerDock.setObjectName("ThemeManagerDock") |
566 | - self.ThemeManagerContents = QtGui.QWidget() |
567 | - self.ThemeManagerContents.setObjectName("ThemeManagerContents") |
568 | - self.ThemeManagerLayout = QtGui.QVBoxLayout(self.ThemeManagerContents) |
569 | - self.ThemeManagerLayout.setSpacing(0) |
570 | - self.ThemeManagerLayout.setMargin(0) |
571 | - self.ThemeManagerLayout.setObjectName("ThemeManagerLayout") |
572 | - self.ThemeManagerToolbar = QtGui.QToolBar(self.ThemeManagerContents) |
573 | - self.ThemeManagerToolbar.setObjectName("ThemeManagerToolbar") |
574 | - NewThemeIcon = QtGui.QIcon() |
575 | - NewThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_new.png"), |
576 | - QtGui.QIcon.Normal, QtGui.QIcon.Off) |
577 | - self.ThemeNewItem = self.ThemeManagerToolbar.addAction(NewThemeIcon, 'New theme') |
578 | - EditThemeIcon = QtGui.QIcon() |
579 | - EditThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_edit.png"), |
580 | - QtGui.QIcon.Normal, QtGui.QIcon.Off) |
581 | - self.ThemeEditItem = self.ThemeManagerToolbar.addAction(EditThemeIcon, 'Edit theme') |
582 | - DeleteThemeIcon = QtGui.QIcon() |
583 | - DeleteThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_delete.png"), |
584 | - QtGui.QIcon.Normal, QtGui.QIcon.Off) |
585 | - self.ThemeDeleteButton = self.ThemeManagerToolbar.addAction(DeleteThemeIcon, 'Delete theme') |
586 | - self.ThemeManagerToolbar.addSeparator() |
587 | - ImportThemeIcon = QtGui.QIcon() |
588 | - ImportThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_import.png"), |
589 | - QtGui.QIcon.Normal, QtGui.QIcon.Off) |
590 | - self.ThemeImportButton = self.ThemeManagerToolbar.addAction(ImportThemeIcon, 'Import theme') |
591 | - ExportThemeIcon = QtGui.QIcon() |
592 | - ExportThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_export.png"), |
593 | - QtGui.QIcon.Normal, QtGui.QIcon.Off) |
594 | - self.ThemeExportButton = self.ThemeManagerToolbar.addAction(ExportThemeIcon, 'Export theme') |
595 | - self.ThemeManagerLayout.addWidget(self.ThemeManagerToolbar) |
596 | - self.ThemeManagerListView = QtGui.QListView(self.ThemeManagerContents) |
597 | - self.ThemeManagerListView.setObjectName("ThemeManagerListView") |
598 | - self.ThemeManagerLayout.addWidget(self.ThemeManagerListView) |
599 | + |
600 | + self.ThemeManagerContents = ThemeManager(self) |
601 | + |
602 | +# self.ThemeManagerContents = QtGui.QWidget() |
603 | +# self.ThemeManagerContents.setObjectName("ThemeManagerContents") |
604 | +# self.ThemeManagerLayout = QtGui.QVBoxLayout(self.ThemeManagerContents) |
605 | +# self.ThemeManagerLayout.setSpacing(0) |
606 | +# self.ThemeManagerLayout.setMargin(0) |
607 | +# self.ThemeManagerLayout.setObjectName("ThemeManagerLayout") |
608 | +# self.ThemeManagerToolbar = QtGui.QToolBar(self.ThemeManagerContents) |
609 | +# self.ThemeManagerToolbar.setObjectName("ThemeManagerToolbar") |
610 | +# NewThemeIcon = QtGui.QIcon() |
611 | +# NewThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_new.png"), |
612 | +# QtGui.QIcon.Normal, QtGui.QIcon.Off) |
613 | +# self.ThemeNewItem = self.ThemeManagerToolbar.addAction(NewThemeIcon, 'New theme') |
614 | +# EditThemeIcon = QtGui.QIcon() |
615 | +# EditThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_edit.png"), |
616 | +# QtGui.QIcon.Normal, QtGui.QIcon.Off) |
617 | +# self.ThemeEditItem = self.ThemeManagerToolbar.addAction(EditThemeIcon, 'Edit theme') |
618 | +# DeleteThemeIcon = QtGui.QIcon() |
619 | +# DeleteThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_delete.png"), |
620 | +# QtGui.QIcon.Normal, QtGui.QIcon.Off) |
621 | +# self.ThemeDeleteButton = self.ThemeManagerToolbar.addAction(DeleteThemeIcon, 'Delete theme') |
622 | +# self.ThemeManagerToolbar.addSeparator() |
623 | +# ImportThemeIcon = QtGui.QIcon() |
624 | +# ImportThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_import.png"), |
625 | +# QtGui.QIcon.Normal, QtGui.QIcon.Off) |
626 | +# self.ThemeImportButton = self.ThemeManagerToolbar.addAction(ImportThemeIcon, 'Import theme') |
627 | +# ExportThemeIcon = QtGui.QIcon() |
628 | +# ExportThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_export.png"), |
629 | +# QtGui.QIcon.Normal, QtGui.QIcon.Off) |
630 | +# self.ThemeExportButton = self.ThemeManagerToolbar.addAction(ExportThemeIcon, 'Export theme') |
631 | +# self.ThemeManagerLayout.addWidget(self.ThemeManagerToolbar) |
632 | +# self.ThemeManagerListView = QtGui.QListView(self.ThemeManagerContents) |
633 | +# self.ThemeManagerListView.setObjectName("ThemeManagerListView") |
634 | +# self.ThemeManagerLayout.addWidget(self.ThemeManagerListView) |
635 | + |
636 | self.ThemeManagerDock.setWidget(self.ThemeManagerContents) |
637 | self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.ThemeManagerDock) |
638 | + |
639 | self.FileNewItem = QtGui.QAction(self.main_window) |
640 | self.FileNewItem.setIcon(self.ServiceManagerContents.Toolbar.getIconFromTitle("New Service")) |
641 | self.FileNewItem.setObjectName("FileNewItem") |
642 | @@ -359,11 +385,11 @@ |
643 | # self.ServiceManagerContents.ThemeComboBox.setItemText(1, QtGui.QApplication.translate("main_window", "Snowy Mountains", None, QtGui.QApplication.UnicodeUTF8)) |
644 | # self.ServiceManagerContents.ThemeComboBox.setItemText(2, QtGui.QApplication.translate("main_window", "Wilderness", None, QtGui.QApplication.UnicodeUTF8)) |
645 | self.ThemeManagerDock.setWindowTitle(QtGui.QApplication.translate("main_window", "Theme Manager", None, QtGui.QApplication.UnicodeUTF8)) |
646 | - self.ThemeNewItem.setText(QtGui.QApplication.translate("main_window", "New Theme", None, QtGui.QApplication.UnicodeUTF8)) |
647 | - self.ThemeEditItem.setText(QtGui.QApplication.translate("main_window", "Edit Theme", None, QtGui.QApplication.UnicodeUTF8)) |
648 | - self.ThemeDeleteButton.setText(QtGui.QApplication.translate("main_window", "Delete Theme", None, QtGui.QApplication.UnicodeUTF8)) |
649 | - self.ThemeImportButton.setText(QtGui.QApplication.translate("main_window", "Import Theme", None, QtGui.QApplication.UnicodeUTF8)) |
650 | - self.ThemeExportButton.setText(QtGui.QApplication.translate("main_window", "Export Theme", None, QtGui.QApplication.UnicodeUTF8)) |
651 | +# self.ThemeNewItem.setText(QtGui.QApplication.translate("main_window", "New Theme", None, QtGui.QApplication.UnicodeUTF8)) |
652 | +# self.ThemeEditItem.setText(QtGui.QApplication.translate("main_window", "Edit Theme", None, QtGui.QApplication.UnicodeUTF8)) |
653 | +# self.ThemeDeleteButton.setText(QtGui.QApplication.translate("main_window", "Delete Theme", None, QtGui.QApplication.UnicodeUTF8)) |
654 | +# self.ThemeImportButton.setText(QtGui.QApplication.translate("main_window", "Import Theme", None, QtGui.QApplication.UnicodeUTF8)) |
655 | +# self.ThemeExportButton.setText(QtGui.QApplication.translate("main_window", "Export Theme", None, QtGui.QApplication.UnicodeUTF8)) |
656 | self.FileNewItem.setText(QtGui.QApplication.translate("main_window", "&New", None, QtGui.QApplication.UnicodeUTF8)) |
657 | self.FileNewItem.setToolTip(QtGui.QApplication.translate("main_window", "New Service", None, QtGui.QApplication.UnicodeUTF8)) |
658 | self.FileNewItem.setStatusTip(QtGui.QApplication.translate("main_window", "Create a new Service", None, QtGui.QApplication.UnicodeUTF8)) |
659 | |
660 | === modified file 'openlp/core/ui/servicemanager.py' |
661 | --- openlp/core/ui/servicemanager.py 2009-03-04 21:56:27 +0000 |
662 | +++ openlp/core/ui/servicemanager.py 2009-03-22 07:13:34 +0000 |
663 | @@ -40,7 +40,7 @@ |
664 | Root contains a list of ServiceItems |
665 | """ |
666 | global log |
667 | - log=logging.getLogger("ServiceData") |
668 | + log=logging.getLogger(u'ServiceData') |
669 | def __init__(self): |
670 | QAbstractItemModel.__init__(self) |
671 | self.items=[] |
672 | @@ -108,6 +108,8 @@ |
673 | one lump. |
674 | Also handles the UI tasks of moving things up and down etc. |
675 | """ |
676 | + global log |
677 | + log=logging.getLogger(u'ServiceManager') |
678 | |
679 | def __init__(self, parent): |
680 | QWidget.__init__(self) |
681 | @@ -163,6 +165,7 @@ |
682 | self.service_data.addRow(item) |
683 | else: |
684 | self.service_data.insertRow(row+1, item) |
685 | + |
686 | def removeServiceItem(self): |
687 | """Remove currently selected item""" |
688 | pass |
689 | @@ -186,3 +189,10 @@ |
690 | oosfile.write(self.oos_as_text) |
691 | oosfile.write("# END OOS\n") |
692 | oosfile.close() |
693 | + |
694 | + def handle_event(self, event): |
695 | + """ |
696 | + Handle the event contained in the event object. |
697 | + """ |
698 | + log.debug(u'Handle event called with event %s' %event.get_type()) |
699 | + |
700 | |
701 | === modified file 'openlp/core/ui/settingsform.py' |
702 | --- openlp/core/ui/settingsform.py 2009-03-05 20:31:17 +0000 |
703 | +++ openlp/core/ui/settingsform.py 2009-03-22 07:13:34 +0000 |
704 | @@ -40,9 +40,6 @@ |
705 | # Themes tab |
706 | self.ThemesTab = ThemesTab() |
707 | self.addTab(self.ThemesTab) |
708 | - # Alerts tab |
709 | - self.AlertsTab = AlertsTab() |
710 | - self.addTab(self.AlertsTab) |
711 | |
712 | def addTab(self, tab): |
713 | log.info(u'Inserting %s' % tab.title()) |
714 | |
715 | === added file 'openlp/core/ui/thememanager.py' |
716 | --- openlp/core/ui/thememanager.py 1970-01-01 00:00:00 +0000 |
717 | +++ openlp/core/ui/thememanager.py 2009-03-22 07:11:05 +0000 |
718 | @@ -0,0 +1,193 @@ |
719 | +# -*- coding: utf-8 -*- |
720 | +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 |
721 | +""" |
722 | +OpenLP - Open Source Lyrics Projection |
723 | +Copyright (c) 2009 Raoul Snyman |
724 | +Portions copyright (c) 2009 Martin Thompson, Tim Bentley, |
725 | + |
726 | +This program is free software; you can redistribute it and/or modify it under |
727 | +the terms of the GNU General Public License as published by the Free Software |
728 | +Foundation; version 2 of the License. |
729 | + |
730 | +This program is distributed in the hope that it will be useful, but WITHOUT ANY |
731 | +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
732 | +PARTICULAR PURPOSE. See the GNU General Public License for more details. |
733 | + |
734 | +You should have received a copy of the GNU General Public License along with |
735 | +this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
736 | +Place, Suite 330, Boston, MA 02111-1307 USA |
737 | +""" |
738 | +import os |
739 | + |
740 | +from time import sleep |
741 | +from copy import deepcopy |
742 | +from PyQt4 import * |
743 | +from PyQt4 import QtCore, QtGui |
744 | +from PyQt4.QtCore import * |
745 | +from PyQt4.QtGui import * |
746 | +# from openlp.core.resources import * |
747 | +# from openlp.core.ui import AboutForm, AlertForm, SettingsForm, SlideController |
748 | +from openlp.core.lib import OpenLPToolbar |
749 | +#from openlp.core.lib import ThemeItem |
750 | + |
751 | +# from openlp.core import PluginManager |
752 | +import logging |
753 | + |
754 | +class ThemeData(QAbstractItemModel): |
755 | + """ |
756 | + Tree of items for an order of Theme. |
757 | + Includes methods for reading and writing the contents to an OOS file |
758 | + Root contains a list of ThemeItems |
759 | + """ |
760 | + global log |
761 | + log=logging.getLogger(u'ThemeData') |
762 | + def __init__(self): |
763 | + QAbstractItemModel.__init__(self) |
764 | + self.items=[] |
765 | + log.info("Starting") |
766 | + def columnCount(self, parent): |
767 | + return 1; # always only a single column (for now) |
768 | + def rowCount(self, parent): |
769 | + return len(self.items) |
770 | + def insertRow(self, row, Theme_item): |
771 | +# self.beginInsertRows(QModelIndex(),row,row) |
772 | + log.info("insert row %d:%s"%(row,Theme_item)) |
773 | + self.items.insert(row, Theme_item) |
774 | + log.info("Items: %s" % self.items) |
775 | +# self.endInsertRows() |
776 | + def removeRow(self, row): |
777 | + self.beginRemoveRows(QModelIndex(), row,row) |
778 | + self.items.pop(row) |
779 | + self.endRemoveRows() |
780 | + def addRow(self, item): |
781 | + self.insertRow(len(self.items), item) |
782 | + |
783 | + def index(self, row, col, parent = QModelIndex()): |
784 | + return self.createIndex(row,col) |
785 | + |
786 | + def parent(self, index=QModelIndex()): |
787 | + return QModelIndex() # no children as yet |
788 | + def data(self, index, role): |
789 | + """ |
790 | + Called by the Theme manager to draw us in the Theme window |
791 | + """ |
792 | + row=index.row() |
793 | + if row > len(self.items): # if the last row is selected and deleted, we then get called with an empty row! |
794 | + return QVariant() |
795 | + item=self.items[row] |
796 | + if role==Qt.DisplayRole: |
797 | + retval= item.pluginname + ":" + item.shortname |
798 | + elif role == Qt.DecorationRole: |
799 | + retval = item.iconic_representation |
800 | + elif role == Qt.ToolTipRole: |
801 | + retval= None |
802 | + else: |
803 | + retval= None |
804 | + if retval == None: |
805 | + retval=QVariant() |
806 | +# log.info("Returning"+ str(retval)) |
807 | + if type(retval) is not type(QVariant): |
808 | + return QVariant(retval) |
809 | + else: |
810 | + return retval |
811 | + |
812 | + def __iter__(self): |
813 | + for i in self.items: |
814 | + yield i |
815 | + |
816 | + def item(self, row): |
817 | + log.info("Get Item:%d -> %s" %(row, str(self.items))) |
818 | + return self.items[row] |
819 | + |
820 | + |
821 | +class ThemeManager(QWidget): |
822 | + |
823 | + """Manages the orders of Theme. Currently this involves taking |
824 | + text strings from plugins and adding them to an OOS file. In |
825 | + future, it will also handle zipping up all the resources used into |
826 | + one lump. |
827 | + Also handles the UI tasks of moving things up and down etc. |
828 | + """ |
829 | + global log |
830 | + log=logging.getLogger(u'ThemeManager') |
831 | + |
832 | + def __init__(self, parent): |
833 | + QWidget.__init__(self) |
834 | + self.parent=parent |
835 | + self.Layout = QtGui.QVBoxLayout(self) |
836 | + self.Layout.setSpacing(0) |
837 | + self.Layout.setMargin(0) |
838 | + self.Toolbar = OpenLPToolbar(self) |
839 | + self.Toolbar.addToolbarButton("New Theme", ":/themes/theme_new.png") |
840 | + self.Toolbar.addToolbarButton("Edit Theme", ":/themes/theme_edit.png") |
841 | + self.Toolbar.addToolbarButton("Delete Theme", ":/themes/theme_delete.png") |
842 | + self.Toolbar.addSeparator() |
843 | + self.Toolbar.addToolbarButton("Import Theme", ":/themes/theme_import.png") |
844 | + self.Toolbar.addToolbarButton("Export Theme", ":/themes/theme_export.png") |
845 | + self.ThemeWidget = QtGui.QWidgetAction(self.Toolbar) |
846 | + self.Toolbar.addAction(self.ThemeWidget) |
847 | + |
848 | + self.Layout.addWidget(self.Toolbar) |
849 | + |
850 | + self.TreeView = QtGui.QTreeView(self) |
851 | + self.Theme_data=ThemeData() |
852 | + self.TreeView.setModel(self.Theme_data) |
853 | + self.Layout.addWidget(self.TreeView) |
854 | + |
855 | +# def addThemeItem(self, item): |
856 | +# """Adds Theme item""" |
857 | +# log.info("addThemeItem") |
858 | +# indexes=self.TreeView.selectedIndexes() |
859 | +# assert len(indexes) <= 1 # can only have one selected index in this view |
860 | +# if indexes == []: |
861 | +# log.info("No row") |
862 | +# row = None |
863 | +# selected_item = None |
864 | +# else: |
865 | +# row=indexes[0].row() |
866 | +# # if currently selected is of correct type, add it to it |
867 | +# log.info("row:%d"%row) |
868 | +# selected_item=self.Theme_data.item(row) |
869 | +# if type(selected_item) == type(item): |
870 | +# log.info("Add to existing item") |
871 | +# selected_item.add(item) |
872 | +# else: |
873 | +# log.info("Create new item") |
874 | +# if row is None: |
875 | +# self.Theme_data.addRow(item) |
876 | +# else: |
877 | +# self.Theme_data.insertRow(row+1, item) |
878 | +# |
879 | +# def removeThemeItem(self): |
880 | +# """Remove currently selected item""" |
881 | +# pass |
882 | +# |
883 | +# def oos_as_text(self): |
884 | +# text=[] |
885 | +# log.info( "oos as text") |
886 | +# log.info("Data:"+str(self.Theme_data)) |
887 | +# for i in self.Theme_data: |
888 | +# text.append("# " + str(i)) |
889 | +# text.append(i.get_oos_text()) |
890 | +# return '\n'.join(text) |
891 | +# |
892 | +# def write_oos(self, filename): |
893 | +# """ |
894 | +# Write a full OOS file out - iterate over plugins and call their respective methods |
895 | +# This format is totally arbitrary testing purposes - something sensible needs to go in here! |
896 | +# """ |
897 | +# oosfile=open(filename, "w") |
898 | +# oosfile.write("# BEGIN OOS\n") |
899 | +# oosfile.write(self.oos_as_text) |
900 | +# oosfile.write("# END OOS\n") |
901 | +# oosfile.close() |
902 | + |
903 | + def handle_event(self, event): |
904 | + """ |
905 | + Handle the event contained in the event object. |
906 | + """ |
907 | + log.debug(u'Handle event called with event %s' %event.get_type()) |
908 | + |
909 | + def get_themes(self): |
910 | + return [u'Theme A', u'Theme B'] |
911 | + |
912 | |
913 | === modified file 'openlp/plugins/bibles/bibleplugin.py' |
914 | --- openlp/plugins/bibles/bibleplugin.py 2009-03-18 17:19:30 +0000 |
915 | +++ openlp/plugins/bibles/bibleplugin.py 2009-03-22 07:13:34 +0000 |
916 | @@ -35,9 +35,9 @@ |
917 | log=logging.getLogger(u'BiblePlugin') |
918 | log.info(u'Bible Plugin loaded') |
919 | |
920 | - def __init__(self): |
921 | + def __init__(self, plugin_helpers): |
922 | # Call the parent constructor |
923 | - Plugin.__init__(self, u'Bibles', u'1.9.0') |
924 | + Plugin.__init__(self, u'Bibles', u'1.9.0', plugin_helpers) |
925 | self.weight = -9 |
926 | # Create the plugin icon |
927 | self.icon = QtGui.QIcon() |
928 | |
929 | === modified file 'openlp/plugins/custom/customplugin.py' |
930 | --- openlp/plugins/custom/customplugin.py 2009-03-17 05:05:04 +0000 |
931 | +++ openlp/plugins/custom/customplugin.py 2009-03-22 07:13:34 +0000 |
932 | @@ -22,7 +22,7 @@ |
933 | from PyQt4 import QtCore, QtGui |
934 | |
935 | from openlp.core.resources import * |
936 | -from openlp.core.lib import Plugin |
937 | +from openlp.core.lib import Plugin, Event |
938 | from forms import EditCustomForm |
939 | from openlp.plugins.custom.lib import CustomManager, CustomTab, CustomMediaItem, CustomServiceItem |
940 | |
941 | @@ -32,9 +32,9 @@ |
942 | log=logging.getLogger(u'CustomPlugin') |
943 | log.info(u'Custom Plugin loaded') |
944 | |
945 | - def __init__(self, preview_controller, live_controller): |
946 | + def __init__(self, plugin_helpers): |
947 | # Call the parent constructor |
948 | - Plugin.__init__(self, u'Custom', u'1.9.0', preview_controller, live_controller) |
949 | + Plugin.__init__(self, u'Custom', u'1.9.0', plugin_helpers) |
950 | self.weight = -5 |
951 | self.custommanager = CustomManager(self.config) |
952 | self.edit_custom_form = EditCustomForm(self.custommanager) |
953 | @@ -43,17 +43,16 @@ |
954 | self.icon.addPixmap(QtGui.QPixmap(':/media/media_custom.png'), |
955 | QtGui.QIcon.Normal, QtGui.QIcon.Off) |
956 | |
957 | - self.preview_service_item = CustomServiceItem(preview_controller) |
958 | - self.live_service_item = CustomServiceItem(live_controller) |
959 | + self.preview_service_item = CustomServiceItem(self.preview_controller) |
960 | + self.live_service_item = CustomServiceItem(self.live_controller) |
961 | |
962 | def get_media_manager_item(self): |
963 | # Create the CustomManagerItem object |
964 | self.media_item = CustomMediaItem(self, self.icon, u'Custom Slides') |
965 | return self.media_item |
966 | |
967 | - def get_settings_tab(self): |
968 | - pass |
969 | - |
970 | - def initialise(self): |
971 | - pass |
972 | - |
973 | + def handle_event(self, event): |
974 | + """ |
975 | + Handle the event contained in the event object. |
976 | + """ |
977 | + log.debug(u'Handle event called with event %s' %event.get_type()) |
978 | |
979 | === modified file 'openlp/plugins/images/imageplugin.py' |
980 | --- openlp/plugins/images/imageplugin.py 2009-03-18 17:19:30 +0000 |
981 | +++ openlp/plugins/images/imageplugin.py 2009-03-22 07:13:34 +0000 |
982 | @@ -31,17 +31,17 @@ |
983 | log=logging.getLogger(u'ImagePlugin') |
984 | log.info(u'Image Plugin loaded') |
985 | |
986 | - def __init__(self, preview_controller, live_controller): |
987 | + def __init__(self, plugin_helpers): |
988 | # Call the parent constructor |
989 | - Plugin.__init__(self, u'Images', u'1.9.0', preview_controller, live_controller) |
990 | + Plugin.__init__(self, u'Images', u'1.9.0', plugin_helpers) |
991 | self.weight = -7 |
992 | # Create the plugin icon |
993 | self.icon = QtGui.QIcon() |
994 | self.icon.addPixmap(QtGui.QPixmap(':/media/media_image.png'), |
995 | QtGui.QIcon.Normal, QtGui.QIcon.Off) |
996 | |
997 | - self.preview_service_item = ImageServiceItem(preview_controller) |
998 | - self.live_service_item = ImageServiceItem(live_controller) |
999 | + self.preview_service_item = ImageServiceItem(self.preview_controller) |
1000 | + self.live_service_item = ImageServiceItem(self.live_controller) |
1001 | |
1002 | def get_media_manager_item(self): |
1003 | # Create the MediaManagerItem object |
1004 | |
1005 | === modified file 'openlp/plugins/presentations/presentationplugin.py' |
1006 | --- openlp/plugins/presentations/presentationplugin.py 2009-03-19 17:31:33 +0000 |
1007 | +++ openlp/plugins/presentations/presentationplugin.py 2009-03-22 07:13:34 +0000 |
1008 | @@ -28,9 +28,9 @@ |
1009 | |
1010 | class PresentationPlugin(Plugin): |
1011 | |
1012 | - def __init__(self): |
1013 | + def __init__(self, plugin_helpers): |
1014 | # Call the parent constructor |
1015 | - Plugin.__init__(self, u'Presentations', u'1.9.0') |
1016 | + Plugin.__init__(self, u'Presentations', u'1.9.0', plugin_helpers) |
1017 | self.weight = -8 |
1018 | # Create the plugin icon |
1019 | self.icon = QtGui.QIcon() |
1020 | |
1021 | === modified file 'openlp/plugins/songs/songsplugin.py' |
1022 | --- openlp/plugins/songs/songsplugin.py 2009-03-18 17:19:30 +0000 |
1023 | +++ openlp/plugins/songs/songsplugin.py 2009-03-22 07:13:34 +0000 |
1024 | @@ -33,9 +33,9 @@ |
1025 | log=logging.getLogger(u'SongsPlugin') |
1026 | log.info(u'Song Plugin loaded') |
1027 | |
1028 | - def __init__(self): |
1029 | + def __init__(self, plugin_helpers): |
1030 | # Call the parent constructor |
1031 | - Plugin.__init__(self, u'Songs', u'1.9.0') |
1032 | + Plugin.__init__(self, u'Songs', u'1.9.0', plugin_helpers) |
1033 | self.weight = -10 |
1034 | self.songmanager = SongManager(self.config) |
1035 | self.openlp_import_form = OpenLPImportForm() |
1036 | |
1037 | === modified file 'openlp/plugins/videos/videoplugin.py' |
1038 | --- openlp/plugins/videos/videoplugin.py 2009-03-19 17:31:33 +0000 |
1039 | +++ openlp/plugins/videos/videoplugin.py 2009-03-22 07:13:34 +0000 |
1040 | @@ -26,9 +26,9 @@ |
1041 | |
1042 | class VideoPlugin(Plugin): |
1043 | |
1044 | - def __init__(self): |
1045 | + def __init__(self, plugin_helpers): |
1046 | # Call the parent constructor |
1047 | - Plugin.__init__(self, u'Videos', u'1.9.0') |
1048 | + Plugin.__init__(self, u'Videos', u'1.9.0', plugin_helpers) |
1049 | self.weight = -6 |
1050 | # Create the plugin icon |
1051 | self.icon = QtGui.QIcon() |
This is my first attempt at merge request please be nice ;-)
The code added eventmanager and thememanager (based on service manager)
Tidies up the plugin interface to make it generic for passing objects in and fixes all plugins.
Refactor the AlertDialog and Tab so the Dialog can see the Tab. Update SettingsManager.
Create a Event calling chain based on the Alert Display button. (See the log file for output)
Clean up MainWindow and PluginManager
Other small formatting tidyups.