From 1cc95fddb6dc502a43f9692b900c985ec108fc73 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 12 Jun 2011 17:17:01 +0200 Subject: [PATCH 01/77] general thumb clean ups --- openlp/core/lib/__init__.py | 48 ++++++++++++++++++- openlp/core/lib/mediamanageritem.py | 38 --------------- openlp/core/ui/thememanager.py | 17 +++---- openlp/plugins/images/lib/mediaitem.py | 12 ++--- openlp/plugins/presentations/lib/mediaitem.py | 12 +++-- 5 files changed, 67 insertions(+), 60 deletions(-) diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 75bafc5e8..15f40b0e3 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -137,6 +137,52 @@ def image_to_byte(image): # convert to base64 encoding so does not get missed! return byte_array.toBase64() +def create_thumb(image_path, thumb_path, return_icon=True): + """ + Create a thumbnail from the given image path and depending on + ``return_icon`` it returns an icon from this thumb. + + ``image_path`` + The image file to create the icon from. + + ``thumb_path`` + The filename to save the thumbnail to. + + ``return_icon`` + States if an icon should be build and returned from the thumb. Defaults + to ``True``. + """ + ext = os.path.splitext(thumb_path)[1].lower() + reader = QtGui.QImageReader(image_path) + ratio = float(reader.size().width()) / float(reader.size().height()) + reader.setScaledSize(QtCore.QSize(int(ratio * 88), 88)) + thumb = reader.read() + thumb.save(thumb_path, ext[1:]) + if not return_icon: + return + if os.path.exists(thumb_path): + return build_icon(unicode(thumb_path)) + # Fallback for files with animation support. + return build_icon(unicode(image_path)) + +def validate_thumb(image_path, thumb_path): + """ + Validates whether an image's thumb still exists and if is up to date. + **Note**, you must **not** call this function, before checking the + existence of the image. + + ``image_path`` + The path to the image. + + ``thumb_path`` + The path to the thumb. + """ + if not os.path.exists(unicode(thumb_path)): + return False + image_date = os.stat(unicode(image_path)).st_mtime + thumb_date = os.stat(unicode(thumb_path)).st_mtime + return image_date <= thumb_date + def resize_image(image_path, width, height, background=QtCore.Qt.black): """ Resize an image to fit on the current screen. @@ -151,7 +197,7 @@ def resize_image(image_path, width, height, background=QtCore.Qt.black): The new image height. ``background`` - The background colour defaults to black. + The background colour. Defaults to ``QtCore.Qt.black``. """ log.debug(u'resize_image - start') reader = QtGui.QImageReader(image_path) diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index b8f7b28ad..38846fec1 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -374,44 +374,6 @@ class MediaManagerItem(QtGui.QWidget): count += 1 return filelist - def validate(self, image, thumb): - """ - Validates whether an image still exists and, if it does, is the - thumbnail representation of the image up to date. - """ - if not os.path.exists(unicode(image)): - return False - if os.path.exists(thumb): - imageDate = os.stat(unicode(image)).st_mtime - thumbDate = os.stat(unicode(thumb)).st_mtime - # If image has been updated rebuild icon - if imageDate > thumbDate: - self.iconFromFile(image, thumb) - else: - self.iconFromFile(image, thumb) - return True - - def iconFromFile(self, image_path, thumb_path): - """ - Create a thumbnail icon from a given image. - - ``image_path`` - The image file to create the icon from. - - ``thumb_path`` - The filename to save the thumbnail to. - """ - ext = os.path.splitext(thumb_path)[1].lower() - reader = QtGui.QImageReader(image_path) - ratio = float(reader.size().width()) / float(reader.size().height()) - reader.setScaledSize(QtCore.QSize(int(ratio * 88), 88)) - thumb = reader.read() - thumb.save(thumb_path, ext[1:]) - if os.path.exists(thumb_path): - return build_icon(unicode(thumb_path)) - # Fallback for files with animation support. - return build_icon(unicode(image_path)) - def loadList(self, list): raise NotImplementedError(u'MediaManagerItem.loadList needs to be ' u'defined by the plugin') diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 72bdf4558..7ee3ccc88 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -36,7 +36,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import OpenLPToolbar, get_text_file_string, build_icon, \ Receiver, SettingsManager, translate, check_item_selected, \ - check_directory_exists + check_directory_exists, create_thumb, validate_thumb from openlp.core.lib.theme import ThemeXML, BackgroundType, VerticalType, \ BackgroundGradientType from openlp.core.lib.ui import UiStrings, critical_error_message_box @@ -364,7 +364,7 @@ class ThemeManager(QtGui.QWidget): The theme to delete. """ self.themelist.remove(theme) - thumb = theme + u'.png' + thumb = u'%s.png' % theme delete_file(os.path.join(self.path, thumb)) delete_file(os.path.join(self.thumbPath, thumb)) try: @@ -478,15 +478,12 @@ class ThemeManager(QtGui.QWidget): name = textName thumb = os.path.join(self.thumbPath, u'%s.png' % textName) item_name = QtGui.QListWidgetItem(name) - if os.path.exists(thumb): + if validate_thumb(theme, thumb): icon = build_icon(thumb) else: - icon = build_icon(theme) - pixmap = icon.pixmap(QtCore.QSize(88, 50)) - pixmap.save(thumb, u'png') + icon = create_thumb(theme, thumb) item_name.setIcon(icon) - item_name.setData(QtCore.Qt.UserRole, - QtCore.QVariant(textName)) + item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(textName)) self.themeListWidget.addItem(item_name) self.themelist.append(textName) self._pushThemes() @@ -658,9 +655,7 @@ class ThemeManager(QtGui.QWidget): os.unlink(samplepathname) frame.save(samplepathname, u'png') thumb = os.path.join(self.thumbPath, u'%s.png' % name) - icon = build_icon(frame) - pixmap = icon.pixmap(QtCore.QSize(88, 50)) - pixmap.save(thumb, u'png') + create_thumb(samplepathname, thumb, False) log.debug(u'Theme image written to %s', samplepathname) def updatePreviewImages(self): diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 921a52ede..875f5b7fc 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -33,7 +33,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \ SettingsManager, translate, check_item_selected, check_directory_exists, \ - Receiver + Receiver, create_thumb, validate_thumb from openlp.core.lib.ui import UiStrings, critical_error_message_box from openlp.core.utils import AppLocation, delete_file, get_images_filter @@ -122,13 +122,13 @@ class ImageMediaItem(MediaManagerItem): self.plugin.formparent.incrementProgressBar() filename = os.path.split(unicode(imageFile))[1] thumb = os.path.join(self.servicePath, filename) - if os.path.exists(thumb): - if self.validate(imageFile, thumb): + if not os.path.exists(imageFile): + icon = build_icon(u':/general/general_delete.png') + else: + if validate_thumb(imageFile, thumb): icon = build_icon(thumb) else: - icon = build_icon(u':/general/general_delete.png') - else: - icon = self.iconFromFile(imageFile, thumb) + icon = create_thumb(imageFile, thumb) item_name = QtGui.QListWidgetItem(filename) item_name.setIcon(icon) item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(imageFile)) diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index e138d4ef9..ff515f79b 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -32,7 +32,8 @@ import locale from PyQt4 import QtCore, QtGui from openlp.core.lib import MediaManagerItem, build_icon, SettingsManager, \ - translate, check_item_selected, Receiver, ItemCapabilities + translate, check_item_selected, Receiver, ItemCapabilities, create_thumb, \ + validate_thumb from openlp.core.lib.ui import UiStrings, critical_error_message_box, \ media_item_combo_box from openlp.plugins.presentations.lib import MessageListener @@ -190,10 +191,13 @@ class PresentationMediaItem(MediaManagerItem): doc.load_presentation() preview = doc.get_thumbnail_path(1, True) doc.close_presentation() - if preview and self.validate(preview, thumb): - icon = build_icon(thumb) - else: + if not os.path.exists(preview): icon = build_icon(u':/general/general_delete.png') + else: + if validate_thumb(preview, thumb): + icon = build_icon(thumb) + else: + icon = create_thumb(preview, thumb) else: if initialLoad: icon = build_icon(u':/general/general_delete.png') From 900a817cbfca6aa49045f90e41678797ff8f1e79 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 12 Jun 2011 17:59:46 +0200 Subject: [PATCH 02/77] asdf --- openlp/core/lib/__init__.py | 24 ++++++++++++------- .../lib/presentationcontroller.py | 18 ++++++++++---- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 15f40b0e3..24d86ab27 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -137,7 +137,7 @@ def image_to_byte(image): # convert to base64 encoding so does not get missed! return byte_array.toBase64() -def create_thumb(image_path, thumb_path, return_icon=True): +def create_thumb(image_path, thumb_path, return_icon=True, size=None): """ Create a thumbnail from the given image path and depending on ``return_icon`` it returns an icon from this thumb. @@ -151,11 +151,17 @@ def create_thumb(image_path, thumb_path, return_icon=True): ``return_icon`` States if an icon should be build and returned from the thumb. Defaults to ``True``. + + ``size`` + """ ext = os.path.splitext(thumb_path)[1].lower() reader = QtGui.QImageReader(image_path) - ratio = float(reader.size().width()) / float(reader.size().height()) - reader.setScaledSize(QtCore.QSize(int(ratio * 88), 88)) + if size is None: + ratio = float(reader.size().width()) / float(reader.size().height()) + reader.setScaledSize(QtCore.QSize(int(ratio * 88), 88)) + else: + reader.setScaledSize(size) thumb = reader.read() thumb.save(thumb_path, ext[1:]) if not return_icon: @@ -165,21 +171,21 @@ def create_thumb(image_path, thumb_path, return_icon=True): # Fallback for files with animation support. return build_icon(unicode(image_path)) -def validate_thumb(image_path, thumb_path): +def validate_thumb(file_path, thumb_path): """ - Validates whether an image's thumb still exists and if is up to date. + Validates whether an file's thumb still exists and if is up to date. **Note**, you must **not** call this function, before checking the - existence of the image. + existence of the file. - ``image_path`` - The path to the image. + ``file_path`` + The path to the file. The file must exist! ``thumb_path`` The path to the thumb. """ if not os.path.exists(unicode(thumb_path)): return False - image_date = os.stat(unicode(image_path)).st_mtime + image_date = os.stat(unicode(file_path)).st_mtime thumb_date = os.stat(unicode(thumb_path)).st_mtime return image_date <= thumb_date diff --git a/openlp/plugins/presentations/lib/presentationcontroller.py b/openlp/plugins/presentations/lib/presentationcontroller.py index 63bd44cc4..de138a6e1 100644 --- a/openlp/plugins/presentations/lib/presentationcontroller.py +++ b/openlp/plugins/presentations/lib/presentationcontroller.py @@ -31,7 +31,7 @@ import shutil from PyQt4 import QtCore -from openlp.core.lib import Receiver, resize_image +from openlp.core.lib import Receiver, create_thumb, resize_image, validate_thumb from openlp.core.utils import AppLocation log = logging.getLogger(__name__) @@ -149,11 +149,15 @@ class PresentationDocument(object): recent than the powerpoint """ lastimage = self.get_thumbnail_path(self.get_slide_count(), True) + a = validate_thumb(self.filepath, lastimage) if not (lastimage and os.path.isfile(lastimage)): return False imgdate = os.stat(lastimage).st_mtime pptdate = os.stat(self.filepath).st_mtime - return imgdate >= pptdate + #return imgdate >= pptdate + d = imgdate >= pptdate + print a, d + return a def close_presentation(self): """ @@ -245,9 +249,15 @@ class PresentationDocument(object): """ if self.check_thumbnails(): return + import time + import datetime + start = time.time() if os.path.isfile(file): - img = resize_image(file, 320, 240) - img.save(self.get_thumbnail_path(idx, False)) + size = QtCore.QSize(320, 240) + create_thumb(file, self.get_thumbnail_path(idx, False), False, size) +# img = resize_image(file, 320, 240) +# img.save(self.get_thumbnail_path(idx, False)) + print unicode(datetime.timedelta(seconds=time.time() - start)) def get_thumbnail_path(self, slide_no, check_exists): """ From dbef87021c0a268d9a5637360d72b0ef9d78366d Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 21 Jun 2011 12:10:53 +0200 Subject: [PATCH 03/77] minor clean ups; do not create qimage and then convert to qpixmap, instad create qpixmap directly --- openlp/core/ui/slidecontroller.py | 4 ++-- openlp/plugins/presentations/lib/mediaitem.py | 2 +- openlp/plugins/presentations/lib/presentationcontroller.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 30341b9dd..5ea2c5f23 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -625,14 +625,14 @@ class SlideController(QtGui.QWidget): label.setMargin(4) label.setScaledContents(True) if self.serviceItem.is_command(): - image = QtGui.QImage(frame[u'image']) + label.setPixmap(QtGui.QPixmap(frame[u'image'])) else: # If current slide set background to image if framenumber == slideno: self.serviceItem.bg_image_bytes = \ self.imageManager.get_image_bytes(frame[u'title']) image = self.imageManager.get_image(frame[u'title']) - label.setPixmap(QtGui.QPixmap.fromImage(image)) + label.setPixmap(QtGui.QPixmap.fromImage(image)) self.previewListWidget.setCellWidget(framenumber, 0, label) slideHeight = width * self.parent().renderer.screen_ratio row += 1 diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index 5e14a88eb..e0bc1be0d 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -191,7 +191,7 @@ class PresentationMediaItem(MediaManagerItem): doc.load_presentation() preview = doc.get_thumbnail_path(1, True) doc.close_presentation() - if not os.path.exists(preview): + if not (preview and os.path.exists(preview)): icon = build_icon(u':/general/general_delete.png') else: if validate_thumb(preview, thumb): diff --git a/openlp/plugins/presentations/lib/presentationcontroller.py b/openlp/plugins/presentations/lib/presentationcontroller.py index f0588e1bc..c26396229 100644 --- a/openlp/plugins/presentations/lib/presentationcontroller.py +++ b/openlp/plugins/presentations/lib/presentationcontroller.py @@ -149,7 +149,7 @@ class PresentationDocument(object): the powerpoint file. """ lastimage = self.get_thumbnail_path(self.get_slide_count(), True) - if not os.path.isfile(lastimage): + if not (lastimage and os.path.isfile(lastimage)): return False return validate_thumb(self.filepath, lastimage) From 11cb39d2dc743953976dcd809ce8e82a9c1213d5 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 21 Jun 2011 13:37:28 +0200 Subject: [PATCH 04/77] resize image in the thread not when adding the image --- openlp/core/lib/imagemanager.py | 43 +++++++++++++++++-------------- openlp/core/ui/slidecontroller.py | 6 +++++ 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index d89cefccc..88def49e4 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -53,15 +53,17 @@ class ImageThread(QtCore.QThread): """ Run the thread. """ - self.imageManager.process() + self.imageManager._process() class Image(object): - name = '' - path = '' - dirty = True - image = None - image_bytes = None + def __init__(self, name='', path=''): + self.name = name + self.path = path + self.dirty = True + self.image = None + self.image_bytes = None + self.priority = False class ImageManager(QtCore.QObject): @@ -92,7 +94,6 @@ class ImageManager(QtCore.QObject): for key in self._cache.keys(): image = self._cache[key] image.dirty = True - image.image = resize_image(image.path, self.width, self.height) self._cache_dirty = True # only one thread please if not self._thread_running: @@ -103,6 +104,10 @@ class ImageManager(QtCore.QObject): Return the Qimage from the cache """ log.debug(u'get_image %s' % name) + if not self._cache[name].image_bytes: + while self._cache[name].dirty: + log.debug(u'get_image - waiting') + time.sleep(0.1) return self._cache[name].image def get_image_bytes(self, name): @@ -131,10 +136,7 @@ class ImageManager(QtCore.QObject): """ log.debug(u'add_image %s:%s' % (name, path)) if not name in self._cache: - image = Image() - image.name = name - image.path = path - image.image = resize_image(path, self.width, self.height) + image = Image(name, path) self._cache[name] = image else: log.debug(u'Image in cache %s:%s' % (name, path)) @@ -143,29 +145,30 @@ class ImageManager(QtCore.QObject): if not self._thread_running: self.image_thread.start() - def process(self): + def _process(self): """ - Controls the processing called from a QThread + Controls the processing called from a ``QtCore.QThread``. """ - log.debug(u'process - started') + log.debug(u'_process - started') self._thread_running = True - self.clean_cache() + self._clean_cache() # data loaded since we started ? while self._cache_dirty: - log.debug(u'process - recycle') - self.clean_cache() + log.debug(u'_process - recycle') + self._clean_cache() self._thread_running = False - log.debug(u'process - ended') + log.debug(u'_process - ended') - def clean_cache(self): + def _clean_cache(self): """ Actually does the work. """ - log.debug(u'clean_cache') + log.debug(u'_clean_cache') # we will clean the cache now self._cache_dirty = False for key in self._cache.keys(): image = self._cache[key] if image.dirty: + image.image = resize_image(image.path, self.width, self.height) image.image_bytes = image_to_byte(image.image) image.dirty = False diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 5ea2c5f23..44dc5f3de 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -582,6 +582,9 @@ class SlideController(QtGui.QWidget): Loads a ServiceItem into the system from ServiceManager Display the slide number passed """ + import time + import datetime + start = time.time() log.debug(u'processManagerItem live = %s' % self.isLive) self.onStopLoop() old_item = self.serviceItem @@ -631,7 +634,9 @@ class SlideController(QtGui.QWidget): if framenumber == slideno: self.serviceItem.bg_image_bytes = \ self.imageManager.get_image_bytes(frame[u'title']) + print u' start', frame[u'title'] image = self.imageManager.get_image(frame[u'title']) + print u' end', frame[u'title'] label.setPixmap(QtGui.QPixmap.fromImage(image)) self.previewListWidget.setCellWidget(framenumber, 0, label) slideHeight = width * self.parent().renderer.screen_ratio @@ -668,6 +673,7 @@ class SlideController(QtGui.QWidget): self.onMediaClose() Receiver.send_message(u'slidecontroller_%s_started' % self.typePrefix, [serviceItem]) + print unicode(datetime.timedelta(seconds=time.time() - start)) def __updatePreviewSelection(self, slideno): """ From 47f5332bc37ec28ccbc7293be8eebf345c4ae85b Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 21 Jun 2011 22:28:22 +0200 Subject: [PATCH 05/77] Initial work on new image queuing (not working) --- openlp/core/lib/imagemanager.py | 92 ++++++++++++++++++++++++------- openlp/core/ui/slidecontroller.py | 2 - 2 files changed, 72 insertions(+), 22 deletions(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index 88def49e4..a529a4287 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -32,6 +32,7 @@ to wait for the conversion to happen. """ import logging import time +import Queue from PyQt4 import QtCore @@ -55,15 +56,39 @@ class ImageThread(QtCore.QThread): """ self.imageManager._process() +class ProcessingPriority(object): + """ + Enumeration class. + + ``Low`` + Only the image's byte stream has to be generated. Neither the QImage nor + the byte stream has been requested yet. + + ``Normal`` + The image's byte stream as well as the image has to be generated. + Neither the QImage nor the byte stream has been requested yet. + + ``High`` + The image's byte stream as well as the image has to be generated. The + QImage for this image has been requested. + + ``Urgent`` + The image's byte stream as well as the image has to be generated. The + byte stream for this image has been requested. + """ + Low = 3 + Normal = 2 + High = 1 + Urgent = 0 + class Image(object): def __init__(self, name='', path=''): self.name = name self.path = path - self.dirty = True self.image = None self.image_bytes = None - self.priority = False + self.priority = ProcessingPriority.Normal class ImageManager(QtCore.QObject): @@ -80,7 +105,8 @@ class ImageManager(QtCore.QObject): self._cache = {} self._thread_running = False self._cache_dirty = False - self.image_thread = ImageThread(self) + self._image_thread = ImageThread(self) + self._clean_queue = Queue.PriorityQueue() def update_display(self): """ @@ -91,33 +117,45 @@ class ImageManager(QtCore.QObject): self.width = current_screen[u'size'].width() self.height = current_screen[u'size'].height() # mark the images as dirty for a rebuild + self._clean_queue = Queue.PriorityQueue() for key in self._cache.keys(): image = self._cache[key] - image.dirty = True + image.priority = ProcessingPriority.Normal + image.image = None + image.image_bytes = None + self._clean_queue.put_nowait((image.priority, image)) self._cache_dirty = True # only one thread please if not self._thread_running: - self.image_thread.start() + self._image_thread.start() def get_image(self, name): """ Return the Qimage from the cache """ + print u'get_image:', name log.debug(u'get_image %s' % name) - if not self._cache[name].image_bytes: - while self._cache[name].dirty: + image = self._cache[name] + if image.image_bytes is None: + image.priority = ProcessingPriority.High + self._clean_queue.put_nowait((image.priority, image)) + while image.image_bytes is None: log.debug(u'get_image - waiting') time.sleep(0.1) - return self._cache[name].image + return image.image def get_image_bytes(self, name): """ Returns the byte string for an image If not present wait for the background thread to process it. """ + print u'get_image_bytes:', name log.debug(u'get_image_bytes %s' % name) - if not self._cache[name].image_bytes: - while self._cache[name].dirty: + image = self._cache[name] + if image.image_bytes is None: + image.priority = ProcessingPriority.Urgent + self._clean_queue.put_nowait((image.priority, image)) + while self._cache[name].image_bytes is None: log.debug(u'get_image_bytes - waiting') time.sleep(0.1) return self._cache[name].image_bytes @@ -138,12 +176,13 @@ class ImageManager(QtCore.QObject): if not name in self._cache: image = Image(name, path) self._cache[name] = image + self._clean_queue.put_nowait((image.priority, image)) else: log.debug(u'Image in cache %s:%s' % (name, path)) self._cache_dirty = True # only one thread please if not self._thread_running: - self.image_thread.start() + self._image_thread.start() def _process(self): """ @@ -152,7 +191,7 @@ class ImageManager(QtCore.QObject): log.debug(u'_process - started') self._thread_running = True self._clean_cache() - # data loaded since we started ? + # data loaded since we started? while self._cache_dirty: log.debug(u'_process - recycle') self._clean_cache() @@ -164,11 +203,24 @@ class ImageManager(QtCore.QObject): Actually does the work. """ log.debug(u'_clean_cache') - # we will clean the cache now - self._cache_dirty = False - for key in self._cache.keys(): - image = self._cache[key] - if image.dirty: - image.image = resize_image(image.path, self.width, self.height) - image.image_bytes = image_to_byte(image.image) - image.dirty = False + if self._clean_queue.empty(): + print u'empty' + self._cache_dirty = False + return + image = self._clean_queue.get_nowait()[1] + if image.image is None: + print u'processing (image):', image.name, image.priority + image.image = resize_image(image.path, self.width, self.height) + if image.priority == ProcessingPriority.Urgent: + image.priority = ProcessingPriority.High + elif image.priority == ProcessingPriority.High: + image.priority = ProcessingPriority.Normal + else: + image.priority = ProcessingPriority.Low + self._clean_queue.put_nowait((image.priority, image)) + self._clean_queue.task_done() + return + if image.image_bytes is None: + print u'processing (bytes):', image.name, image.priority + image.image_bytes = image_to_byte(image.image) + self._clean_queue.task_done() diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 44dc5f3de..821bed9b3 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -634,9 +634,7 @@ class SlideController(QtGui.QWidget): if framenumber == slideno: self.serviceItem.bg_image_bytes = \ self.imageManager.get_image_bytes(frame[u'title']) - print u' start', frame[u'title'] image = self.imageManager.get_image(frame[u'title']) - print u' end', frame[u'title'] label.setPixmap(QtGui.QPixmap.fromImage(image)) self.previewListWidget.setCellWidget(framenumber, 0, label) slideHeight = width * self.parent().renderer.screen_ratio From 67a3a6dc08bddbd40220981446d18018ab344341 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 21 Jun 2011 22:31:46 +0200 Subject: [PATCH 06/77] added missing line --- openlp/core/lib/imagemanager.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index a529a4287..d073728c2 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -56,6 +56,7 @@ class ImageThread(QtCore.QThread): """ self.imageManager._process() + class ProcessingPriority(object): """ Enumeration class. From 6f88ccb006e721bcb9f02ebb6a2a523d0198ed0f Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 21 Jun 2011 23:03:58 +0200 Subject: [PATCH 07/77] some fixes --- openlp/core/lib/imagemanager.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index d073728c2..bc4cb8f5a 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -137,10 +137,10 @@ class ImageManager(QtCore.QObject): print u'get_image:', name log.debug(u'get_image %s' % name) image = self._cache[name] - if image.image_bytes is None: + if image.image is None: image.priority = ProcessingPriority.High self._clean_queue.put_nowait((image.priority, image)) - while image.image_bytes is None: + while image.image is None: log.debug(u'get_image - waiting') time.sleep(0.1) return image.image @@ -156,10 +156,10 @@ class ImageManager(QtCore.QObject): if image.image_bytes is None: image.priority = ProcessingPriority.Urgent self._clean_queue.put_nowait((image.priority, image)) - while self._cache[name].image_bytes is None: + while image.image_bytes is None: log.debug(u'get_image_bytes - waiting') time.sleep(0.1) - return self._cache[name].image_bytes + return image.image_bytes def del_image(self, name): """ @@ -212,13 +212,16 @@ class ImageManager(QtCore.QObject): if image.image is None: print u'processing (image):', image.name, image.priority image.image = resize_image(image.path, self.width, self.height) - if image.priority == ProcessingPriority.Urgent: - image.priority = ProcessingPriority.High - elif image.priority == ProcessingPriority.High: - image.priority = ProcessingPriority.Normal - else: - image.priority = ProcessingPriority.Low - self._clean_queue.put_nowait((image.priority, image)) + self._clean_queue.task_done() + if image.priority != ProcessingPriority.Urgent: + if image.priority == ProcessingPriority.High: + image.priority = ProcessingPriority.Normal + else: + image.priority = ProcessingPriority.Low + self._clean_queue.put_nowait((image.priority, image)) + return + if image.priority not in [ProcessingPriority.Urgent, + ProcessingPriority.Low]: self._clean_queue.task_done() return if image.image_bytes is None: From e268b963519206b953012a31661c3cef8f06603c Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 21 Jun 2011 23:19:29 +0200 Subject: [PATCH 08/77] fixed crash --- openlp/core/lib/imagemanager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index bc4cb8f5a..9c67d4593 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -219,7 +219,7 @@ class ImageManager(QtCore.QObject): else: image.priority = ProcessingPriority.Low self._clean_queue.put_nowait((image.priority, image)) - return + return if image.priority not in [ProcessingPriority.Urgent, ProcessingPriority.Low]: self._clean_queue.task_done() From bf1c643caa3379916f4dcfa067aa37ea52188d25 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 21 Jun 2011 23:24:27 +0200 Subject: [PATCH 09/77] use qt variable instead --- openlp/core/lib/imagemanager.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index 9c67d4593..a056a783b 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -104,7 +104,6 @@ class ImageManager(QtCore.QObject): self.width = current_screen[u'size'].width() self.height = current_screen[u'size'].height() self._cache = {} - self._thread_running = False self._cache_dirty = False self._image_thread = ImageThread(self) self._clean_queue = Queue.PriorityQueue() @@ -127,7 +126,7 @@ class ImageManager(QtCore.QObject): self._clean_queue.put_nowait((image.priority, image)) self._cache_dirty = True # only one thread please - if not self._thread_running: + if not self._image_thread.isRunning(): self._image_thread.start() def get_image(self, name): @@ -182,7 +181,7 @@ class ImageManager(QtCore.QObject): log.debug(u'Image in cache %s:%s' % (name, path)) self._cache_dirty = True # only one thread please - if not self._thread_running: + if not self._image_thread.isRunning(): self._image_thread.start() def _process(self): @@ -190,13 +189,11 @@ class ImageManager(QtCore.QObject): Controls the processing called from a ``QtCore.QThread``. """ log.debug(u'_process - started') - self._thread_running = True self._clean_cache() # data loaded since we started? while self._cache_dirty: log.debug(u'_process - recycle') self._clean_cache() - self._thread_running = False log.debug(u'_process - ended') def _clean_cache(self): From 9a58a0eca5157ea3b5658ad123feefe4e11ac3a7 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 22 Jun 2011 09:56:08 +0200 Subject: [PATCH 10/77] improved/fixed queue order --- openlp/core/lib/imagemanager.py | 43 +++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index a056a783b..ce187e7b2 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -92,6 +92,18 @@ class Image(object): self.priority = ProcessingPriority.Normal +class PriorityQueue(Queue.PriorityQueue): + """ + Customised ``Queue.PriorityQueue``. + """ +# def put(self, image): +# self._put((image.priority, image)) + + def remove(self, item): + if item in self.queue: + self.queue.remove(item) + + class ImageManager(QtCore.QObject): """ Image Manager handles the conversion and sizing of images. @@ -106,7 +118,7 @@ class ImageManager(QtCore.QObject): self._cache = {} self._cache_dirty = False self._image_thread = ImageThread(self) - self._clean_queue = Queue.PriorityQueue() + self._clean_queue = PriorityQueue() def update_display(self): """ @@ -123,7 +135,7 @@ class ImageManager(QtCore.QObject): image.priority = ProcessingPriority.Normal image.image = None image.image_bytes = None - self._clean_queue.put_nowait((image.priority, image)) + self._clean_queue.put((image.priority, image)) self._cache_dirty = True # only one thread please if not self._image_thread.isRunning(): @@ -137,8 +149,9 @@ class ImageManager(QtCore.QObject): log.debug(u'get_image %s' % name) image = self._cache[name] if image.image is None: + self._clean_queue.remove((image.priority, image)) image.priority = ProcessingPriority.High - self._clean_queue.put_nowait((image.priority, image)) + self._clean_queue.put((image.priority, image)) while image.image is None: log.debug(u'get_image - waiting') time.sleep(0.1) @@ -153,8 +166,9 @@ class ImageManager(QtCore.QObject): log.debug(u'get_image_bytes %s' % name) image = self._cache[name] if image.image_bytes is None: + self._clean_queue.remove((image.priority, image)) image.priority = ProcessingPriority.Urgent - self._clean_queue.put_nowait((image.priority, image)) + self._clean_queue.put((image.priority, image)) while image.image_bytes is None: log.debug(u'get_image_bytes - waiting') time.sleep(0.1) @@ -176,7 +190,7 @@ class ImageManager(QtCore.QObject): if not name in self._cache: image = Image(name, path) self._cache[name] = image - self._clean_queue.put_nowait((image.priority, image)) + self._clean_queue.put((image.priority, image)) else: log.debug(u'Image in cache %s:%s' % (name, path)) self._cache_dirty = True @@ -205,23 +219,22 @@ class ImageManager(QtCore.QObject): print u'empty' self._cache_dirty = False return - image = self._clean_queue.get_nowait()[1] + image = self._clean_queue.get()[1] if image.image is None: print u'processing (image):', image.name, image.priority image.image = resize_image(image.path, self.width, self.height) - self._clean_queue.task_done() + #self._clean_queue.task_done() if image.priority != ProcessingPriority.Urgent: - if image.priority == ProcessingPriority.High: - image.priority = ProcessingPriority.Normal - else: - image.priority = ProcessingPriority.Low - self._clean_queue.put_nowait((image.priority, image)) - return + self._clean_queue.task_done() + image.priority = ProcessingPriority.Low + self._clean_queue.put((image.priority, image)) + return if image.priority not in [ProcessingPriority.Urgent, ProcessingPriority.Low]: - self._clean_queue.task_done() + print u'return!', image.name, image.priority + #self._clean_queue.task_done() return if image.image_bytes is None: print u'processing (bytes):', image.name, image.priority image.image_bytes = image_to_byte(image.image) - self._clean_queue.task_done() + self._clean_queue.task_done() From b984f61e98ae6ef8915d166841615d400b0bf239 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 22 Jun 2011 10:04:01 +0200 Subject: [PATCH 11/77] clean ups --- openlp/core/lib/imagemanager.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index ce187e7b2..3303a1162 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -57,9 +57,9 @@ class ImageThread(QtCore.QThread): self.imageManager._process() -class ProcessingPriority(object): +class Priority(object): """ - Enumeration class. + Enumeration class for different priorities. ``Low`` Only the image's byte stream has to be generated. Neither the QImage nor @@ -89,17 +89,22 @@ class Image(object): self.path = path self.image = None self.image_bytes = None - self.priority = ProcessingPriority.Normal + self.priority = Priority.Normal class PriorityQueue(Queue.PriorityQueue): """ Customised ``Queue.PriorityQueue``. """ -# def put(self, image): -# self._put((image.priority, image)) - def remove(self, item): + """ + Removes the given ``item`` from the queue.remove + + ``item`` + The item to remove. This should be a tuple:: + + ``(Priority, Image)`` + """ if item in self.queue: self.queue.remove(item) @@ -132,7 +137,7 @@ class ImageManager(QtCore.QObject): self._clean_queue = Queue.PriorityQueue() for key in self._cache.keys(): image = self._cache[key] - image.priority = ProcessingPriority.Normal + image.priority = Priority.Normal image.image = None image.image_bytes = None self._clean_queue.put((image.priority, image)) @@ -150,7 +155,7 @@ class ImageManager(QtCore.QObject): image = self._cache[name] if image.image is None: self._clean_queue.remove((image.priority, image)) - image.priority = ProcessingPriority.High + image.priority = Priority.High self._clean_queue.put((image.priority, image)) while image.image is None: log.debug(u'get_image - waiting') @@ -167,7 +172,7 @@ class ImageManager(QtCore.QObject): image = self._cache[name] if image.image_bytes is None: self._clean_queue.remove((image.priority, image)) - image.priority = ProcessingPriority.Urgent + image.priority = Priority.Urgent self._clean_queue.put((image.priority, image)) while image.image_bytes is None: log.debug(u'get_image_bytes - waiting') @@ -224,13 +229,12 @@ class ImageManager(QtCore.QObject): print u'processing (image):', image.name, image.priority image.image = resize_image(image.path, self.width, self.height) #self._clean_queue.task_done() - if image.priority != ProcessingPriority.Urgent: + if image.priority != Priority.Urgent: self._clean_queue.task_done() - image.priority = ProcessingPriority.Low + image.priority = Priority.Low self._clean_queue.put((image.priority, image)) return - if image.priority not in [ProcessingPriority.Urgent, - ProcessingPriority.Low]: + if image.priority not in [Priority.Urgent, Priority.Low]: print u'return!', image.name, image.priority #self._clean_queue.task_done() return From 7996bb914da25d3b694902ac0041616338bf1808 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 22 Jun 2011 10:14:04 +0200 Subject: [PATCH 12/77] removed not needed code --- openlp/core/lib/imagemanager.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index 3303a1162..92e1055d2 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -199,7 +199,7 @@ class ImageManager(QtCore.QObject): else: log.debug(u'Image in cache %s:%s' % (name, path)) self._cache_dirty = True - # only one thread please + # We want only one thread. if not self._image_thread.isRunning(): self._image_thread.start() @@ -208,8 +208,6 @@ class ImageManager(QtCore.QObject): Controls the processing called from a ``QtCore.QThread``. """ log.debug(u'_process - started') - self._clean_cache() - # data loaded since we started? while self._cache_dirty: log.debug(u'_process - recycle') self._clean_cache() @@ -228,16 +226,11 @@ class ImageManager(QtCore.QObject): if image.image is None: print u'processing (image):', image.name, image.priority image.image = resize_image(image.path, self.width, self.height) - #self._clean_queue.task_done() if image.priority != Priority.Urgent: self._clean_queue.task_done() image.priority = Priority.Low self._clean_queue.put((image.priority, image)) return - if image.priority not in [Priority.Urgent, Priority.Low]: - print u'return!', image.name, image.priority - #self._clean_queue.task_done() - return if image.image_bytes is None: print u'processing (bytes):', image.name, image.priority image.image_bytes = image_to_byte(image.image) From 87e6a61f19f1ca0adea77dda7cc5f34e8bf116bc Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 22 Jun 2011 10:25:49 +0200 Subject: [PATCH 13/77] clean ups --- openlp/core/lib/imagemanager.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index 92e1055d2..30b46dc00 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -98,7 +98,7 @@ class PriorityQueue(Queue.PriorityQueue): """ def remove(self, item): """ - Removes the given ``item`` from the queue.remove + Removes the given ``item`` from the queue. ``item`` The item to remove. This should be a tuple:: @@ -127,14 +127,14 @@ class ImageManager(QtCore.QObject): def update_display(self): """ - Screen has changed size so rebuild the cache to new size + Screen has changed size so rebuild the cache to new size. """ log.debug(u'update_display') current_screen = ScreenList.get_instance().current self.width = current_screen[u'size'].width() self.height = current_screen[u'size'].height() - # mark the images as dirty for a rebuild - self._clean_queue = Queue.PriorityQueue() + # Mark the images as dirty for a rebuild. + self._clean_queue = PriorityQueue() for key in self._cache.keys(): image = self._cache[key] image.priority = Priority.Normal @@ -142,13 +142,13 @@ class ImageManager(QtCore.QObject): image.image_bytes = None self._clean_queue.put((image.priority, image)) self._cache_dirty = True - # only one thread please + # We want only one thread. if not self._image_thread.isRunning(): self._image_thread.start() def get_image(self, name): """ - Return the Qimage from the cache + Return the Qimage from the cache. """ print u'get_image:', name log.debug(u'get_image %s' % name) @@ -164,8 +164,8 @@ class ImageManager(QtCore.QObject): def get_image_bytes(self, name): """ - Returns the byte string for an image - If not present wait for the background thread to process it. + Returns the byte string for an image. If not present wait for the + background thread to process it. """ print u'get_image_bytes:', name log.debug(u'get_image_bytes %s' % name) From 63242b4191d8f5bc59360167f17264075a20556a Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 22 Jun 2011 18:13:07 +0200 Subject: [PATCH 14/77] more simplifications --- openlp/core/lib/imagemanager.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index 30b46dc00..c282f925e 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -121,7 +121,6 @@ class ImageManager(QtCore.QObject): self.width = current_screen[u'size'].width() self.height = current_screen[u'size'].height() self._cache = {} - self._cache_dirty = False self._image_thread = ImageThread(self) self._clean_queue = PriorityQueue() @@ -141,7 +140,6 @@ class ImageManager(QtCore.QObject): image.image = None image.image_bytes = None self._clean_queue.put((image.priority, image)) - self._cache_dirty = True # We want only one thread. if not self._image_thread.isRunning(): self._image_thread.start() @@ -198,7 +196,6 @@ class ImageManager(QtCore.QObject): self._clean_queue.put((image.priority, image)) else: log.debug(u'Image in cache %s:%s' % (name, path)) - self._cache_dirty = True # We want only one thread. if not self._image_thread.isRunning(): self._image_thread.start() @@ -208,7 +205,7 @@ class ImageManager(QtCore.QObject): Controls the processing called from a ``QtCore.QThread``. """ log.debug(u'_process - started') - while self._cache_dirty: + while not self._clean_queue.empty(): log.debug(u'_process - recycle') self._clean_cache() log.debug(u'_process - ended') @@ -218,10 +215,6 @@ class ImageManager(QtCore.QObject): Actually does the work. """ log.debug(u'_clean_cache') - if self._clean_queue.empty(): - print u'empty' - self._cache_dirty = False - return image = self._clean_queue.get()[1] if image.image is None: print u'processing (image):', image.name, image.priority From 95d24f68b0f7302fa1a64547c4452cef8564db64 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 22 Jun 2011 19:06:35 +0200 Subject: [PATCH 15/77] fixed forgotten lines --- openlp/core/lib/imagemanager.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index c282f925e..8f4142a1d 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -206,8 +206,8 @@ class ImageManager(QtCore.QObject): """ log.debug(u'_process - started') while not self._clean_queue.empty(): - log.debug(u'_process - recycle') self._clean_cache() + print u'empty' log.debug(u'_process - ended') def _clean_cache(self): @@ -221,6 +221,7 @@ class ImageManager(QtCore.QObject): image.image = resize_image(image.path, self.width, self.height) if image.priority != Priority.Urgent: self._clean_queue.task_done() + self._clean_queue.remove((image.priority, image)) image.priority = Priority.Low self._clean_queue.put((image.priority, image)) return From 929301b2e8cfe5d530290a923465bc3876da639e Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 24 Jun 2011 18:12:04 +0200 Subject: [PATCH 16/77] removed test lines --- openlp/core/lib/imagemanager.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index 8f4142a1d..3103a7e12 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -148,7 +148,6 @@ class ImageManager(QtCore.QObject): """ Return the Qimage from the cache. """ - print u'get_image:', name log.debug(u'get_image %s' % name) image = self._cache[name] if image.image is None: @@ -165,7 +164,6 @@ class ImageManager(QtCore.QObject): Returns the byte string for an image. If not present wait for the background thread to process it. """ - print u'get_image_bytes:', name log.debug(u'get_image_bytes %s' % name) image = self._cache[name] if image.image_bytes is None: @@ -207,7 +205,6 @@ class ImageManager(QtCore.QObject): log.debug(u'_process - started') while not self._clean_queue.empty(): self._clean_cache() - print u'empty' log.debug(u'_process - ended') def _clean_cache(self): @@ -217,15 +214,11 @@ class ImageManager(QtCore.QObject): log.debug(u'_clean_cache') image = self._clean_queue.get()[1] if image.image is None: - print u'processing (image):', image.name, image.priority image.image = resize_image(image.path, self.width, self.height) if image.priority != Priority.Urgent: - self._clean_queue.task_done() self._clean_queue.remove((image.priority, image)) image.priority = Priority.Low self._clean_queue.put((image.priority, image)) return if image.image_bytes is None: - print u'processing (bytes):', image.name, image.priority image.image_bytes = image_to_byte(image.image) - self._clean_queue.task_done() From 1ff42f59de688c1dc7ee7fd9d7a39e438e8a0f28 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 25 Jun 2011 06:36:43 +0200 Subject: [PATCH 17/77] - added comments - qt name change - remove test lines --- openlp/core/lib/imagemanager.py | 27 ++++++++++++++++----------- openlp/core/ui/slidecontroller.py | 4 ---- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index 3103a7e12..bab9748d0 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -121,7 +121,7 @@ class ImageManager(QtCore.QObject): self.width = current_screen[u'size'].width() self.height = current_screen[u'size'].height() self._cache = {} - self._image_thread = ImageThread(self) + self._imageThread = ImageThread(self) self._clean_queue = PriorityQueue() def update_display(self): @@ -132,21 +132,22 @@ class ImageManager(QtCore.QObject): current_screen = ScreenList.get_instance().current self.width = current_screen[u'size'].width() self.height = current_screen[u'size'].height() - # Mark the images as dirty for a rebuild. + # Mark the images as dirty for a rebuild by setting the image and byte + # stream to None. self._clean_queue = PriorityQueue() - for key in self._cache.keys(): - image = self._cache[key] + for key, image in self._cache.iteritems(): image.priority = Priority.Normal image.image = None image.image_bytes = None self._clean_queue.put((image.priority, image)) # We want only one thread. - if not self._image_thread.isRunning(): - self._image_thread.start() + if not self._imageThread.isRunning(): + self._imageThread.start() def get_image(self, name): """ - Return the Qimage from the cache. + Return the ``QImage`` from the cache. If not present wait for the + background thread to process it. """ log.debug(u'get_image %s' % name) image = self._cache[name] @@ -177,7 +178,7 @@ class ImageManager(QtCore.QObject): def del_image(self, name): """ - Delete the Image from the Cache + Delete the Image from the cache. """ log.debug(u'del_image %s' % name) if name in self._cache: @@ -185,7 +186,7 @@ class ImageManager(QtCore.QObject): def add_image(self, name, path): """ - Add image to cache if it is not already there + Add image to cache if it is not already there. """ log.debug(u'add_image %s:%s' % (name, path)) if not name in self._cache: @@ -195,8 +196,8 @@ class ImageManager(QtCore.QObject): else: log.debug(u'Image in cache %s:%s' % (name, path)) # We want only one thread. - if not self._image_thread.isRunning(): - self._image_thread.start() + if not self._imageThread.isRunning(): + self._imageThread.start() def _process(self): """ @@ -213,12 +214,16 @@ class ImageManager(QtCore.QObject): """ log.debug(u'_clean_cache') image = self._clean_queue.get()[1] + # Generate the QImage for the image. if image.image is None: image.image = resize_image(image.path, self.width, self.height) + # If the priority is not urgent, then set the priority to low and + # do not start to generate the byte stream. if image.priority != Priority.Urgent: self._clean_queue.remove((image.priority, image)) image.priority = Priority.Low self._clean_queue.put((image.priority, image)) return + # Generate the byte stream for the image. if image.image_bytes is None: image.image_bytes = image_to_byte(image.image) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 821bed9b3..5ea2c5f23 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -582,9 +582,6 @@ class SlideController(QtGui.QWidget): Loads a ServiceItem into the system from ServiceManager Display the slide number passed """ - import time - import datetime - start = time.time() log.debug(u'processManagerItem live = %s' % self.isLive) self.onStopLoop() old_item = self.serviceItem @@ -671,7 +668,6 @@ class SlideController(QtGui.QWidget): self.onMediaClose() Receiver.send_message(u'slidecontroller_%s_started' % self.typePrefix, [serviceItem]) - print unicode(datetime.timedelta(seconds=time.time() - start)) def __updatePreviewSelection(self, slideno): """ From b12fd94f6e23c19702f3f7d141376a503ae87ba2 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 25 Jun 2011 07:35:24 +0200 Subject: [PATCH 18/77] moved image queue changes to an own branch --- openlp/core/lib/imagemanager.py | 170 +++++++++++--------------------- 1 file changed, 56 insertions(+), 114 deletions(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index bab9748d0..d89cefccc 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -32,7 +32,6 @@ to wait for the conversion to happen. """ import logging import time -import Queue from PyQt4 import QtCore @@ -54,59 +53,15 @@ class ImageThread(QtCore.QThread): """ Run the thread. """ - self.imageManager._process() - - -class Priority(object): - """ - Enumeration class for different priorities. - - ``Low`` - Only the image's byte stream has to be generated. Neither the QImage nor - the byte stream has been requested yet. - - ``Normal`` - The image's byte stream as well as the image has to be generated. - Neither the QImage nor the byte stream has been requested yet. - - ``High`` - The image's byte stream as well as the image has to be generated. The - QImage for this image has been requested. - - ``Urgent`` - The image's byte stream as well as the image has to be generated. The - byte stream for this image has been requested. - """ - Low = 3 - Normal = 2 - High = 1 - Urgent = 0 + self.imageManager.process() class Image(object): - def __init__(self, name='', path=''): - self.name = name - self.path = path - self.image = None - self.image_bytes = None - self.priority = Priority.Normal - - -class PriorityQueue(Queue.PriorityQueue): - """ - Customised ``Queue.PriorityQueue``. - """ - def remove(self, item): - """ - Removes the given ``item`` from the queue. - - ``item`` - The item to remove. This should be a tuple:: - - ``(Priority, Image)`` - """ - if item in self.queue: - self.queue.remove(item) + name = '' + path = '' + dirty = True + image = None + image_bytes = None class ImageManager(QtCore.QObject): @@ -121,64 +76,50 @@ class ImageManager(QtCore.QObject): self.width = current_screen[u'size'].width() self.height = current_screen[u'size'].height() self._cache = {} - self._imageThread = ImageThread(self) - self._clean_queue = PriorityQueue() + self._thread_running = False + self._cache_dirty = False + self.image_thread = ImageThread(self) def update_display(self): """ - Screen has changed size so rebuild the cache to new size. + Screen has changed size so rebuild the cache to new size """ log.debug(u'update_display') current_screen = ScreenList.get_instance().current self.width = current_screen[u'size'].width() self.height = current_screen[u'size'].height() - # Mark the images as dirty for a rebuild by setting the image and byte - # stream to None. - self._clean_queue = PriorityQueue() - for key, image in self._cache.iteritems(): - image.priority = Priority.Normal - image.image = None - image.image_bytes = None - self._clean_queue.put((image.priority, image)) - # We want only one thread. - if not self._imageThread.isRunning(): - self._imageThread.start() + # mark the images as dirty for a rebuild + for key in self._cache.keys(): + image = self._cache[key] + image.dirty = True + image.image = resize_image(image.path, self.width, self.height) + self._cache_dirty = True + # only one thread please + if not self._thread_running: + self.image_thread.start() def get_image(self, name): """ - Return the ``QImage`` from the cache. If not present wait for the - background thread to process it. + Return the Qimage from the cache """ log.debug(u'get_image %s' % name) - image = self._cache[name] - if image.image is None: - self._clean_queue.remove((image.priority, image)) - image.priority = Priority.High - self._clean_queue.put((image.priority, image)) - while image.image is None: - log.debug(u'get_image - waiting') - time.sleep(0.1) - return image.image + return self._cache[name].image def get_image_bytes(self, name): """ - Returns the byte string for an image. If not present wait for the - background thread to process it. + Returns the byte string for an image + If not present wait for the background thread to process it. """ log.debug(u'get_image_bytes %s' % name) - image = self._cache[name] - if image.image_bytes is None: - self._clean_queue.remove((image.priority, image)) - image.priority = Priority.Urgent - self._clean_queue.put((image.priority, image)) - while image.image_bytes is None: + if not self._cache[name].image_bytes: + while self._cache[name].dirty: log.debug(u'get_image_bytes - waiting') time.sleep(0.1) - return image.image_bytes + return self._cache[name].image_bytes def del_image(self, name): """ - Delete the Image from the cache. + Delete the Image from the Cache """ log.debug(u'del_image %s' % name) if name in self._cache: @@ -186,44 +127,45 @@ class ImageManager(QtCore.QObject): def add_image(self, name, path): """ - Add image to cache if it is not already there. + Add image to cache if it is not already there """ log.debug(u'add_image %s:%s' % (name, path)) if not name in self._cache: - image = Image(name, path) + image = Image() + image.name = name + image.path = path + image.image = resize_image(path, self.width, self.height) self._cache[name] = image - self._clean_queue.put((image.priority, image)) else: log.debug(u'Image in cache %s:%s' % (name, path)) - # We want only one thread. - if not self._imageThread.isRunning(): - self._imageThread.start() + self._cache_dirty = True + # only one thread please + if not self._thread_running: + self.image_thread.start() - def _process(self): + def process(self): """ - Controls the processing called from a ``QtCore.QThread``. + Controls the processing called from a QThread """ - log.debug(u'_process - started') - while not self._clean_queue.empty(): - self._clean_cache() - log.debug(u'_process - ended') + log.debug(u'process - started') + self._thread_running = True + self.clean_cache() + # data loaded since we started ? + while self._cache_dirty: + log.debug(u'process - recycle') + self.clean_cache() + self._thread_running = False + log.debug(u'process - ended') - def _clean_cache(self): + def clean_cache(self): """ Actually does the work. """ - log.debug(u'_clean_cache') - image = self._clean_queue.get()[1] - # Generate the QImage for the image. - if image.image is None: - image.image = resize_image(image.path, self.width, self.height) - # If the priority is not urgent, then set the priority to low and - # do not start to generate the byte stream. - if image.priority != Priority.Urgent: - self._clean_queue.remove((image.priority, image)) - image.priority = Priority.Low - self._clean_queue.put((image.priority, image)) - return - # Generate the byte stream for the image. - if image.image_bytes is None: - image.image_bytes = image_to_byte(image.image) + log.debug(u'clean_cache') + # we will clean the cache now + self._cache_dirty = False + for key in self._cache.keys(): + image = self._cache[key] + if image.dirty: + image.image_bytes = image_to_byte(image.image) + image.dirty = False From 14e2ce6b644c51b36dd7e0c719246c28dca761b2 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 25 Jun 2011 15:23:49 +0200 Subject: [PATCH 19/77] better comment --- openlp/core/lib/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index f141ef305..80b35ef6f 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -153,7 +153,8 @@ def create_thumb(image_path, thumb_path, return_icon=True, size=None): to ``True``. ``size`` - Defaults to ``None``. + Allows to state a own size to use. Defaults to ``None``, which means + that a default height of 88 is used. """ ext = os.path.splitext(thumb_path)[1].lower() reader = QtGui.QImageReader(image_path) From 4f955f25d7c1c5af4bbed4f8bd45b3891dba908e Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 25 Jun 2011 15:47:46 +0200 Subject: [PATCH 20/77] refactoring --- .../presentations/lib/presentationcontroller.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/openlp/plugins/presentations/lib/presentationcontroller.py b/openlp/plugins/presentations/lib/presentationcontroller.py index c26396229..55823dfd2 100644 --- a/openlp/plugins/presentations/lib/presentationcontroller.py +++ b/openlp/plugins/presentations/lib/presentationcontroller.py @@ -31,7 +31,8 @@ import shutil from PyQt4 import QtCore -from openlp.core.lib import Receiver, create_thumb, resize_image, validate_thumb +from openlp.core.lib import Receiver, check_directory_exists, create_thumb, \ + resize_image, validate_thumb from openlp.core.utils import AppLocation log = logging.getLogger(__name__) @@ -97,8 +98,7 @@ class PresentationDocument(object): self.slidenumber = 0 self.controller = controller self.filepath = name - if not os.path.isdir(self.get_thumbnail_folder()): - os.mkdir(self.get_thumbnail_folder()) + check_directory_exists(self.get_thumbnail_folder()) def load_presentation(self): """ @@ -385,10 +385,8 @@ class PresentationController(object): AppLocation.get_section_data_path(self.settings_section), u'thumbnails') self.thumbnail_prefix = u'slide' - if not os.path.isdir(self.thumbnail_folder): - os.makedirs(self.thumbnail_folder) - if not os.path.isdir(self.temp_folder): - os.makedirs(self.temp_folder) + check_directory_exists(self.thumbnail_folder) + check_directory_exists(self.temp_folder) def enabled(self): """ From 50b820af4e74bde630fcc18efc3745ed5f52a529 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 24 Aug 2011 10:34:15 +0200 Subject: [PATCH 21/77] try to fix gradient when using html5 doctype --- openlp/core/lib/htmlbuilder.py | 18 ++++++++++-------- openlp/core/ui/maindisplay.py | 1 + 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index 6f56cf8b2..e1a76ac43 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -36,6 +36,7 @@ log = logging.getLogger(__name__) # FIXME: Add html5 doctype. However, do not break theme gradients. HTMLSRC = u""" + OpenLP Display @@ -393,18 +394,18 @@ def build_background_css(item, width, height): """ width = int(width) / 2 theme = item.themedata - background = u'background-color: black' + background = u'background-color: black;' if theme: if theme.background_type == \ BackgroundType.to_string(BackgroundType.Solid): - background = u'background-color: %s' % theme.background_color + background = u'background-color: %s;' % theme.background_color else: if theme.background_direction == BackgroundGradientType.to_string \ (BackgroundGradientType.Horizontal): background = \ u'background: ' \ u'-webkit-gradient(linear, left top, left bottom, ' \ - 'from(%s), to(%s))' % (theme.background_start_color, + 'from(%s), to(%s)) fixed;' % (theme.background_start_color, theme.background_end_color) elif theme.background_direction == \ BackgroundGradientType.to_string( \ @@ -412,7 +413,7 @@ def build_background_css(item, width, height): background = \ u'background: ' \ u'-webkit-gradient(linear, left top, right bottom, ' \ - 'from(%s), to(%s))' % (theme.background_start_color, + 'from(%s), to(%s)) fixed;' % (theme.background_start_color, theme.background_end_color) elif theme.background_direction == \ BackgroundGradientType.to_string \ @@ -420,20 +421,21 @@ def build_background_css(item, width, height): background = \ u'background: ' \ u'-webkit-gradient(linear, left bottom, right top, ' \ - 'from(%s), to(%s))' % (theme.background_start_color, + 'from(%s), to(%s)) fixed;' % (theme.background_start_color, theme.background_end_color) elif theme.background_direction == \ BackgroundGradientType.to_string \ (BackgroundGradientType.Vertical): background = \ u'background: -webkit-gradient(linear, left top, ' \ - u'right top, from(%s), to(%s))' % \ + u'right top, from(%s), to(%s)) fixed;' % \ (theme.background_start_color, theme.background_end_color) else: background = \ u'background: -webkit-gradient(radial, %s 50%%, 100, %s ' \ - u'50%%, %s, from(%s), to(%s))' % (width, width, width, - theme.background_start_color, theme.background_end_color) + u'50%%, %s, from(%s), to(%s)) fixed;' % (width, width, + width, theme.background_start_color, + theme.background_end_color) return background def build_lyrics_css(item, webkitvers): diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 9904868ce..b96fe9985 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -103,6 +103,7 @@ class MainDisplay(QtGui.QGraphicsView): self.createMediaObject() log.debug(u'Setup webView') self.webView = QtWebKit.QWebView(self) + self.webView.settings().setAttribute(7, True) self.webView.setGeometry(0, 0, self.screen[u'size'].width(), self.screen[u'size'].height()) self.page = self.webView.page() From 6a901f2de9c51a379618005e11bc57c798928f2e Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 16 Sep 2011 18:23:39 +0100 Subject: [PATCH 22/77] Add justify to theme options Fixes: https://launchpad.net/bugs/802252 --- openlp/core/lib/htmlbuilder.py | 8 ++++++-- openlp/core/lib/theme.py | 3 ++- openlp/core/ui/themewizard.py | 4 +++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index 6f56cf8b2..da19cae0e 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -557,11 +557,15 @@ def build_lyrics_format_css(theme, width, height): left_margin = int(theme.font_main_outline_size) * 2 else: left_margin = 0 - lyrics = u'white-space:pre-wrap; word-wrap: break-word; ' \ + justify = u'white-space:pre-wrap;' + # fix tag incompatibilities + if theme.display_horizontal_align == HorizontalType.Justify: + justify = u'' + lyrics = u'%s word-wrap: break-word; ' \ 'text-align: %s; vertical-align: %s; font-family: %s; ' \ 'font-size: %spt; color: %s; line-height: %d%%; margin: 0;' \ 'padding: 0; padding-left: %spx; width: %spx; height: %spx; ' % \ - (align, valign, theme.font_main_name, theme.font_main_size, + (justify, align, valign, theme.font_main_name, theme.font_main_size, theme.font_main_color, 100 + int(theme.font_main_line_adjustment), left_margin, width, height) if theme.font_main_outline: diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index 3b0a62f5b..34a3b9d98 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -176,8 +176,9 @@ class HorizontalType(object): Left = 0 Right = 1 Center = 2 + Justify = 3 - Names = [u'left', u'right', u'center'] + Names = [u'left', u'right', u'center', u'justify'] class VerticalType(object): diff --git a/openlp/core/ui/themewizard.py b/openlp/core/ui/themewizard.py index 6001c83d6..c7cba0ebd 100644 --- a/openlp/core/ui/themewizard.py +++ b/openlp/core/ui/themewizard.py @@ -246,7 +246,7 @@ class Ui_ThemeWizard(object): self.horizontalLabel = QtGui.QLabel(self.alignmentPage) self.horizontalLabel.setObjectName(u'HorizontalLabel') self.horizontalComboBox = QtGui.QComboBox(self.alignmentPage) - self.horizontalComboBox.addItems([u'', u'', u'']) + self.horizontalComboBox.addItems([u'', u'', u'', u'']) self.horizontalComboBox.setObjectName(u'HorizontalComboBox') self.alignmentLayout.addRow(self.horizontalLabel, self.horizontalComboBox) @@ -495,6 +495,8 @@ class Ui_ThemeWizard(object): translate('OpenLP.ThemeWizard', 'Right')) self.horizontalComboBox.setItemText(HorizontalType.Center, translate('OpenLP.ThemeWizard', 'Center')) + self.horizontalComboBox.setItemText(HorizontalType.Justify, + translate('OpenLP.ThemeWizard', 'Justify')) self.transitionsLabel.setText( translate('OpenLP.ThemeWizard', 'Transitions:')) self.areaPositionPage.setTitle( From cd33d807fcf9d4cbc7c429e944ed40ec088e9d2a Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 18 Sep 2011 12:28:10 +0200 Subject: [PATCH 23/77] removed test code --- openlp/core/ui/maindisplay.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index b96fe9985..9904868ce 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -103,7 +103,6 @@ class MainDisplay(QtGui.QGraphicsView): self.createMediaObject() log.debug(u'Setup webView') self.webView = QtWebKit.QWebView(self) - self.webView.settings().setAttribute(7, True) self.webView.setGeometry(0, 0, self.screen[u'size'].width(), self.screen[u'size'].height()) self.page = self.webView.page() From d856e957b4624b89f6cf6ed2fb80974e49fd1dbe Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 18 Sep 2011 12:30:14 +0200 Subject: [PATCH 24/77] removed FIXME --- openlp/core/lib/htmlbuilder.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index e1a76ac43..1a879017b 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -34,7 +34,6 @@ from openlp.core.lib.theme import BackgroundType, BackgroundGradientType, \ log = logging.getLogger(__name__) -# FIXME: Add html5 doctype. However, do not break theme gradients. HTMLSRC = u""" From 734c868223b9c2fdc8b337e875faca118bca6e68 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 18 Sep 2011 17:39:12 +0200 Subject: [PATCH 25/77] removed semicolon --- openlp/core/lib/htmlbuilder.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index 1a879017b..c67700a29 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -393,18 +393,18 @@ def build_background_css(item, width, height): """ width = int(width) / 2 theme = item.themedata - background = u'background-color: black;' + background = u'background-color: black' if theme: if theme.background_type == \ BackgroundType.to_string(BackgroundType.Solid): - background = u'background-color: %s;' % theme.background_color + background = u'background-color: %s' % theme.background_color else: if theme.background_direction == BackgroundGradientType.to_string \ (BackgroundGradientType.Horizontal): background = \ u'background: ' \ u'-webkit-gradient(linear, left top, left bottom, ' \ - 'from(%s), to(%s)) fixed;' % (theme.background_start_color, + 'from(%s), to(%s)) fixed' % (theme.background_start_color, theme.background_end_color) elif theme.background_direction == \ BackgroundGradientType.to_string( \ @@ -412,7 +412,7 @@ def build_background_css(item, width, height): background = \ u'background: ' \ u'-webkit-gradient(linear, left top, right bottom, ' \ - 'from(%s), to(%s)) fixed;' % (theme.background_start_color, + 'from(%s), to(%s)) fixed' % (theme.background_start_color, theme.background_end_color) elif theme.background_direction == \ BackgroundGradientType.to_string \ @@ -420,19 +420,19 @@ def build_background_css(item, width, height): background = \ u'background: ' \ u'-webkit-gradient(linear, left bottom, right top, ' \ - 'from(%s), to(%s)) fixed;' % (theme.background_start_color, + 'from(%s), to(%s)) fixed' % (theme.background_start_color, theme.background_end_color) elif theme.background_direction == \ BackgroundGradientType.to_string \ (BackgroundGradientType.Vertical): background = \ u'background: -webkit-gradient(linear, left top, ' \ - u'right top, from(%s), to(%s)) fixed;' % \ + u'right top, from(%s), to(%s)) fixed' % \ (theme.background_start_color, theme.background_end_color) else: background = \ u'background: -webkit-gradient(radial, %s 50%%, 100, %s ' \ - u'50%%, %s, from(%s), to(%s)) fixed;' % (width, width, + u'50%%, %s, from(%s), to(%s)) fixed' % (width, width, width, theme.background_start_color, theme.background_end_color) return background From 0aadc32d4f5ceacabbca818cd8f5d1264debac05 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sat, 24 Sep 2011 00:14:23 +0200 Subject: [PATCH 26/77] Fixed the last part of bug #855342 where when you save a file a few times, it throws an exception. Fixes: https://launchpad.net/bugs/855342 --- openlp/core/ui/servicemanager.py | 72 +++++++++++++++++++++----------- 1 file changed, 48 insertions(+), 24 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index c6ffaaccc..911b04674 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -30,6 +30,7 @@ import logging import os import shutil import zipfile +from tempfile import mkstemp log = logging.getLogger(__name__) @@ -467,15 +468,24 @@ class ServiceManager(QtGui.QWidget): def saveFile(self): """ - Save the current Service file. + Save the current service file. + + A temporary file is created so that we don't overwrite the existing one + and leave a mangled service file should there be an error when saving. + Audio files are also copied into the service manager directory, and + then packaged into the zip file. """ if not self.fileName(): return self.saveFileAs() + temp_file, temp_file_name = mkstemp(u'.osz', u'openlp_') + # We don't need the file handle. + os.close(temp_file) + log.debug(temp_file_name) path_file_name = unicode(self.fileName()) path, file_name = os.path.split(path_file_name) basename, extension = os.path.splitext(file_name) service_file_name = '%s.osd' % basename - log.debug(u'ServiceManager.saveFile - %s' % path_file_name) + log.debug(u'ServiceManager.saveFile - %s', path_file_name) SettingsManager.set_last_dir( self.mainwindow.servicemanagerSettingsSection, path) @@ -494,7 +504,8 @@ class ServiceManager(QtGui.QWidget): if len(service_item[u'header'][u'background_audio']) > 0: for i, filename in \ enumerate(service_item[u'header'][u'background_audio']): - new_file = os.path.join(u'audio', item[u'service_item']._uuid, + new_file = os.path.join(u'audio', + item[u'service_item']._uuid, os.path.split(filename)[1]) audio_files.append((filename, new_file)) service_item[u'header'][u'background_audio'][i] = new_file @@ -545,30 +556,38 @@ class ServiceManager(QtGui.QWidget): success = True self.mainwindow.incrementProgressBar() try: - zip = zipfile.ZipFile(path_file_name, 'w', zipfile.ZIP_STORED, + zip = zipfile.ZipFile(temp_file_name, 'w', zipfile.ZIP_STORED, allow_zip_64) # First we add service contents. # We save ALL filenames into ZIP using UTF-8. zip.writestr(service_file_name.encode(u'utf-8'), service_content) # Finally add all the listed media files. - for path_from in write_list: - zip.write(path_from, path_from.encode(u'utf-8')) - for path_from, path_to in audio_files: - if path_from == path_to: - # If this file has already been saved, let's use set the - # from path to the real location of the files - path_from = os.path.join(self.servicePath, path_from) - else: - # If this file has not yet been saved, let's copy the file - # to the service manager path - save_file = os.path.join(self.servicePath, path_to) - save_path = os.path.split(save_file)[0] - if not os.path.exists(save_path): - os.makedirs(save_path) - shutil.copy(path_from, save_file) - zip.write(path_from, path_to.encode(u'utf-8')) + for write_from in write_list: + zip.write(write_from, write_from.encode(u'utf-8')) + for audio_from, audio_to in audio_files: + if audio_from.startswith(u'audio'): + # When items are saved, they get new UUID's. Let's copy the + # file to the new location. Unused files can be ignored, + # OpenLP automatically cleans up the service manager dir on + # exit. + audio_from = os.path.join(self.servicePath, audio_from) + save_file = os.path.join(self.servicePath, audio_to) + save_path = os.path.split(save_file)[0] + if not os.path.exists(save_path): + os.makedirs(save_path) + if not os.path.exists(save_file): + shutil.copy(audio_from, save_file) + zip.write(audio_from, audio_to.encode(u'utf-8')) except IOError: - log.exception(u'Failed to save service to disk') + log.exception(u'Failed to save service to disk: %s', temp_file_name) + # Add this line in after the release to notify the user that saving + # their file failed. Commented out due to string freeze. + #Receiver.send_message(u'openlp_error_message', { + # u'title': translate(u'OpenLP.ServiceManager', + # u'Error Saving File'), + # u'message': translate(u'OpenLP.ServiceManager', + # u'There was an error saving your file.') + #}) success = False finally: if zip: @@ -576,10 +595,13 @@ class ServiceManager(QtGui.QWidget): self.mainwindow.finishedProgressBar() Receiver.send_message(u'cursor_normal') if success: + shutil.copy(temp_file_name, path_file_name) self.mainwindow.addRecentFile(path_file_name) self.setModified(False) - else: - delete_file(path_file_name) + try: + delete_file(temp_file_name) + except: + pass return success def saveFileAs(self): @@ -623,6 +645,7 @@ class ServiceManager(QtGui.QWidget): osfile = unicode(QtCore.QDir.toNativeSeparators(ucsfile)) if not osfile.startswith(u'audio'): osfile = os.path.split(osfile)[1] + log.debug(u'Extract file: %s', osfile) zipinfo.filename = osfile zip.extract(zipinfo, self.servicePath) if osfile.endswith(u'osd'): @@ -1022,11 +1045,12 @@ class ServiceManager(QtGui.QWidget): """ Empties the servicePath of temporary files. """ + log.debug(u'Cleaning up servicePath') for file in os.listdir(self.servicePath): file_path = os.path.join(self.servicePath, file) delete_file(file_path) if os.path.exists(os.path.join(self.servicePath, u'audio')): - shutil.rmtree(os.path.join(self.servicePath, u'audio'), False) + shutil.rmtree(os.path.join(self.servicePath, u'audio'), True) def onThemeComboBoxSelected(self, currentIndex): """ From 9841406071d0ee78c1631df8a4b3c33f122f6fd5 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 24 Sep 2011 14:54:27 +0200 Subject: [PATCH 27/77] minor improvement for such cases where [---] was used --- openlp/core/lib/renderer.py | 99 +++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 55 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index abfd658ba..b5646bc5d 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -224,54 +224,52 @@ class Renderer(object): # Bibles if item.is_capable(ItemCapabilities.CanWordSplit): pages = self._paginate_slide_words(text.split(u'\n'), line_end) - else: - # Clean up line endings. - lines = self._lines_split(text) - pages = self._paginate_slide(lines, line_end) - # Songs and Custom - if item.is_capable(ItemCapabilities.CanSoftBreak) and \ - len(pages) > 1 and u'[---]' in text: - pages = [] - while True: - slides = text.split(u'\n[---]\n', 2) - # If there are (at least) two occurrences of [---] we use - # the first two slides (and neglect the last for now). - if len(slides) == 3: - html_text = expand_tags(u'\n'.join(slides[:2])) - # We check both slides to determine if the virtual break is - # needed (there is only one virtual break). + # Songs and Custom + elif item.is_capable(ItemCapabilities.CanSoftBreak): + pages = [] + while True: + slides = text.split(u'\n[---]\n', 2) + # If there are (at least) two occurrences of [---] we use + # the first two slides (and neglect the last for now). + if len(slides) == 3: + html_text = expand_tags(u'\n'.join(slides[:2])) + # We check both slides to determine if the virtual break is + # needed (there is only one virtual break). + else: + html_text = expand_tags(u'\n'.join(slides)) + html_text = html_text.replace(u'\n', u'
') + if self._text_fits_on_slide(html_text): + # The first two virtual slides fit (as a whole) on one + # slide. Replace the first occurrence of [---]. + text = text.replace(u'\n[---]', u'', 1) + else: + # The first virtual slide fits, which means we have to + # render the first virtual slide. + text_contains_break = u'[---]' in text + if text_contains_break: + text_to_render, text = text.split(u'\n[---]\n', 1) else: - html_text = expand_tags(u'\n'.join(slides)) - html_text = html_text.replace(u'\n', u'
') - if self._text_fits_on_slide(html_text): - # The first two virtual slides fit (as a whole) on one - # slide. Replace the first occurrence of [---]. - text = text.replace(u'\n[---]', u'', 1) + text_to_render = text + text = u'' + lines = text_to_render.strip(u'\n').split(u'\n') + slides = self._paginate_slide(lines, line_end) + if len(slides) > 1 and text: + # Add all slides apart from the last one the list. + pages.extend(slides[:-1]) + if text_contains_break: + text = slides[-1] + u'\n[---]\n' + text + else: + text = slides[-1] + u'\n'+ text + text = text.replace(u'
', u'\n') else: - # The first virtual slide fits, which means we have to - # render the first virtual slide. - text_contains_break = u'[---]' in text - if text_contains_break: - text_to_render, text = text.split(u'\n[---]\n', 1) - else: - text_to_render = text - text = u'' - lines = text_to_render.strip(u'\n').split(u'\n') - slides = self._paginate_slide(lines, line_end) - if len(slides) > 1 and text: - # Add all slides apart from the last one the list. - pages.extend(slides[:-1]) - if text_contains_break: - text = slides[-1] + u'\n[---]\n' + text - else: - text = slides[-1] + u'\n'+ text - text = text.replace(u'
', u'\n') - else: - pages.extend(slides) - if u'[---]' not in text: - lines = text.strip(u'\n').split(u'\n') - pages.extend(self._paginate_slide(lines, line_end)) - break + pages.extend(slides) + if u'[---]' not in text: + lines = text.strip(u'\n').split(u'\n') + pages.extend(self._paginate_slide(lines, line_end)) + break + else: + # Clean up line endings. + pages = self._paginate_slide(text.split(u'\n'), line_end) new_pages = [] for page in pages: while page.endswith(u'
'): @@ -585,12 +583,3 @@ class Renderer(object): # this parse we are to be wordy line = line.replace(u'\n', u' ') return line.split(u' ') - - def _lines_split(self, text): - """ - Split the slide up by physical line - """ - # this parse we do not want to use this so remove it - text = text.replace(u'\n[---]', u'') - text = text.replace(u'[---]', u'') - return text.split(u'\n') From c058c774fcb142ac7b7b560bd51611b8425da89e Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 24 Sep 2011 16:18:48 +0100 Subject: [PATCH 28/77] revert 1757 --- openlp/plugins/songs/lib/mediaitem.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 950eff870..166e49246 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -428,11 +428,9 @@ class SongMediaItem(MediaManagerItem): def generateSlideData(self, service_item, item=None, xmlVersion=False, remote=False): - log.debug(u'generateSlideData: %s, %s, %s' % (service_item, item, self.remoteSong)) - # The ``None`` below is a workaround for bug #812289 - I think that Qt - # deletes the item somewhere along the line because the user is taking - # so long to update their item (or something weird like that). - item_id = self._getIdOfItemToGenerate(None, self.remoteSong) + log.debug(u'generateSlideData: %s, %s, %s' % + (service_item, item, self.remoteSong)) + item_id = self._getIdOfItemToGenerate(item, self.remoteSong) service_item.add_capability(ItemCapabilities.CanEdit) service_item.add_capability(ItemCapabilities.CanPreview) service_item.add_capability(ItemCapabilities.CanLoop) From 682e822d2196acdcb7f7a23843e29c9767f1567c Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 25 Sep 2011 08:27:09 +0100 Subject: [PATCH 29/77] Clean up --- openlp/core/ui/servicemanager.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 9f8073618..4b1049d49 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -663,6 +663,7 @@ class ServiceManager(QtGui.QWidget): serviceItem.renderer = self.mainwindow.renderer serviceItem.set_from_service(item, self.servicePath) self.validateItem(serviceItem) + self.loadItem_uuid = 0 if serviceItem.is_capable(ItemCapabilities.OnLoadUpdate): Receiver.send_message(u'%s_service_load' % serviceItem.name.lower(), serviceItem) @@ -1124,14 +1125,9 @@ class ServiceManager(QtGui.QWidget): def serviceItemUpdate(self, message): """ Triggered from plugins to update service items. + Save the values as they will be used as part of the service load """ - editId, uuid = message.split(u':') - self.loadItem_uuid = uuid - self.loadItem_editId = editId - for item in self.serviceItems: - if item[u'service_item']._uuid == uuid: - item[u'service_item'].edit_id = int(editId) - self.setModified() + self.loadItem_editId, self.loadItem_uuid = message.split(u':') def replaceServiceItem(self, newItem): """ From 8c6fcfcd4a7bd21a98b91cd434b503c2bc984e5a Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 26 Sep 2011 17:12:40 +0100 Subject: [PATCH 30/77] Fix typing error --- openlp/core/lib/serviceitem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index d8808503f..3170e0a93 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -87,7 +87,6 @@ class ServiceItem(object): if plugin: self.renderer = plugin.renderer self.name = plugin.name - self.from_service = False if plugin else False self.title = u'' self.shortname = u'' self.audit = u'' @@ -116,6 +115,7 @@ class ServiceItem(object): self.start_time = 0 self.end_time = 0 self.media_length = 0 + self.from_service = False self.image_border = u'#000000' self.background_audio = [] self._new_item() From 3a2be026f5c47ec194522e7dad55c3386cf3664a Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 26 Sep 2011 18:25:22 +0200 Subject: [PATCH 31/77] reverted some changes --- openlp/core/lib/renderer.py | 78 +++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index b5646bc5d..2b799d62c 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -227,46 +227,50 @@ class Renderer(object): # Songs and Custom elif item.is_capable(ItemCapabilities.CanSoftBreak): pages = [] - while True: - slides = text.split(u'\n[---]\n', 2) - # If there are (at least) two occurrences of [---] we use - # the first two slides (and neglect the last for now). - if len(slides) == 3: - html_text = expand_tags(u'\n'.join(slides[:2])) - # We check both slides to determine if the virtual break is - # needed (there is only one virtual break). - else: - html_text = expand_tags(u'\n'.join(slides)) - html_text = html_text.replace(u'\n', u'
') - if self._text_fits_on_slide(html_text): - # The first two virtual slides fit (as a whole) on one - # slide. Replace the first occurrence of [---]. - text = text.replace(u'\n[---]', u'', 1) - else: - # The first virtual slide fits, which means we have to - # render the first virtual slide. - text_contains_break = u'[---]' in text - if text_contains_break: - text_to_render, text = text.split(u'\n[---]\n', 1) + if u'[---]' in text: + while True: + slides = text.split(u'\n[---]\n', 2) + # If there are (at least) two occurrences of [---] we use + # the first two slides (and neglect the last for now). + if len(slides) == 3: + html_text = expand_tags(u'\n'.join(slides[:2])) + # We check both slides to determine if the virtual break is + # needed (there is only one virtual break). else: - text_to_render = text - text = u'' - lines = text_to_render.strip(u'\n').split(u'\n') - slides = self._paginate_slide(lines, line_end) - if len(slides) > 1 and text: - # Add all slides apart from the last one the list. - pages.extend(slides[:-1]) - if text_contains_break: - text = slides[-1] + u'\n[---]\n' + text + html_text = expand_tags(u'\n'.join(slides)) + html_text = html_text.replace(u'\n', u'
') + if self._text_fits_on_slide(html_text): + # The first two virtual slides fit (as a whole) on one + # slide. Replace the first occurrence of [---]. + text = text.replace(u'\n[---]', u'', 1) + else: + # The first virtual slide fits, which means we have to + # render the first virtual slide. + text_contains_break = u'[---]' in text + if text_contains_break: + text_to_render, text = text.split(u'\n[---]\n', 1) else: - text = slides[-1] + u'\n'+ text - text = text.replace(u'
', u'\n') + text_to_render = text + text = u'' + lines = text_to_render.strip(u'\n').split(u'\n') + slides = self._paginate_slide(lines, line_end) + if len(slides) > 1 and text: + # Add all slides apart from the last one the list. + pages.extend(slides[:-1]) + if text_contains_break: + text = slides[-1] + u'\n[---]\n' + text + else: + text = slides[-1] + u'\n'+ text + text = text.replace(u'
', u'\n') + else: + pages.extend(slides) + if u'[---]' not in text: + lines = text.strip(u'\n').split(u'\n') + pages.extend(self._paginate_slide(lines, line_end)) + break else: - pages.extend(slides) - if u'[---]' not in text: - lines = text.strip(u'\n').split(u'\n') - pages.extend(self._paginate_slide(lines, line_end)) - break + pages = self._paginate_slide( + text.split(u'\n'), line_end) else: # Clean up line endings. pages = self._paginate_slide(text.split(u'\n'), line_end) From c9b7b55a8796ae81ccc178a2d0f775eae4f2bd86 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 26 Sep 2011 18:46:11 +0200 Subject: [PATCH 32/77] reverted some changes --- openlp/core/lib/renderer.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 2b799d62c..e64c80f55 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -268,9 +268,6 @@ class Renderer(object): lines = text.strip(u'\n').split(u'\n') pages.extend(self._paginate_slide(lines, line_end)) break - else: - pages = self._paginate_slide( - text.split(u'\n'), line_end) else: # Clean up line endings. pages = self._paginate_slide(text.split(u'\n'), line_end) From 9a40b27672487589c60ae1bd684f6f2f745d7507 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 26 Sep 2011 18:57:32 +0200 Subject: [PATCH 33/77] fix for theme editing --- openlp/core/lib/renderer.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index e64c80f55..9dd359769 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -271,6 +271,8 @@ class Renderer(object): else: # Clean up line endings. pages = self._paginate_slide(text.split(u'\n'), line_end) + else: + pages = self._paginate_slide(text.split(u'\n'), line_end) new_pages = [] for page in pages: while page.endswith(u'
'): From 7fe57a9a5d896d12aeab691783eb30dbc2ca64bf Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 26 Sep 2011 19:12:27 +0100 Subject: [PATCH 34/77] Make Int --- openlp/core/ui/servicemanager.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 4b1049d49..7d9073ca7 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -1127,7 +1127,8 @@ class ServiceManager(QtGui.QWidget): Triggered from plugins to update service items. Save the values as they will be used as part of the service load """ - self.loadItem_editId, self.loadItem_uuid = message.split(u':') + self.loadItem_editId, uuid = message.split(u':') + self.loadItem_uuid = int(uuid) def replaceServiceItem(self, newItem): """ From 947a58dbbe962f4135936adbb0035092b8b404d7 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 26 Sep 2011 20:26:13 +0200 Subject: [PATCH 35/77] improved line counting --- openlp/core/lib/renderer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 9dd359769..1eb6896e9 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -44,6 +44,8 @@ VERSE = u'The Lord said to {r}Noah{/r}: \n' \ 'Get those children out of the muddy, muddy \n' \ '{r}C{/r}{b}h{/b}{bl}i{/bl}{y}l{/y}{g}d{/g}{pk}' \ 'r{/pk}{o}e{/o}{pp}n{/pp} of the Lord\n' +VERSE_FOR_LINE_COUNT = u'1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15' \ + '\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33' FOOTER = [u'Arky Arky (Unknown)', u'Public Domain', u'CCLI 123456'] class Renderer(object): @@ -190,7 +192,7 @@ class Renderer(object): serviceItem.theme = theme_data if self.force_page: # make big page for theme edit dialog to get line count - serviceItem.add_from_text(u'', VERSE + VERSE + VERSE) + serviceItem.add_from_text(u'', VERSE_FOR_LINE_COUNT) else: self.imageManager.del_image(theme_data.theme_name) serviceItem.add_from_text(u'', VERSE) From 695e08a63a1af53b4c0a218099e45be3d26a3ca7 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 26 Sep 2011 19:56:52 +0100 Subject: [PATCH 36/77] get the right field --- openlp/core/ui/servicemanager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 7d9073ca7..c9f058351 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -1127,8 +1127,8 @@ class ServiceManager(QtGui.QWidget): Triggered from plugins to update service items. Save the values as they will be used as part of the service load """ - self.loadItem_editId, uuid = message.split(u':') - self.loadItem_uuid = int(uuid) + editId, self.loadItem_uuid = message.split(u':') + self.loadItem_editId = int(editId) def replaceServiceItem(self, newItem): """ From 3e2e87bb2c6686753486294f9fb6650a8d921234 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Tue, 27 Sep 2011 20:37:34 +0100 Subject: [PATCH 37/77] Initial stab Fixes: https://launchpad.net/bugs/814201 --- openlp/core/ui/themeform.py | 34 ++++++++++++++++++++++++++++++++++ openlp/core/ui/themewizard.py | 15 +++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index dc3c23d0d..5de7a239e 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -229,6 +229,8 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): """ Detects Page changes and updates as approprate. """ + if self.page(pageId) == self.areaPositionPage: + self._generate_layout() if self.page(pageId) == self.previewPage: self.updateTheme() frame = self.thememanager.generateImage(self.theme) @@ -236,6 +238,38 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): self.displayAspectRatio = float(frame.width()) / frame.height() self.resizeEvent() + def _generate_layout(self): + width = self.thememanager.mainwindow.renderer.width + height = self.thememanager.mainwindow.renderer.height + footer_start = int(height * 0.90) + pixmap = QtGui.QPixmap(width, height) + pixmap.fill(QtCore.Qt.white) + paint = QtGui.QPainter(pixmap) + paint.setPen(QtCore.Qt.blue) + if not self.theme.font_main_override: + main_rect = QtCore.QRect(10, 0, width - 20, footer_start) + else: + main_rect = QtCore.QRect(self.theme.font_main_x, self.theme.font_main_y, + self.theme.font_main_width - 1, self.theme.font_main_height - 1) + paint.drawRect(main_rect) + paint.setPen(QtCore.Qt.red) + if not self.theme.font_footer_override: + footer_rect = QtCore.QRect(10, footer_start, width - 20, + height - footer_start) + else: + footer_rect = QtCore.QRect(self.theme.font_footer_x, + self.theme.font_footer_y, self.theme.font_footer_width - 1, + self.theme.font_footer_height - 1) + print footer_rect + paint.drawRect(footer_rect) + paint.end() + pixmap = pixmap.scaled(100, 100 * + self.thememanager.mainwindow.renderer.screen_ratio, + QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation) + self.themeLayoutLabel.setPixmap(pixmap) + self.displayAspectRatio = float(pixmap.width()) / pixmap.height() + self.resizeEvent() + def onOutlineCheckCheckBoxStateChanged(self, state): """ Change state as Outline check box changed diff --git a/openlp/core/ui/themewizard.py b/openlp/core/ui/themewizard.py index c7cba0ebd..12ae97d0d 100644 --- a/openlp/core/ui/themewizard.py +++ b/openlp/core/ui/themewizard.py @@ -336,6 +336,21 @@ class Ui_ThemeWizard(object): self.footerPositionLayout.addRow(self.footerHeightLabel, self.footerHeightSpinBox) self.areaPositionLayout.addWidget(self.footerPositionGroupBox) + self.layoutArea = QtGui.QWidget(self.areaPositionPage) + self.layoutArea.setObjectName(u'LayoutArea') + self.themeLayoutPreview = QtGui.QGridLayout(self.layoutArea) + self.themeLayoutPreview.setMargin(0) + self.themeLayoutPreview.setColumnStretch(0, 1) + self.themeLayoutPreview.setRowStretch(0, 1) + self.themeLayoutLabel = QtGui.QLabel(self.areaPositionPage) + self.themeLayoutLabel.setObjectName(u'ThemeLayoutPreview') + self.themeLayoutLabel.setObjectName(u'ThemeLayoutPreview') + self.themeLayoutLabel = QtGui.QLabel(self.layoutArea) + self.themeLayoutLabel.setFrameShape(QtGui.QFrame.Box) + self.themeLayoutLabel.setScaledContents(True) + self.themeLayoutLabel.setObjectName(u'ThemeLayoutLabel') + self.areaPositionLayout.addWidget(self.themeLayoutLabel) + self.areaPositionLayout.addWidget(self.layoutArea) themeWizard.addPage(self.areaPositionPage) # Preview Page self.previewPage = QtGui.QWizardPage() From 632e2ce2dd1acf21838450040365ec10158d49d0 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 28 Sep 2011 05:50:56 +0100 Subject: [PATCH 38/77] More fixes --- openlp/core/ui/themeform.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index 5de7a239e..63dc542fa 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -245,14 +245,14 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): pixmap = QtGui.QPixmap(width, height) pixmap.fill(QtCore.Qt.white) paint = QtGui.QPainter(pixmap) - paint.setPen(QtCore.Qt.blue) + paint.setPen(QtGui.QPen(QtCore.Qt.blue)) if not self.theme.font_main_override: main_rect = QtCore.QRect(10, 0, width - 20, footer_start) else: main_rect = QtCore.QRect(self.theme.font_main_x, self.theme.font_main_y, self.theme.font_main_width - 1, self.theme.font_main_height - 1) paint.drawRect(main_rect) - paint.setPen(QtCore.Qt.red) + paint.setPen(QtGui.QPen(QtCore.Qt.red)) if not self.theme.font_footer_override: footer_rect = QtCore.QRect(10, footer_start, width - 20, height - footer_start) @@ -260,12 +260,9 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): footer_rect = QtCore.QRect(self.theme.font_footer_x, self.theme.font_footer_y, self.theme.font_footer_width - 1, self.theme.font_footer_height - 1) - print footer_rect paint.drawRect(footer_rect) paint.end() - pixmap = pixmap.scaled(100, 100 * - self.thememanager.mainwindow.renderer.screen_ratio, - QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation) + pixmap = pixmap.scaledToWidth(100, QtCore.Qt.SmoothTransformation) self.themeLayoutLabel.setPixmap(pixmap) self.displayAspectRatio = float(pixmap.width()) / pixmap.height() self.resizeEvent() @@ -303,6 +300,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): """ if self.updateThemeAllowed: self.theme.font_main_override = not (value == QtCore.Qt.Checked) + self._generate_layout() def onFooterPositionCheckBoxStateChanged(self, value): """ @@ -311,6 +309,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): """ if self.updateThemeAllowed: self.theme.font_footer_override = not (value == QtCore.Qt.Checked) + self._generate_layout() def exec_(self, edit=False): """ From ff32139b2e278791753868255efa941713f4e0aa Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 28 Sep 2011 18:39:26 +0100 Subject: [PATCH 39/77] refactor code to stop duplicate code --- openlp/core/lib/renderer.py | 28 +++++++++++++++++++----- openlp/core/ui/themeform.py | 18 +++------------ openlp/plugins/remotes/lib/httpserver.py | 2 +- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 6d48707b4..dce5b38ee 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -306,19 +306,37 @@ class Renderer(object): log.debug(u'_build_text_rectangle') main_rect = None footer_rect = None + main_rect = self.get_main_rectangle(theme) + footer_rect = self.get_main_rectangle(theme) + self._set_text_rectangle(main_rect, footer_rect) + + def get_main_rectangle(self, theme): + """ + Calculates the placement and size of the main rectangle + + ``theme`` + The theme information + """ if not theme.font_main_override: - main_rect = QtCore.QRect(10, 0, self.width - 20, self.footer_start) + return QtCore.QRect(10, 0, self.width - 20, self.footer_start) else: - main_rect = QtCore.QRect(theme.font_main_x, theme.font_main_y, + return QtCore.QRect(theme.font_main_x, theme.font_main_y, theme.font_main_width - 1, theme.font_main_height - 1) + + def get_footer_rectangle(self, theme): + """ + Calculates the placement and size of the main rectangle + + ``theme`` + The theme information + """ if not theme.font_footer_override: - footer_rect = QtCore.QRect(10, self.footer_start, self.width - 20, + return QtCore.QRect(10, self.footer_start, self.width - 20, self.height - self.footer_start) else: - footer_rect = QtCore.QRect(theme.font_footer_x, + return QtCore.QRect(theme.font_footer_x, theme.font_footer_y, theme.font_footer_width - 1, theme.font_footer_height - 1) - self._set_text_rectangle(main_rect, footer_rect) def _set_text_rectangle(self, rect_main, rect_footer): """ diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index 63dc542fa..0d4aeff32 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -246,23 +246,11 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): pixmap.fill(QtCore.Qt.white) paint = QtGui.QPainter(pixmap) paint.setPen(QtGui.QPen(QtCore.Qt.blue)) - if not self.theme.font_main_override: - main_rect = QtCore.QRect(10, 0, width - 20, footer_start) - else: - main_rect = QtCore.QRect(self.theme.font_main_x, self.theme.font_main_y, - self.theme.font_main_width - 1, self.theme.font_main_height - 1) - paint.drawRect(main_rect) + paint.drawRect(self.thememanager.mainwindow.renderer.get_main_rectangle(self.theme)) paint.setPen(QtGui.QPen(QtCore.Qt.red)) - if not self.theme.font_footer_override: - footer_rect = QtCore.QRect(10, footer_start, width - 20, - height - footer_start) - else: - footer_rect = QtCore.QRect(self.theme.font_footer_x, - self.theme.font_footer_y, self.theme.font_footer_width - 1, - self.theme.font_footer_height - 1) - paint.drawRect(footer_rect) + paint.drawRect(self.thememanager.mainwindow.renderer.get_footer_rectangle(self.theme)) paint.end() - pixmap = pixmap.scaledToWidth(100, QtCore.Qt.SmoothTransformation) + pixmap = pixmap.scaledToWidth(200, QtCore.Qt.SmoothTransformation) self.themeLayoutLabel.setPixmap(pixmap) self.displayAspectRatio = float(pixmap.width()) / pixmap.height() self.resizeEvent() diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index c81c83d92..a01691284 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -315,7 +315,7 @@ class HttpConnection(object): """ log.debug(u'ready to read socket') if self.socket.canReadLine(): - data = unicode(self.socket.readLine()) + data = unicode(self.socket.readLine()).encode(u'utf-8') log.debug(u'received: ' + data) words = data.split(u' ') response = None From 9142ffb4881d8743691523c19e33dd02593b01bd Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 28 Sep 2011 21:43:30 +0100 Subject: [PATCH 40/77] more visible lines --- openlp/core/lib/renderer.py | 2 -- openlp/core/ui/themeform.py | 5 ++--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index dce5b38ee..3d0d1e080 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -304,8 +304,6 @@ class Renderer(object): The theme to build a text block for. """ log.debug(u'_build_text_rectangle') - main_rect = None - footer_rect = None main_rect = self.get_main_rectangle(theme) footer_rect = self.get_main_rectangle(theme) self._set_text_rectangle(main_rect, footer_rect) diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index 0d4aeff32..114d541f5 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -241,13 +241,12 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): def _generate_layout(self): width = self.thememanager.mainwindow.renderer.width height = self.thememanager.mainwindow.renderer.height - footer_start = int(height * 0.90) pixmap = QtGui.QPixmap(width, height) pixmap.fill(QtCore.Qt.white) paint = QtGui.QPainter(pixmap) - paint.setPen(QtGui.QPen(QtCore.Qt.blue)) + paint.setPen(QtGui.QPen(QtCore.Qt.blue, 2)) paint.drawRect(self.thememanager.mainwindow.renderer.get_main_rectangle(self.theme)) - paint.setPen(QtGui.QPen(QtCore.Qt.red)) + paint.setPen(QtGui.QPen(QtCore.Qt.red, 2)) paint.drawRect(self.thememanager.mainwindow.renderer.get_footer_rectangle(self.theme)) paint.end() pixmap = pixmap.scaledToWidth(200, QtCore.Qt.SmoothTransformation) From 128b6b80bf9139e276795270a0bea3a0ec4e63c7 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 29 Sep 2011 18:57:48 +0100 Subject: [PATCH 41/77] Display now works --- openlp/core/ui/themeform.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index 114d541f5..743b0ca2d 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -249,7 +249,8 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): paint.setPen(QtGui.QPen(QtCore.Qt.red, 2)) paint.drawRect(self.thememanager.mainwindow.renderer.get_footer_rectangle(self.theme)) paint.end() - pixmap = pixmap.scaledToWidth(200, QtCore.Qt.SmoothTransformation) + pixmap = pixmap.scaledToHeight(150, QtCore.Qt.SmoothTransformation) + self.themeLayoutLabel.setFixedSize(pixmap.width() + 2, pixmap.height() + 2) self.themeLayoutLabel.setPixmap(pixmap) self.displayAspectRatio = float(pixmap.width()) / pixmap.height() self.resizeEvent() From d8fc6cd4dd6fe8716280b25a42c188802b8b4d44 Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Fri, 30 Sep 2011 17:45:59 -0400 Subject: [PATCH 42/77] Added additional desctiption to OpenLyrics import selection and added code to select xml files for import --- openlp/core/ui/wizard.py | 2 +- openlp/plugins/songs/forms/songimportform.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/wizard.py b/openlp/core/ui/wizard.py index 9d8a106ed..40591872b 100644 --- a/openlp/core/ui/wizard.py +++ b/openlp/core/ui/wizard.py @@ -49,7 +49,7 @@ class WizardStrings(object): EW = u'EasyWorship' ES = u'EasiSlides' FP = u'Foilpresenter' - OL = u'OpenLyrics' + OL = u'OpenLyrics or OpenLP 2.0 Exported Song' OS = u'OpenSong' OSIS = u'OSIS' SB = u'SongBeamer' diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index 6f09c9b8c..f3f7b1fce 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -508,7 +508,8 @@ class SongImportForm(OpenLPWizard): Get OpenLyrics song database files """ self.getFiles(WizardStrings.OpenTypeFile % WizardStrings.OL, - self.openLyricsFileListWidget) + self.openLyricsFileListWidget, u'%s (*.xml)' % + translate('SongsPlugin.ImportWizardForm', 'OpenLyrics Files')) def onOpenLyricsRemoveButtonClicked(self): """ From 648c5159a190e235be90109dd0311448ad168788 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 1 Oct 2011 17:34:09 +0530 Subject: [PATCH 44/77] Allow the stageview time to be formatted between 12 and 24 hours Fixes: https://launchpad.net/bugs/863841 --- openlp/plugins/remotes/html/stage.js | 6 +++--- openlp/plugins/remotes/lib/httpserver.py | 4 +++- openlp/plugins/remotes/lib/remotetab.py | 21 +++++++++++++++++++++ 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/openlp/plugins/remotes/html/stage.js b/openlp/plugins/remotes/html/stage.js index 09c82c49b..8db92b39a 100644 --- a/openlp/plugins/remotes/html/stage.js +++ b/openlp/plugins/remotes/html/stage.js @@ -121,11 +121,11 @@ window.OpenLP = { $("#nextslide").html(text); } }, - updateClock: function() { + updateClock: function(data) { var div = $("#clock"); var t = new Date(); var h = t.getHours(); - if (h > 12) + if (data.results.twelve && h > 12) h = h - 12; var m = t.getMinutes(); if (m < 10) @@ -136,7 +136,7 @@ window.OpenLP = { $.getJSON( "/api/poll", function (data, status) { - OpenLP.updateClock(); + OpenLP.updateClock(data); if (OpenLP.currentItem != data.results.item) { OpenLP.currentItem = data.results.item; OpenLP.loadSlides(); diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index a01691284..522c354b8 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -397,7 +397,9 @@ class HttpConnection(object): result = { u'slide': self.parent.current_slide or 0, u'item': self.parent.current_item._uuid \ - if self.parent.current_item else u'' + if self.parent.current_item else u'', + u'twelve':QtCore.QSettings().value( + u'remotes/twelve hour', QtCore.QVariant(True)).toBool() } return HttpResponse(json.dumps({u'results': result}), {u'Content-Type': u'application/json'}) diff --git a/openlp/plugins/remotes/lib/remotetab.py b/openlp/plugins/remotes/lib/remotetab.py index 03781ae06..d2b5659fe 100644 --- a/openlp/plugins/remotes/lib/remotetab.py +++ b/openlp/plugins/remotes/lib/remotetab.py @@ -57,6 +57,9 @@ class RemoteTab(SettingsTab): QtCore.QObject.connect(self.addressEdit, QtCore.SIGNAL(u'textChanged(const QString&)'), self.setUrls) self.serverSettingsLayout.addRow(self.addressLabel, self.addressEdit) + self.twelveHourCheckBox = QtGui.QCheckBox(self.serverSettingsGroupBox) + self.twelveHourCheckBox.setObjectName(u'twelveHourCheckBox') + self.serverSettingsLayout.addRow(self.twelveHourCheckBox) self.portLabel = QtGui.QLabel(self.serverSettingsGroupBox) self.portLabel.setObjectName(u'portLabel') self.portSpinBox = QtGui.QSpinBox(self.serverSettingsGroupBox) @@ -80,6 +83,9 @@ class RemoteTab(SettingsTab): self.leftLayout.addWidget(self.serverSettingsGroupBox) self.leftLayout.addStretch() self.rightLayout.addStretch() + QtCore.QObject.connect(self.twelveHourCheckBox, + QtCore.SIGNAL(u'stateChanged(int)'), + self.onTwelveHourCheckBoxChanged) def retranslateUi(self): self.serverSettingsGroupBox.setTitle( @@ -92,6 +98,9 @@ class RemoteTab(SettingsTab): 'Remote URL:')) self.stageUrlLabel.setText(translate('RemotePlugin.RemoteTab', 'Stage view URL:')) + self.twelveHourCheckBox.setText( + translate('RemotePlugin.RemoteTab', + 'Display stage time in 12hr format')) def setUrls(self): ipAddress = u'localhost' @@ -123,6 +132,10 @@ class RemoteTab(SettingsTab): self.addressEdit.setText( QtCore.QSettings().value(self.settingsSection + u'/ip address', QtCore.QVariant(ZERO_URL)).toString()) + self.twelveHour = QtCore.QSettings().value( + self.settingsSection + u'/twelve hour', + QtCore.QVariant(True)).toBool() + self.twelveHourCheckBox.setChecked(self.twelveHour) self.setUrls() def save(self): @@ -130,3 +143,11 @@ class RemoteTab(SettingsTab): QtCore.QVariant(self.portSpinBox.value())) QtCore.QSettings().setValue(self.settingsSection + u'/ip address', QtCore.QVariant(self.addressEdit.text())) + QtCore.QSettings().setValue(self.settingsSection + u'/twelve hour', + QtCore.QVariant(self.twelveHour)) + + def onTwelveHourCheckBoxChanged(self, check_state): + self.twelveHour = False + # we have a set value convert to True/False + if check_state == QtCore.Qt.Checked: + self.twelveHour = True From dc41fa4318e4be18e0d83c4779049b06b31e7acd Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Sat, 1 Oct 2011 10:34:30 -0400 Subject: [PATCH 45/77] Added coded to translate the modified OpenLyrics import description --- openlp/plugins/songs/forms/songimportform.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index f3f7b1fce..72048e409 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -240,8 +240,8 @@ class SongImportForm(OpenLPWizard): self.formatLabel.setText(WizardStrings.FormatLabel) self.formatComboBox.setItemText(SongFormat.OpenLP2, UiStrings().OLPV2) self.formatComboBox.setItemText(SongFormat.OpenLP1, UiStrings().OLPV1) - self.formatComboBox.setItemText( - SongFormat.OpenLyrics, WizardStrings.OL) + self.formatComboBox.setItemText(SongFormat.OpenLyrics, + translate('SongsPlugin.ImportWizardForm', WizardStrings.OL)) self.formatComboBox.setItemText(SongFormat.OpenSong, WizardStrings.OS) self.formatComboBox.setItemText( SongFormat.WordsOfWorship, WizardStrings.WoW) From 9b5074991ce895696c5837495e77c1b883b7ce6e Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 1 Oct 2011 21:33:53 +0100 Subject: [PATCH 46/77] Add new dialog --- openlp/core/ui/themeform.py | 11 +++++++---- openlp/core/ui/themewizard.py | 21 +++++---------------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index 743b0ca2d..1ac2cf754 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -230,7 +230,10 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): Detects Page changes and updates as approprate. """ if self.page(pageId) == self.areaPositionPage: + self.setOption(QtGui.QWizard.HaveCustomButton1, True) self._generate_layout() + else: + self.setOption(QtGui.QWizard.HaveCustomButton1, False) if self.page(pageId) == self.previewPage: self.updateTheme() frame = self.thememanager.generateImage(self.theme) @@ -250,10 +253,10 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): paint.drawRect(self.thememanager.mainwindow.renderer.get_footer_rectangle(self.theme)) paint.end() pixmap = pixmap.scaledToHeight(150, QtCore.Qt.SmoothTransformation) - self.themeLayoutLabel.setFixedSize(pixmap.width() + 2, pixmap.height() + 2) - self.themeLayoutLabel.setPixmap(pixmap) - self.displayAspectRatio = float(pixmap.width()) / pixmap.height() - self.resizeEvent() + #self.themeLayoutLabel.setFixedSize(pixmap.width() + 2, pixmap.height() + 2) + #self.themeLayoutLabel.setPixmap(pixmap) + #self.displayAspectRatio = float(pixmap.width()) / pixmap.height() + #self.resizeEvent() def onOutlineCheckCheckBoxStateChanged(self, state): """ diff --git a/openlp/core/ui/themewizard.py b/openlp/core/ui/themewizard.py index 12ae97d0d..76b9ba3a8 100644 --- a/openlp/core/ui/themewizard.py +++ b/openlp/core/ui/themewizard.py @@ -38,7 +38,8 @@ class Ui_ThemeWizard(object): themeWizard.setModal(True) themeWizard.setWizardStyle(QtGui.QWizard.ModernStyle) themeWizard.setOptions(QtGui.QWizard.IndependentPages | - QtGui.QWizard.NoBackButtonOnStartPage) + QtGui.QWizard.NoBackButtonOnStartPage | + QtGui.QWizard.HaveCustomButton1) self.spacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum) # Welcome Page @@ -336,21 +337,6 @@ class Ui_ThemeWizard(object): self.footerPositionLayout.addRow(self.footerHeightLabel, self.footerHeightSpinBox) self.areaPositionLayout.addWidget(self.footerPositionGroupBox) - self.layoutArea = QtGui.QWidget(self.areaPositionPage) - self.layoutArea.setObjectName(u'LayoutArea') - self.themeLayoutPreview = QtGui.QGridLayout(self.layoutArea) - self.themeLayoutPreview.setMargin(0) - self.themeLayoutPreview.setColumnStretch(0, 1) - self.themeLayoutPreview.setRowStretch(0, 1) - self.themeLayoutLabel = QtGui.QLabel(self.areaPositionPage) - self.themeLayoutLabel.setObjectName(u'ThemeLayoutPreview') - self.themeLayoutLabel.setObjectName(u'ThemeLayoutPreview') - self.themeLayoutLabel = QtGui.QLabel(self.layoutArea) - self.themeLayoutLabel.setFrameShape(QtGui.QFrame.Box) - self.themeLayoutLabel.setScaledContents(True) - self.themeLayoutLabel.setObjectName(u'ThemeLayoutLabel') - self.areaPositionLayout.addWidget(self.themeLayoutLabel) - self.areaPositionLayout.addWidget(self.layoutArea) themeWizard.addPage(self.areaPositionPage) # Preview Page self.previewPage = QtGui.QWizardPage() @@ -550,6 +536,9 @@ class Ui_ThemeWizard(object): translate('OpenLP.ThemeWizard', 'px')) self.footerPositionCheckBox.setText( translate('OpenLP.ThemeWizard', 'Use default location')) + themeWizard.setOption(QtGui.QWizard.HaveCustomButton1, False) + themeWizard.setButtonText(QtGui.QWizard.CustomButton1, + translate('OpenLP.ThemeWizard', 'Preview')) self.previewPage.setTitle( translate('OpenLP.ThemeWizard', 'Save and Preview')) self.previewPage.setSubTitle( From 297a25001031925f19f48ea2a51eba432dafe8ac Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 2 Oct 2011 08:52:28 +0100 Subject: [PATCH 47/77] Display works but bigggggggggg --- openlp/core/ui/__init__.py | 1 + openlp/core/ui/themeform.py | 21 ++++---- openlp/core/ui/themelayoutdialog.py | 65 +++++++++++++++++++++++ openlp/core/ui/themelayoutform.py | 54 +++++++++++++++++++ resources/forms/themelayout.ui | 81 +++++++++++++++++++++++++++++ 5 files changed, 213 insertions(+), 9 deletions(-) create mode 100644 openlp/core/ui/themelayoutdialog.py create mode 100644 openlp/core/ui/themelayoutform.py create mode 100644 resources/forms/themelayout.ui diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index e754480e0..7d2dfa0ba 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -54,6 +54,7 @@ class HideMode(object): from firsttimeform import FirstTimeForm from firsttimelanguageform import FirstTimeLanguageForm +from themelayoutform import ThemeLayoutForm from themeform import ThemeForm from filerenameform import FileRenameForm from starttimeform import StartTimeForm diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index 1ac2cf754..cbb83073d 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -33,6 +33,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import Receiver, translate from openlp.core.lib.theme import BackgroundType, BackgroundGradientType from openlp.core.lib.ui import UiStrings, critical_error_message_box +from openlp.core.ui import ThemeLayoutForm from openlp.core.utils import get_images_filter from themewizard import Ui_ThemeWizard @@ -58,6 +59,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): self.registerFields() self.updateThemeAllowed = True self.temp_background_filename = u'' + self.themeLayoutForm = ThemeLayoutForm(self) QtCore.QObject.connect(self.backgroundComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'), self.onBackgroundComboBoxCurrentIndexChanged) @@ -88,6 +90,9 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): self.onShadowCheckCheckBoxStateChanged) QtCore.QObject.connect(self.footerColorButton, QtCore.SIGNAL(u'clicked()'), self.onFooterColorButtonClicked) + QtCore.QObject.connect(self, + QtCore.SIGNAL(u'customButtonClicked(int)'), + self.onCustom1ButtonClicked) QtCore.QObject.connect(self.mainPositionCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onMainPositionCheckBoxStateChanged) @@ -231,7 +236,6 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): """ if self.page(pageId) == self.areaPositionPage: self.setOption(QtGui.QWizard.HaveCustomButton1, True) - self._generate_layout() else: self.setOption(QtGui.QWizard.HaveCustomButton1, False) if self.page(pageId) == self.previewPage: @@ -241,22 +245,21 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): self.displayAspectRatio = float(frame.width()) / frame.height() self.resizeEvent() - def _generate_layout(self): + def onCustom1ButtonClicked(self, number): width = self.thememanager.mainwindow.renderer.width height = self.thememanager.mainwindow.renderer.height pixmap = QtGui.QPixmap(width, height) pixmap.fill(QtCore.Qt.white) paint = QtGui.QPainter(pixmap) paint.setPen(QtGui.QPen(QtCore.Qt.blue, 2)) - paint.drawRect(self.thememanager.mainwindow.renderer.get_main_rectangle(self.theme)) + paint.drawRect(self.thememanager.mainwindow.renderer. + get_main_rectangle(self.theme)) paint.setPen(QtGui.QPen(QtCore.Qt.red, 2)) - paint.drawRect(self.thememanager.mainwindow.renderer.get_footer_rectangle(self.theme)) + paint.drawRect(self.thememanager.mainwindow.renderer. + get_footer_rectangle(self.theme)) paint.end() - pixmap = pixmap.scaledToHeight(150, QtCore.Qt.SmoothTransformation) - #self.themeLayoutLabel.setFixedSize(pixmap.width() + 2, pixmap.height() + 2) - #self.themeLayoutLabel.setPixmap(pixmap) - #self.displayAspectRatio = float(pixmap.width()) / pixmap.height() - #self.resizeEvent() + self.themeLayoutForm.exec_(pixmap) + def onOutlineCheckCheckBoxStateChanged(self, state): """ diff --git a/openlp/core/ui/themelayoutdialog.py b/openlp/core/ui/themelayoutdialog.py new file mode 100644 index 000000000..d9770be23 --- /dev/null +++ b/openlp/core/ui/themelayoutdialog.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2011 Raoul Snyman # +# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # +# Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # +# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # +# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### + +from PyQt4 import QtCore, QtGui + +from openlp.core.lib import translate +from openlp.core.lib.ui import create_accept_reject_button_box + + +class Ui_ThemeLayoutDialog(object): + def setupUi(self, themeLayoutDialog): + themeLayoutDialog.setObjectName(u'themeLayoutDialogDialog') + themeLayoutDialog.resize(300, 200) + self.previewLayout = QtGui.QVBoxLayout(themeLayoutDialog) + self.previewLayout.setObjectName(u'PreviewLayout') + self.previewArea = QtGui.QWidget(themeLayoutDialog) + self.previewArea.setObjectName(u'PreviewArea') + self.previewAreaLayout = QtGui.QGridLayout(self.previewArea) + self.previewAreaLayout.setMargin(0) + self.previewAreaLayout.setColumnStretch(0, 1) + self.previewAreaLayout.setRowStretch(0, 1) + self.previewAreaLayout.setObjectName(u'PreviewAreaLayout') + self.themeDisplayLabel = QtGui.QLabel(self.previewArea) + self.themeDisplayLabel.setFrameShape(QtGui.QFrame.Box) + self.themeDisplayLabel.setScaledContents(True) + self.themeDisplayLabel.setObjectName(u'ThemeDisplayLabel') + self.previewAreaLayout.addWidget(self.themeDisplayLabel) + self.previewLayout.addWidget(self.previewArea) + self.buttonBox = QtGui.QDialogButtonBox(themeLayoutDialog) + self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) + self.buttonBox.setObjectName(u'ButtonBox') + QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'), + themeLayoutDialog.accept) + self.previewLayout.addWidget(self.buttonBox) + self.retranslateUi(themeLayoutDialog) + QtCore.QMetaObject.connectSlotsByName(themeLayoutDialog) + + def retranslateUi(self, themeLayoutDialog): + themeLayoutDialog.setWindowTitle( + translate('OpenLP.StartTimeForm', 'Theme Layout')) + diff --git a/openlp/core/ui/themelayoutform.py b/openlp/core/ui/themelayoutform.py new file mode 100644 index 000000000..b1984c01a --- /dev/null +++ b/openlp/core/ui/themelayoutform.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2011 Raoul Snyman # +# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # +# Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # +# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # +# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### + +from PyQt4 import QtGui, QtCore + +from themelayoutdialog import Ui_ThemeLayoutDialog + +from openlp.core.lib import translate +from openlp.core.lib.ui import UiStrings, critical_error_message_box + +class ThemeLayoutForm(QtGui.QDialog, Ui_ThemeLayoutDialog): + """ + The exception dialog + """ + def __init__(self, parent): + QtGui.QDialog.__init__(self, parent) + self.setupUi(self) + + def exec_(self, image): + """ + Run the Dialog with correct heading. + """ + pixmap = image.scaledToHeight(150, QtCore.Qt.SmoothTransformation) + self.themeDisplayLabel.setPixmap(image) + return QtGui.QDialog.exec_(self) + + def accept(self): + return QtGui.QDialog.accept(self) + + diff --git a/resources/forms/themelayout.ui b/resources/forms/themelayout.ui new file mode 100644 index 000000000..2152fc5d0 --- /dev/null +++ b/resources/forms/themelayout.ui @@ -0,0 +1,81 @@ + + + ThemeLayout + + + + 0 + 0 + 400 + 300 + + + + Theme Layout + + + + + 50 + 260 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 20 + 10 + 361 + 231 + + + + + + + + + + + buttonBox + accepted() + ThemeLayout + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + ThemeLayout + reject() + + + 316 + 260 + + + 286 + 274 + + + + + From 6426d9aac4e01a8bff73b35916afb62df28350a1 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 2 Oct 2011 17:38:05 +0100 Subject: [PATCH 48/77] Display is now big enough --- openlp/core/ui/themeform.py | 6 +++--- openlp/core/ui/themelayoutdialog.py | 2 +- openlp/core/ui/themelayoutform.py | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index cbb83073d..064652488 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -246,6 +246,9 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): self.resizeEvent() def onCustom1ButtonClicked(self, number): + """ + Generate layout preview and display the form + """ width = self.thememanager.mainwindow.renderer.width height = self.thememanager.mainwindow.renderer.height pixmap = QtGui.QPixmap(width, height) @@ -260,7 +263,6 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): paint.end() self.themeLayoutForm.exec_(pixmap) - def onOutlineCheckCheckBoxStateChanged(self, state): """ Change state as Outline check box changed @@ -294,7 +296,6 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): """ if self.updateThemeAllowed: self.theme.font_main_override = not (value == QtCore.Qt.Checked) - self._generate_layout() def onFooterPositionCheckBoxStateChanged(self, value): """ @@ -303,7 +304,6 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): """ if self.updateThemeAllowed: self.theme.font_footer_override = not (value == QtCore.Qt.Checked) - self._generate_layout() def exec_(self, edit=False): """ diff --git a/openlp/core/ui/themelayoutdialog.py b/openlp/core/ui/themelayoutdialog.py index d9770be23..58c09fb26 100644 --- a/openlp/core/ui/themelayoutdialog.py +++ b/openlp/core/ui/themelayoutdialog.py @@ -34,7 +34,7 @@ from openlp.core.lib.ui import create_accept_reject_button_box class Ui_ThemeLayoutDialog(object): def setupUi(self, themeLayoutDialog): themeLayoutDialog.setObjectName(u'themeLayoutDialogDialog') - themeLayoutDialog.resize(300, 200) + #themeLayoutDialog.resize(300, 200) self.previewLayout = QtGui.QVBoxLayout(themeLayoutDialog) self.previewLayout.setObjectName(u'PreviewLayout') self.previewArea = QtGui.QWidget(themeLayoutDialog) diff --git a/openlp/core/ui/themelayoutform.py b/openlp/core/ui/themelayoutform.py index b1984c01a..6f77d31da 100644 --- a/openlp/core/ui/themelayoutform.py +++ b/openlp/core/ui/themelayoutform.py @@ -44,11 +44,12 @@ class ThemeLayoutForm(QtGui.QDialog, Ui_ThemeLayoutDialog): """ Run the Dialog with correct heading. """ - pixmap = image.scaledToHeight(150, QtCore.Qt.SmoothTransformation) + pixmap = image.scaledToHeight(400, QtCore.Qt.SmoothTransformation) self.themeDisplayLabel.setPixmap(image) + displayAspectRatio = float(image.width()) / image.height() + self.themeDisplayLabel.setFixedSize(400, 400 / displayAspectRatio ) return QtGui.QDialog.exec_(self) def accept(self): return QtGui.QDialog.accept(self) - From c5a7127aec29e1a86530efaf0e41ff16be65d2ba Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 2 Oct 2011 20:49:29 +0100 Subject: [PATCH 49/77] Copy theme during remote edit. Fixes: https://launchpad.net/bugs/864822 --- openlp/core/lib/serviceitem.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 3170e0a93..941f54897 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -364,6 +364,9 @@ class ServiceItem(object): """ self._uuid = other._uuid self.notes = other.notes + # copy theme over if present. Assumes overridden + if other.theme is not None: + self.theme = other.theme if self.is_capable(ItemCapabilities.HasBackgroundAudio): log.debug(self.background_audio) From 9f9f2186aeecccb4720deb18232184ee413c4daf Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 2 Oct 2011 20:57:42 +0100 Subject: [PATCH 50/77] Minor performance improvement --- openlp/core/lib/serviceitem.py | 2 +- openlp/core/ui/servicemanager.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 941f54897..a48ef157d 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -366,7 +366,7 @@ class ServiceItem(object): self.notes = other.notes # copy theme over if present. Assumes overridden if other.theme is not None: - self.theme = other.theme + self.update_theme(other.theme) if self.is_capable(ItemCapabilities.HasBackgroundAudio): log.debug(self.background_audio) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index c9f058351..8ad2db9c2 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -1160,7 +1160,6 @@ class ServiceManager(QtGui.QWidget): # if not passed set to config value if expand is None: expand = self.expandTabs - item.render() item.from_service = True if replace: sitem, child = self.findServiceItem() @@ -1169,6 +1168,7 @@ class ServiceManager(QtGui.QWidget): self.repaintServiceList(sitem, child) self.mainwindow.liveController.replaceServiceManagerItem(item) else: + item.render() # nothing selected for dnd if self.dropPosition == 0: if isinstance(item, list): From 42d15a53c7c9af1daf1c9b33aa734747f37e6cc2 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 3 Oct 2011 14:32:45 +0200 Subject: [PATCH 51/77] suggest web bible name when registering --- openlp/plugins/bibles/forms/bibleimportform.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index b5478e514..7577e86a3 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -461,6 +461,11 @@ class BibleImportForm(OpenLPWizard): WizardStrings.YouSpecifyFile % WizardStrings.OS) self.openSongFileEdit.setFocus() return False + elif self.field(u'source_format').toInt()[0] == \ + BibleFormat.WebDownload: + self.versionNameEdit.setText( + self.webTranslationComboBox.currentText()) + return True elif self.field(u'source_format').toInt()[0] == BibleFormat.OpenLP1: if not self.field(u'openlp1_location').toString(): critical_error_message_box(UiStrings().NFSs, @@ -674,7 +679,7 @@ class BibleImportForm(OpenLPWizard): elif bible_type == BibleFormat.CSV: # Import a CSV bible. importer = self.manager.import_bible(BibleFormat.CSV, - name=license_version, + name=license_version, booksfile=unicode(self.field(u'csv_booksfile').toString()), versefile=unicode(self.field(u'csv_versefile').toString()) ) From 5053e27c76f937f536699bbac2546056237e82a9 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 3 Oct 2011 17:53:54 +0100 Subject: [PATCH 52/77] Fix up review comments --- openlp/core/lib/renderer.py | 4 ++-- openlp/core/lib/serviceitem.py | 6 ++++-- openlp/core/ui/themeform.py | 3 ++- openlp/plugins/remotes/lib/remotetab.py | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 3d0d1e080..960dde7fa 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -310,7 +310,7 @@ class Renderer(object): def get_main_rectangle(self, theme): """ - Calculates the placement and size of the main rectangle + Calculates the placement and size of the main rectangle. ``theme`` The theme information @@ -323,7 +323,7 @@ class Renderer(object): def get_footer_rectangle(self, theme): """ - Calculates the placement and size of the main rectangle + Calculates the placement and size of the footer rectangle. ``theme`` The theme information diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index a48ef157d..510d71cde 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -364,9 +364,11 @@ class ServiceItem(object): """ self._uuid = other._uuid self.notes = other.notes - # copy theme over if present. Assumes overridden + # Copy theme over if present. if other.theme is not None: - self.update_theme(other.theme) + self.theme = other.theme + self._new_item() + self.render() if self.is_capable(ItemCapabilities.HasBackgroundAudio): log.debug(self.background_audio) diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index 064652488..f91beb429 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -247,8 +247,9 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): def onCustom1ButtonClicked(self, number): """ - Generate layout preview and display the form + Generate layout preview and display the form. """ + self.updateTheme() width = self.thememanager.mainwindow.renderer.width height = self.thememanager.mainwindow.renderer.height pixmap = QtGui.QPixmap(width, height) diff --git a/openlp/plugins/remotes/lib/remotetab.py b/openlp/plugins/remotes/lib/remotetab.py index d2b5659fe..95bb27f1c 100644 --- a/openlp/plugins/remotes/lib/remotetab.py +++ b/openlp/plugins/remotes/lib/remotetab.py @@ -100,7 +100,7 @@ class RemoteTab(SettingsTab): 'Stage view URL:')) self.twelveHourCheckBox.setText( translate('RemotePlugin.RemoteTab', - 'Display stage time in 12hr format')) + 'Display stage time in 12h format')) def setUrls(self): ipAddress = u'localhost' From 88c0a22ac482fb274549e29c4ddc0770aa7ab94e Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 3 Oct 2011 19:27:34 +0200 Subject: [PATCH 53/77] improve performance of preview Fixes: https://launchpad.net/bugs/856296 --- openlp/core/lib/renderer.py | 3 ++- openlp/core/ui/maindisplay.py | 8 ++------ openlp/core/ui/slidecontroller.py | 10 ++++------ openlp/core/ui/themeform.py | 2 +- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 6d48707b4..b25b2a3f4 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -201,7 +201,8 @@ class Renderer(object): if not self.force_page: self.display.buildHtml(serviceItem) raw_html = serviceItem.get_rendered_frame(0) - preview = self.display.text(raw_html) + self.display.text(raw_html) + preview = self.display.preview() # Reset the real screen size for subsequent render requests self._calculate_default() return preview diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 06afb0313..d6eff912c 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -194,7 +194,6 @@ class MainDisplay(QtGui.QGraphicsView): self.setGeometry(self.screen[u'size']) self.frame.evaluateJavaScript(u'show_text("%s")' % slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"')) - return self.preview() def alert(self, text): """ @@ -256,7 +255,6 @@ class MainDisplay(QtGui.QGraphicsView): image = self.imageManager.get_image_bytes(name) self.resetVideo() self.displayImage(image) - return self.preview() def displayImage(self, image): """ @@ -387,7 +385,6 @@ class MainDisplay(QtGui.QGraphicsView): # Update the preview frame. if self.isLive: Receiver.send_message(u'maindisplay_active') - return self.preview() def videoState(self, newState, oldState): """ @@ -455,9 +452,8 @@ class MainDisplay(QtGui.QGraphicsView): self.setVisible(True) else: self.setVisible(True) - preview = QtGui.QImage(self.screen[u'size'].width(), - self.screen[u'size'].height(), - QtGui.QImage.Format_ARGB32_Premultiplied) + preview = QtGui.QPixmap(self.screen[u'size'].width(), + self.screen[u'size'].height()) painter = QtGui.QPainter(preview) painter.setRenderHint(QtGui.QPainter.Antialiasing) self.frame.render(painter) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 18d010a40..d1e93706b 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -940,16 +940,15 @@ class SlideController(QtGui.QWidget): else: toDisplay = self.serviceItem.get_rendered_frame(row) if self.serviceItem.is_text(): - frame = self.display.text(toDisplay) + self.display.text(toDisplay) else: if start: self.display.buildHtml(self.serviceItem, toDisplay) - frame = self.display.preview() else: - frame = self.display.image(toDisplay) + self.display.image(toDisplay) # reset the store used to display first image self.serviceItem.bg_image_bytes = None - self.slidePreview.setPixmap(QtGui.QPixmap.fromImage(frame)) + self.slidePreview.setPixmap(self.display.preview()) self.selectedRow = row self.__checkUpdateSelectedSlide(row) Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix, @@ -977,8 +976,7 @@ class SlideController(QtGui.QWidget): QtCore.QTimer.singleShot(0.5, self.grabMainDisplay) QtCore.QTimer.singleShot(2.5, self.grabMainDisplay) else: - self.slidePreview.setPixmap( - QtGui.QPixmap.fromImage(self.display.preview())) + self.slidePreview.setPixmap(self.display.preview()) def grabMainDisplay(self): """ diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index dc3c23d0d..ae05f141e 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -232,7 +232,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): if self.page(pageId) == self.previewPage: self.updateTheme() frame = self.thememanager.generateImage(self.theme) - self.previewBoxLabel.setPixmap(QtGui.QPixmap.fromImage(frame)) + self.previewBoxLabel.setPixmap(frame) self.displayAspectRatio = float(frame.width()) / frame.height() self.resizeEvent() From 360e11791874c12440d1fcc9e2dbedddf31c7e7a Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 3 Oct 2011 20:14:39 +0200 Subject: [PATCH 54/77] removed dead code --- openlp/core/lib/eventreceiver.py | 6 ------ openlp/core/ui/slidecontroller.py | 35 ------------------------------- 2 files changed, 41 deletions(-) diff --git a/openlp/core/lib/eventreceiver.py b/openlp/core/lib/eventreceiver.py index 7c0115f89..6bba2d919 100644 --- a/openlp/core/lib/eventreceiver.py +++ b/openlp/core/lib/eventreceiver.py @@ -51,9 +51,6 @@ class EventReceiver(QtCore.QObject): ``config_screen_changed`` The display monitor has been changed - ``slidecontroller_{live|preview}_first`` - Moves to the first slide - ``slidecontroller_{live|preview}_next`` Moves to the next slide @@ -66,9 +63,6 @@ class EventReceiver(QtCore.QObject): ``slidecontroller_{live|preview}_previous_noloop`` Moves to the previous slide, without auto advance - ``slidecontroller_{live|preview}_last`` - Moves to the last slide - ``slidecontroller_{live|preview}_set`` Moves to a specific slide, by index diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index d1e93706b..a205ddc45 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -351,18 +351,12 @@ class SlideController(QtGui.QWidget): QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'slidecontroller_%s_stop_loop' % self.typePrefix), self.onStopLoop) - QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'slidecontroller_%s_first' % self.typePrefix), - self.onSlideSelectedFirst) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'slidecontroller_%s_next' % self.typePrefix), self.onSlideSelectedNext) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'slidecontroller_%s_previous' % self.typePrefix), self.onSlideSelectedPrevious) - QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'slidecontroller_%s_last' % self.typePrefix), - self.onSlideSelectedLast) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'slidecontroller_%s_change' % self.typePrefix), self.onSlideChange) @@ -744,20 +738,6 @@ class SlideController(QtGui.QWidget): % self.typePrefix, data) # Screen event methods - def onSlideSelectedFirst(self): - """ - Go to the first slide. - """ - if not self.serviceItem: - return - if self.serviceItem.is_command(): - Receiver.send_message(u'%s_first' % self.serviceItem.name.lower(), - [self.serviceItem, self.isLive]) - self.updatePreview() - else: - self.previewListWidget.selectRow(0) - self.slideSelected() - def onSlideSelectedIndex(self, message): """ Go to the requested slide @@ -1039,21 +1019,6 @@ class SlideController(QtGui.QWidget): self.previewListWidget.item(row + 1, 0)) self.previewListWidget.selectRow(row) - def onSlideSelectedLast(self): - """ - Go to the last slide. - """ - if not self.serviceItem: - return - Receiver.send_message(u'%s_last' % self.serviceItem.name.lower(), - [self.serviceItem, self.isLive]) - if self.serviceItem.is_command(): - self.updatePreview() - else: - self.previewListWidget.selectRow( - self.previewListWidget.rowCount() - 1) - self.slideSelected() - def onToggleLoop(self): """ Toggles the loop state. From 201ec584a8f3ee1c2f21a7b27d76ec22e7df9806 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 3 Oct 2011 20:51:32 +0200 Subject: [PATCH 55/77] removed dead code + minor clean up --- openlp/core/lib/eventreceiver.py | 5 ----- openlp/core/ui/slidecontroller.py | 33 +++++-------------------------- 2 files changed, 5 insertions(+), 33 deletions(-) diff --git a/openlp/core/lib/eventreceiver.py b/openlp/core/lib/eventreceiver.py index 6bba2d919..1b957e5df 100644 --- a/openlp/core/lib/eventreceiver.py +++ b/openlp/core/lib/eventreceiver.py @@ -76,11 +76,6 @@ class EventReceiver(QtCore.QObject): ``slidecontroller_{live|preview}_changed`` Broadcasts that the slidecontroller has changed the current slide - ``slidecontroller_{live|preview}_text_request`` - Request the text for the current item in the controller - Returns a slidecontroller_{live|preview}_text_response with an - array of dictionaries with the tag and verse text - ``slidecontroller_{live|preview}_blank`` Request that the output screen is blanked diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index a205ddc45..e29cb3ae4 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -118,7 +118,7 @@ class SlideController(QtGui.QWidget): self.previewListWidget.horizontalHeader().setVisible(False) self.previewListWidget.setColumnWidth(0, self.controller.width()) self.previewListWidget.isLive = self.isLive - self.previewListWidget.setObjectName(u'PreviewListWidget') + self.previewListWidget.setObjectName(u'previewListWidget') self.previewListWidget.setSelectionBehavior( QtGui.QAbstractItemView.SelectRows) self.previewListWidget.setSelectionMode( @@ -288,14 +288,14 @@ class SlideController(QtGui.QWidget): QtGui.QSizePolicy.Label)) self.previewFrame.setFrameShape(QtGui.QFrame.StyledPanel) self.previewFrame.setFrameShadow(QtGui.QFrame.Sunken) - self.previewFrame.setObjectName(u'PreviewFrame') + self.previewFrame.setObjectName(u'previewFrame') self.grid = QtGui.QGridLayout(self.previewFrame) self.grid.setMargin(8) self.grid.setObjectName(u'grid') self.slideLayout = QtGui.QVBoxLayout() self.slideLayout.setSpacing(0) self.slideLayout.setMargin(0) - self.slideLayout.setObjectName(u'SlideLayout') + self.slideLayout.setObjectName(u'slideLayout') if not self.isLive: self.mediaObject = Phonon.MediaObject(self) self.video = Phonon.VideoWidget() @@ -319,7 +319,7 @@ class SlideController(QtGui.QWidget): self.slidePreview.setFrameShadow(QtGui.QFrame.Plain) self.slidePreview.setLineWidth(1) self.slidePreview.setScaledContents(True) - self.slidePreview.setObjectName(u'SlidePreview') + self.slidePreview.setObjectName(u'slidePreview') self.slideLayout.insertWidget(0, self.slidePreview) self.grid.addLayout(self.slideLayout, 0, 0, 1, 1) # Signals @@ -369,9 +369,6 @@ class SlideController(QtGui.QWidget): QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'slidecontroller_%s_unblank' % self.typePrefix), self.onSlideUnblank) - QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'slidecontroller_%s_text_request' % self.typePrefix), - self.onTextRequest) def setPreviewHotkeys(self, parent=None): self.previousItem.setObjectName(u'previousItemPreview') @@ -717,26 +714,6 @@ class SlideController(QtGui.QWidget): else: self.__checkUpdateSelectedSlide(slideno) - def onTextRequest(self): - """ - Return the text for the current item in controller - """ - data = [] - if self.serviceItem: - for framenumber, frame in enumerate(self.serviceItem.get_frames()): - dataItem = {} - if self.serviceItem.is_text(): - dataItem[u'tag'] = unicode(frame[u'verseTag']) - dataItem[u'text'] = unicode(frame[u'html']) - else: - dataItem[u'tag'] = unicode(framenumber) - dataItem[u'text'] = u'' - dataItem[u'selected'] = \ - (self.previewListWidget.currentRow() == framenumber) - data.append(dataItem) - Receiver.send_message(u'slidecontroller_%s_text_response' - % self.typePrefix, data) - # Screen event methods def onSlideSelectedIndex(self, message): """ @@ -928,7 +905,7 @@ class SlideController(QtGui.QWidget): self.display.image(toDisplay) # reset the store used to display first image self.serviceItem.bg_image_bytes = None - self.slidePreview.setPixmap(self.display.preview()) + self.updatePreview() self.selectedRow = row self.__checkUpdateSelectedSlide(row) Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix, From d3bfffa4b15a93d3245e431a5a7ae26078cb575e Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 3 Oct 2011 22:12:57 +0200 Subject: [PATCH 56/77] removed not used imports --- openlp/plugins/bibles/lib/db.py | 1 - openlp/plugins/images/lib/imagetab.py | 1 - openlp/plugins/presentations/lib/presentationcontroller.py | 2 +- openlp/plugins/presentations/presentationplugin.py | 2 +- openlp/plugins/songs/lib/mediaitem.py | 2 +- openlp/plugins/songs/lib/openlyricsexport.py | 1 - openlp/plugins/songs/lib/upgrade.py | 2 +- openlp/plugins/songusage/forms/songusagedeletedialog.py | 1 - 8 files changed, 4 insertions(+), 8 deletions(-) diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index e5962664b..9ec5b45b2 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -28,7 +28,6 @@ import logging import chardet import os -import re import sqlite3 from PyQt4 import QtCore diff --git a/openlp/plugins/images/lib/imagetab.py b/openlp/plugins/images/lib/imagetab.py index 98fbd203f..1aa39b63c 100644 --- a/openlp/plugins/images/lib/imagetab.py +++ b/openlp/plugins/images/lib/imagetab.py @@ -28,7 +28,6 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import SettingsTab, translate, Receiver -from openlp.core.lib.ui import UiStrings, create_valign_combo class ImageTab(SettingsTab): """ diff --git a/openlp/plugins/presentations/lib/presentationcontroller.py b/openlp/plugins/presentations/lib/presentationcontroller.py index 55823dfd2..a9d384c81 100644 --- a/openlp/plugins/presentations/lib/presentationcontroller.py +++ b/openlp/plugins/presentations/lib/presentationcontroller.py @@ -32,7 +32,7 @@ import shutil from PyQt4 import QtCore from openlp.core.lib import Receiver, check_directory_exists, create_thumb, \ - resize_image, validate_thumb + validate_thumb from openlp.core.utils import AppLocation log = logging.getLogger(__name__) diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index a97f82159..643ad14ad 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -87,7 +87,7 @@ class PresentationPlugin(Plugin): to close down their applications and release resources. """ log.info(u'Plugin Finalise') - #Ask each controller to tidy up + # Ask each controller to tidy up. for key in self.controllers: controller = self.controllers[key] if controller.enabled(): diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 98b2d3f24..f20c02903 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -397,7 +397,7 @@ class SongMediaItem(MediaManagerItem): try: os.remove(media_file.file_name) except: - log.exception('Could not remove file: %s', audio) + log.exception('Could not remove file: %s', media_file) try: save_path = os.path.join(AppLocation.get_section_data_path( self.plugin.name), 'audio', str(item_id)) diff --git a/openlp/plugins/songs/lib/openlyricsexport.py b/openlp/plugins/songs/lib/openlyricsexport.py index ec5677ea4..515674618 100644 --- a/openlp/plugins/songs/lib/openlyricsexport.py +++ b/openlp/plugins/songs/lib/openlyricsexport.py @@ -30,7 +30,6 @@ songs from the database to the OpenLyrics format. """ import logging import os -import re from lxml import etree diff --git a/openlp/plugins/songs/lib/upgrade.py b/openlp/plugins/songs/lib/upgrade.py index fae3400c2..21988c267 100644 --- a/openlp/plugins/songs/lib/upgrade.py +++ b/openlp/plugins/songs/lib/upgrade.py @@ -29,7 +29,7 @@ The :mod:`upgrade` module provides a way for the database and schema that is the backend for the Songs plugin """ -from sqlalchemy import Column, ForeignKey, Table, types +from sqlalchemy import Column, Table, types from sqlalchemy.sql.expression import func from migrate import changeset from migrate.changeset.constraint import ForeignKeyConstraint diff --git a/openlp/plugins/songusage/forms/songusagedeletedialog.py b/openlp/plugins/songusage/forms/songusagedeletedialog.py index 28f18d578..a6f7fb2b0 100644 --- a/openlp/plugins/songusage/forms/songusagedeletedialog.py +++ b/openlp/plugins/songusage/forms/songusagedeletedialog.py @@ -28,7 +28,6 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import translate -from openlp.core.lib.ui import create_accept_reject_button_box class Ui_SongUsageDeleteDialog(object): def setupUi(self, songUsageDeleteDialog): From 91c20c42713b8dcbf28efecfb0bf628241042b99 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 3 Oct 2011 22:26:51 +0200 Subject: [PATCH 57/77] more clean ups --- openlp/plugins/bibles/lib/http.py | 9 ++++++--- openlp/plugins/songs/lib/cclifileimport.py | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index 2d8e16c4c..228d4758c 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -82,13 +82,16 @@ class BGExtract(object): Receiver.send_message(u'openlp_process_events') footnotes = soup.findAll(u'sup', u'footnote') if footnotes: - [footnote.extract() for footnote in footnotes] + for footnote in footnotes: + footnote.extract() crossrefs = soup.findAll(u'sup', u'xref') if crossrefs: - [crossref.extract() for crossref in crossrefs] + for crossref in crossrefs: + crossref.extract() headings = soup.findAll(u'h5') if headings: - [heading.extract() for heading in headings] + for heading in headings: + heading.extract() cleanup = [(re.compile('\s+'), lambda match: ' ')] verses = BeautifulSoup(str(soup), markupMassage=cleanup) verse_list = {} diff --git a/openlp/plugins/songs/lib/cclifileimport.py b/openlp/plugins/songs/lib/cclifileimport.py index e15f898ab..624256290 100644 --- a/openlp/plugins/songs/lib/cclifileimport.py +++ b/openlp/plugins/songs/lib/cclifileimport.py @@ -333,5 +333,6 @@ class CCLIFileImport(SongImport): if len(author_list) < 2: author_list = song_author.split(u'|') # Clean spaces before and after author names. - [self.addAuthor(author_name.strip()) for author_name in author_list] + for author_name in author_list: + self.addAuthor(author_name.strip()) return self.finish() From 947b31d2c412b7ec66f8182080a1439b004be485 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 3 Oct 2011 22:28:17 +0200 Subject: [PATCH 58/77] fixed name --- openlp/plugins/songs/lib/mediaitem.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index f20c02903..d98a55c00 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -397,7 +397,8 @@ class SongMediaItem(MediaManagerItem): try: os.remove(media_file.file_name) except: - log.exception('Could not remove file: %s', media_file) + log.exception('Could not remove file: %s', + media_file.file_name) try: save_path = os.path.join(AppLocation.get_section_data_path( self.plugin.name), 'audio', str(item_id)) From 00aaae3022fc9ee8c602a69415c5925674b1ad4f Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 4 Oct 2011 18:02:45 +0200 Subject: [PATCH 59/77] removed not needed files + updated copyright --- copyright.txt | 2 +- resources/images/openlp-2.qrc | 2 -- resources/images/slide_first.png | Bin 653 -> 0 bytes resources/images/slide_last.png | Bin 666 -> 0 bytes scripts/check_dependencies.py | 2 +- scripts/generate_resources.sh | 14 +++++++------- testing/conftest.py | 2 +- testing/test_app.py | 2 +- 8 files changed, 11 insertions(+), 13 deletions(-) delete mode 100644 resources/images/slide_first.png delete mode 100644 resources/images/slide_last.png diff --git a/copyright.txt b/copyright.txt index 0fb988622..df5563844 100644 --- a/copyright.txt +++ b/copyright.txt @@ -7,7 +7,7 @@ # Copyright (c) 2008-2011 Raoul Snyman # # Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # -# Armin Köhler, Joshua Millar, Stevan Pettit, Andreas Preikschat, Mattias # +# Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund # # --------------------------------------------------------------------------- # diff --git a/resources/images/openlp-2.qrc b/resources/images/openlp-2.qrc index fff1f75b8..c12b67002 100644 --- a/resources/images/openlp-2.qrc +++ b/resources/images/openlp-2.qrc @@ -60,8 +60,6 @@ slide_close.png - slide_first.png - slide_last.png slide_next.png slide_blank.png slide_desktop.png diff --git a/resources/images/slide_first.png b/resources/images/slide_first.png deleted file mode 100644 index a9d66123e5de9fe7f7f96e2ee3d58b4cce8f5fe9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 653 zcmV;80&@L{P)EBIrR7FMfW;W012HS>cd+2*S zc;C$XzV`;+Fe1WHOv53@rkTTL*#o95!i8RZ-~_D5@?#@oWyf-y@`rK~5@$!Vqpz)` zWiNkOPSPuC{&xb^9zk z(^YsiXz8t90d}30a$fFv#>&KMts0X| z6(o3L!%YP1kw_5aYbIy+JEqSI}`gKpG&M0DI?dUyzCbNQBAWJ)mdu zg&%8P9vDe&m?=||LBIfj6uKgw3OCB5GoIl6i$qV`@3z?QGrAZ5Y^7`&bu_yK!!rN} zT~U>CUH|tc(gLmfeDhoY@$$Ht2^q0yZ0o0D|Ik7ZfDWK*{Q`R;^F)oi{ zm48#9jt019>j@<{P4dJ&WnfNzOPQCe+}2uZ5Mdod4zRs+R=yVX~W&uk?6p{ neRzB!{ult;#fy9R$lv)7L~iNTQ>DOK00000NkvXXu0mjfir*rXKo+ z$2Sk=d-Ddq5k!Q8Km$Yk#Z_@%I3m@jr&<38Q37#ISd-aF&uzGs^}_mPNPKqAI9}N; zmsdAd9ePD;gA?=+Y9VGW%p|5xPrU)*mM?td^ZBH6-dW)^w=n<`J=A%X+>#j2jw^e_ zUg9(;RZAjwHmBmr_+#t3b*?qhxZC`M#3rPm0tKVZCT*#oIG#;g#?XqmDQ?g+dbwlZ=}k1d9-#MZ6%e7rtOLRo zKn2i#X^2_F1Vh*R66hvt13;XaWZF!@^bmnM1k1Mq!!&EPt;Q948ocW_ki6{zFqy+# z(k9wkJGvE3AQ4LjVWaz{=DC;X32pD01F7{4n5bxBVmlSt3lcaMX2N#afBsukPtn3| zbAN)a4&^KA)Pn#&aE}anV3tf8-8vc;z7_9=bN<79CoyHEks3L|^Q2AVefLqSlSaBQ zTL1pFcrj`ogx+ry`jT42JPz;Zg0u A!2kdN diff --git a/scripts/check_dependencies.py b/scripts/check_dependencies.py index 14d27fb81..dd2907ba9 100755 --- a/scripts/check_dependencies.py +++ b/scripts/check_dependencies.py @@ -8,7 +8,7 @@ # Copyright (c) 2008-2011 Raoul Snyman # # Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # -# Armin Köhler, Joshua Millar, Stevan Pettit, Andreas Preikschat, Mattias # +# Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund # # --------------------------------------------------------------------------- # diff --git a/scripts/generate_resources.sh b/scripts/generate_resources.sh index cf6f8f2f8..1c4475198 100755 --- a/scripts/generate_resources.sh +++ b/scripts/generate_resources.sh @@ -1,15 +1,15 @@ -#!/bin/sh +# -*- coding: utf-8 -*- # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # # Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael # -# Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin Köhler, # -# Andreas Preikschat, Mattias Põldaru, Christian Richter, Philip Ridout, # -# Jeffrey Smith, Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode # -# Woldsund # +# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # +# Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # +# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # +# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund # # --------------------------------------------------------------------------- # # This program is free software; you can redistribute it and/or modify it # # under the terms of the GNU General Public License as published by the Free # @@ -49,7 +49,7 @@ cat openlp/core/resources.py.new | sed '/# Created: /d;/# by: /d' \ > openlp/core/resources.py # Patch resources.py to OpenLP coding style -patch --posix -s openlp/core/resources.py scripts/resources.patch +#patch --posix -s openlp/core/resources.py scripts/resources.patch # Remove temporary file rm openlp/core/resources.py.new diff --git a/testing/conftest.py b/testing/conftest.py index f38018c17..001f8979a 100644 --- a/testing/conftest.py +++ b/testing/conftest.py @@ -8,7 +8,7 @@ # Copyright (c) 2008-2011 Raoul Snyman # # Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # -# Armin Köhler, Joshua Millar, Stevan Pettit, Andreas Preikschat, Mattias # +# Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund # # --------------------------------------------------------------------------- # diff --git a/testing/test_app.py b/testing/test_app.py index 00cd744ba..3ff053479 100644 --- a/testing/test_app.py +++ b/testing/test_app.py @@ -8,7 +8,7 @@ # Copyright (c) 2008-2011 Raoul Snyman # # Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # -# Armin Köhler, Joshua Millar, Stevan Pettit, Andreas Preikschat, Mattias # +# Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund # # --------------------------------------------------------------------------- # From 8c4ed560d0eaf6d166a620e229ecc2ff8ca579bb Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 4 Oct 2011 18:03:07 +0200 Subject: [PATCH 60/77] uncommented needed line --- scripts/generate_resources.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generate_resources.sh b/scripts/generate_resources.sh index 1c4475198..a18822aa2 100755 --- a/scripts/generate_resources.sh +++ b/scripts/generate_resources.sh @@ -49,7 +49,7 @@ cat openlp/core/resources.py.new | sed '/# Created: /d;/# by: /d' \ > openlp/core/resources.py # Patch resources.py to OpenLP coding style -#patch --posix -s openlp/core/resources.py scripts/resources.patch +patch --posix -s openlp/core/resources.py scripts/resources.patch # Remove temporary file rm openlp/core/resources.py.new From 196795106197bb4bd98f60037167acd9e5386ac6 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 4 Oct 2011 20:01:13 +0200 Subject: [PATCH 62/77] attempt to prevent calling updatePreview more than once --- openlp/core/ui/slidecontroller.py | 8 ++++---- scripts/generate_resources.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index e29cb3ae4..0abc6cf05 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -328,8 +328,8 @@ class SlideController(QtGui.QWidget): if self.isLive: QtCore.QObject.connect(self.volumeSlider, QtCore.SIGNAL(u'sliderReleased()'), self.mediaVolume) - QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'maindisplay_active'), self.updatePreview) +# QtCore.QObject.connect(Receiver.get_receiver(), +# QtCore.SIGNAL(u'maindisplay_active'), self.updatePreview) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'slidecontroller_live_spin_delay'), self.receiveSpinDelay) @@ -893,7 +893,6 @@ class SlideController(QtGui.QWidget): Receiver.send_message( u'%s_slide' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive, row]) - self.updatePreview() else: toDisplay = self.serviceItem.get_rendered_frame(row) if self.serviceItem.is_text(): @@ -905,7 +904,7 @@ class SlideController(QtGui.QWidget): self.display.image(toDisplay) # reset the store used to display first image self.serviceItem.bg_image_bytes = None - self.updatePreview() + self.updatePreview() self.selectedRow = row self.__checkUpdateSelectedSlide(row) Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix, @@ -926,6 +925,7 @@ class SlideController(QtGui.QWidget): using *Blank to Theme*. """ log.debug(u'updatePreview %s ' % self.screens.current[u'primary']) + print u'updatePreview' if not self.screens.current[u'primary'] and self.serviceItem and \ self.serviceItem.is_capable(ItemCapabilities.ProvidesOwnDisplay): # Grab now, but try again in a couple of seconds if slide change diff --git a/scripts/generate_resources.sh b/scripts/generate_resources.sh index a18822aa2..5778f771a 100755 --- a/scripts/generate_resources.sh +++ b/scripts/generate_resources.sh @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +#!/bin/sh # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 ############################################################################### From 159a95855f781769510640dacabef70274c400f7 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 5 Oct 2011 17:14:21 +0100 Subject: [PATCH 63/77] Change Text --- openlp/core/ui/themelayoutdialog.py | 10 ++++++++++ openlp/core/ui/themewizard.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/themelayoutdialog.py b/openlp/core/ui/themelayoutdialog.py index 58c09fb26..d2c91619f 100644 --- a/openlp/core/ui/themelayoutdialog.py +++ b/openlp/core/ui/themelayoutdialog.py @@ -50,6 +50,12 @@ class Ui_ThemeLayoutDialog(object): self.themeDisplayLabel.setObjectName(u'ThemeDisplayLabel') self.previewAreaLayout.addWidget(self.themeDisplayLabel) self.previewLayout.addWidget(self.previewArea) + self.mainColourLabel = QtGui.QLabel(self.previewArea) + self.mainColourLabel.setObjectName(u'MainColourLabel') + self.previewLayout.addWidget(self.mainColourLabel) + self.footerColourLabel = QtGui.QLabel(self.previewArea) + self.footerColourLabel.setObjectName(u'FooterColourLabel') + self.previewLayout.addWidget(self.footerColourLabel) self.buttonBox = QtGui.QDialogButtonBox(themeLayoutDialog) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName(u'ButtonBox') @@ -62,4 +68,8 @@ class Ui_ThemeLayoutDialog(object): def retranslateUi(self, themeLayoutDialog): themeLayoutDialog.setWindowTitle( translate('OpenLP.StartTimeForm', 'Theme Layout')) + self.mainColourLabel.setText(translate('OpenLP.StartTimeForm', + 'The main layout area is shown by a blue box.')) + self.footerColourLabel.setText(translate('OpenLP.StartTimeForm', + 'The footer layout area is shown by a red box.')) diff --git a/openlp/core/ui/themewizard.py b/openlp/core/ui/themewizard.py index 76b9ba3a8..1135db274 100644 --- a/openlp/core/ui/themewizard.py +++ b/openlp/core/ui/themewizard.py @@ -538,7 +538,7 @@ class Ui_ThemeWizard(object): translate('OpenLP.ThemeWizard', 'Use default location')) themeWizard.setOption(QtGui.QWizard.HaveCustomButton1, False) themeWizard.setButtonText(QtGui.QWizard.CustomButton1, - translate('OpenLP.ThemeWizard', 'Preview')) + translate('OpenLP.ThemeWizard', 'Layout Preview')) self.previewPage.setTitle( translate('OpenLP.ThemeWizard', 'Save and Preview')) self.previewPage.setSubTitle( From 45b296b741b30e69e5d4f4ad6d4c431bb41534ef Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 5 Oct 2011 19:04:59 +0200 Subject: [PATCH 64/77] clean up --- openlp/core/ui/slidecontroller.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 0abc6cf05..354cfa168 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -328,8 +328,6 @@ class SlideController(QtGui.QWidget): if self.isLive: QtCore.QObject.connect(self.volumeSlider, QtCore.SIGNAL(u'sliderReleased()'), self.mediaVolume) -# QtCore.QObject.connect(Receiver.get_receiver(), -# QtCore.SIGNAL(u'maindisplay_active'), self.updatePreview) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'slidecontroller_live_spin_delay'), self.receiveSpinDelay) @@ -925,7 +923,6 @@ class SlideController(QtGui.QWidget): using *Blank to Theme*. """ log.debug(u'updatePreview %s ' % self.screens.current[u'primary']) - print u'updatePreview' if not self.screens.current[u'primary'] and self.serviceItem and \ self.serviceItem.is_capable(ItemCapabilities.ProvidesOwnDisplay): # Grab now, but try again in a couple of seconds if slide change From 575aa020222960b147bb39a2f3e38bdd05d94e0d Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 5 Oct 2011 18:18:56 +0100 Subject: [PATCH 65/77] Amend text --- openlp/core/ui/themelayoutdialog.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/themelayoutdialog.py b/openlp/core/ui/themelayoutdialog.py index d2c91619f..5be08ad65 100644 --- a/openlp/core/ui/themelayoutdialog.py +++ b/openlp/core/ui/themelayoutdialog.py @@ -69,7 +69,7 @@ class Ui_ThemeLayoutDialog(object): themeLayoutDialog.setWindowTitle( translate('OpenLP.StartTimeForm', 'Theme Layout')) self.mainColourLabel.setText(translate('OpenLP.StartTimeForm', - 'The main layout area is shown by a blue box.')) + 'The blue box shows the main area.')) self.footerColourLabel.setText(translate('OpenLP.StartTimeForm', - 'The footer layout area is shown by a red box.')) + 'The red box shows the footer.')) From 5dfa0c95cefe96337e3f29a2cea1d40d3d7a5a64 Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Wed, 5 Oct 2011 15:50:17 -0400 Subject: [PATCH 66/77] Modified code so new Openlyrics song import description will appear for translate --- openlp/core/ui/wizard.py | 2 +- openlp/plugins/songs/forms/songimportform.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/wizard.py b/openlp/core/ui/wizard.py index 40591872b..9d8a106ed 100644 --- a/openlp/core/ui/wizard.py +++ b/openlp/core/ui/wizard.py @@ -49,7 +49,7 @@ class WizardStrings(object): EW = u'EasyWorship' ES = u'EasiSlides' FP = u'Foilpresenter' - OL = u'OpenLyrics or OpenLP 2.0 Exported Song' + OL = u'OpenLyrics' OS = u'OpenSong' OSIS = u'OSIS' SB = u'SongBeamer' diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index 72048e409..18a66fb85 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -241,7 +241,8 @@ class SongImportForm(OpenLPWizard): self.formatComboBox.setItemText(SongFormat.OpenLP2, UiStrings().OLPV2) self.formatComboBox.setItemText(SongFormat.OpenLP1, UiStrings().OLPV1) self.formatComboBox.setItemText(SongFormat.OpenLyrics, - translate('SongsPlugin.ImportWizardForm', WizardStrings.OL)) + translate('SongsPlugin.ImportWizardForm', + 'OpenLyrics or OpenLP 2.0 Exported Song')) self.formatComboBox.setItemText(SongFormat.OpenSong, WizardStrings.OS) self.formatComboBox.setItemText( SongFormat.WordsOfWorship, WizardStrings.WoW) From 2a1d0009a8152ed4b6673feade755ff2d8b8e64b Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Wed, 5 Oct 2011 18:17:57 -0400 Subject: [PATCH 67/77] Removed whitespace --- openlp/plugins/songs/forms/songimportform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index 18a66fb85..b79e56f7b 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -241,7 +241,7 @@ class SongImportForm(OpenLPWizard): self.formatComboBox.setItemText(SongFormat.OpenLP2, UiStrings().OLPV2) self.formatComboBox.setItemText(SongFormat.OpenLP1, UiStrings().OLPV1) self.formatComboBox.setItemText(SongFormat.OpenLyrics, - translate('SongsPlugin.ImportWizardForm', + translate('SongsPlugin.ImportWizardForm', 'OpenLyrics or OpenLP 2.0 Exported Song')) self.formatComboBox.setItemText(SongFormat.OpenSong, WizardStrings.OS) self.formatComboBox.setItemText( From 2591854fddb62d2df68f4b797d00db3ba260f18a Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 8 Oct 2011 15:20:57 +0200 Subject: [PATCH 68/77] fixed bug 863376 - clean ups Fixes: https://launchpad.net/bugs/863376 --- openlp/plugins/songs/lib/xml.py | 42 ++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/openlp/plugins/songs/lib/xml.py b/openlp/plugins/songs/lib/xml.py index 5b36a7cb9..a6928cecf 100644 --- a/openlp/plugins/songs/lib/xml.py +++ b/openlp/plugins/songs/lib/xml.py @@ -60,7 +60,7 @@ The XML of an `OpenLyrics `_ song looks like this:: """ - +import cgi import logging import re @@ -257,11 +257,11 @@ class OpenLyrics(object): """ IMPLEMENTED_VERSION = u'0.8' + START_TAGS_REGEX = re.compile(r'\{(\w+)\}') # {abc} -> abc + END_TAGS_REGEX = re.compile(r'\{\/(\w+)\}') # {/abc} -> abc def __init__(self, manager): self.manager = manager - self.start_tags_regex = re.compile(r'\{(\w+)\}') # {abc} -> abc - self.end_tags_regex = re.compile(r'\{\/(\w+)\}') # {/abc} -> abc def song_to_xml(self, song): """ @@ -334,7 +334,8 @@ class OpenLyrics(object): if u'lang' in verse[0]: verse_element.set(u'lang', verse[0][u'lang']) # Create a list with all "virtual" verses. - virtual_verses = verse[1].split(u'[---]') + virtual_verses = cgi.escape(verse[1]) + virtual_verses = virtual_verses.split(u'[---]') for index, virtual_verse in enumerate(virtual_verses): # Add formatting tags to text lines_element = self._add_text_with_tags_to_lines(verse_element, @@ -402,32 +403,32 @@ class OpenLyrics(object): def _add_tag_to_formatting(self, tag_name, tags_element): """ - Add new formatting tag to the element ```` - if the tag is not present yet. + Add new formatting tag to the element ```` if the tag is not + present yet. """ available_tags = FormattingTags.get_html_tags() start_tag = '{%s}' % tag_name - for t in available_tags: - if t[u'start tag'] == start_tag: + for tag in available_tags: + if tag[u'start tag'] == start_tag: # Create new formatting tag in openlyrics xml. - el = self._add_text_to_element(u'tag', tags_element) - el.set(u'name', tag_name) - el_open = self._add_text_to_element(u'open', el) - el_open.text = etree.CDATA(t[u'start html']) + element = self._add_text_to_element(u'tag', tags_element) + element.set(u'name', tag_name) + element_open = self._add_text_to_element(u'open', element) + element_open.text = etree.CDATA(tag[u'start html']) # Check if formatting tag contains end tag. Some formatting # tags e.g. {br} has only start tag. If no end tag is present # element has not to be in OpenLyrics xml. - if t['end tag']: - el_close = self._add_text_to_element(u'close', el) - el_close.text = etree.CDATA(t[u'end html']) + if tag['end tag']: + element_close = self._add_text_to_element(u'close', element) + element_close.text = etree.CDATA(tag[u'end html']) def _add_text_with_tags_to_lines(self, verse_element, text, tags_element): """ Convert text with formatting tags from OpenLP format to OpenLyrics format and append it to element ````. """ - start_tags = self.start_tags_regex.findall(text) - end_tags = self.end_tags_regex.findall(text) + start_tags = OpenLyrics.START_TAGS_REGEX.findall(text) + end_tags = OpenLyrics.END_TAGS_REGEX.findall(text) # Replace start tags with xml syntax. for tag in start_tags: # Tags already converted to xml structure. @@ -442,12 +443,11 @@ class OpenLyrics(object): if tag not in xml_tags: self._add_tag_to_formatting(tag, tags_element) # Replace end tags. - for t in end_tags: - text = text.replace(u'{/%s}' % t, u'') + for tag in end_tags: + text = text.replace(u'{/%s}' % tag, u'') # Replace \n with
. text = text.replace(u'\n', u'
') - text = u'' + text + u'' - element = etree.XML(text) + element = etree.XML(u'' + text + u'') verse_element.append(element) return element From 06068eedce7522541ae3f2e0c402828fe19e758a Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 8 Oct 2011 15:29:35 +0200 Subject: [PATCH 69/77] fixed bug 863846 Fixes: https://launchpad.net/bugs/863846 --- openlp/core/ui/splashscreen.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openlp/core/ui/splashscreen.py b/openlp/core/ui/splashscreen.py index 8b2ba5d95..036daf968 100644 --- a/openlp/core/ui/splashscreen.py +++ b/openlp/core/ui/splashscreen.py @@ -36,8 +36,7 @@ class SplashScreen(QtGui.QSplashScreen): QtCore.SIGNAL(u'close_splash'), self.close) def setupUi(self): - self.setObjectName(u'splash_screen') - self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint) + self.setObjectName(u'splashScreen') self.setContextMenuPolicy(QtCore.Qt.PreventContextMenu) splash_image = QtGui.QPixmap(u':/graphics/openlp-splash-screen.png') self.setPixmap(splash_image) From e774b084149711b202c509a54233621bdb5918f6 Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Sat, 8 Oct 2011 18:21:23 -0400 Subject: [PATCH 70/77] Modified Inno setup control file to pass proper string to psvince.dll when checking if OpenLP is currently running --- resources/windows/OpenLP-2.0.iss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/windows/OpenLP-2.0.iss b/resources/windows/OpenLP-2.0.iss index 9d2e6bfaa..d773a22fd 100644 --- a/resources/windows/OpenLP-2.0.iss +++ b/resources/windows/OpenLP-2.0.iss @@ -87,7 +87,7 @@ Root: HKCR; Subkey: "OpenLP\DefaultIcon"; ValueType: string; ValueName: ""; Valu Root: HKCR; Subkey: "OpenLP\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\OpenLP.exe"" ""%1""" [Code] -function IsModuleLoaded(modulename: String ): Boolean; +function IsModuleLoaded(modulename: AnsiString ): Boolean; external 'IsModuleLoaded@files:psvince.dll stdcall'; function GetUninstallString(): String; From 3c8cc5c5320fb51d7cf26614a2fe3562d1e73f6d Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 9 Oct 2011 21:45:50 +0200 Subject: [PATCH 71/77] removed comment + fixed regex --- openlp/plugins/songs/lib/xml.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/songs/lib/xml.py b/openlp/plugins/songs/lib/xml.py index a6928cecf..3b1cefaa7 100644 --- a/openlp/plugins/songs/lib/xml.py +++ b/openlp/plugins/songs/lib/xml.py @@ -257,8 +257,9 @@ class OpenLyrics(object): """ IMPLEMENTED_VERSION = u'0.8' - START_TAGS_REGEX = re.compile(r'\{(\w+)\}') # {abc} -> abc - END_TAGS_REGEX = re.compile(r'\{\/(\w+)\}') # {/abc} -> abc + START_TAGS_REGEX = re.compile(r'\{(\w+)\}') + END_TAGS_REGEX = re.compile(r'\{\/(\w+)\}') + VERSE_NUMBER_REGEX = re.compile(u'[a-zA-Z]*') def __init__(self, manager): self.manager = manager @@ -692,7 +693,7 @@ class OpenLyrics(object): verse_tag = verse_def[0] else: verse_tag = VerseType.Tags[VerseType.Other] - verse_number = re.compile(u'[a-zA-Z]*').sub(u'', verse_def) + verse_number = OpenLyrics.VERSE_NUMBER_REGEX.sub(u'', verse_def) # OpenLyrics allows e. g. "c", but we need "c1". However, this does # not correct the verse order. if not verse_number: From e6751bd043268db1357404de2ce091926e53a158 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 9 Oct 2011 21:51:44 +0200 Subject: [PATCH 72/77] fixed string --- openlp/plugins/songs/lib/xml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/xml.py b/openlp/plugins/songs/lib/xml.py index 3b1cefaa7..aaf82b395 100644 --- a/openlp/plugins/songs/lib/xml.py +++ b/openlp/plugins/songs/lib/xml.py @@ -448,7 +448,7 @@ class OpenLyrics(object): text = text.replace(u'{/%s}' % tag, u'') # Replace \n with
. text = text.replace(u'\n', u'
') - element = etree.XML(u'' + text + u'') + element = etree.XML(u'%s' % text) verse_element.append(element) return element From 9259eed4a61029f00b7844c9345dcc6bcdbc343d Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 15 Oct 2011 13:30:39 +0200 Subject: [PATCH 73/77] -fixed bug 871272 -clean ups Fixes: https://launchpad.net/bugs/871272 --- openlp/core/lib/serviceitem.py | 10 ++++------ openlp/core/ui/maindisplay.py | 3 ++- openlp/plugins/media/lib/mediaitem.py | 11 +++++------ 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 510d71cde..6dff9f6ab 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -122,9 +122,8 @@ class ServiceItem(object): def _new_item(self): """ - Method to set the internal id of the item - This is used to compare service items to see if they are - the same + Method to set the internal id of the item. This is used to compare + service items to see if they are the same. """ self._uuid = unicode(uuid.uuid1()) @@ -160,9 +159,8 @@ class ServiceItem(object): def render(self, use_override=False): """ The render method is what generates the frames for the screen and - obtains the display information from the renderemanager. - At this point all the slides are built for the given - display size. + obtains the display information from the renderemanager. At this point + all the slides are built for the given display size. """ log.debug(u'Render called') self._display_frames = [] diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index d6eff912c..36f911df5 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -355,7 +355,7 @@ class MainDisplay(QtGui.QGraphicsView): """ # We request a background video but have no service Item if isBackground and not hasattr(self, u'serviceItem'): - return None + return False if not self.mediaObject: self.createMediaObject() log.debug(u'video') @@ -385,6 +385,7 @@ class MainDisplay(QtGui.QGraphicsView): # Update the preview frame. if self.isLive: Receiver.send_message(u'maindisplay_active') + return True def videoState(self, newState, oldState): """ diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index f2e0bbc06..c8f746851 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -39,7 +39,7 @@ from openlp.core.lib.ui import UiStrings, critical_error_message_box log = logging.getLogger(__name__) -CLAPPERBOARD = QtGui.QPixmap(u':/media/media_video.png').toImage() +CLAPPERBOARD = QtGui.QImage(u':/media/media_video.png') class MediaMediaItem(MediaManagerItem): """ @@ -95,14 +95,14 @@ class MediaMediaItem(MediaManagerItem): def onResetClick(self): """ - Called to reset the Live backgound with the media selected, + Called to reset the Live backgound with the media selected. """ self.resetAction.setVisible(False) self.plugin.liveController.display.resetVideo() def videobackgroundReplaced(self): """ - Triggered by main display on change of serviceitem + Triggered by main display on change of serviceitem. """ self.resetAction.setVisible(False) @@ -179,8 +179,7 @@ class MediaMediaItem(MediaManagerItem): def mediaStateWait(self, mediaState): """ - Wait for the video to change its state - Wait no longer than 5 seconds. + Wait for the video to change its state. Wait no longer than 5 seconds. """ start = datetime.now() while self.mediaObject.state() != mediaState: @@ -198,7 +197,7 @@ class MediaMediaItem(MediaManagerItem): def onDeleteClick(self): """ - Remove a media item from the list + Remove a media item from the list. """ if check_item_selected(self.listView, translate('MediaPlugin.MediaItem', 'You must select a media file to delete.')): From 1527704c03c52202d92efac726427fcbca5693da Mon Sep 17 00:00:00 2001 From: M2j Date: Sat, 15 Oct 2011 22:18:49 +0200 Subject: [PATCH 74/77] - exception dialog uses Qt call instead of external library - unicode support in report and attached filename was broken --- openlp/core/lib/mailto/LICENSE | 38 ---- openlp/core/lib/mailto/__init__.py | 321 ----------------------------- openlp/core/ui/exceptionform.py | 13 +- 3 files changed, 6 insertions(+), 366 deletions(-) delete mode 100644 openlp/core/lib/mailto/LICENSE delete mode 100644 openlp/core/lib/mailto/__init__.py diff --git a/openlp/core/lib/mailto/LICENSE b/openlp/core/lib/mailto/LICENSE deleted file mode 100644 index d8ab2d8d2..000000000 --- a/openlp/core/lib/mailto/LICENSE +++ /dev/null @@ -1,38 +0,0 @@ -PSF LICENSE AGREEMENT FOR PYTHON 2.7.1 - - 1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), - and the Individual or Organization ("Licensee") accessing and otherwise - using Python 2.7.1 software in source or binary form and its associated - documentation. - 2. Subject to the terms and conditions of this License Agreement, PSF hereby - grants Licensee a nonexclusive, royalty-free, world-wide license to - reproduce, analyze, test, perform and/or display publicly, prepare - derivative works, distribute, and otherwise use Python 2.7.1 alone or in any - derivative version, provided, however, that PSF's License Agreement and - PSF's notice of copyright, i.e., "Copyright (c) 2001-2010 Python Software - Foundation; All Rights Reserved" are retained in Python 2.7.1 alone or in - any derivative version prepared by Licensee. - 3. In the event Licensee prepares a derivative work that is based on or - incorporates Python 2.7.1 or any part thereof, and wants to make the - derivative work available to others as provided herein, then Licensee hereby - agrees to include in any such work a brief summary of the changes made to - Python 2.7.1. - 4. PSF is making Python 2.7.1 available to Licensee on an "AS IS" basis. PSF - MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF - EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION - OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT - THE USE OF PYTHON 2.7.1 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS. - 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON 2.7.1 FOR - ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF - MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 2.7.1, OR ANY DERIVATIVE - THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. - 6. This License Agreement will automatically terminate upon a material breach - of its terms and conditions. - 7. Nothing in this License Agreement shall be deemed to create any relationship - of agency, partnership, or joint venture between PSF and Licensee. This - License Agreement does not grant permission to use PSF trademarks or trade - name in a trademark sense to endorse or promote products or services of - Licensee, or any third party. - 8. By copying, installing or otherwise using Python 2.7.1, Licensee agrees to - be bound by the terms and conditions of this License Agreement. - diff --git a/openlp/core/lib/mailto/__init__.py b/openlp/core/lib/mailto/__init__.py deleted file mode 100644 index f05ebfdee..000000000 --- a/openlp/core/lib/mailto/__init__.py +++ /dev/null @@ -1,321 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 - -############################################################################### -# Utilities for opening files or URLs in the registered default application # -# and for sending e-mail using the user's preferred composer. # -# --------------------------------------------------------------------------- # -# Copyright (c) 2007 Antonio Valentino # -# All rights reserved. # -# --------------------------------------------------------------------------- # -# This program offered under the PSF License as published by the Python # -# Software Foundation. # -# # -# The license text can be found at http://docs.python.org/license.html # -# # -# This code is taken from: http://code.activestate.com/recipes/511443 # -# Modified for use in OpenLP # -############################################################################### - -__version__ = u'1.1' -__all__ = [u'open', u'mailto'] - -import os -import sys -import webbrowser -import subprocess - -from email.Utils import encode_rfc2231 - -_controllers = {} -_open = None - - -class BaseController(object): - """ - Base class for open program controllers. - """ - - def __init__(self, name): - self.name = name - - def open(self, filename): - raise NotImplementedError - - -class Controller(BaseController): - """ - Controller for a generic open program. - """ - - def __init__(self, *args): - super(Controller, self).__init__(os.path.basename(args[0])) - self.args = list(args) - - def _invoke(self, cmdline): - if sys.platform[:3] == u'win': - closefds = False - startupinfo = subprocess.STARTUPINFO() - startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW - else: - closefds = True - startupinfo = None - - if (os.environ.get(u'DISPLAY') or sys.platform[:3] == u'win' or \ - sys.platform == u'darwin'): - inout = file(os.devnull, u'r+') - else: - # for TTY programs, we need stdin/out - inout = None - - # if possible, put the child precess in separate process group, - # so keyboard interrupts don't affect child precess as well as - # Python - setsid = getattr(os, u'setsid', None) - if not setsid: - setsid = getattr(os, u'setpgrp', None) - - pipe = subprocess.Popen(cmdline, stdin=inout, stdout=inout, - stderr=inout, close_fds=closefds, preexec_fn=setsid, - startupinfo=startupinfo) - - # It is assumed that this kind of tools (gnome-open, kfmclient, - # exo-open, xdg-open and open for OSX) immediately exit after lauching - # the specific application - returncode = pipe.wait() - if hasattr(self, u'fixreturncode'): - returncode = self.fixreturncode(returncode) - return not returncode - - def open(self, filename): - if isinstance(filename, basestring): - cmdline = self.args + [filename] - else: - # assume it is a sequence - cmdline = self.args + filename - try: - return self._invoke(cmdline) - except OSError: - return False - - -# Platform support for Windows -if sys.platform[:3] == u'win': - - class Start(BaseController): - """ - Controller for the win32 start progam through os.startfile. - """ - - def open(self, filename): - try: - os.startfile(filename) - except WindowsError: - # [Error 22] No application is associated with the specified - # file for this operation: '' - return False - else: - return True - - _controllers[u'windows-default'] = Start(u'start') - _open = _controllers[u'windows-default'].open - - -# Platform support for MacOS -elif sys.platform == u'darwin': - _controllers[u'open'] = Controller(u'open') - _open = _controllers[u'open'].open - - -# Platform support for Unix -else: - - import commands - - # @WARNING: use the private API of the webbrowser module - from webbrowser import _iscommand - - class KfmClient(Controller): - """ - Controller for the KDE kfmclient program. - """ - - def __init__(self, kfmclient=u'kfmclient'): - super(KfmClient, self).__init__(kfmclient, u'exec') - self.kde_version = self.detect_kde_version() - - def detect_kde_version(self): - kde_version = None - try: - info = commands.getoutput(u'kfmclient --version') - - for line in info.splitlines(): - if line.startswith(u'KDE'): - kde_version = line.split(u':')[-1].strip() - break - except (OSError, RuntimeError): - pass - - return kde_version - - def fixreturncode(self, returncode): - if returncode is not None and self.kde_version > u'3.5.4': - return returncode - else: - return os.EX_OK - - def detect_desktop_environment(): - """ - Checks for known desktop environments - - Return the desktop environments name, lowercase (kde, gnome, xfce) - or "generic" - """ - - desktop_environment = u'generic' - - if os.environ.get(u'KDE_FULL_SESSION') == u'true': - desktop_environment = u'kde' - elif os.environ.get(u'GNOME_DESKTOP_SESSION_ID'): - desktop_environment = u'gnome' - else: - try: - info = commands.getoutput(u'xprop -root _DT_SAVE_MODE') - if u' = "xfce4"' in info: - desktop_environment = u'xfce' - except (OSError, RuntimeError): - pass - - return desktop_environment - - - def register_X_controllers(): - if _iscommand(u'kfmclient'): - _controllers[u'kde-open'] = KfmClient() - - for command in (u'gnome-open', u'exo-open', u'xdg-open'): - if _iscommand(command): - _controllers[command] = Controller(command) - - - def get(): - controllers_map = { - u'gnome': u'gnome-open', - u'kde': u'kde-open', - u'xfce': u'exo-open', - } - - desktop_environment = detect_desktop_environment() - - try: - controller_name = controllers_map[desktop_environment] - return _controllers[controller_name].open - - except KeyError: - if _controllers.has_key(u'xdg-open'): - return _controllers[u'xdg-open'].open - else: - return webbrowser.open - - if os.environ.get(u'DISPLAY'): - register_X_controllers() - _open = get() - - -def open(filename): - """ - Open a file or an URL in the registered default application. - """ - - return _open(filename) - - -def _fix_addresses(**kwargs): - for headername in (u'address', u'to', u'cc', u'bcc'): - try: - headervalue = kwargs[headername] - if not headervalue: - del kwargs[headername] - continue - elif not isinstance(headervalue, basestring): - # assume it is a sequence - headervalue = u','.join(headervalue) - except KeyError: - pass - except TypeError: - raise TypeError(u'string or sequence expected for "%s", %s ' - u'found' % (headername, type(headervalue).__name__)) - else: - translation_map = {u'%': u'%25', u'&': u'%26', u'?': u'%3F'} - for char, replacement in translation_map.items(): - headervalue = headervalue.replace(char, replacement) - kwargs[headername] = headervalue - - return kwargs - - -def mailto_format(**kwargs): - """ - Compile mailto string from call parameters - """ - # @TODO: implement utf8 option - - kwargs = _fix_addresses(**kwargs) - parts = [] - for headername in (u'to', u'cc', u'bcc', u'subject', u'body', u'attach'): - if kwargs.has_key(headername): - headervalue = kwargs[headername] - if not headervalue: - continue - if headername in (u'address', u'to', u'cc', u'bcc'): - parts.append(u'%s=%s' % (headername, headervalue)) - else: - headervalue = encode_rfc2231(headervalue) # @TODO: check - parts.append(u'%s=%s' % (headername, headervalue)) - - mailto_string = u'mailto:%s' % kwargs.get(u'address', '') - if parts: - mailto_string = u'%s?%s' % (mailto_string, u'&'.join(parts)) - - return mailto_string - - -def mailto(address, to=None, cc=None, bcc=None, subject=None, body=None, - attach=None): - """ - Send an e-mail using the user's preferred composer. - - Open the user's preferred e-mail composer in order to send a mail to - address(es) that must follow the syntax of RFC822. Multiple addresses - may be provided (for address, cc and bcc parameters) as separate - arguments. - - All parameters provided are used to prefill corresponding fields in - the user's e-mail composer. The user will have the opportunity to - change any of this information before actually sending the e-mail. - - ``address`` - specify the destination recipient - - ``cc`` - specify a recipient to be copied on the e-mail - - ``bcc`` - specify a recipient to be blindly copied on the e-mail - - ``subject`` - specify a subject for the e-mail - - ``body`` - specify a body for the e-mail. Since the user will be able to make - changes before actually sending the e-mail, this can be used to provide - the user with a template for the e-mail text may contain linebreaks - - ``attach`` - specify an attachment for the e-mail. file must point to an existing - file - """ - - mailto_string = mailto_format(**locals()) - return open(mailto_string) - diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py index 7a42d99cc..5f78eb4c3 100644 --- a/openlp/core/ui/exceptionform.py +++ b/openlp/core/ui/exceptionform.py @@ -56,7 +56,6 @@ except ImportError: SQLITE_VERSION = u'-' from openlp.core.lib import translate, SettingsManager -from openlp.core.lib.mailto import mailto from openlp.core.lib.ui import UiStrings from openlp.core.utils import get_application_version @@ -158,13 +157,13 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): source = re.sub(r'.*[/\\]openlp[/\\](.*)".*', r'\1', line) if u':' in line: exception = line.split(u'\n')[-1].split(u':')[0] - subject = u'Bug report: %s in %s' % (exception, source) + mailto_url = QtCore.QUrl(u'mailto:bugs@openlp.org') + mailto_url.addQueryItem(u'subject', + u'Bug report: %s in %s' % (exception, source)) + mailto_url.addQueryItem(u'body', body % content) if self.fileAttachment: - mailto(address=u'bugs@openlp.org', subject=subject, - body=body % content, attach=self.fileAttachment) - else: - mailto(address=u'bugs@openlp.org', subject=subject, - body=body % content) + mailto_url.addQueryItem(u'attach', self.fileAttachment) + QtGui.QDesktopServices.openUrl(mailto_url) def onDescriptionUpdated(self): count = int(20 - len(self.descriptionTextEdit.toPlainText())) From 525658ae8b05566e91a600fb4c4bb7c09dbb642d Mon Sep 17 00:00:00 2001 From: M2j Date: Sat, 15 Oct 2011 23:21:22 +0200 Subject: [PATCH 75/77] better readable coding style --- openlp/core/ui/exceptionform.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py index 5f78eb4c3..c5fc678e2 100644 --- a/openlp/core/ui/exceptionform.py +++ b/openlp/core/ui/exceptionform.py @@ -157,9 +157,9 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): source = re.sub(r'.*[/\\]openlp[/\\](.*)".*', r'\1', line) if u':' in line: exception = line.split(u'\n')[-1].split(u':')[0] + subject = u'Bug report: %s in %s' % (exception, source) mailto_url = QtCore.QUrl(u'mailto:bugs@openlp.org') - mailto_url.addQueryItem(u'subject', - u'Bug report: %s in %s' % (exception, source)) + mailto_url.addQueryItem(u'subject', subject) mailto_url.addQueryItem(u'body', body % content) if self.fileAttachment: mailto_url.addQueryItem(u'attach', self.fileAttachment) From a75e0156cc50d0b3ab1fee1f5148b97692c22178 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 16 Oct 2011 16:40:46 +0200 Subject: [PATCH 76/77] fixed docstrings --- openlp/core/lib/renderer.py | 8 ++++---- openlp/core/lib/serviceitem.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 71670ff21..02f6970ac 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -57,14 +57,14 @@ class Renderer(object): def __init__(self, imageManager, themeManager): """ - Initialise the render manager. + Initialise the renderer. ``imageManager`` - A ImageManager instance which takes care of e. g. caching and resizing + A imageManager instance which takes care of e. g. caching and resizing images. ``themeManager`` - The ThemeManager instance, used to get the current theme details. + The themeManager instance, used to get the current theme details. """ log.debug(u'Initialisation started') self.themeManager = themeManager @@ -81,7 +81,7 @@ class Renderer(object): def update_display(self): """ - Updates the render manager's information about the current screen. + Updates the renderer's information about the current screen. """ log.debug(u'Update Display') self._calculate_default() diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 6dff9f6ab..0eb0c866f 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -159,8 +159,8 @@ class ServiceItem(object): def render(self, use_override=False): """ The render method is what generates the frames for the screen and - obtains the display information from the renderemanager. At this point - all the slides are built for the given display size. + obtains the display information from the renderer. At this point all + slides are built for the given display size. """ log.debug(u'Render called') self._display_frames = [] From 13ff2faf182542cdb7291857fe75e97606dbcd9c Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 16 Oct 2011 22:32:50 +0200 Subject: [PATCH 77/77] fixed ticket 299 --- openlp/plugins/songs/lib/easislidesimport.py | 2 +- openlp/plugins/songs/lib/sofimport.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/songs/lib/easislidesimport.py b/openlp/plugins/songs/lib/easislidesimport.py index 6d3bde025..a3dd553f1 100644 --- a/openlp/plugins/songs/lib/easislidesimport.py +++ b/openlp/plugins/songs/lib/easislidesimport.py @@ -258,7 +258,7 @@ class EasiSlidesImport(SongImport): verses[reg][vt][vn] = {} if not verses[reg][vt][vn].has_key(inst): verses[reg][vt][vn][inst] = [] - words = self.tidy_text(line) + words = self.tidyText(line) verses[reg][vt][vn][inst].append(words) # done parsing diff --git a/openlp/plugins/songs/lib/sofimport.py b/openlp/plugins/songs/lib/sofimport.py index 6294f211e..5f310dba0 100644 --- a/openlp/plugins/songs/lib/sofimport.py +++ b/openlp/plugins/songs/lib/sofimport.py @@ -194,7 +194,7 @@ class SofImport(OooImport): into line """ text = textportion.getString() - text = self.tidy_text(text) + text = self.tidyText(text) if text.strip() == u'': return text if textportion.CharWeight == BOLD: