Merge lp:~meths/openlp/trivialfixes into lp:openlp

Proposed by Jon Tibble
Status: Merged
Merged at revision: not available
Proposed branch: lp:~meths/openlp/trivialfixes
Merge into: lp:openlp
Diff against target: None lines
To merge this branch: bzr merge lp:~meths/openlp/trivialfixes
Reviewer Review Type Date Requested Status
Raoul Snyman Approve
Review via email: mp+12126@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jon Tibble (meths) wrote :

Refactor services to:

- Change all references of oos to service
- Add code to clean service directory on closing OpenLP

Revision history for this message
Raoul Snyman (raoul-snyman) :
review: Approve
lp:~meths/openlp/trivialfixes updated
557. By Jon Tibble

Refactor services

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2009-09-16 04:59:38 +0000
+++ openlp/core/lib/serviceitem.py 2009-09-19 21:45:50 +0000
@@ -174,12 +174,12 @@
174 self.service_item_path = path174 self.service_item_path = path
175 self.service_frames.append({u'title': frame_title, u'command': None})175 self.service_frames.append({u'title': frame_title, u'command': None})
176176
177 def get_oos_repr(self):177 def get_service_repr(self):
178 """178 """
179 This method returns some text which can be saved into the OOS179 This method returns some text which can be saved into the service
180 file to represent this item.180 file to represent this item.
181 """181 """
182 oos_header = {182 service_header = {
183 u'name': self.name.lower(),183 u'name': self.name.lower(),
184 u'plugin': self.shortname,184 u'plugin': self.shortname,
185 u'theme':self.theme,185 u'theme':self.theme,
@@ -189,19 +189,19 @@
189 u'type':self.service_item_type,189 u'type':self.service_item_type,
190 u'audit':self.audit190 u'audit':self.audit
191 }191 }
192 oos_data = []192 service_data = []
193 if self.service_item_type == ServiceType.Text:193 if self.service_item_type == ServiceType.Text:
194 for slide in self.service_frames:194 for slide in self.service_frames:
195 oos_data.append(slide)195 service_data.append(slide)
196 elif self.service_item_type == ServiceType.Image:196 elif self.service_item_type == ServiceType.Image:
197 for slide in self.service_frames:197 for slide in self.service_frames:
198 oos_data.append(slide[u'title'])198 service_data.append(slide[u'title'])
199 elif self.service_item_type == ServiceType.Command:199 elif self.service_item_type == ServiceType.Command:
200 for slide in self.service_frames:200 for slide in self.service_frames:
201 oos_data.append(slide[u'title'])201 service_data.append(slide[u'title'])
202 return {u'header': oos_header, u'data': oos_data}202 return {u'header': service_header, u'data': service_data}
203203
204 def set_from_oos(self, serviceitem, path=None):204 def set_from_service(self, serviceitem, path=None):
205 """205 """
206 This method takes a service item from a saved service file (passed206 This method takes a service item from a saved service file (passed
207 from the ServiceManager) and extracts the data actually required.207 from the ServiceManager) and extracts the data actually required.
208208
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2009-09-19 11:25:01 +0000
+++ openlp/core/ui/mainwindow.py 2009-09-19 21:45:50 +0000
@@ -453,7 +453,7 @@
453 QtGui.QMainWindow.__init__(self)453 QtGui.QMainWindow.__init__(self)
454 self.closeEvent = self.onCloseEvent454 self.closeEvent = self.onCloseEvent
455 self.screenList = screens455 self.screenList = screens
456 self.oosNotSaved = False456 self.serviceNotSaved = False
457 self.settingsmanager = SettingsManager(screens)457 self.settingsmanager = SettingsManager(screens)
458 self.mainDisplay = MainDisplay(self, screens)458 self.mainDisplay = MainDisplay(self, screens)
459 self.generalConfig = PluginConfig(u'General')459 self.generalConfig = PluginConfig(u'General')
@@ -535,8 +535,8 @@
535 self.plugin_helpers[u'service'] = self.ServiceManagerContents535 self.plugin_helpers[u'service'] = self.ServiceManagerContents
536 self.plugin_helpers[u'settings'] = self.settingsForm536 self.plugin_helpers[u'settings'] = self.settingsForm
537 self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers)537 self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers)
538 # hook methods have to happen after find_plugins. Find plugins needs the538 # hook methods have to happen after find_plugins. Find plugins needs
539 # controllers hence the hooks have moved from setupUI() to here539 # the controllers hence the hooks have moved from setupUI() to here
540 # Find and insert settings tabs540 # Find and insert settings tabs
541 log.info(u'hook settings')541 log.info(u'hook settings')
542 self.plugin_manager.hook_settings_tabs(self.settingsForm)542 self.plugin_manager.hook_settings_tabs(self.settingsForm)
@@ -617,10 +617,10 @@
617 """617 """
618 Hook to close the main window and display windows on exit618 Hook to close the main window and display windows on exit
619 """619 """
620 if self.oosNotSaved == True:620 if self.serviceNotSaved == True:
621 ret = QtGui.QMessageBox.question(None,621 ret = QtGui.QMessageBox.question(None,
622 translate(u'mainWindow', u'Save Changes to Service?'),622 translate(u'mainWindow', u'Save Changes to Service?'),
623 translate(u'mainWindow', u'Your service has been changed, do you want to save those changes?'),623 translate(u'mainWindow', u'Your service has changed, do you want to save those changes?'),
624 QtGui.QMessageBox.StandardButtons(624 QtGui.QMessageBox.StandardButtons(
625 QtGui.QMessageBox.Cancel |625 QtGui.QMessageBox.Cancel |
626 QtGui.QMessageBox.Discard |626 QtGui.QMessageBox.Discard |
@@ -629,16 +629,19 @@
629 if ret == QtGui.QMessageBox.Save:629 if ret == QtGui.QMessageBox.Save:
630 self.ServiceManagerContents.onSaveService()630 self.ServiceManagerContents.onSaveService()
631 self.mainDisplay.close()631 self.mainDisplay.close()
632 self.ServiceManagerContents.cleanUp()
632 self.cleanUp()633 self.cleanUp()
633 event.accept()634 event.accept()
634 elif ret == QtGui.QMessageBox.Discard:635 elif ret == QtGui.QMessageBox.Discard:
635 self.mainDisplay.close()636 self.mainDisplay.close()
637 self.ServiceManagerContents.cleanUp()
636 self.cleanUp()638 self.cleanUp()
637 event.accept()639 event.accept()
638 else:640 else:
639 event.ignore()641 event.ignore()
640 else:642 else:
641 self.mainDisplay.close()643 self.mainDisplay.close()
644 self.ServiceManagerContents.cleanUp()
642 self.cleanUp()645 self.cleanUp()
643 event.accept()646 event.accept()
644647
@@ -647,21 +650,25 @@
647 log.info(u'cleanup plugins')650 log.info(u'cleanup plugins')
648 self.plugin_manager.finalise_plugins()651 self.plugin_manager.finalise_plugins()
649652
650 def OosChanged(self, reset=False, oosName=None):653 def serviceChanged(self, reset=False, serviceName=None):
651 """654 """
652 Hook to change the title if the OOS has been changed655 Hook to change the main window title when the service changes
653 reset - tells if the OOS has been cleared or saved656
654 oosName - is the name of the OOS (if it has one)657 ``reset``
655 """658 Shows if the service has been cleared or saved
656 if not oosName:659
660 ``serviceName``
661 The name of the service (if it has one)
662 """
663 if not serviceName:
657 service_name = u'(unsaved service)'664 service_name = u'(unsaved service)'
658 else:665 else:
659 service_name = oosName666 service_name = serviceName
660 if reset == True:667 if reset == True:
661 self.oosNotSaved = False668 self.serviceNotSaved = False
662 title = u'%s - %s' % (self.mainTitle, service_name)669 title = u'%s - %s' % (self.mainTitle, service_name)
663 else:670 else:
664 self.oosNotSaved = True671 self.serviceNotSaved = True
665 title = u'%s - %s*' % (self.mainTitle, service_name)672 title = u'%s - %s*' % (self.mainTitle, service_name)
666 self.setWindowTitle(title)673 self.setWindowTitle(title)
667674
668675
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2009-09-19 19:37:01 +0000
+++ openlp/core/ui/servicemanager.py 2009-09-19 21:45:50 +0000
@@ -84,10 +84,9 @@
8484
85class ServiceManager(QtGui.QWidget):85class ServiceManager(QtGui.QWidget):
86 """86 """
87 Manages the orders of service. Currently this involves taking87 Manages the services. This involves taking text strings from plugins and
88 text strings from plugins and adding them to an OOS file. In88 adding them to the service. This service can then be zipped up with all
89 future, it will also handle zipping up all the resources used into89 the resources used into one OSZ file for use on any OpenLP v2 installation.
90 one lump.
91 Also handles the UI tasks of moving things up and down etc.90 Also handles the UI tasks of moving things up and down etc.
92 """91 """
93 global log92 global log
@@ -274,7 +273,7 @@
274 self.serviceItems.remove(self.serviceItems[item])273 self.serviceItems.remove(self.serviceItems[item])
275 self.serviceItems.insert(0, temp)274 self.serviceItems.insert(0, temp)
276 self.repaintServiceList(0, count)275 self.repaintServiceList(0, count)
277 self.parent.OosChanged(False, self.serviceName)276 self.parent.serviceChanged(False, self.serviceName)
278277
279 def onServiceUp(self):278 def onServiceUp(self):
280 """279 """
@@ -287,7 +286,7 @@
287 self.serviceItems.remove(self.serviceItems[item])286 self.serviceItems.remove(self.serviceItems[item])
288 self.serviceItems.insert(item - 1, temp)287 self.serviceItems.insert(item - 1, temp)
289 self.repaintServiceList(item - 1, count)288 self.repaintServiceList(item - 1, count)
290 self.parent.OosChanged(False, self.serviceName)289 self.parent.serviceChanged(False, self.serviceName)
291290
292 def onServiceDown(self):291 def onServiceDown(self):
293 """292 """
@@ -300,7 +299,7 @@
300 self.serviceItems.remove(self.serviceItems[item])299 self.serviceItems.remove(self.serviceItems[item])
301 self.serviceItems.insert(item + 1, temp)300 self.serviceItems.insert(item + 1, temp)
302 self.repaintServiceList(item + 1, count)301 self.repaintServiceList(item + 1, count)
303 self.parent.OosChanged(False, self.serviceName)302 self.parent.serviceChanged(False, self.serviceName)
304303
305 def onServiceEnd(self):304 def onServiceEnd(self):
306 """305 """
@@ -312,7 +311,7 @@
312 self.serviceItems.remove(self.serviceItems[item])311 self.serviceItems.remove(self.serviceItems[item])
313 self.serviceItems.insert(len(self.serviceItems), temp)312 self.serviceItems.insert(len(self.serviceItems), temp)
314 self.repaintServiceList(len(self.serviceItems) - 1, count)313 self.repaintServiceList(len(self.serviceItems) - 1, count)
315 self.parent.OosChanged(False, self.serviceName)314 self.parent.serviceChanged(False, self.serviceName)
316315
317 def onNewService(self):316 def onNewService(self):
318 """317 """
@@ -322,7 +321,7 @@
322 self.serviceItems = []321 self.serviceItems = []
323 self.serviceName = u''322 self.serviceName = u''
324 self.isNew = True323 self.isNew = True
325 self.parent.OosChanged(True, self.serviceName)324 self.parent.serviceChanged(True, self.serviceName)
326325
327 def onDeleteFromService(self):326 def onDeleteFromService(self):
328 """327 """
@@ -332,9 +331,9 @@
332 if item is not -1:331 if item is not -1:
333 self.serviceItems.remove(self.serviceItems[item])332 self.serviceItems.remove(self.serviceItems[item])
334 self.repaintServiceList(0, 0)333 self.repaintServiceList(0, 0)
335 self.parent.OosChanged(False, self.serviceName)334 self.parent.serviceChanged(False, self.serviceName)
336335
337 def repaintServiceList(self, serviceItem, serviceItemCount):336 def repaintServiceList(self, serviceItem, serviceItemCount):
338 """337 """
339 Clear the existing service list and prepaint all the items338 Clear the existing service list and prepaint all the items
340 Used when moving items as the move takes place in supporting array,339 Used when moving items as the move takes place in supporting array,
@@ -366,28 +365,29 @@
366365
367 def onSaveService(self, quick=False):366 def onSaveService(self, quick=False):
368 """367 """
369 Save the current service in a zip file368 Save the current service in a zip (OSZ) file
370 This file contains369 This file contains
371 * An ood which is a pickle of the service items370 * An osd which is a pickle of the service items
372 * All image, presentation and video files needed to run the service.371 * All image, presentation and video files needed to run the service.
373 """372 """
374 if not quick or self.isNew:373 if not quick or self.isNew:
375 filename = QtGui.QFileDialog.getSaveFileName(self,374 filename = QtGui.QFileDialog.getSaveFileName(self,
376 u'Save Order of Service',self.config.get_last_dir() )375 u'Save Service', self.config.get_last_dir())
377 else:376 else:
378 filename = self.config.get_last_dir()377 filename = self.config.get_last_dir()
379 if filename != u'':378 if filename != u'':
380 splittedFile = filename.split(u'.')379 splittedFile = filename.split(u'.')
381 if splittedFile[-1] != u'oos':380 if splittedFile[-1] != u'osz':
382 filename = filename + u'.oos'381 filename = filename + u'.osz'
383 filename = unicode(filename)382 filename = unicode(filename)
384 self.isNew = False383 self.isNew = False
385 self.config.set_last_dir(filename)384 self.config.set_last_dir(filename)
386 service = []385 service = []
387 servicefile= filename + u'.ood'386 servicefile = filename + u'.osd'
388 zip = zipfile.ZipFile(unicode(filename), 'w')387 zip = zipfile.ZipFile(unicode(filename), 'w')
389 for item in self.serviceItems:388 for item in self.serviceItems:
390 service.append({u'serviceitem':item[u'data'].get_oos_repr()})389 service.append(
390 {u'serviceitem':item[u'data'].get_service_repr()})
391 if item[u'data'].service_item_type == ServiceType.Image or \391 if item[u'data'].service_item_type == ServiceType.Image or \
392 item[u'data'].service_item_type == ServiceType.Command:392 item[u'data'].service_item_type == ServiceType.Command:
393 for frame in item[u'data'].frames:393 for frame in item[u'data'].frames:
@@ -405,20 +405,19 @@
405 pass #if not present do not worry405 pass #if not present do not worry
406 name = filename.split(os.path.sep)406 name = filename.split(os.path.sep)
407 self.serviceName = name[-1]407 self.serviceName = name[-1]
408 self.parent.OosChanged(True, self.serviceName)408 self.parent.serviceChanged(True, self.serviceName)
409 409
410 def onQuickSaveService(self):410 def onQuickSaveService(self):
411 self.onSaveService(True)411 self.onSaveService(True)
412412
413 def onLoadService(self):413 def onLoadService(self):
414 """414 """
415 Load an existing service from disk and rebuilds the serviceitems415 Load an existing service from disk and rebuild the serviceitems. All
416 All files retrieved from the zip file are placed in a temporary416 files retrieved from the zip file are placed in a temporary directory
417 directory and will only be used for this service.417 and will only be used for this service.
418 """418 """
419 filename = QtGui.QFileDialog.getOpenFileName(self,419 filename = QtGui.QFileDialog.getOpenFileName(self, u'Open Service',
420 u'Open Order of Service', self.config.get_last_dir(),420 self.config.get_last_dir(), u'Services (*.osz)')
421 u'Services (*.oos)')
422 filename = unicode(filename)421 filename = unicode(filename)
423 name = filename.split(os.path.sep)422 name = filename.split(os.path.sep)
424 if filename != u'':423 if filename != u'':
@@ -439,7 +438,7 @@
439 f.write(zip.read(file))438 f.write(zip.read(file))
440 f.flush()439 f.flush()
441 f.close()440 f.close()
442 if file_to.endswith(u'ood'):441 if file_to.endswith(u'osd'):
443 p_file = file_to442 p_file = file_to
444 f = open(p_file, u'r')443 f = open(p_file, u'r')
445 items = cPickle.load(f)444 items = cPickle.load(f)
@@ -448,17 +447,30 @@
448 for item in items:447 for item in items:
449 serviceitem = ServiceItem()448 serviceitem = ServiceItem()
450 serviceitem.RenderManager = self.parent.RenderManager449 serviceitem.RenderManager = self.parent.RenderManager
451 serviceitem.set_from_oos(item, self.servicePath )450 serviceitem.set_from_service(item, self.servicePath )
452 self.addServiceItem(serviceitem)451 self.addServiceItem(serviceitem)
453 try:452 try:
454 os.remove(p_file)453 if os.path.isfile(p_file):
454 os.remove(p_file)
455 except:455 except:
456 log.exception(u'Failed to remove ood file')456 log.exception(u'Failed to remove osd file')
457 except:457 except:
458 log.exception(u'Problem loading a service file')458 log.exception(u'Problem loading a service file')
459 self.isNew = False459 self.isNew = False
460 self.serviceName = name[len(name) - 1]460 self.serviceName = name[len(name) - 1]
461 self.parent.OosChanged(True, self.serviceName)461 self.parent.serviceChanged(True, self.serviceName)
462
463 def cleanUp(self):
464 """
465 Empties the servicePath of temporary files
466 """
467 for file in os.listdir(self.servicePath):
468 file_path = os.path.join(self.servicePath, file)
469 try:
470 if os.path.isfile(file_path):
471 os.remove(file_path)
472 except:
473 log.exception(u'Failed to clean up servicePath')
462474
463 def onThemeComboBoxSelected(self, currentIndex):475 def onThemeComboBoxSelected(self, currentIndex):
464 """476 """
@@ -501,7 +513,7 @@
501 treewidgetitem1.setData(0, QtCore.Qt.UserRole,513 treewidgetitem1.setData(0, QtCore.Qt.UserRole,
502 QtCore.QVariant(count))514 QtCore.QVariant(count))
503 count = count + 1515 count = count + 1
504 self.parent.OosChanged(False, self.serviceName)516 self.parent.serviceChanged(False, self.serviceName)
505517
506 def makePreview(self):518 def makePreview(self):
507 """519 """
508520
=== modified file 'openlp/core/ui/test/test_service_manager.py'
--- openlp/core/ui/test/test_service_manager.py 2009-09-06 13:57:32 +0000
+++ openlp/core/ui/test/test_service_manager.py 2009-09-19 21:45:50 +0000
@@ -19,15 +19,17 @@
19import time19import time
20import sys20import sys
21import os, os.path21import os, os.path
22import logging
22from PyQt4 import QtGui, QtCore23from PyQt4 import QtGui, QtCore
23from PyQt4.QtCore import *24from PyQt4.QtCore import *
24from PyQt4.QtGui import *25from PyQt4.QtGui import *
25mypath=os.path.split(os.path.abspath(__file__))[0]26
26sys.path.insert(0,(os.path.join(mypath, '..','..', '..','..')))27mypath = os.path.split(os.path.abspath(__file__))[0]
28sys.path.insert(0, (os.path.join(mypath, '..', '..', '..', '..')))
29
27from openlp.core.ui import ServiceManager30from openlp.core.ui import ServiceManager
28from openlp.plugins.images.lib import ImageServiceItem31from openlp.plugins.images.lib import ImageServiceItem
2932
30import logging
31logging.basicConfig(filename='test_service_manager.log', level=logging.INFO,33logging.basicConfig(filename='test_service_manager.log', level=logging.INFO,
32 filemode='w')34 filemode='w')
3335
@@ -36,69 +38,72 @@
36# return sys._getframe(depth).f_code.co_name38# return sys._getframe(depth).f_code.co_name
37global app39global app
38global log40global log
39log=logging.getLogger(u'TestServiceManager')41log = logging.getLogger(u'TestServiceManager')
42
40class TestServiceManager_base:43class TestServiceManager_base:
41 def __init__(self):44 def __init__(self):
42 pass45 pass
4346
44 def setup_class(self):47 def setup_class(self):
45 log.info( "class setup"+unicode(self))48 log.info( "class setup" + unicode(self))
46 try:49 try:
47 if app is None:50 if app is None:
48 app = QtGui.QApplication([])51 app = QtGui.QApplication([])
49 except UnboundLocalError:52 except UnboundLocalError:
50 app = QtGui.QApplication([])53 app = QtGui.QApplication([])
5154
52
53 def teardown_class(self):55 def teardown_class(self):
54 pass56 pass
5557
56 def setup_method(self, method):58 def setup_method(self, method):
57 log.info(u'Setup method:' + unicode(method))59 log.info(u'Setup method:' + unicode(method))
58 self.expected_answer="Don't know yet"60 self.expected_answer = "Don't know yet"
59 self.answer=None61 self.answer = None
60 self.s=ServiceManager(None)62 self.s = ServiceManager(None)
61 log.info(u'--------------- Setup Done -------------')63 log.info(u'--------------- Setup Done -------------')
6264
63 def teardown_method(self, method):65 def teardown_method(self, method):
64 self.s=None66 self.s = None
6567
66 def select_row(self, row):68 def select_row(self, row):
67 # now select the line we just added69 # now select the line we just added
68 # first get the index70 # first get the index
69 i=QModelIndex(self.s.service_data.index(0,0))71 i = QModelIndex(self.s.service_data.index(0,0))
70 # make a selection of it72 # make a selection of it
71 self.sm=QItemSelectionModel(self.s.service_data)73 self.sm = QItemSelectionModel(self.s.service_data)
72 self.sm.select(i, QItemSelectionModel.ClearAndSelect)74 self.sm.select(i, QItemSelectionModel.ClearAndSelect)
73 log.info(unicode(self.sm.selectedIndexes()))75 log.info(unicode(self.sm.selectedIndexes()))
74 self.s.TreeView.setSelectionModel(self.sm)76 self.s.TreeView.setSelectionModel(self.sm)
75 log.info(u'Selected indexes = ' + unicode(self.s.TreeView.selectedIndexes()))77 log.info(u'Selected indexes = ' + unicode(
78 self.s.TreeView.selectedIndexes()))
79
76 def test_easy(self):80 def test_easy(self):
77 log.info(u'test_easy')81 log.info(u'test_easy')
78 item=ImageServiceItem(None)82 item = ImageServiceItem(None)
79 item.add(u'test.gif')83 item.add(u'test.gif')
80 self.s.addServiceItem(item)84 self.s.addServiceItem(item)
81 answer = self.s.oos_as_text()85 answer = self.s.service_as_text()
82 log.info(u'Answer = ' + unicode(answer))86 log.info(u'Answer = ' + unicode(answer))
83 lines=answer.split(u'\n')87 lines = answer.split(u'\n')
84 log.info(u'lines = ' + unicode(lines))88 log.info(u'lines = ' + unicode(lines))
85 assert lines[0].startswith(u'# <openlp.plugins.images.imageserviceitem.ImageServiceItem object')89 assert lines[0].startswith(u'# <openlp.plugins.images.imageserviceitem.ImageServiceItem object')
86 assert lines[1] == "test.gif"90 assert lines[1] == "test.gif"
87 log.info(u'done')91 log.info(u'done')
8892
89 def test_2items_as_separate_items(self):93 def test_2items_as_separate_items(self):
90 # If nothing is selected when item is added, a new base service item is added94 # If nothing is selected when item is added, a new base service item
95 # is added
91 log.info(u'test_2items_as_separate_items')96 log.info(u'test_2items_as_separate_items')
92 item=ImageServiceItem(None)97 item = ImageServiceItem(None)
93 item.add(u'test.gif')98 item.add(u'test.gif')
94 self.s.addServiceItem(item)99 self.s.addServiceItem(item)
95 item=ImageServiceItem(None)100 item = ImageServiceItem(None)
96 item.add(u'test2.gif')101 item.add(u'test2.gif')
97 item.add(u'test3.gif')102 item.add(u'test3.gif')
98 self.s.addServiceItem(item)103 self.s.addServiceItem(item)
99 answer = self.s.oos_as_text()104 answer = self.s.service_as_text()
100 log.info(u'Answer = ' + unicode(answer))105 log.info(u'Answer = ' + unicode(answer))
101 lines=answer.split(u'\n')106 lines = answer.split(u'\n')
102 log.info(u'lines = ' + unicode(lines))107 log.info(u'lines = ' + unicode(lines))
103 assert lines[0].startswith(u'# <openlp.plugins.images.imageserviceitem.ImageServiceItem object')108 assert lines[0].startswith(u'# <openlp.plugins.images.imageserviceitem.ImageServiceItem object')
104 assert lines[1] == "test.gif"109 assert lines[1] == "test.gif"
@@ -108,20 +113,22 @@
108 log.info(u'done')113 log.info(u'done')
109114
110 def test_2items_merged(self):115 def test_2items_merged(self):
111 # If the first object is selected when item is added it should be extended116 # If the first object is selected when item is added it should be
117 # extended
112 log.info(u'test_2items_merged')118 log.info(u'test_2items_merged')
113 item=ImageServiceItem(None)119 item = ImageServiceItem(None)
114 item.add(u'test.gif')120 item.add(u'test.gif')
115 self.s.addServiceItem(item)121 self.s.addServiceItem(item)
116 self.select_row(0)122 self.select_row(0)
117 log.info(u'Selected indexes = ' + unicode(self.s.TreeView.selectedIndexes()))123 log.info(u'Selected indexes = ' + unicode(
118 item=ImageServiceItem(None)124 self.s.TreeView.selectedIndexes()))
125 item = ImageServiceItem(None)
119 item.add(u'test2.gif')126 item.add(u'test2.gif')
120 item.add(u'test3.gif')127 item.add(u'test3.gif')
121 self.s.addServiceItem(item)128 self.s.addServiceItem(item)
122 answer = self.s.oos_as_text()129 answer = self.s.service_as_text()
123 log.info(u'Answer = ' + unicode(answer))130 log.info(u'Answer = ' + unicode(answer))
124 lines=answer.split(u'\n')131 lines = answer.split(u'\n')
125 log.info(u'lines = ' + unicode(lines))132 log.info(u'lines = ' + unicode(lines))
126 assert lines[0].startswith(u'# <openlp.plugins.images.imageserviceitem.ImageServiceItem object')133 assert lines[0].startswith(u'# <openlp.plugins.images.imageserviceitem.ImageServiceItem object')
127 assert lines[1] == "test.gif"134 assert lines[1] == "test.gif"
@@ -138,7 +145,6 @@
138145
139146
140if __name__ == "__main__":147if __name__ == "__main__":
141
142 t=TestServiceManager_base()148 t=TestServiceManager_base()
143 t.setup_class()149 t.setup_class()
144 t.setup_method(None)150 t.setup_method(None)
145151
=== modified file 'openlp/plugins/plugin.txt'
--- openlp/plugins/plugin.txt 2008-11-17 20:36:01 +0000
+++ openlp/plugins/plugin.txt 2009-09-19 21:45:50 +0000
@@ -9,21 +9,23 @@
9* Powerpoint/Openoffice Impress9* Powerpoint/Openoffice Impress
10* Lyrics :) (with chords, rich text, etc...)10* Lyrics :) (with chords, rich text, etc...)
11* Musical score11* Musical score
12* Midi files (hmmm, that's not a thing to display, but feels like it should be there...)12* Midi files (hmmm, that's not a thing to display, but feels like it should be
13 there...)
13* Audio files, CDs (hmmm again)14* Audio files, CDs (hmmm again)
14* Collections of pictures15* Collections of pictures
15* Alerts to members of the congregation16* Alerts to members of the congregation
16... etc.17... etc.
1718
18The scope of these plugins is "things for display purposes", so19The scope of these plugins is "things for display purposes", so each needs to
19each needs to be able to:20be able to:
20* Render their display (on the projection screen and in a "shrunken form"21* Render their display (on the projection screen and in a "shrunken form"
21 for preview purposes)22 for preview purposes)
2223
23These plugins need to be part of an OOS. This means they need to 24These plugins need to be part of an service. This means they need to
24* Be able to tell the OOS manager code what to put in the OOS for their "bit"25* Be able to tell the service manager code what to put in the service for their
26 "bit"
25* Have a "tab" in the media manager, which they can render on request27* Have a "tab" in the media manager, which they can render on request
26 to allow bits to be added to the OOS (or indeed shown live)28 to allow bits to be added to the service (or indeed shown live)
2729
28In addition, some plugins need to be able to show30In addition, some plugins need to be able to show
29* How their multiple screens of data are split (eg verses)31* How their multiple screens of data are split (eg verses)
@@ -41,29 +43,29 @@
41* A version number43* A version number
42* Helpfile?44* Helpfile?
4345
44Funnily enough, the core lyrics engine fits those requirements, so46Funnily enough, the core lyrics engine fits those requirements, so could
45could actually form a plugin...47actually form a plugin...
4648
47Each OOS entry may be made up of multiple plugins (to do text on49Each service entry may be made up of multiple plugins (to do text on video), so
48video), so each plugin that contributes to an OOS item will need a50each plugin that contributes to an service item will need a "layering"
49"layering" priority.51priority.
5052
51Plugin management53Plugin management
52-----------------54-----------------
5355
54Plugins will be packages within the plugins/ directory. The plugin56Plugins will be packages within the plugins/ directory. The plugin manager
55manager will scan this directory when openlp loads for any class which57will scan this directory when openlp loads for any class which is based on the
56is based on the base Plugin class (or should we call it the58base Plugin class (or should we call it the DisplayPlugin class to allow for
57DisplayPlugin class to allow for other sorts??)59other sorts??)
5860
59These plugins are then queried for their capabilities/requirements and61These plugins are then queried for their capabilities/requirements and
60spaces made in the prefs UI as required, and in the media manager.62spaces made in the prefs UI as required, and in the media manager.
6163
62The OOS manager can find out what plugins it has available (we need to64The service manager can find out what plugins it has available (we need to
63report missing plugins when an OOS is loaded).65report missing plugins when an service is loaded).
6466
65The display manager will get a ref to a/some plugin(s) from the OOS67The display manager will get a ref to a/some plugin(s) from the service
66manager when each OOS item is made live, and can then call on each to68manager when each service item is made live, and can then call on each to
67render their display.69render their display.
6870
69Each plugin will have basic attributes for 71Each plugin will have basic attributes for
@@ -78,8 +80,8 @@
7880
79and a set of API functions for81and a set of API functions for
80* media manager rendering and handling82* media manager rendering and handling
81* creating OOS data83* creating service data
82* being told OOS data84* being told service data
83* set paint context85* set paint context
84* render86* render
85* selecting a screen to display87* selecting a screen to display