From cb4fa5d03ab5c84d5234c3c19aedc91c6df2846c Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 20 Dec 2010 20:22:21 +0000 Subject: [PATCH] Fix Preview of Theme with Image bug Fix Protection of Single Character Theme titles Add Cursor update to Image import Fixes: https://launchpad.net/bugs/692684 --- openlp/core/lib/imagemanager.py | 10 ++++++++++ openlp/core/lib/rendermanager.py | 2 ++ openlp/core/ui/slidecontroller.py | 2 +- openlp/core/ui/themeform.py | 2 +- openlp/plugins/images/lib/mediaitem.py | 6 +++++- 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index 307ee84df..14de141fc 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -113,6 +113,14 @@ class ImageManager(QtCore.QObject): time.sleep(0.1) return self._cache[name].image_bytes + def del_image(self, name): + """ + Delete the Image from the Cache + """ + log.debug(u'del_image %s' % name) + if name in self._cache: + del self._cache[name] + def add_image(self, name, path): """ Add image to cache if it is not already there @@ -125,6 +133,8 @@ class ImageManager(QtCore.QObject): image.image = resize_image(path, self.width, self.height) self._cache[name] = 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: diff --git a/openlp/core/lib/rendermanager.py b/openlp/core/lib/rendermanager.py index 81cde12a0..fc7ba38b8 100644 --- a/openlp/core/lib/rendermanager.py +++ b/openlp/core/lib/rendermanager.py @@ -213,6 +213,8 @@ class RenderManager(object): # make big page for theme edit dialog to get line count if self.force_page: verse = verse + verse + verse + else: + self.image_manager.del_image(self.theme_data.theme_name) footer = [] footer.append(u'Arky Arky (Unknown)' ) footer.append(u'Public Domain') diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 6c7fb8538..0f275a792 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -560,7 +560,7 @@ class SlideController(QtGui.QWidget): [serviceItem, self.isLive, blanked, slideno]) self.slideList = {} width = self.parent.ControlSplitter.sizes()[self.split] - # Set pointing cursor when we have somthing to point at + # Set pointing cursor when we have something to point at self.PreviewListWidget.setCursor(QtCore.Qt.PointingHandCursor) self.serviceItem = serviceItem self.PreviewListWidget.clear() diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index b091427bf..84c6f0aa3 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -444,7 +444,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): def setPreviewTabValues(self): self.setField(u'name', QtCore.QVariant(self.theme.theme_name)) - if len(self.theme.theme_name) > 1: + if len(self.theme.theme_name) > 0: self.themeNameEdit.setEnabled(False) else: self.themeNameEdit.setEnabled(True) diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 4f1e9378e..0774787f5 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \ context_menu_action, ItemCapabilities, SettingsManager, translate, \ - check_item_selected + check_item_selected, Receiver from openlp.core.utils import AppLocation, get_images_filter log = logging.getLogger(__name__) @@ -139,6 +139,8 @@ class ImageMediaItem(MediaManagerItem): self.settingsSection, self.getFileList()) def loadList(self, list): + self.listView.setCursor(QtCore.Qt.BusyCursor) + Receiver.send_message(u'openlp_process_events') for file in list: filename = os.path.split(unicode(file))[1] thumb = os.path.join(self.servicePath, filename) @@ -153,6 +155,8 @@ class ImageMediaItem(MediaManagerItem): item_name.setIcon(icon) item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file)) self.listView.addItem(item_name) + self.listView.setCursor(QtCore.Qt.ArrowCursor) + Receiver.send_message(u'openlp_process_events') def generateSlideData(self, service_item, item=None, xmlVersion=False): items = self.listView.selectedIndexes()