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