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

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

 466. By Tim Bentley 2 minutes ago

    Rendering cleanup
465. By Tim Bentley 20 hours ago

    Theme Preview in ThemeTab
464. By Tim Bentley 21 hours ago

    Finish the Theme work to save all themes and replay them on reload
    Add rules as to which theme to use in the RenderManager
463. By Tim Bentley on 2009-05-18

    Fix Bible plugin to handle themes correctly when changed and removed.
462. By Tim Bentley on 2009-05-18

    Change Presentation Plugin to choose presentation software.
    Trial version until superfly gets his hands on it!
461. By Tim Bentley on 2009-05-18

    Fix comments from last merge
    Fix BiblePlugin Theme storage and usage
460. By Tim Bentley on 2009-05-17

    Corrections to Renderer to handle slides not lines
    Fixes to Bibleplugin to renderer multiple verses per slide
    Pass Bible Theme to RenderManager

Revision history for this message
Martin Thompson (mjthompson) wrote :

Possible tweaks?

Line 69 of diff - would the uninit'ed theme be better as None than u'' - more pythonic? At line 437, it does seem to be that way
Line 113 - extra space after comma

Lines:
158 + self.service_theme = self.ThemeComboBox.currentText()
159 + self.RenderManager.set_service_theme(self.service_theme)
160 + self.config.set_config(u'theme service theme', self.service_theme)

Do all these three have to be kept in sync like this? It feels a bit potentially "fragile" (to me), but I guess if it's only ever going to be done this once, it won't matter!

Line 277: Would it be acceptable to use double-quoted strings to avoid escaping all the single quotes (this is the reason I default to double-quoted strings in my code :)

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

Erm, what's happening here?

112 - def __init__(self, parent, screens):
113 + def __init__(self, parent , screens):

Also not sure why some lines seem to have been removed and then added again...

