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
=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py 2009-05-17 15:24:02 +0000
+++ openlp/core/lib/renderer.py 2009-05-19 16:27:01 +0000
@@ -78,26 +78,19 @@
7878
79 def scale_bg_image(self):79 def scale_bg_image(self):
80 assert self._frame80 assert self._frame
81 image = QtGui.QImage(self._bg_image_filename)81 preview = QtGui.QPixmap(self._bg_image_filename)
82 # rescale and offset82 width = self._frame.width()
83 imw = image.width()83 height = self._frame.height()
84 imh = image.height()84 preview = preview.scaled(width, height, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
85 dcw = self._frame.width()+185 realwidth = preview.width()
86 dch = self._frame.height()86 realheight = preview.height()
87 imratio = imw/float(imh)87 # and move it to the centre of the preview space
88 dcratio = dcw/float(dch)88 self.bg_image = QtGui.QPixmap(width, height)
89 log.debug(u'Image scaling params %s %s %s %s %s %s', imw, imh, imratio, dcw, dch, dcratio)89 self.bg_image.fill(QtCore.Qt.transparent)
90 if imratio > dcratio:90 painter = QtGui.QPainter(self.bg_image)
91 scale = dcw/float(imw)91 self.background_offsetx = (width - realwidth) / 2
92 elif imratio < dcratio:92 self.background_offsety = (height - realheight) / 2
93 scale = dch/float(imh)93 painter.drawPixmap(self.background_offsetx, self.background_offsety , preview)
94 else:
95 scale = dcw/float(imw) # either will do
96 neww = int(round(imw*scale))
97 newh = int(round(imh*scale))
98 self.background_offsetx=(dcw-neww)/2
99 self.background_offsety=(dch-newh)/2
100 self.bg_image=QtGui.QPixmap.fromImage(image.scaled(QtCore.QSize(neww, newh), Qt.Qt.KeepAspectRatio))
10194
102 def set_frame_dest(self, frame_width, frame_height, preview=False):95 def set_frame_dest(self, frame_width, frame_height, preview=False):
103 """96 """
@@ -118,6 +111,7 @@
118 """111 """
119 log.debug(u'format_slide %s', words)112 log.debug(u'format_slide %s', words)
120 verses = []113 verses = []
114 words=words.replace("\r\n", "\n")
121 verses_text = words.split(u'\n\n')115 verses_text = words.split(u'\n\n')
122 for verse in verses_text:116 for verse in verses_text:
123 lines = verse.split(u'\n')117 lines = verse.split(u'\n')
124118
=== modified file 'openlp/core/lib/rendermanager.py'
--- openlp/core/lib/rendermanager.py 2009-05-17 15:24:02 +0000
+++ openlp/core/lib/rendermanager.py 2009-05-18 19:47:18 +0000
@@ -44,8 +44,6 @@
44 print "%s:%s: %s" % (name, lineno, line.rstrip())44 print "%s:%s: %s" % (name, lineno, line.rstrip())
45 return traceit45 return traceit
4646
47
48
49class RenderManager:47class RenderManager:
50 """48 """
51 Class to pull all Renderer interactions into one place.49 Class to pull all Renderer interactions into one place.
@@ -64,14 +62,34 @@
64 self.current_display = 062 self.current_display = 0
65 self.renderer = Renderer()63 self.renderer = Renderer()
66 self.calculate_default(self.screen_list[self.current_display]['size'])64 self.calculate_default(self.screen_list[self.current_display]['size'])
65 self.theme = u''
66
67 def set_global_theme(self, global_theme, global_style = u'Global'):
68 self.global_theme = global_theme
69 self.global_style = global_style
70
71 def set_service_theme(self, service_theme):
72 self.service_theme = service_theme
6773
68 def set_override_theme(self, theme):74 def set_override_theme(self, theme):
69 log.debug(u'set override theme to %s', theme)75 log.debug(u'set override theme to %s', theme)
70 if theme is not None:76 if self.global_style == u'Global':
71 self.theme = theme77 self.theme = self.global_theme
78 elif self.global_style == u'Service':
79 if self.service_theme == u'':
80 self.theme = self.global_theme
81 else:
82 self.theme = self.service_theme
72 else:83 else:
73 self.theme = self.default_theme84 if theme is not None:
74 if self.theme != self.renderer.theme_name:85 self.theme = theme
86 elif self.global_style == u'Service':
87 if self.service_theme == u'':
88 self.theme = self.global_theme
89 else:
90 self.theme = self.service_theme
91
92 if self.theme is not self.renderer.theme_name:
75 log.debug(u'theme is now %s', self.theme)93 log.debug(u'theme is now %s', self.theme)
76 self.themedata = self.theme_manager.getThemeData(self.theme)94 self.themedata = self.theme_manager.getThemeData(self.theme)
77 self.calculate_default(self.screen_list[self.current_display]['size'])95 self.calculate_default(self.screen_list[self.current_display]['size'])
7896
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2009-05-16 19:47:30 +0000
+++ openlp/core/ui/maindisplay.py 2009-05-18 19:04:25 +0000
@@ -24,7 +24,7 @@
2424
25class MainDisplay(QtGui.QWidget):25class MainDisplay(QtGui.QWidget):
2626
27 def __init__(self, parent, screens):27 def __init__(self, parent , screens):
28 QtGui.QWidget.__init__(self, parent)28 QtGui.QWidget.__init__(self, parent)
29 self.setWindowTitle(u'OpenLP Display')29 self.setWindowTitle(u'OpenLP Display')
30 self.screens = screens30 self.screens = screens
3131
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2009-05-16 16:38:03 +0000
+++ openlp/core/ui/mainwindow.py 2009-05-18 19:04:25 +0000
@@ -43,7 +43,7 @@
43 self.EventManager = EventManager()43 self.EventManager = EventManager()
44 self.alert_form = AlertForm()44 self.alert_form = AlertForm()
45 self.about_form = AboutForm()45 self.about_form = AboutForm()
46 self.settings_form = SettingsForm(self.screen_list)46 self.settings_form = SettingsForm(self.screen_list, self)
4747
48 pluginpath = os.path.split(os.path.abspath(__file__))[0]48 pluginpath = os.path.split(os.path.abspath(__file__))[0]
49 pluginpath = os.path.abspath(os.path.join(pluginpath, u'..', u'..', u'plugins'))49 pluginpath = os.path.abspath(os.path.join(pluginpath, u'..', u'..', u'plugins'))
5050
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2009-05-16 16:38:03 +0000
+++ openlp/core/ui/servicemanager.py 2009-05-18 19:04:25 +0000
@@ -21,7 +21,7 @@
21import logging21import logging
2222
23from PyQt4 import QtCore, QtGui23from PyQt4 import QtCore, QtGui
2424from openlp.core.lib import PluginConfig
25from openlp.core.lib import OpenLPToolbar25from openlp.core.lib import OpenLPToolbar
26from openlp.core.lib import ServiceItem26from openlp.core.lib import ServiceItem
27from openlp.core.lib import RenderManager27from openlp.core.lib import RenderManager
@@ -103,6 +103,9 @@
103 QtCore.QObject.connect(self.ThemeComboBox,103 QtCore.QObject.connect(self.ThemeComboBox,
104 QtCore.SIGNAL("activated(int)"), self.onThemeComboBoxSelected)104 QtCore.SIGNAL("activated(int)"), self.onThemeComboBoxSelected)
105105
106 self.config = PluginConfig(u'Main')
107 self.service_theme = self.config.get_config(u'theme service theme', u'')
108
106 def contextMenuAction(self, base, icon, text, slot):109 def contextMenuAction(self, base, icon, text, slot):
107 """110 """
108 Utility method to help build context menus for plugins111 Utility method to help build context menus for plugins
@@ -142,7 +145,9 @@
142 pass145 pass
143146
144 def onThemeComboBoxSelected(self, currentIndex):147 def onThemeComboBoxSelected(self, currentIndex):
145 self.RenderManager.default_theme = self.ThemeComboBox.currentText()148 self.service_theme = self.ThemeComboBox.currentText()
149 self.RenderManager.set_service_theme(self.service_theme)
150 self.config.set_config(u'theme service theme', self.service_theme)
146151
147 def addServiceItem(self, item):152 def addServiceItem(self, item):
148 self.serviceItems.append({u'data': item, u'order': len(self.serviceItems)+1})153 self.serviceItems.append({u'data': item, u'order': len(self.serviceItems)+1})
@@ -224,7 +229,11 @@
224 Called from ThemeManager when the Themes have changed229 Called from ThemeManager when the Themes have changed
225 """230 """
226 self.ThemeComboBox.clear()231 self.ThemeComboBox.clear()
232 self.ThemeComboBox.addItem(u'')
227 for theme in theme_list:233 for theme in theme_list:
228 self.ThemeComboBox.addItem(theme)234 self.ThemeComboBox.addItem(theme)
229 self.RenderManager.default_theme = self.ThemeComboBox.currentText()235 id = self.ThemeComboBox.findText(str(self.service_theme), QtCore.Qt.MatchExactly)
230236 if id == -1:
237 id = 0 # Not Found
238 self.service_theme = u''
239 self.ThemeComboBox.setCurrentIndex(id)
231240
=== modified file 'openlp/core/ui/settingsform.py'
--- openlp/core/ui/settingsform.py 2009-05-01 11:50:09 +0000
+++ openlp/core/ui/settingsform.py 2009-05-18 19:04:25 +0000
@@ -31,14 +31,14 @@
3131
32class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):32class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
3333
34 def __init__(self, screen_list, parent=None):34 def __init__(self, screen_list, mainWindow, parent=None):
35 QtGui.QDialog.__init__(self, parent)35 QtGui.QDialog.__init__(self, None)
36 self.setupUi(self)36 self.setupUi(self)
37 # General tab37 # General tab
38 self.GeneralTab = GeneralTab(screen_list)38 self.GeneralTab = GeneralTab(screen_list)
39 self.addTab(self.GeneralTab)39 self.addTab(self.GeneralTab)
40 # Themes tab40 # Themes tab
41 self.ThemesTab = ThemesTab()41 self.ThemesTab = ThemesTab(mainWindow)
42 self.addTab(self.ThemesTab)42 self.addTab(self.ThemesTab)
43 # Alert tab43 # Alert tab
44 self.AlertsTab = AlertsTab()44 self.AlertsTab = AlertsTab()
4545
=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py 2009-05-17 08:25:15 +0000
+++ openlp/core/ui/thememanager.py 2009-05-18 19:47:18 +0000
@@ -367,3 +367,7 @@
367 frame = self.RenderManager.generate_preview(themedata)367 frame = self.RenderManager.generate_preview(themedata)
368 return frame368 return frame
369369
370 def getPreviewImage(self, theme):
371 log.debug(u'getPreviewImage %s ', theme)
372 image = os.path.join(self.path, theme + u'.png')
373 return image
370374
=== modified file 'openlp/core/ui/themestab.py'
--- openlp/core/ui/themestab.py 2009-05-16 16:38:03 +0000
+++ openlp/core/ui/themestab.py 2009-05-18 19:47:18 +0000
@@ -3,7 +3,7 @@
3"""3"""
4OpenLP - Open Source Lyrics Projection4OpenLP - Open Source Lyrics Projection
5Copyright (c) 2008 Raoul Snyman5Copyright (c) 2008 Raoul Snyman
6Portions copyright (c) 2008 Martin Thompson, Tim Bentley,6Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley,
77
8This program is free software; you can redistribute it and/or modify it under8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU General Public License as published by the Free Software9the terms of the GNU General Public License as published by the Free Software
@@ -22,13 +22,13 @@
2222
23from openlp.core import translate23from openlp.core import translate
24from openlp.core.lib import SettingsTab24from openlp.core.lib import SettingsTab
25from openlp.core.resources import *
2625
27class ThemesTab(SettingsTab):26class ThemesTab(SettingsTab):
28 """27 """
29 ThemesTab is the theme settings tab in the settings dialog.28 ThemesTab is the theme settings tab in the settings dialog.
30 """29 """
31 def __init__(self):30 def __init__(self, parent):
31 self.parent = parent
32 SettingsTab.__init__(self, u'Themes')32 SettingsTab.__init__(self, u'Themes')
3333
34 def setupUi(self):34 def setupUi(self):
@@ -45,11 +45,8 @@
45 self.GlobalGroupBoxLayout.setObjectName(u'GlobalGroupBoxLayout')45 self.GlobalGroupBoxLayout.setObjectName(u'GlobalGroupBoxLayout')
46 self.DefaultComboBox = QtGui.QComboBox(self.GlobalGroupBox)46 self.DefaultComboBox = QtGui.QComboBox(self.GlobalGroupBox)
47 self.DefaultComboBox.setObjectName(u'DefaultComboBox')47 self.DefaultComboBox.setObjectName(u'DefaultComboBox')
48 self.DefaultComboBox.addItem(QtCore.QString())
49 self.DefaultComboBox.addItem(QtCore.QString())
50 self.DefaultComboBox.addItem(QtCore.QString())
51 self.GlobalGroupBoxLayout.addWidget(self.DefaultComboBox)48 self.GlobalGroupBoxLayout.addWidget(self.DefaultComboBox)
52 self.DefaultListView = QtGui.QListView(self.GlobalGroupBox)49 self.DefaultListView = QtGui.QLabel(self.GlobalGroupBox)
53 self.DefaultListView.setObjectName(u'DefaultListView')50 self.DefaultListView.setObjectName(u'DefaultListView')
54 self.GlobalGroupBoxLayout.addWidget(self.DefaultListView)51 self.GlobalGroupBoxLayout.addWidget(self.DefaultListView)
55 self.ThemesTabLayout.addWidget(self.GlobalGroupBox)52 self.ThemesTabLayout.addWidget(self.GlobalGroupBox)
@@ -93,11 +90,20 @@
93 self.GlobalLevelLabel)90 self.GlobalLevelLabel)
94 self.ThemesTabLayout.addWidget(self.LevelGroupBox)91 self.ThemesTabLayout.addWidget(self.LevelGroupBox)
9592
93 QtCore.QObject.connect(self.SongLevelRadioButton,
94 QtCore.SIGNAL("pressed()"), self.onSongLevelButtonPressed)
95 QtCore.QObject.connect(self.ServiceLevelRadioButton,
96 QtCore.SIGNAL("pressed()"), self.onServiceLevelButtonPressed)
97 QtCore.QObject.connect(self.GlobalLevelRadioButton,
98 QtCore.SIGNAL("pressed()"), self.onGlobalLevelButtonPressed)
99
100 QtCore.QObject.connect(self.DefaultComboBox,
101 QtCore.SIGNAL("activated(int)"), self.onDefaultComboBoxChanged)
102
103 #self.DefaultListView.setScaledContents(True)
104
96 def retranslateUi(self):105 def retranslateUi(self):
97 self.GlobalGroupBox.setTitle(translate(u'ThemesTab', u'Global theme'))106 self.GlobalGroupBox.setTitle(translate(u'ThemesTab', u'Global theme'))
98 self.DefaultComboBox.setItemText(0, translate(u'ThemesTab', u'African Sunset'))
99 self.DefaultComboBox.setItemText(1, translate(u'ThemesTab', u'Snowy Mountains'))
100 self.DefaultComboBox.setItemText(2, translate(u'ThemesTab', u'Wilderness'))
101 self.LevelGroupBox.setTitle(translate(u'ThemesTab', u'Theme level'))107 self.LevelGroupBox.setTitle(translate(u'ThemesTab', u'Theme level'))
102 self.SongLevelRadioButton.setText(translate(u'ThemesTab', u'Song level'))108 self.SongLevelRadioButton.setText(translate(u'ThemesTab', u'Song level'))
103 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.'))109 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.'))
@@ -106,6 +112,40 @@
106 self.GlobalLevelRadioButton.setText(translate(u'ThemesTab', u'Global level'))112 self.GlobalLevelRadioButton.setText(translate(u'ThemesTab', u'Global level'))
107 self.GlobalLevelLabel.setText(translate(u'ThemesTab', u'Use the global theme, overriding any themes associated wither either the service or the songs.'))113 self.GlobalLevelLabel.setText(translate(u'ThemesTab', u'Use the global theme, overriding any themes associated wither either the service or the songs.'))
108114
115 def load(self):
116 self.global_style = self.config.get_config(u'theme global style', u'Global')
117 self.global_theme = self.config.get_config(u'theme global theme', u'')
118 if self.global_style == u'Global':
119 self.GlobalLevelRadioButton.setChecked(True)
120 elif self.global_style == u'Service':
121 self.ServiceLevelRadioButton.setChecked(True)
122 else:
123 self.SongLevelRadioButton.setChecked(True)
124
125 def save(self):
126 self.config.set_config(u'theme global style', self.global_style )
127 self.config.set_config(u'theme global theme',self.global_theme)
128
129 def onSongLevelButtonPressed(self):
130 self.global_style= u'Song'
131 self.parent.RenderManager.set_global_theme(self.global_theme, self.global_style)
132
133 def onServiceLevelButtonPressed(self):
134 self.global_style= u'Service'
135 self.parent.RenderManager.set_global_theme(self.global_theme, self.global_style)
136
137 def onGlobalLevelButtonPressed(self):
138 self.global_style= u'Global'
139 self.parent.RenderManager.set_global_theme(self.global_theme, self.global_style)
140
141 def onDefaultComboBoxChanged(self, value):
142 self.global_theme = self.DefaultComboBox.currentText()
143 self.parent.RenderManager.set_global_theme(self.global_theme, self.global_style)
144 image = self.parent.ThemeManagerContents.getPreviewImage(str(self.global_theme))
145 preview = QtGui.QPixmap(str(image))
146 display = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
147 self.DefaultListView.setPixmap(display)
148
109 def updateThemeList(self, theme_list):149 def updateThemeList(self, theme_list):
110 """150 """
111 Called from ThemeManager when the Themes have changed151 Called from ThemeManager when the Themes have changed
@@ -113,3 +153,14 @@
113 self.DefaultComboBox.clear()153 self.DefaultComboBox.clear()
114 for theme in theme_list:154 for theme in theme_list:
115 self.DefaultComboBox.addItem(theme)155 self.DefaultComboBox.addItem(theme)
156 id = self.DefaultComboBox.findText(str(self.global_theme), QtCore.Qt.MatchExactly)
157 if id == -1:
158 id = 0 # Not Found
159 self.global_theme = u''
160 self.DefaultComboBox.setCurrentIndex(id)
161 self.parent.RenderManager.set_global_theme(self.global_theme, self.global_style)
162 if self.global_theme is not u'':
163 image = self.parent.ThemeManagerContents.getPreviewImage(str(self.global_theme))
164 preview = QtGui.QPixmap(str(image))
165 display = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
166 self.DefaultListView.setPixmap(display)
116167
=== modified file 'openlp/plugins/bibles/lib/biblestab.py'
--- openlp/plugins/bibles/lib/biblestab.py 2009-05-17 15:24:02 +0000
+++ openlp/plugins/bibles/lib/biblestab.py 2009-05-18 16:11:59 +0000
@@ -3,7 +3,7 @@
3"""3"""
4OpenLP - Open Source Lyrics Projection4OpenLP - Open Source Lyrics Projection
5Copyright (c) 2008 Raoul Snyman5Copyright (c) 2008 Raoul Snyman
6Portions copyright (c) 2008 Martin Thompson, Tim Bentley,6Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley,
77
8This program is free software; you can redistribute it and/or modify it under8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU General Public License as published by the Free Software9the terms of the GNU General Public License as published by the Free Software
@@ -18,7 +18,7 @@
18Place, Suite 330, Boston, MA 02111-1307 USA18Place, Suite 330, Boston, MA 02111-1307 USA
19"""19"""
2020
21from PyQt4 import QtCore, QtGui21from PyQt4 import Qt, QtCore, QtGui
2222
23from openlp.core import translate23from openlp.core import translate
24from openlp import convertStringToBoolean24from openlp import convertStringToBoolean
@@ -144,6 +144,8 @@
144 QtCore.SIGNAL("pressed()"), self.onParagraphRadioButtonPressed)144 QtCore.SIGNAL("pressed()"), self.onParagraphRadioButtonPressed)
145 QtCore.QObject.connect(self.DisplayStyleComboBox,145 QtCore.QObject.connect(self.DisplayStyleComboBox,
146 QtCore.SIGNAL("activated(int)"), self.onDisplayStyleComboBoxChanged)146 QtCore.SIGNAL("activated(int)"), self.onDisplayStyleComboBoxChanged)
147 QtCore.QObject.connect(self.BibleThemeComboBox,
148 QtCore.SIGNAL("activated(int)"), self.onBibleThemeComboBoxChanged)
147149
148 def retranslateUi(self):150 def retranslateUi(self):
149 self.VerseDisplayGroupBox.setTitle(translate('SettingsForm', 'Verse Display'))151 self.VerseDisplayGroupBox.setTitle(translate('SettingsForm', 'Verse Display'))
@@ -160,6 +162,9 @@
160 self.BibleSearchGroupBox.setTitle(translate('SettingsForm', 'Search'))162 self.BibleSearchGroupBox.setTitle(translate('SettingsForm', 'Search'))
161 self.BibleSearchCheckBox.setText(translate('SettingsForm', 'Search-as-you-type'))163 self.BibleSearchCheckBox.setText(translate('SettingsForm', 'Search-as-you-type'))
162164
165 def onBibleThemeComboBoxChanged(self):
166 self.bible_theme = self.BibleThemeComboBox.currentText()
167
163 def onDisplayStyleComboBoxChanged(self):168 def onDisplayStyleComboBoxChanged(self):
164 self.display_style = self.DisplayStyleComboBox.currentIndex()169 self.display_style = self.DisplayStyleComboBox.currentIndex()
165170
@@ -182,11 +187,11 @@
182 self.bible_search = True187 self.bible_search = True
183188
184 def load(self):189 def load(self):
185 self.paragraph_style = convertStringToBoolean(self.config.get_config('paragraph style', u'True'))190 self.paragraph_style = convertStringToBoolean(self.config.get_config(u'paragraph style', u'True'))
186 self.show_new_chapters = convertStringToBoolean(self.config.get_config('display new chapter', u"False"))191 self.show_new_chapters = convertStringToBoolean(self.config.get_config(u'display new chapter', u"False"))
187 self.display_style = int(self.config.get_config('display brackets', '0'))192 self.display_style = int(self.config.get_config(u'display brackets', u'0'))
188 self.bible_theme = int(self.config.get_config('bible theme', '0'))193 self.bible_theme = self.config.get_config(u'bible theme', u'0')
189 self.bible_search = convertStringToBoolean(self.config.get_config('search as type', u'True'))194 self.bible_search = convertStringToBoolean(self.config.get_config(u'search as type', u'True'))
190 if self.paragraph_style:195 if self.paragraph_style:
191 self.ParagraphRadioButton.setChecked(True)196 self.ParagraphRadioButton.setChecked(True)
192 else:197 else:
@@ -194,23 +199,24 @@
194 self.NewChaptersCheckBox.setChecked(self.show_new_chapters)199 self.NewChaptersCheckBox.setChecked(self.show_new_chapters)
195 self.DisplayStyleComboBox.setCurrentIndex(self.display_style)200 self.DisplayStyleComboBox.setCurrentIndex(self.display_style)
196 self.BibleSearchCheckBox.setChecked(self.bible_search)201 self.BibleSearchCheckBox.setChecked(self.bible_search)
197 if self.bible_theme == 0: # must be new set to first
198 self.BibleThemeComboBox.setCurrentIndex(self.bible_theme)
199 else:
200 pass # TODO need to code
201 self.bible_theme = None
202202
203 def save(self):203 def save(self):
204 self.config.set_config("paragraph style", str(self.paragraph_style))204 self.config.set_config(u'paragraph style', str(self.paragraph_style))
205 self.config.set_config("display new chapter", str(self.show_new_chapters))205 self.config.set_config(u'display new chapter', str(self.show_new_chapters))
206 self.config.set_config("display brackets", str(self.display_style))206 self.config.set_config(u'display brackets', str(self.display_style))
207 self.config.set_config("search as type", str(self.bible_search))207 self.config.set_config(u'search as type', str(self.bible_search))
208 self.config.set_config("bible theme", str(self.bible_theme))208 self.config.set_config(u'bible theme', str(self.bible_theme))
209209
210 def updateThemeList(self, theme_list):210 def updateThemeList(self, theme_list):
211 """211 """
212 Called from ThemeManager when the Themes have changed212 Called from ThemeManager when the Themes have changed
213 """213 """
214 self.BibleThemeComboBox.clear()214 self.BibleThemeComboBox.clear()
215 self.BibleThemeComboBox.addItem(u'')
215 for theme in theme_list:216 for theme in theme_list:
216 self.BibleThemeComboBox.addItem(theme)217 self.BibleThemeComboBox.addItem(theme)
218 id = self.BibleThemeComboBox.findText(str(self.bible_theme), QtCore.Qt.MatchExactly)
219 if id == -1:
220 id = 0 # Not Found
221 self.bible_theme = u''
222 self.BibleThemeComboBox.setCurrentIndex(id)
217223
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2009-05-17 15:24:02 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2009-05-18 16:11:59 +0000
@@ -398,7 +398,10 @@
398 if len(raw_footer) <= 1:398 if len(raw_footer) <= 1:
399 raw_footer.append(book)399 raw_footer.append(book)
400400
401 service_item.theme = self.parent.bibles_tab.bible_theme401 if len(self.parent.bibles_tab.bible_theme) == 0:
402 service_item.theme = None
403 else:
404 service_item.theme = self.parent.bibles_tab.bible_theme
402 raw_slides.append(bible_text)405 raw_slides.append(bible_text)
403 service_item.raw_slides = raw_slides406 service_item.raw_slides = raw_slides
404 service_item.raw_footer = raw_footer407 service_item.raw_footer = raw_footer
405408
=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py 2009-05-16 16:38:03 +0000
+++ openlp/plugins/media/lib/mediaitem.py 2009-05-18 04:41:49 +0000
@@ -100,7 +100,7 @@
100 files = QtGui.QFileDialog.getOpenFileNames(None,100 files = QtGui.QFileDialog.getOpenFileNames(None,
101 translate('MediaMediaItem', u'Select Media(s) items'),101 translate('MediaMediaItem', u'Select Media(s) items'),
102 self.parent.config.get_last_dir(),102 self.parent.config.get_last_dir(),
103 u'Images (*.avi *.mpeg);;Audio (*.mp3 *.ogg *.wma);;All files (*)')103 u'Videos (*.avi *.mpeg);;Audio (*.mp3 *.ogg *.wma);;All files (*)')
104 if len(files) > 0:104 if len(files) > 0:
105 self.loadMediaList(files)105 self.loadMediaList(files)
106 dir, filename = os.path.split(str(files[0]))106 dir, filename = os.path.split(str(files[0]))
107107
=== modified file 'openlp/plugins/presentations/lib/__init__.py'
--- openlp/plugins/presentations/lib/__init__.py 2009-03-19 17:31:33 +0000
+++ openlp/plugins/presentations/lib/__init__.py 2009-05-18 16:04:34 +0000
@@ -20,5 +20,6 @@
2020
21from filelistdata import FileListData21from filelistdata import FileListData
22from mediaitem import PresentationMediaItem22from mediaitem import PresentationMediaItem
23from presentationtab import PresentationTab
2324
24__all__ = ['PresentationMediaItem', 'FileListData']25__all__ = ['PresentationMediaItem', 'FileListData', 'PresentationTab']
2526
=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py 2009-03-19 17:31:33 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py 2009-05-18 19:04:25 +0000
@@ -39,87 +39,111 @@
39 def __init__(self, parent, icon, title):39 def __init__(self, parent, icon, title):
40 MediaManagerItem.__init__(self, parent, icon, title)40 MediaManagerItem.__init__(self, parent, icon, title)
4141
42 def setupUi(self): 42 def setupUi(self):
43 # Add a toolbar43 # Add a toolbar
44 self.addToolbar()44 self.addToolbar()
45 # Create buttons for the toolbar45 # Create buttons for the toolbar
46 ## New Presentation Button ##46 ## New Presentation Button ##
47 self.addToolbarButton(47 self.addToolbarButton(
48 translate('PresentationsMediaItem',u'New presentations'), 48 translate('PresentationsMediaItem',u'New presentations'),
49 translate('PresentationsMediaItem',u'Load presentations into openlp.org'),49 translate('PresentationsMediaItem',u'Load presentations into openlp.org'),
50 ':/presentations/presentation_load.png', self.onPresentationNewClick, 'PresentationNewItem')50 ':/presentations/presentation_load.png', self.onPresentationNewClick, 'PresentationNewItem')
51 ## Delete Presentation Button ##51 ## Delete Presentation Button ##
52 self.addToolbarButton(52 self.addToolbarButton(
53 translate('PresentationsMediaItem',u'Delete Presentation'), 53 translate('PresentationsMediaItem',u'Delete Presentation'),
54 translate('PresentationsMediaItem',u'Delete the selected presentation'),54 translate('PresentationsMediaItem',u'Delete the selected presentation'),
55 ':/presentations/presentation_delete.png', self.onPresentationDeleteClick, 'PresentationDeleteItem')55 ':/presentations/presentation_delete.png', self.onPresentationDeleteClick, 'PresentationDeleteItem')
56 ## Separator Line ##56 ## Separator Line ##
57 self.addToolbarSeparator()57 self.addToolbarSeparator()
58 ## Preview Presentation Button ##58 ## Preview Presentation Button ##
59 self.addToolbarButton(59 self.addToolbarButton(
60 translate('PresentationsMediaItem',u'Preview Presentation'), 60 translate('PresentationsMediaItem',u'Preview Presentation'),
61 translate('PresentationsMediaItem',u'Preview the selected Presentation'),61 translate('PresentationsMediaItem',u'Preview the selected Presentation'),
62 ':/system/system_preview.png', self.onPresentationPreviewClick, 'PresentationPreviewItem')62 ':/system/system_preview.png', self.onPresentationPreviewClick, 'PresentationPreviewItem')
63 ## Live Presentation Button ##63 ## Live Presentation Button ##
64 self.addToolbarButton(64 self.addToolbarButton(
65 translate('PresentationsMediaItem',u'Go Live'), 65 translate('PresentationsMediaItem',u'Go Live'),
66 translate('PresentationsMediaItem',u'Send the selected presentation live'),66 translate('PresentationsMediaItem',u'Send the selected presentation live'),
67 ':/system/system_live.png', self.onPresentationLiveClick, 'PresentationLiveItem')67 ':/system/system_live.png', self.onPresentationLiveClick, 'PresentationLiveItem')
68 ## Add Presentation Button ##68 ## Add Presentation Button ##
69 self.addToolbarButton(69 self.addToolbarButton(
70 translate('PresentationsMediaItem',u'Add Presentation To Service'),70 translate('PresentationsMediaItem',u'Add Presentation To Service'),
71 translate('PresentationsMediaItem',u'Add the selected Presentations(s) to the service'), 71 translate('PresentationsMediaItem',u'Add the selected Presentations(s) to the service'),
72 ':/system/system_add.png',self.onPresentationAddClick, 'PresentationsAddItem')72 ':/system/system_add.png',self.onPresentationAddClick, 'PresentationsAddItem')
73 ## Add the Presentationlist widget ##73 ## Add the Presentationlist widget ##
74 74
75 self.PresentationWidget = QtGui.QWidget(self)
76 sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
77 sizePolicy.setHorizontalStretch(0)
78 sizePolicy.setVerticalStretch(0)
79 sizePolicy.setHeightForWidth(self.PresentationWidget.sizePolicy().hasHeightForWidth())
80 self.PresentationWidget.setSizePolicy(sizePolicy)
81 self.PresentationWidget.setObjectName('PresentationWidget')
82 self.DisplayLayout = QtGui.QGridLayout(self.PresentationWidget)
83 self.DisplayLayout.setObjectName('DisplayLayout')
84 self.DisplayTypeComboBox = QtGui.QComboBox(self.PresentationWidget)
85 self.DisplayTypeComboBox.setObjectName('DisplayTypeComboBox')
86 self.DisplayLayout.addWidget(self.DisplayTypeComboBox, 0, 1, 1, 2)
87 self.DisplayTypeLabel = QtGui.QLabel(self.PresentationWidget)
88 self.DisplayTypeLabel.setObjectName('SearchTypeLabel')
89 self.DisplayLayout.addWidget(self.DisplayTypeLabel, 0, 0, 1, 1)
90
91 self.DisplayTypeLabel.setText(translate('PresentationMediaItem', u'Present using:'))
92
93 # Add the song widget to the page layout
94 self.PageLayout.addWidget(self.PresentationWidget)
95
75 self.PresentationsListView = QtGui.QListView()96 self.PresentationsListView = QtGui.QListView()
76 self.PresentationsListView.setAlternatingRowColors(True)97 self.PresentationsListView.setAlternatingRowColors(True)
77 self.PresentationsListData = FileListData()98 self.PresentationsListData = FileListData()
78 self.PresentationsListView.setModel(self.PresentationsListData)99 self.PresentationsListView.setModel(self.PresentationsListData)
79 100
80 self.PageLayout.addWidget(self.PresentationsListView)101 self.PageLayout.addWidget(self.PresentationsListView)
81 102
82 #define and add the context menu103 #define and add the context menu
83 self.PresentationsListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)104 self.PresentationsListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
84105
85 self.PresentationsListView.addAction(self.contextMenuAction(106 self.PresentationsListView.addAction(self.contextMenuAction(
86 self.PresentationsListView, ':/system/system_preview.png', 107 self.PresentationsListView, ':/system/system_preview.png',
87 translate('PresentationsMediaItem',u'&Preview presentations'), self.onPresentationPreviewClick))108 translate('PresentationsMediaItem',u'&Preview presentations'), self.onPresentationPreviewClick))
88 self.PresentationsListView.addAction(self.contextMenuAction(109 self.PresentationsListView.addAction(self.contextMenuAction(
89 self.PresentationsListView, ':/system/system_live.png', 110 self.PresentationsListView, ':/system/system_live.png',
90 translate('PresentationsMediaItem',u'&Show Live'), self.onPresentationLiveClick))111 translate('PresentationsMediaItem',u'&Show Live'), self.onPresentationLiveClick))
91 self.PresentationsListView.addAction(self.contextMenuAction(112 self.PresentationsListView.addAction(self.contextMenuAction(
92 self.PresentationsListView, ':/system/system_add.png', 113 self.PresentationsListView, ':/system/system_add.png',
93 translate('PresentationsMediaItem',u'&Add to Service'), self.onPresentationAddClick))114 translate('PresentationsMediaItem',u'&Add to Service'), self.onPresentationAddClick))
94 115
95 def initialise(self):116 def initialise(self):
96 list = self.parent.config.load_list(u'presentations')117 list = self.parent.config.load_list(u'presentations')
97 self.loadPresentationList(list)118 self.loadPresentationList(list)
119 self.DisplayTypeComboBox.addItem(u'Impress')
120 self.DisplayTypeComboBox.addItem(u'Powerpoint')
121 self.DisplayTypeComboBox.addItem(u'Keynote')
98122
99 def onPresentationNewClick(self):123 def onPresentationNewClick(self):
100 files = QtGui.QFileDialog.getOpenFileNames(None, 124 files = QtGui.QFileDialog.getOpenFileNames(None,
101 translate('PresentationsMediaItem', u'Select presentations(s)'), 125 translate('PresentationsMediaItem', u'Select presentations(s)'),
102 self.parent.config.get_last_dir(), u'Presentations (*.ppt *.pps *.odi)')126 self.parent.config.get_last_dir(), u'Presentations (*.ppt *.pps *.odi)')
103 if len(files) > 0:127 if len(files) > 0:
104 self.loadPresentationList(files)128 self.loadPresentationList(files)
105 dir, filename = os.path.split(str(files[0]))129 dir, filename = os.path.split(str(files[0]))
106 self.parent.config.set_last_dir(dir)130 self.parent.config.set_last_dir(dir)
107 self.parent.config.set_list(u'Presentations', self.PresentationsListData.getFileList())131 self.parent.config.set_list(u'Presentations', self.PresentationsListData.getFileList())
108 132
109 def getFileList(self):133 def getFileList(self):
110 filelist = [item[0] for item in self.PresentationsListView];134 filelist = [item[0] for item in self.PresentationsListView];
111 return filelist 135 return filelist
112136
113 def loadPresentationList(self, list):137 def loadPresentationList(self, list):
114 for files in list:138 for files in list:
115 self.PresentationsListData.addRow(files)139 self.PresentationsListData.addRow(files)
116 140
117 def onPresentationDeleteClick(self):141 def onPresentationDeleteClick(self):
118 indexes = self.PresentationsListView.selectedIndexes()142 indexes = self.PresentationsListView.selectedIndexes()
119 for index in indexes:143 for index in indexes:
120 current_row = int(index.row())144 current_row = int(index.row())
121 self.PresentationsListData.removeRow(current_row)145 self.PresentationsListData.removeRow(current_row)
122 self.parent.config.set_list(u'Presentations', self.PresentationsListData.getFileList()) 146 self.parent.config.set_list(u'Presentations', self.PresentationsListData.getFileList())
123147
124 def onPresentationPreviewClick(self):148 def onPresentationPreviewClick(self):
125 pass149 pass
@@ -128,4 +152,4 @@
128 pass152 pass
129153
130 def onPresentationAddClick(self):154 def onPresentationAddClick(self):
131 pass 155 pass
132156
=== modified file 'openlp/plugins/presentations/presentationplugin.py'
--- openlp/plugins/presentations/presentationplugin.py 2009-03-22 07:13:34 +0000
+++ openlp/plugins/presentations/presentationplugin.py 2009-05-18 16:04:34 +0000
@@ -3,7 +3,7 @@
3"""3"""
4OpenLP - Open Source Lyrics Projection4OpenLP - Open Source Lyrics Projection
5Copyright (c) 2008 Raoul Snyman5Copyright (c) 2008 Raoul Snyman
6Portions copyright (c) 2008 Martin Thompson, Tim Bentley,6Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley,
77
8This program is free software; you can redistribute it and/or modify it under8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU General Public License as published by the Free Software9the terms of the GNU General Public License as published by the Free Software
@@ -22,9 +22,8 @@
2222
23from PyQt4 import QtCore, QtGui23from PyQt4 import QtCore, QtGui
2424
25from openlp.core.resources import *
26from openlp.core.lib import Plugin, MediaManagerItem25from openlp.core.lib import Plugin, MediaManagerItem
27from openlp.plugins.presentations.lib import PresentationMediaItem26from openlp.plugins.presentations.lib import PresentationMediaItem, PresentationTab
2827
29class PresentationPlugin(Plugin):28class PresentationPlugin(Plugin):
3029
@@ -38,7 +37,8 @@
38 QtGui.QIcon.Normal, QtGui.QIcon.Off)37 QtGui.QIcon.Normal, QtGui.QIcon.Off)
3938
40 def get_settings_tab(self):39 def get_settings_tab(self):
41 pass40 self.presentation_tab = PresentationTab()
41 return self.presentation_tab
4242
43 def get_media_manager_item(self):43 def get_media_manager_item(self):
44 # Create the MediaManagerItem object44 # Create the MediaManagerItem object