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

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

Complete OOS for Songs, Bibles, Images, Custom.
Fix unicode bugs in Bibles.
Clean Up image plugin.

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

Good work!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp.pyw'
2--- openlp.pyw 2009-06-07 19:34:24 +0000
3+++ openlp.pyw 2009-06-20 10:44:12 +0000
4@@ -26,7 +26,7 @@
5 from openlp.core.lib import Receiver
6
7 logging.basicConfig(level=logging.DEBUG,
8- format=u'%(asctime)s %(msecs)d %(name)-12s %(levelname)-8s %(message)s',
9+ format=u'%(asctime)s:%(msecs)3d %(name)-15s %(levelname)-8s %(message)s',
10 datefmt=u'%m-%d %H:%M:%S', filename=u'openlp.log', filemode=u'w')
11
12 from openlp.core.resources import *
13
14=== modified file 'openlp/core/lib/renderer.py'
15--- openlp/core/lib/renderer.py 2009-06-19 18:41:38 +0000
16+++ openlp/core/lib/renderer.py 2009-06-20 10:44:12 +0000
17@@ -136,8 +136,6 @@
18 if footer_lines is not None:
19 bbox1 = self._render_lines_unaligned(footer_lines, True)
20 # reset the frame. first time do not worry about what you paint on.
21- #self._frame = QtGui.QPixmap(self._frame.width(), self._frame.height()) #(self._bg_frame)
22- #self._frame.fill(QtCore.Qt.transparent)
23 # reset the frame. first time do not worry about what you paint on.
24 self._frame = QtGui.QImage(self._bg_frame)
25 x, y = self._correctAlignment(self._rect, bbox)
26@@ -445,4 +443,4 @@
27 im.save(u'renderer.png', u'png')
28 if image2 is not None:
29 im = image2.toImage()
30- im.save(u'renderer2.png', u'png')
31\ No newline at end of file
32+ im.save(u'renderer2.png', u'png')
33
34=== modified file 'openlp/core/lib/rendermanager.py'
35--- openlp/core/lib/rendermanager.py 2009-06-19 18:41:38 +0000
36+++ openlp/core/lib/rendermanager.py 2009-06-20 11:23:34 +0000
37@@ -139,10 +139,24 @@
38 self.renderer.set_frame_dest(self.width, self.height)
39 return self.renderer.generate_frame_from_lines(main_text, footer_text)
40
41+ def resize_image(self, image):
42+ preview = QtGui.QImage(image)
43+ w = self.width
44+ h = self.height
45+ preview = preview.scaled(w, h, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
46+ realw = preview.width();
47+ realh = preview.height()
48+ # and move it to the centre of the preview space
49+ newImage = QtGui.QImage(w, h, QtGui.QImage.Format_ARGB32_Premultiplied)
50+ newImage.fill(QtCore.Qt.transparent)
51+ painter = QtGui.QPainter(newImage)
52+ painter.drawImage((w-realw) / 2 , (h-realh) / 2, preview)
53+ return newImage
54+
55 def calculate_default(self, screen):
56 log.debug(u'calculate default %s' , screen)
57 self.width = screen.width()
58 self.height = screen.height()
59 log.debug(u'calculate default %d,%d' , self.width, self.height)
60 # 90% is start of footer
61- self.footer_start = int(self.height*0.90)
62+ self.footer_start = int(self.height * 0.90)
63
64=== modified file 'openlp/core/lib/serviceitem.py'
65--- openlp/core/lib/serviceitem.py 2009-06-10 15:54:46 +0000
66+++ openlp/core/lib/serviceitem.py 2009-06-20 19:11:17 +0000
67@@ -18,6 +18,7 @@
68 Place, Suite 330, Boston, MA 02111-1307 USA
69 """
70 import logging
71+import os
72 import time
73 from openlp.core.lib import buildIcon
74 from PyQt4 import QtCore, QtGui
75@@ -49,6 +50,8 @@
76 self.frames = []
77 self.raw_footer = None
78 self.theme = None
79+ self.service_item_path = None
80+ self.service_item_type = None
81 #log.debug(u'Service item created for %s ', self.shortname)
82 self.service_frames = []
83
84@@ -77,13 +80,18 @@
85 self.frames = self.service_frames
86 self.service_frames = []
87 elif self.service_item_type == u'image':
88+ #print "image"
89+ #print self.service_frames
90+ for slide in self.service_frames:
91+ slide[u'image'] = self.RenderManager.resize_image(slide[u'image'])
92 self.frames = self.service_frames
93- self.service_frames = []
94+ #self.service_frames = []
95 else:
96 log.error(u'Invalid value renderer :%s' % self.service_item_type)
97
98- def add_from_image(self, frame_title, image):
99+ def add_from_image(self, path, frame_title, image):
100 self.service_item_type = u'image'
101+ self.service_item_path = path
102 self.service_frames.append({u'title': frame_title, u'image': image})
103
104 def add_from_text(self, frame_title, raw_slide):
105@@ -105,14 +113,21 @@
106 oos_data = []
107 if self.service_item_type == u'text':
108 for slide in self.service_frames:
109- oos_data.append(slide[u'raw_slide'])
110- return {u'header': oos_header, u'data': self.service_frames}
111+ oos_data.append(slide)
112+ elif self.service_item_type == u'image':
113+ #print "sf", self.service_frames
114+ for slide in self.service_frames:
115+ #print "s", slide
116+ oos_data.append(slide[u'title'])
117+ #print "od", oos_data
118+ return {u'header': oos_header, u'data': oos_data}
119
120- def set_from_oos(self, serviceitem):
121- """
122- This method takes some oostext (passed from the ServiceManager)
123- and parses it into the data actually required
124- """
125+ def set_from_oos(self, serviceitem, path=None):
126+ """
127+ This method takes some oos list (passed from the ServiceManager)
128+ and extracts the data actually required
129+ """
130+ #print "sfs", serviceitem
131 header = serviceitem[u'serviceitem'][u'header']
132 self.title = header[u'title']
133 self.service_item_type = header[u'type']
134@@ -120,4 +135,12 @@
135 self.theme = header[u'theme']
136 self.addIcon(header[u'icon'])
137 self.raw_footer = header[u'footer']
138- self.service_frames = serviceitem[u'serviceitem'][u'data']
139+ if self.service_item_type == u'text':
140+ for slide in serviceitem[u'serviceitem'][u'data']:
141+ self.service_frames.append(slide)
142+ elif self.service_item_type == u'image':
143+ for text_image in serviceitem[u'serviceitem'][u'data']:
144+ filename = os.path.join(path, text_image)
145+ #print "fn", filename
146+ real_image = QtGui.QImage(unicode(filename))
147+ self.add_from_image(path, text_image, real_image)
148
149=== modified file 'openlp/core/ui/mainwindow.py'
150--- openlp/core/ui/mainwindow.py 2009-06-11 05:13:10 +0000
151+++ openlp/core/ui/mainwindow.py 2009-06-20 07:08:17 +0000
152@@ -64,6 +64,7 @@
153 self.RenderManager = RenderManager(self.ThemeManagerContents,
154 self.screenList, int(self.generalConfig.get_config(u'Monitor', 0)))
155 log.info(u'Load Plugins')
156+ #make the controllers available to the plugins
157 self.plugin_helpers[u'preview'] = self.PreviewController
158 self.plugin_helpers[u'live'] = self.LiveController
159 self.plugin_helpers[u'event'] = self.EventManager
160@@ -74,7 +75,7 @@
161 self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers,
162 self.EventManager)
163 # hook methods have to happen after find_plugins. Find plugins needs the
164- # controllershence the hooks have moved from setupUI() to here
165+ # controllers hence the hooks have moved from setupUI() to here
166
167 # Find and insert settings tabs
168 log.info(u'hook settings')
169@@ -378,6 +379,10 @@
170 # Connect up some signals and slots
171 QtCore.QObject.connect(self.FileExitItem,
172 QtCore.SIGNAL(u'triggered()'), self.mainWindow.close)
173+ QtCore.QObject.connect(self.ImportThemeItem,
174+ QtCore.SIGNAL(u'triggered()'), self.ThemeManagerContents.onImportTheme)
175+ QtCore.QObject.connect(self.ExportThemeItem,
176+ QtCore.SIGNAL(u'triggered()'), self.ThemeManagerContents.onExportTheme)
177 QtCore.QObject.connect(self.ViewMediaManagerItem,
178 QtCore.SIGNAL(u'triggered(bool)'), self.MediaManagerDock.setVisible)
179 QtCore.QObject.connect(self.ViewServiceManagerItem,
180
181=== modified file 'openlp/core/ui/servicemanager.py'
182--- openlp/core/ui/servicemanager.py 2009-06-19 18:41:38 +0000
183+++ openlp/core/ui/servicemanager.py 2009-06-20 19:11:17 +0000
184@@ -20,11 +20,14 @@
185 import os
186 import logging
187 import cPickle
188+import zipfile
189+import shutil
190
191 from PyQt4 import QtCore, QtGui
192 from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, Event, \
193 RenderManager, EventType, EventManager, translate, buildIcon, \
194 contextMenuAction, contextMenuSeparator
195+from openlp.core.utils import ConfigHelper
196
197 class ServiceManager(QtGui.QWidget):
198 """
199@@ -105,10 +108,23 @@
200 QtCore.SIGNAL(u'activated(int)'), self.onThemeComboBoxSelected)
201 QtCore.QObject.connect(self.ServiceManagerList,
202 QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.makeLive)
203+ QtCore.QObject.connect(self.ServiceManagerList,
204+ QtCore.SIGNAL(u'itemCollapsed(QTreeWidgetItem*)'), self.collapsed)
205+ QtCore.QObject.connect(self.ServiceManagerList,
206+ QtCore.SIGNAL(u'itemExpanded(QTreeWidgetItem*)'), self.expanded)
207 # Last little bits of setting up
208- self.config = PluginConfig(u'Main')
209+ self.config = PluginConfig(u'ServiceManager')
210+ self.servicePath = self.config.get_data_path()
211 self.service_theme = self.config.get_config(u'theme service theme', u'')
212
213+ def collapsed(self, item):
214+ pos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
215+ self.serviceItems[pos -1 ][u'expanded'] = False
216+
217+ def expanded(self, item):
218+ pos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
219+ self.serviceItems[pos -1 ][u'expanded'] = True
220+
221 def onServiceTop(self):
222 """
223 Move the current ServiceItem to the top of the list
224@@ -185,6 +201,7 @@
225 treewidgetitem.setText(0,serviceitem.title)
226 treewidgetitem.setIcon(0,serviceitem.iconic_representation)
227 treewidgetitem.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(item[u'order']))
228+ treewidgetitem.setExpanded(item[u'expanded'])
229 count = 0
230 for frame in serviceitem.frames:
231 treewidgetitem1 = QtGui.QTreeWidgetItem(treewidgetitem)
232@@ -198,15 +215,27 @@
233 Save the current service
234 """
235 filename = QtGui.QFileDialog.getSaveFileName(self, u'Save Order of Service',self.config.get_last_dir() )
236+ filename = unicode(filename)
237 if filename != u'':
238 self.config.set_last_dir(filename)
239- print filename
240 service = []
241+ servicefile= filename + u'.ood'
242+ zip = zipfile.ZipFile(unicode(filename) + u'.oos', 'w')
243 for item in self.serviceItems:
244 service.append({u'serviceitem':item[u'data'].get_oos_repr()})
245- file = open(filename+u'.oos', u'wb')
246+ if item[u'data'].service_item_type == u'image':
247+ for frame in item[u'data'].frames:
248+ path_from = unicode(item[u'data'].service_item_path + u'/' + frame[u'title'])
249+ zip.write(path_from)
250+ file = open(servicefile, u'wb')
251 cPickle.dump(service, file)
252 file.close()
253+ zip.write(servicefile)
254+ zip.close()
255+ try:
256+ os.remove(servicefile)
257+ except:
258+ pass #if not present do not worry
259
260 def onLoadService(self):
261 """
262@@ -214,17 +243,35 @@
263 """
264 filename = QtGui.QFileDialog.getOpenFileName(self, u'Open Order of Service',self.config.get_last_dir(),
265 u'Services (*.oos)')
266+ filename = unicode(filename)
267 if filename != u'':
268 self.config.set_last_dir(filename)
269- file = open(filename, u'r')
270- items = cPickle.load(file)
271- file.close()
272+ zip = zipfile.ZipFile(unicode(filename))
273+ filexml = None
274+ themename = None
275+ for file in zip.namelist():
276+ names = file.split(os.path.sep)
277+ file_to = os.path.join(self.servicePath, names[len(names) - 1])
278+ file_data = zip.read(file)
279+ f = open(file_to, u'w')
280+ f.write(file_data)
281+ f.close()
282+ if file_to.endswith(u'ood'):
283+ p_file = file_to
284+ f = open(p_file, u'r')
285+ items = cPickle.load(f)
286+ f.close()
287 self.onNewService()
288 for item in items:
289+ #print item
290 serviceitem = ServiceItem()
291 serviceitem.RenderManager = self.parent.RenderManager
292- serviceitem.set_from_oos(item)
293+ serviceitem.set_from_oos(item, self.servicePath )
294 self.addServiceItem(serviceitem)
295+ try:
296+ os.remove(p_file)
297+ except:
298+ pass #if not present do not worry
299
300 def onThemeComboBoxSelected(self, currentIndex):
301 """
302@@ -239,16 +286,16 @@
303 for item in tempServiceItems:
304 self.addServiceItem(item[u'data'])
305
306- def addServiceItem(self, item, expand=True):
307+ def addServiceItem(self, item):
308 """
309 Add an item to the list
310 """
311- self.serviceItems.append({u'data': item, u'order': len(self.serviceItems)+1})
312+ self.serviceItems.append({u'data': item, u'order': len(self.serviceItems)+1, u'expanded':True})
313 treewidgetitem = QtGui.QTreeWidgetItem(self.ServiceManagerList)
314 treewidgetitem.setText(0,item.title)
315 treewidgetitem.setIcon(0,item.iconic_representation)
316 treewidgetitem.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(len(self.serviceItems)))
317- treewidgetitem.setExpanded(expand)
318+ treewidgetitem.setExpanded(True)
319 item.render()
320 count = 0
321 for frame in item.frames:
322
323=== modified file 'openlp/core/ui/slidecontroller.py'
324--- openlp/core/ui/slidecontroller.py 2009-06-16 18:21:24 +0000
325+++ openlp/core/ui/slidecontroller.py 2009-06-20 10:44:12 +0000
326@@ -137,8 +137,9 @@
327 self.PreviewListView.setIconSize(QtCore.QSize(250, 190))
328 self.PreviewListData = SlideData()
329 self.PreviewListView.isLive = self.isLive
330- #self.PreviewListView.setFlow(1)
331- #self.PreviewListView.setViewMode(1)
332+ if QtCore.QT_VERSION_STR > u'4.4.0':
333+ self.PreviewListView.setFlow(1)
334+ self.PreviewListView.setViewMode(1)
335 self.PreviewListView.setWrapping(False)
336 self.PreviewListView.setModel(self.PreviewListData)
337 self.PreviewListView.setSpacing(0)
338@@ -321,4 +322,4 @@
339 if row.isValid():
340 self.PreviewListView.selectionModel().setCurrentIndex(row,
341 QtGui.QItemSelectionModel.SelectCurrent)
342- self.onSlideSelected(row)
343\ No newline at end of file
344+ self.onSlideSelected(row)
345
346=== modified file 'openlp/core/ui/thememanager.py'
347--- openlp/core/ui/thememanager.py 2009-06-16 18:21:24 +0000
348+++ openlp/core/ui/thememanager.py 2009-06-20 19:11:17 +0000
349@@ -40,7 +40,7 @@
350 Root contains a list of ThemeItems
351 """
352 global log
353- log=logging.getLogger(u'ThemeData')
354+ log = logging.getLogger(u'ThemeData')
355
356 def __init__(self):
357 QtCore.QAbstractListModel.__init__(self)
358@@ -200,7 +200,7 @@
359
360 def onImportTheme(self):
361 files = QtGui.QFileDialog.getOpenFileNames(None,
362- translate(u'ThemeManager', u'Select Import File'),
363+ translate(u'ThemeManager', u'Select Theme Import File'),
364 self.path, u'Theme (*.theme)')
365 log.info(u'New Themes %s', unicode(files))
366 if len(files) > 0:
367@@ -335,7 +335,7 @@
368 outfile = open(theme_file, u'w')
369 outfile.write(theme_xml)
370 outfile.close()
371- if image_from is not None and image_from != image_to:
372+ if image_from is not None and image_from is not image_to:
373 shutil.copyfile(image_from, image_to)
374 self.generateAndSaveImage(self.path, name, theme_xml)
375 self.themeData.clearItems()
376@@ -362,4 +362,4 @@
377 def getPreviewImage(self, theme):
378 log.debug(u'getPreviewImage %s ', theme)
379 image = os.path.join(self.path, theme + u'.png')
380- return image
381\ No newline at end of file
382+ return image
383
384=== modified file 'openlp/plugins/bibles/bibleplugin.py'
385--- openlp/plugins/bibles/bibleplugin.py 2009-06-16 18:21:24 +0000
386+++ openlp/plugins/bibles/bibleplugin.py 2009-06-19 19:49:00 +0000
387@@ -25,8 +25,6 @@
388 from openlp.core.lib import Plugin, Event, EventType, translate
389
390 from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
391-from openlp.plugins.bibles.lib.tables import *
392-from openlp.plugins.bibles.lib.classes import *
393
394 class BiblePlugin(Plugin):
395 global log
396@@ -71,9 +69,7 @@
397 pass
398
399 def onBibleNewClick(self):
400- self.bibleimportform = BibleImportForm(self.config, self.biblemanager, self)
401- self.bibleimportform.exec_()
402- pass
403+ self.media_item.onBibleNewClick()
404
405 def handle_event(self, event):
406 """
407
408=== modified file 'openlp/plugins/bibles/forms/bibleimportdialog.py'
409--- openlp/plugins/bibles/forms/bibleimportdialog.py 2009-06-16 18:21:24 +0000
410+++ openlp/plugins/bibles/forms/bibleimportdialog.py 2009-06-19 19:49:00 +0000
411@@ -8,6 +8,7 @@
412 # WARNING! All changes made in this file will be lost!
413
414 from PyQt4 import QtCore, QtGui
415+from openlp.core.lib import translate
416
417 class Ui_BibleImportDialog(object):
418 def setupUi(self, BibleImportDialog):
419
420=== modified file 'openlp/plugins/bibles/lib/bibleHTTPimpl.py'
421--- openlp/plugins/bibles/lib/bibleHTTPimpl.py 2009-06-16 18:21:24 +0000
422+++ openlp/plugins/bibles/lib/bibleHTTPimpl.py 2009-06-20 19:11:17 +0000
423@@ -44,7 +44,7 @@
424 log.debug( u'get_bible_chapter %s,%s,%s,%s', version, bookid, bookname, chapter)
425 urlstring = u'http://www.biblegateway.com/passage/?book_id='+unicode(bookid)+u'&chapter'+unicode(chapter)+u'&version='+unicode(version)
426 xml_string = self._get_web_text(urlstring, self.proxyurl)
427- print xml_string
428+ #print xml_string
429 VerseSearch = u'class='+u'"'+u'sup'+u'"'+u'>'
430 verse = 1
431 i= xml_string.find(u'result-text-style-normal')
432@@ -97,7 +97,7 @@
433 """
434 log.debug(u'get_bible_chapter %s,%s,%s,%s', version, bookid, bookname, chapter)
435 bookname = bookname.replace(u' ', '')
436- urlstring = "http://bible.crosswalk.com/OnlineStudyBible/bible.cgi?word="+bookname+"+"+unicode(chapter)+"&version="+version
437+ urlstring = u'http://bible.crosswalk.com/OnlineStudyBible/bible.cgi?word='+bookname+u'+'+unicode(chapter)+u'&version='+version
438 xml_string = self._get_web_text(urlstring, self.proxyurl)
439 #log.debug(u'Return data %s', xml_string)
440 ## Strip Book Title from Heading to return it to system
441@@ -115,27 +115,33 @@
442
443 ## Strip Verse Data from Page and build an array
444 ##
445+ #log.debug(u'bible data %s', xml_string)
446 i= xml_string.find(u'NavCurrentChapter')
447 xml_string = xml_string[i:len(xml_string)]
448 i= xml_string.find(u'<TABLE')
449 xml_string = xml_string[i:len(xml_string)]
450 i= xml_string.find(u'<B>')
451- xml_string = xml_string[i + 3 :len(xml_string)] #remove the <B> at the front
452- i= xml_string.find(u'<B>') # Remove the heading for the book
453- xml_string = xml_string[i + 3 :len(xml_string)] #remove the <B> at the front
454+ #remove the <B> at the front
455+ xml_string = xml_string[i + 3 :len(xml_string)]
456+ # Remove the heading for the book
457+ i= xml_string.find(u'<B>')
458+ #remove the <B> at the front
459+ xml_string = xml_string[i + 3 :len(xml_string)]
460 versePos = xml_string.find(u'<BLOCKQUOTE>')
461- #log.debug( versePos)
462+ #log.debug(u'verse pos %d', versePos)
463 bible = {}
464 while versePos > 0:
465- verseText = '' # clear out string
466+ verseText = u''
467 versePos = xml_string.find(u'<B><I>', versePos) + 6
468 i = xml_string.find(u'</I></B>', versePos)
469 #log.debug( versePos, i)
470 verse= xml_string[versePos:i] # Got the Chapter
471 #verse = int(temp)
472- #log.debug( 'Chapter = ' + unicode(temp))
473- versePos = i + 8 # move the starting position to negining of the text
474- i = xml_string.find(u'<B><I>', versePos) # fine the start of the next verse
475+ #log.debug( 'Chapter = %s', verse)
476+ # move the starting position to begining of the text
477+ versePos = i + 8
478+ # fined the start of the next verse
479+ i = xml_string.find(u'<B><I>', versePos)
480 if i == -1:
481 i = xml_string.find(u'</BLOCKQUOTE>',versePos)
482 verseText = xml_string[versePos: i]
483
484=== modified file 'openlp/plugins/bibles/lib/common.py'
485--- openlp/plugins/bibles/lib/common.py 2009-06-16 18:21:24 +0000
486+++ openlp/plugins/bibles/lib/common.py 2009-06-20 19:11:17 +0000
487@@ -53,12 +53,12 @@
488 http_support = urllib2.HTTPHandler()
489 opener= urllib2.build_opener(proxy_support, http_support)
490 urllib2.install_opener(opener)
491- xml_string = ""
492+ xml_string = u''
493 req = urllib2.Request(urlstring)
494 req.add_header(u'User-Agent', 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)')
495 try:
496 handle = urllib2.urlopen(req)
497- xml_string = handle.read()
498+ xml_string = unicode(handle.read())
499 except IOError, e:
500 if hasattr(e, u'reason'):
501 log.error(u'Reason : ')
502@@ -97,9 +97,9 @@
503 text= text.replace(u'</P>', u'')
504 text= text.replace(u'<BR>', u'')
505 text= text.replace(u'<BR />', u'')
506- text= text.replace(chr(189), u'1/2')
507- text= text.replace(u'&quot;", u''')
508- text= text.replace(u'&apos;", u''')
509+ #text= text.replace(chr(189), u'1/2');print "l"
510+ text= text.replace(u'&quot;', "'")
511+ text= text.replace(u'&apos;', "'")
512
513 i = text.find(u'<')
514 while i > -1 :
515
516=== modified file 'openlp/plugins/bibles/lib/manager.py'
517--- openlp/plugins/bibles/lib/manager.py 2009-06-16 18:21:24 +0000
518+++ openlp/plugins/bibles/lib/manager.py 2009-06-20 19:11:17 +0000
519@@ -239,17 +239,19 @@
520 text = []
521 log.debug(u'get_verse_text %s,%s,%s,%s,%s,%s', bible, bookname, schapter, echapter, sverse, everse)
522 if not self.bible_http_cache [bible] == None:
523- book= self.bible_db_cache[bible].get_bible_book(bookname) # check to see if book/chapter exists
524+ # check to see if book/chapter exists
525+ book= self.bible_db_cache[bible].get_bible_book(bookname)
526 if book == None:
527 log.debug(u'get_verse_text : new book')
528 for chapter in range(schapter, echapter+1):
529 search_results = self.bible_http_cache [bible].get_bible_chapter(bible, 0, bookname, chapter)
530- if search_results.has_verselist() :
531+ if search_results.has_verse_list() :
532 ## We have found a book of the bible lets check to see if it was there.
533 ## By reusing the returned book name we get a correct book.
534 ## For example it is possible to request ac and get Acts back.
535 bookname = search_results.get_book()
536- book= self.bible_db_cache[bible].get_bible_book(bookname) # check to see if book/chapter exists
537+ # check to see if book/chapter exists
538+ book= self.bible_db_cache[bible].get_bible_book(bookname)
539 if book == None:
540 ## Then create book, chapter and text
541 book = self.bible_db_cache[bible].create_book(bookname, \
542
543=== modified file 'openlp/plugins/images/__init__.py'
544--- openlp/plugins/images/__init__.py 2009-05-11 05:09:43 +0000
545+++ openlp/plugins/images/__init__.py 2009-06-20 10:44:12 +0000
546@@ -3,7 +3,7 @@
547 """
548 OpenLP - Open Source Lyrics Projection
549 Copyright (c) 2008 - 2009 Raoul Snyman
550-Portions copyright (c) 2008 Martin Thompson, Tim Bentley,
551+Portions copyright (c) 2008 - 2009 Martin Thompson, Tim Bentley,
552
553 This program is free software; you can redistribute it and/or modify it under
554 the terms of the GNU General Public License as published by the Free Software
555@@ -17,7 +17,3 @@
556 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
557 Place, Suite 330, Boston, MA 02111-1307 USA
558 """
559-
560-#from imageplugin import ImagePlugin
561-#from imageserviceitem import ImageServiceItem
562-
563
564=== modified file 'openlp/plugins/images/imageplugin.py'
565--- openlp/plugins/images/imageplugin.py 2009-05-21 16:07:01 +0000
566+++ openlp/plugins/images/imageplugin.py 2009-06-20 10:44:12 +0000
567@@ -3,7 +3,7 @@
568 """
569 OpenLP - Open Source Lyrics Projection
570 Copyright (c) 2008 Raoul Snyman
571-Portions copyright (c) 2008 Martin Thompson, Tim Bentley,
572+Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley,
573
574 This program is free software; you can redistribute it and/or modify it under
575 the terms of the GNU General Public License as published by the Free Software
576@@ -22,7 +22,7 @@
577 from PyQt4 import QtCore, QtGui
578
579 from openlp.core.lib import Plugin, Event, EventType
580-from openlp.plugins.images.lib import ImageMediaItem, ImageServiceItem
581+from openlp.plugins.images.lib import ImageMediaItem
582
583 class ImagePlugin(Plugin):
584 global log
585@@ -38,9 +38,6 @@
586 self.icon.addPixmap(QtGui.QPixmap(u':/media/media_image.png'),
587 QtGui.QIcon.Normal, QtGui.QIcon.Off)
588
589- self.preview_service_item = ImageServiceItem(self.preview_controller)
590- self.live_service_item = ImageServiceItem(self.live_controller)
591-
592 def get_media_manager_item(self):
593 # Create the MediaManagerItem object
594 self.media_item = ImageMediaItem(self, self.icon, u'Images')
595@@ -63,5 +60,3 @@
596 if event.event_type == EventType.LiveShow and event.payload == 'Image':
597 log.debug(u'Load Live Show Item received')
598 self.media_item.onImageLiveClick()
599-
600-
601
602=== modified file 'openlp/plugins/images/lib/__init__.py'
603--- openlp/plugins/images/lib/__init__.py 2009-03-24 06:07:03 +0000
604+++ openlp/plugins/images/lib/__init__.py 2009-06-20 10:44:12 +0000
605@@ -3,7 +3,7 @@
606 """
607 OpenLP - Open Source Lyrics Projection
608 Copyright (c) 2008 - 2009 Raoul Snyman
609-Portions copyright (c) 2008 Martin Thompson, Tim Bentley,
610+Portions copyright (c) 2008 - 2009 Martin Thompson, Tim Bentley,
611
612 This program is free software; you can redistribute it and/or modify it under
613 the terms of the GNU General Public License as published by the Free Software
614@@ -18,5 +18,4 @@
615 Place, Suite 330, Boston, MA 02111-1307 USA
616 """
617 from listwithpreviews import ListWithPreviews
618-from imageserviceitem import ImageServiceItem
619 from mediaitem import ImageMediaItem
620
621=== modified file 'openlp/plugins/images/lib/listwithpreviews.py'
622--- openlp/plugins/images/lib/listwithpreviews.py 2009-06-19 18:41:38 +0000
623+++ openlp/plugins/images/lib/listwithpreviews.py 2009-06-20 10:44:12 +0000
624@@ -5,7 +5,7 @@
625 Copyright (c) 2008 Raoul Snyman
626 Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley
627
628-This program is free software; you can rediunicodeibute it and/or modify it under
629+This program is free software; you can redistribute it and/or modify it under
630 the terms of the GNU General Public License as published by the Free Software
631 Foundation; version 2 of the License.
632
633@@ -34,34 +34,35 @@
634 # will be a list of (full filename, QPixmap, shortname) tuples
635 self.items = []
636 self.rowheight = 50
637- self.maximagewidth = self.rowheight*16/9.0;
638+ self.maximagewidth = self.rowheight * 16 / 9.0;
639
640 def rowCount(self, parent):
641 return len(self.items)
642
643 def insertRow(self, row, filename):
644- self.beginInsertRows(QtCore.QModelIndex(),row,row)
645+ self.beginInsertRows(QtCore.QModelIndex(), row, row)
646 #log.info(u'insert row %d:%s' % (row,filename))
647 # get short filename to display next to image
648- (prefix, shortfilename) = os.path.split(unicode(filename))
649+ filename = unicode(filename)
650+ (prefix, shortfilename) = os.path.split(filename)
651 #log.info(u'shortfilename=%s' % (shortfilename))
652 # create a preview image
653 if os.path.exists(filename):
654- preview = QtGui.QPixmap(unicode(filename))
655+ preview = QtGui.QImage(filename)
656 w = self.maximagewidth;
657 h = self.rowheight
658 preview = preview.scaled(w, h, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
659 realw = preview.width();
660 realh = preview.height()
661 # and move it to the centre of the preview space
662- p = QtGui.QPixmap(w,h)
663+ p = QtGui.QImage(w, h, QtGui.QImage.Format_ARGB32_Premultiplied)
664 p.fill(QtCore.Qt.transparent)
665 painter = QtGui.QPainter(p)
666- painter.drawPixmap((w-realw)/2,(h-realh)/2,preview)
667+ painter.drawImage((w-realw) / 2 , (h-realh) / 2, preview)
668 else:
669 w = self.maximagewidth;
670 h = self.rowheight
671- p = QtGui.QPixmap(w,h)
672+ p = QtGui.QImage(w, h, QtGui.QImage.Format_ARGB32_Premultiplied)
673 p.fill(QtCore.Qt.transparent)
674 # finally create the row
675 self.items.insert(row, (filename, p, shortfilename))
676
677=== modified file 'openlp/plugins/images/lib/mediaitem.py'
678--- openlp/plugins/images/lib/mediaitem.py 2009-06-19 18:41:38 +0000
679+++ openlp/plugins/images/lib/mediaitem.py 2009-06-20 10:44:12 +0000
680@@ -51,7 +51,7 @@
681 This is the custom media manager item for images.
682 """
683 global log
684- log=logging.getLogger(u'ImageMediaItem')
685+ log = logging.getLogger(u'ImageMediaItem')
686 log.info(u'Image Media Item loaded')
687
688 def __init__(self, parent, icon, title):
689@@ -95,7 +95,7 @@
690 self.ImageListView.setModel(self.ImageListData)
691 self.ImageListView.setGeometry(QtCore.QRect(10, 100, 256, 591))
692 self.ImageListView.setSpacing(1)
693- self.ImageListView.setSelectionMode(QtGui.QAbstractItemView.MultiSelection)
694+ self.ImageListView.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
695 self.ImageListView.setAlternatingRowColors(True)
696 self.ImageListView.setDragEnabled(True)
697 self.ImageListView.setObjectName(u'ImageListView')
698@@ -114,6 +114,8 @@
699 self.ImageListView, ':/system/system_add.png',
700 translate(u'ImageMediaItem', u'&Add to Service'),
701 self.onImageAddClick))
702+ QtCore.QObject.connect(self.ImageListView,
703+ QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onImagePreviewClick)
704
705 def initialise(self):
706 self.loadImageList(self.parent.config.load_list(u'images'))
707@@ -143,12 +145,12 @@
708
709 def generateSlideData(self, service_item):
710 indexes = self.ImageListView.selectedIndexes()
711- service_item.title = u'Images'
712+ service_item.title = u'Image(s)'
713 for index in indexes:
714 filename = self.ImageListData.getFilename(index)
715- frame = QtGui.QPixmap(unicode(filename))
716- (path, name) =os.path.split(filename)
717- service_item.add_from_image(name, frame)
718+ frame = QtGui.QImage(unicode(filename))
719+ (path, name) = os.path.split(filename)
720+ service_item.add_from_image(path, name, frame)
721
722 def onImagePreviewClick(self):
723 log.debug(u'Image Preview Requested')