review: Approve
Revision history for this message
Tim Bentley (trb143) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/core/lib/renderer.py'
2--- openlp/core/lib/renderer.py 2009-05-17 15:24:02 +0000
3+++ openlp/core/lib/renderer.py 2009-05-19 16:27:01 +0000
4@@ -78,26 +78,19 @@
5
6 def scale_bg_image(self):
7 assert self._frame
8- image = QtGui.QImage(self._bg_image_filename)
9- # rescale and offset
10- imw = image.width()
11- imh = image.height()
12- dcw = self._frame.width()+1
13- dch = self._frame.height()
14- imratio = imw/float(imh)
15- dcratio = dcw/float(dch)
16- log.debug(u'Image scaling params %s %s %s %s %s %s', imw, imh, imratio, dcw, dch, dcratio)
17- if imratio > dcratio:
18- scale = dcw/float(imw)
19- elif imratio < dcratio:
20- scale = dch/float(imh)
21- else:
22- scale = dcw/float(imw) # either will do
23- neww = int(round(imw*scale))
24- newh = int(round(imh*scale))
25- self.background_offsetx=(dcw-neww)/2
26- self.background_offsety=(dch-newh)/2
27- self.bg_image=QtGui.QPixmap.fromImage(image.scaled(QtCore.QSize(neww, newh), Qt.Qt.KeepAspectRatio))
28+ preview = QtGui.QPixmap(self._bg_image_filename)
29+ width = self._frame.width()
30+ height = self._frame.height()
31+ preview = preview.scaled(width, height, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
32+ realwidth = preview.width()
33+ realheight = preview.height()
34+ # and move it to the centre of the preview space
35+ self.bg_image = QtGui.QPixmap(width, height)
36+ self.bg_image.fill(QtCore.Qt.transparent)
37+ painter = QtGui.QPainter(self.bg_image)
38+ self.background_offsetx = (width - realwidth) / 2
39+ self.background_offsety = (height - realheight) / 2
40+ painter.drawPixmap(self.background_offsetx, self.background_offsety , preview)
41
42 def set_frame_dest(self, frame_width, frame_height, preview=False):
43 """
44@@ -118,6 +111,7 @@
45 """
46 log.debug(u'format_slide %s', words)
47 verses = []
48+ words=words.replace("\r\n", "\n")
49 verses_text = words.split(u'\n\n')
50 for verse in verses_text:
51 lines = verse.split(u'\n')
52
53=== modified file 'openlp/core/lib/rendermanager.py'
54--- openlp/core/lib/rendermanager.py 2009-05-17 15:24:02 +0000
55+++ openlp/core/lib/rendermanager.py 2009-05-18 19:47:18 +0000
56@@ -44,8 +44,6 @@
57 print "%s:%s: %s" % (name, lineno, line.rstrip())
58 return traceit
59
60-
61-
62 class RenderManager:
63 """
64 Class to pull all Renderer interactions into one place.
65@@ -64,14 +62,34 @@
66 self.current_display = 0
67 self.renderer = Renderer()
68 self.calculate_default(self.screen_list[self.current_display]['size'])
69+ self.theme = u''
70+
71+ def set_global_theme(self, global_theme, global_style = u'Global'):
72+ self.global_theme = global_theme
73+ self.global_style = global_style
74+
75+ def set_service_theme(self, service_theme):
76+ self.service_theme = service_theme
77
78 def set_override_theme(self, theme):
79 log.debug(u'set override theme to %s', theme)
80- if theme is not None:
81- self.theme = theme
82+ if self.global_style == u'Global':
83+ self.theme = self.global_theme
84+ elif self.global_style == u'Service':
85+ if self.service_theme == u'':
86+ self.theme = self.global_theme
87+ else:
88+ self.theme = self.service_theme
89 else:
90- self.theme = self.default_theme
91- if self.theme != self.renderer.theme_name:
92+ if theme is not None:
93+ self.theme = theme
94+ elif self.global_style == u'Service':
95+ if self.service_theme == u'':
96+ self.theme = self.global_theme
97+ else:
98+ self.theme = self.service_theme
99+
100+ if self.theme is not self.renderer.theme_name:
101 log.debug(u'theme is now %s', self.theme)
102 self.themedata = self.theme_manager.getThemeData(self.theme)
103 self.calculate_default(self.screen_list[self.current_display]['size'])
104
105=== modified file 'openlp/core/ui/maindisplay.py'
106--- openlp/core/ui/maindisplay.py 2009-05-16 19:47:30 +0000
107+++ openlp/core/ui/maindisplay.py 2009-05-18 19:04:25 +0000
108@@ -24,7 +24,7 @@
109
110 class MainDisplay(QtGui.QWidget):
111
112- def __init__(self, parent, screens):
113+ def __init__(self, parent , screens):
114 QtGui.QWidget.__init__(self, parent)
115 self.setWindowTitle(u'OpenLP Display')
116 self.screens = screens
117
118=== modified file 'openlp/core/ui/mainwindow.py'
119--- openlp/core/ui/mainwindow.py 2009-05-16 16:38:03 +0000
120+++ openlp/core/ui/mainwindow.py 2009-05-18 19:04:25 +0000
121@@ -43,7 +43,7 @@
122 self.EventManager = EventManager()
123 self.alert_form = AlertForm()
124 self.about_form = AboutForm()
125- self.settings_form = SettingsForm(self.screen_list)
126+ self.settings_form = SettingsForm(self.screen_list, self)
127
128 pluginpath = os.path.split(os.path.abspath(__file__))[0]
129 pluginpath = os.path.abspath(os.path.join(pluginpath, u'..', u'..', u'plugins'))
130
131=== modified file 'openlp/core/ui/servicemanager.py'
132--- openlp/core/ui/servicemanager.py 2009-05-16 16:38:03 +0000
133+++ openlp/core/ui/servicemanager.py 2009-05-18 19:04:25 +0000
134@@ -21,7 +21,7 @@
135 import logging
136
137 from PyQt4 import QtCore, QtGui
138-
139+from openlp.core.lib import PluginConfig
140 from openlp.core.lib import OpenLPToolbar
141 from openlp.core.lib import ServiceItem
142 from openlp.core.lib import RenderManager
143@@ -103,6 +103,9 @@
144 QtCore.QObject.connect(self.ThemeComboBox,
145 QtCore.SIGNAL("activated(int)"), self.onThemeComboBoxSelected)
146
147+ self.config = PluginConfig(u'Main')
148+ self.service_theme = self.config.get_config(u'theme service theme', u'')
149+
150 def contextMenuAction(self, base, icon, text, slot):
151 """
152 Utility method to help build context menus for plugins
153@@ -142,7 +145,9 @@
154 pass
155
156 def onThemeComboBoxSelected(self, currentIndex):
157- self.RenderManager.default_theme = self.ThemeComboBox.currentText()
158+ self.service_theme = self.ThemeComboBox.currentText()
159+ self.RenderManager.set_service_theme(self.service_theme)
160+ self.config.set_config(u'theme service theme', self.service_theme)
161
162 def addServiceItem(self, item):
163 self.serviceItems.append({u'data': item, u'order': len(self.serviceItems)+1})
164@@ -224,7 +229,11 @@
165 Called from ThemeManager when the Themes have changed
166 """
167 self.ThemeComboBox.clear()
168+ self.ThemeComboBox.addItem(u'')
169 for theme in theme_list:
170 self.ThemeComboBox.addItem(theme)
171- self.RenderManager.default_theme = self.ThemeComboBox.currentText()
172-
173+ id = self.ThemeComboBox.findText(str(self.service_theme), QtCore.Qt.MatchExactly)
174+ if id == -1:
175+ id = 0 # Not Found
176+ self.service_theme = u''
177+ self.ThemeComboBox.setCurrentIndex(id)
178
179=== modified file 'openlp/core/ui/settingsform.py'
180--- openlp/core/ui/settingsform.py 2009-05-01 11:50:09 +0000
181+++ openlp/core/ui/settingsform.py 2009-05-18 19:04:25 +0000
182@@ -31,14 +31,14 @@
183
184 class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
185
186- def __init__(self, screen_list, parent=None):
187- QtGui.QDialog.__init__(self, parent)
188+ def __init__(self, screen_list, mainWindow, parent=None):
189+ QtGui.QDialog.__init__(self, None)
190 self.setupUi(self)
191 # General tab
192 self.GeneralTab = GeneralTab(screen_list)
193 self.addTab(self.GeneralTab)
194 # Themes tab
195- self.ThemesTab = ThemesTab()
196+ self.ThemesTab = ThemesTab(mainWindow)
197 self.addTab(self.ThemesTab)
198 # Alert tab
199 self.AlertsTab = AlertsTab()
200
201=== modified file 'openlp/core/ui/thememanager.py'
202--- openlp/core/ui/thememanager.py 2009-05-17 08:25:15 +0000
203+++ openlp/core/ui/thememanager.py 2009-05-18 19:47:18 +0000
204@@ -367,3 +367,7 @@
205 frame = self.RenderManager.generate_preview(themedata)
206 return frame
207
208+ def getPreviewImage(self, theme):
209+ log.debug(u'getPreviewImage %s ', theme)
210+ image = os.path.join(self.path, theme + u'.png')
211+ return image
212
213=== modified file 'openlp/core/ui/themestab.py'
214--- openlp/core/ui/themestab.py 2009-05-16 16:38:03 +0000
215+++ openlp/core/ui/themestab.py 2009-05-18 19:47:18 +0000
216@@ -3,7 +3,7 @@
217 """
218 OpenLP - Open Source Lyrics Projection
219 Copyright (c) 2008 Raoul Snyman
220-Portions copyright (c) 2008 Martin Thompson, Tim Bentley,
221+Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley,
222
223 This program is free software; you can redistribute it and/or modify it under
224 the terms of the GNU General Public License as published by the Free Software
225@@ -22,13 +22,13 @@
226
227 from openlp.core import translate
228 from openlp.core.lib import SettingsTab
229-from openlp.core.resources import *
230
231 class ThemesTab(SettingsTab):
232 """
233 ThemesTab is the theme settings tab in the settings dialog.
234 """
235- def __init__(self):
236+ def __init__(self, parent):
237+ self.parent = parent
238 SettingsTab.__init__(self, u'Themes')
239
240 def setupUi(self):
241@@ -45,11 +45,8 @@
242 self.GlobalGroupBoxLayout.setObjectName(u'GlobalGroupBoxLayout')
243 self.DefaultComboBox = QtGui.QComboBox(self.GlobalGroupBox)
244 self.DefaultComboBox.setObjectName(u'DefaultComboBox')
245- self.DefaultComboBox.addItem(QtCore.QString())
246- self.DefaultComboBox.addItem(QtCore.QString())
247- self.DefaultComboBox.addItem(QtCore.QString())
248 self.GlobalGroupBoxLayout.addWidget(self.DefaultComboBox)
249- self.DefaultListView = QtGui.QListView(self.GlobalGroupBox)
250+ self.DefaultListView = QtGui.QLabel(self.GlobalGroupBox)
251 self.DefaultListView.setObjectName(u'DefaultListView')
252 self.GlobalGroupBoxLayout.addWidget(self.DefaultListView)
253 self.ThemesTabLayout.addWidget(self.GlobalGroupBox)
254@@ -93,11 +90,20 @@
255 self.GlobalLevelLabel)
256 self.ThemesTabLayout.addWidget(self.LevelGroupBox)
257
258+ QtCore.QObject.connect(self.SongLevelRadioButton,
259+ QtCore.SIGNAL("pressed()"), self.onSongLevelButtonPressed)
260+ QtCore.QObject.connect(self.ServiceLevelRadioButton,
261+ QtCore.SIGNAL("pressed()"), self.onServiceLevelButtonPressed)
262+ QtCore.QObject.connect(self.GlobalLevelRadioButton,
263+ QtCore.SIGNAL("pressed()"), self.onGlobalLevelButtonPressed)
264+
265+ QtCore.QObject.connect(self.DefaultComboBox,
266+ QtCore.SIGNAL("activated(int)"), self.onDefaultComboBoxChanged)
267+
268+ #self.DefaultListView.setScaledContents(True)
269+
270 def retranslateUi(self):
271 self.GlobalGroupBox.setTitle(translate(u'ThemesTab', u'Global theme'))
272- self.DefaultComboBox.setItemText(0, translate(u'ThemesTab', u'African Sunset'))
273- self.DefaultComboBox.setItemText(1, translate(u'ThemesTab', u'Snowy Mountains'))
274- self.DefaultComboBox.setItemText(2, translate(u'ThemesTab', u'Wilderness'))
275 self.LevelGroupBox.setTitle(translate(u'ThemesTab', u'Theme level'))
276 self.SongLevelRadioButton.setText(translate(u'ThemesTab', u'Song level'))
277 self.SongLevelLabel.setText(translate(u'ThemesTab', u'Use the theme from each song in the database. If a song doesn\'t have a theme associated with it, then use the service\'s theme. If the service doesn\'t have a theme, then use the global theme.'))
278@@ -106,6 +112,40 @@
279 self.GlobalLevelRadioButton.setText(translate(u'ThemesTab', u'Global level'))
280 self.GlobalLevelLabel.setText(translate(u'ThemesTab', u'Use the global theme, overriding any themes associated wither either the service or the songs.'))
281
282+ def load(self):
283+ self.global_style = self.config.get_config(u'theme global style', u'Global')
284+ self.global_theme = self.config.get_config(u'theme global theme', u'')
285+ if self.global_style == u'Global':
286+ self.GlobalLevelRadioButton.setChecked(True)
287+ elif self.global_style == u'Service':
288+ self.ServiceLevelRadioButton.setChecked(True)
289+ else:
290+ self.SongLevelRadioButton.setChecked(True)
291+
292+ def save(self):
293+ self.config.set_config(u'theme global style', self.global_style )
294+ self.config.set_config(u'theme global theme',self.global_theme)
295+
296+ def onSongLevelButtonPressed(self):
297+ self.global_style= u'Song'
298+ self.parent.RenderManager.set_global_theme(self.global_theme, self.global_style)
299+
300+ def onServiceLevelButtonPressed(self):
301+ self.global_style= u'Service'
302+ self.parent.RenderManager.set_global_theme(self.global_theme, self.global_style)
303+
304+ def onGlobalLevelButtonPressed(self):
305+ self.global_style= u'Global'
306+ self.parent.RenderManager.set_global_theme(self.global_theme, self.global_style)
307+
308+ def onDefaultComboBoxChanged(self, value):
309+ self.global_theme = self.DefaultComboBox.currentText()
310+ self.parent.RenderManager.set_global_theme(self.global_theme, self.global_style)
311+ image = self.parent.ThemeManagerContents.getPreviewImage(str(self.global_theme))
312+ preview = QtGui.QPixmap(str(image))
313+ display = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
314+ self.DefaultListView.setPixmap(display)
315+
316 def updateThemeList(self, theme_list):
317 """
318 Called from ThemeManager when the Themes have changed
319@@ -113,3 +153,14 @@
320 self.DefaultComboBox.clear()
321 for theme in theme_list:
322 self.DefaultComboBox.addItem(theme)
323+ id = self.DefaultComboBox.findText(str(self.global_theme), QtCore.Qt.MatchExactly)
324+ if id == -1:
325+ id = 0 # Not Found
326+ self.global_theme = u''
327+ self.DefaultComboBox.setCurrentIndex(id)
328+ self.parent.RenderManager.set_global_theme(self.global_theme, self.global_style)
329+ if self.global_theme is not u'':
330+ image = self.parent.ThemeManagerContents.getPreviewImage(str(self.global_theme))
331+ preview = QtGui.QPixmap(str(image))
332+ display = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
333+ self.DefaultListView.setPixmap(display)
334
335=== modified file 'openlp/plugins/bibles/lib/biblestab.py'
336--- openlp/plugins/bibles/lib/biblestab.py 2009-05-17 15:24:02 +0000
337+++ openlp/plugins/bibles/lib/biblestab.py 2009-05-18 16:11:59 +0000
338@@ -3,7 +3,7 @@
339 """
340 OpenLP - Open Source Lyrics Projection
341 Copyright (c) 2008 Raoul Snyman
342-Portions copyright (c) 2008 Martin Thompson, Tim Bentley,
343+Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley,
344
345 This program is free software; you can redistribute it and/or modify it under
346 the terms of the GNU General Public License as published by the Free Software
347@@ -18,7 +18,7 @@
348 Place, Suite 330, Boston, MA 02111-1307 USA
349 """
350
351-from PyQt4 import QtCore, QtGui
352+from PyQt4 import Qt, QtCore, QtGui
353
354 from openlp.core import translate
355 from openlp import convertStringToBoolean
356@@ -144,6 +144,8 @@
357 QtCore.SIGNAL("pressed()"), self.onParagraphRadioButtonPressed)
358 QtCore.QObject.connect(self.DisplayStyleComboBox,
359 QtCore.SIGNAL("activated(int)"), self.onDisplayStyleComboBoxChanged)
360+ QtCore.QObject.connect(self.BibleThemeComboBox,
361+ QtCore.SIGNAL("activated(int)"), self.onBibleThemeComboBoxChanged)
362
363 def retranslateUi(self):
364 self.VerseDisplayGroupBox.setTitle(translate('SettingsForm', 'Verse Display'))
365@@ -160,6 +162,9 @@
366 self.BibleSearchGroupBox.setTitle(translate('SettingsForm', 'Search'))
367 self.BibleSearchCheckBox.setText(translate('SettingsForm', 'Search-as-you-type'))
368
369+ def onBibleThemeComboBoxChanged(self):
370+ self.bible_theme = self.BibleThemeComboBox.currentText()
371+
372 def onDisplayStyleComboBoxChanged(self):
373 self.display_style = self.DisplayStyleComboBox.currentIndex()
374
375@@ -182,11 +187,11 @@
376 self.bible_search = True
377
378 def load(self):
379- self.paragraph_style = convertStringToBoolean(self.config.get_config('paragraph style', u'True'))
380- self.show_new_chapters = convertStringToBoolean(self.config.get_config('display new chapter', u"False"))
381- self.display_style = int(self.config.get_config('display brackets', '0'))
382- self.bible_theme = int(self.config.get_config('bible theme', '0'))
383- self.bible_search = convertStringToBoolean(self.config.get_config('search as type', u'True'))
384+ self.paragraph_style = convertStringToBoolean(self.config.get_config(u'paragraph style', u'True'))
385+ self.show_new_chapters = convertStringToBoolean(self.config.get_config(u'display new chapter', u"False"))
386+ self.display_style = int(self.config.get_config(u'display brackets', u'0'))
387+ self.bible_theme = self.config.get_config(u'bible theme', u'0')
388+ self.bible_search = convertStringToBoolean(self.config.get_config(u'search as type', u'True'))
389 if self.paragraph_style:
390 self.ParagraphRadioButton.setChecked(True)
391 else:
392@@ -194,23 +199,24 @@
393 self.NewChaptersCheckBox.setChecked(self.show_new_chapters)
394 self.DisplayStyleComboBox.setCurrentIndex(self.display_style)
395 self.BibleSearchCheckBox.setChecked(self.bible_search)
396- if self.bible_theme == 0: # must be new set to first
397- self.BibleThemeComboBox.setCurrentIndex(self.bible_theme)
398- else:
399- pass # TODO need to code
400- self.bible_theme = None
401
402 def save(self):
403- self.config.set_config("paragraph style", str(self.paragraph_style))
404- self.config.set_config("display new chapter", str(self.show_new_chapters))
405- self.config.set_config("display brackets", str(self.display_style))
406- self.config.set_config("search as type", str(self.bible_search))
407- self.config.set_config("bible theme", str(self.bible_theme))
408+ self.config.set_config(u'paragraph style', str(self.paragraph_style))
409+ self.config.set_config(u'display new chapter', str(self.show_new_chapters))
410+ self.config.set_config(u'display brackets', str(self.display_style))
411+ self.config.set_config(u'search as type', str(self.bible_search))
412+ self.config.set_config(u'bible theme', str(self.bible_theme))
413
414 def updateThemeList(self, theme_list):
415 """
416 Called from ThemeManager when the Themes have changed
417 """
418 self.BibleThemeComboBox.clear()
419+ self.BibleThemeComboBox.addItem(u'')
420 for theme in theme_list:
421 self.BibleThemeComboBox.addItem(theme)
422+ id = self.BibleThemeComboBox.findText(str(self.bible_theme), QtCore.Qt.MatchExactly)
423+ if id == -1:
424+ id = 0 # Not Found
425+ self.bible_theme = u''
426+ self.BibleThemeComboBox.setCurrentIndex(id)
427
428=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
429--- openlp/plugins/bibles/lib/mediaitem.py 2009-05-17 15:24:02 +0000
430+++ openlp/plugins/bibles/lib/mediaitem.py 2009-05-18 16:11:59 +0000
431@@ -398,7 +398,10 @@
432 if len(raw_footer) <= 1:
433 raw_footer.append(book)
434
435- service_item.theme = self.parent.bibles_tab.bible_theme
436+ if len(self.parent.bibles_tab.bible_theme) == 0:
437+ service_item.theme = None
438+ else:
439+ service_item.theme = self.parent.bibles_tab.bible_theme
440 raw_slides.append(bible_text)
441 service_item.raw_slides = raw_slides
442 service_item.raw_footer = raw_footer
443
444=== modified file 'openlp/plugins/media/lib/mediaitem.py'
445--- openlp/plugins/media/lib/mediaitem.py 2009-05-16 16:38:03 +0000
446+++ openlp/plugins/media/lib/mediaitem.py 2009-05-18 04:41:49 +0000
447@@ -100,7 +100,7 @@
448 files = QtGui.QFileDialog.getOpenFileNames(None,
449 translate('MediaMediaItem', u'Select Media(s) items'),
450 self.parent.config.get_last_dir(),
451- u'Images (*.avi *.mpeg);;Audio (*.mp3 *.ogg *.wma);;All files (*)')
452+ u'Videos (*.avi *.mpeg);;Audio (*.mp3 *.ogg *.wma);;All files (*)')
453 if len(files) > 0:
454 self.loadMediaList(files)
455 dir, filename = os.path.split(str(files[0]))
456
457=== modified file 'openlp/plugins/presentations/lib/__init__.py'
458--- openlp/plugins/presentations/lib/__init__.py 2009-03-19 17:31:33 +0000
459+++ openlp/plugins/presentations/lib/__init__.py 2009-05-18 16:04:34 +0000
460@@ -20,5 +20,6 @@
461
462 from filelistdata import FileListData
463 from mediaitem import PresentationMediaItem
464+from presentationtab import PresentationTab
465
466-__all__ = ['PresentationMediaItem', 'FileListData']
467+__all__ = ['PresentationMediaItem', 'FileListData', 'PresentationTab']
468
469=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
470--- openlp/plugins/presentations/lib/mediaitem.py 2009-03-19 17:31:33 +0000
471+++ openlp/plugins/presentations/lib/mediaitem.py 2009-05-18 19:04:25 +0000
472@@ -39,87 +39,111 @@
473 def __init__(self, parent, icon, title):
474 MediaManagerItem.__init__(self, parent, icon, title)
475
476- def setupUi(self):
477+ def setupUi(self):
478 # Add a toolbar
479 self.addToolbar()
480 # Create buttons for the toolbar
481 ## New Presentation Button ##
482 self.addToolbarButton(
483- translate('PresentationsMediaItem',u'New presentations'),
484+ translate('PresentationsMediaItem',u'New presentations'),
485 translate('PresentationsMediaItem',u'Load presentations into openlp.org'),
486 ':/presentations/presentation_load.png', self.onPresentationNewClick, 'PresentationNewItem')
487 ## Delete Presentation Button ##
488 self.addToolbarButton(
489- translate('PresentationsMediaItem',u'Delete Presentation'),
490+ translate('PresentationsMediaItem',u'Delete Presentation'),
491 translate('PresentationsMediaItem',u'Delete the selected presentation'),
492 ':/presentations/presentation_delete.png', self.onPresentationDeleteClick, 'PresentationDeleteItem')
493 ## Separator Line ##
494 self.addToolbarSeparator()
495 ## Preview Presentation Button ##
496 self.addToolbarButton(
497- translate('PresentationsMediaItem',u'Preview Presentation'),
498+ translate('PresentationsMediaItem',u'Preview Presentation'),
499 translate('PresentationsMediaItem',u'Preview the selected Presentation'),
500 ':/system/system_preview.png', self.onPresentationPreviewClick, 'PresentationPreviewItem')
501 ## Live Presentation Button ##
502 self.addToolbarButton(
503- translate('PresentationsMediaItem',u'Go Live'),
504+ translate('PresentationsMediaItem',u'Go Live'),
505 translate('PresentationsMediaItem',u'Send the selected presentation live'),
506 ':/system/system_live.png', self.onPresentationLiveClick, 'PresentationLiveItem')
507 ## Add Presentation Button ##
508 self.addToolbarButton(
509 translate('PresentationsMediaItem',u'Add Presentation To Service'),
510- translate('PresentationsMediaItem',u'Add the selected Presentations(s) to the service'),
511+ translate('PresentationsMediaItem',u'Add the selected Presentations(s) to the service'),
512 ':/system/system_add.png',self.onPresentationAddClick, 'PresentationsAddItem')
513 ## Add the Presentationlist widget ##
514-
515+
516+ self.PresentationWidget = QtGui.QWidget(self)
517+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
518+ sizePolicy.setHorizontalStretch(0)
519+ sizePolicy.setVerticalStretch(0)
520+ sizePolicy.setHeightForWidth(self.PresentationWidget.sizePolicy().hasHeightForWidth())
521+ self.PresentationWidget.setSizePolicy(sizePolicy)
522+ self.PresentationWidget.setObjectName('PresentationWidget')
523+ self.DisplayLayout = QtGui.QGridLayout(self.PresentationWidget)
524+ self.DisplayLayout.setObjectName('DisplayLayout')
525+ self.DisplayTypeComboBox = QtGui.QComboBox(self.PresentationWidget)
526+ self.DisplayTypeComboBox.setObjectName('DisplayTypeComboBox')
527+ self.DisplayLayout.addWidget(self.DisplayTypeComboBox, 0, 1, 1, 2)
528+ self.DisplayTypeLabel = QtGui.QLabel(self.PresentationWidget)
529+ self.DisplayTypeLabel.setObjectName('SearchTypeLabel')
530+ self.DisplayLayout.addWidget(self.DisplayTypeLabel, 0, 0, 1, 1)
531+
532+ self.DisplayTypeLabel.setText(translate('PresentationMediaItem', u'Present using:'))
533+
534+ # Add the song widget to the page layout
535+ self.PageLayout.addWidget(self.PresentationWidget)
536+
537 self.PresentationsListView = QtGui.QListView()
538 self.PresentationsListView.setAlternatingRowColors(True)
539 self.PresentationsListData = FileListData()
540 self.PresentationsListView.setModel(self.PresentationsListData)
541-
542+
543 self.PageLayout.addWidget(self.PresentationsListView)
544-
545+
546 #define and add the context menu
547 self.PresentationsListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
548
549 self.PresentationsListView.addAction(self.contextMenuAction(
550- self.PresentationsListView, ':/system/system_preview.png',
551+ self.PresentationsListView, ':/system/system_preview.png',
552 translate('PresentationsMediaItem',u'&Preview presentations'), self.onPresentationPreviewClick))
553 self.PresentationsListView.addAction(self.contextMenuAction(
554- self.PresentationsListView, ':/system/system_live.png',
555+ self.PresentationsListView, ':/system/system_live.png',
556 translate('PresentationsMediaItem',u'&Show Live'), self.onPresentationLiveClick))
557 self.PresentationsListView.addAction(self.contextMenuAction(
558- self.PresentationsListView, ':/system/system_add.png',
559+ self.PresentationsListView, ':/system/system_add.png',
560 translate('PresentationsMediaItem',u'&Add to Service'), self.onPresentationAddClick))
561-
562+
563 def initialise(self):
564 list = self.parent.config.load_list(u'presentations')
565 self.loadPresentationList(list)
566+ self.DisplayTypeComboBox.addItem(u'Impress')
567+ self.DisplayTypeComboBox.addItem(u'Powerpoint')
568+ self.DisplayTypeComboBox.addItem(u'Keynote')
569
570 def onPresentationNewClick(self):
571- files = QtGui.QFileDialog.getOpenFileNames(None,
572- translate('PresentationsMediaItem', u'Select presentations(s)'),
573+ files = QtGui.QFileDialog.getOpenFileNames(None,
574+ translate('PresentationsMediaItem', u'Select presentations(s)'),
575 self.parent.config.get_last_dir(), u'Presentations (*.ppt *.pps *.odi)')
576 if len(files) > 0:
577 self.loadPresentationList(files)
578 dir, filename = os.path.split(str(files[0]))
579 self.parent.config.set_last_dir(dir)
580 self.parent.config.set_list(u'Presentations', self.PresentationsListData.getFileList())
581-
582+
583 def getFileList(self):
584 filelist = [item[0] for item in self.PresentationsListView];
585- return filelist
586+ return filelist
587
588 def loadPresentationList(self, list):
589 for files in list:
590 self.PresentationsListData.addRow(files)
591-
592+
593 def onPresentationDeleteClick(self):
594 indexes = self.PresentationsListView.selectedIndexes()
595 for index in indexes:
596 current_row = int(index.row())
597 self.PresentationsListData.removeRow(current_row)
598- self.parent.config.set_list(u'Presentations', self.PresentationsListData.getFileList())
599+ self.parent.config.set_list(u'Presentations', self.PresentationsListData.getFileList())
600
601 def onPresentationPreviewClick(self):
602 pass
603@@ -128,4 +152,4 @@
604 pass
605
606 def onPresentationAddClick(self):
607- pass
608+ pass
609
610=== modified file 'openlp/plugins/presentations/presentationplugin.py'
611--- openlp/plugins/presentations/presentationplugin.py 2009-03-22 07:13:34 +0000
612+++ openlp/plugins/presentations/presentationplugin.py 2009-05-18 16:04:34 +0000
613@@ -3,7 +3,7 @@
614 """
615 OpenLP - Open Source Lyrics Projection
616 Copyright (c) 2008 Raoul Snyman
617-Portions copyright (c) 2008 Martin Thompson, Tim Bentley,
618+Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley,
619
620 This program is free software; you can redistribute it and/or modify it under
621 the terms of the GNU General Public License as published by the Free Software
622@@ -22,9 +22,8 @@
623
624 from PyQt4 import QtCore, QtGui
625
626-from openlp.core.resources import *
627 from openlp.core.lib import Plugin, MediaManagerItem
628-from openlp.plugins.presentations.lib import PresentationMediaItem
629+from openlp.plugins.presentations.lib import PresentationMediaItem, PresentationTab
630
631 class PresentationPlugin(Plugin):
632
633@@ -38,7 +37,8 @@
634 QtGui.QIcon.Normal, QtGui.QIcon.Off)
635
636 def get_settings_tab(self):
637- pass
638+ self.presentation_tab = PresentationTab()
639+ return self.presentation_tab
640
641 def get_media_manager_item(self):
642 # Create the MediaManagerItem object