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
This commit is contained in:
Tim Bentley 2010-12-20 20:22:21 +00:00
parent 12af5cada3
commit cb4fa5d03a
5 changed files with 19 additions and 3 deletions

View File

@ -113,6 +113,14 @@ class ImageManager(QtCore.QObject):
time.sleep(0.1) time.sleep(0.1)
return self._cache[name].image_bytes 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): 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
@ -125,6 +133,8 @@ class ImageManager(QtCore.QObject):
image.image = resize_image(path, image.image = resize_image(path,
self.width, self.height) self.width, self.height)
self._cache[name] = image self._cache[name] = image
else:
log.debug(u'Image in cache %s:%s' % (name, path))
self._cache_dirty = True self._cache_dirty = True
# only one thread please # only one thread please
if not self._thread_running: if not self._thread_running:

View File

@ -213,6 +213,8 @@ class RenderManager(object):
# make big page for theme edit dialog to get line count # make big page for theme edit dialog to get line count
if self.force_page: if self.force_page:
verse = verse + verse + verse verse = verse + verse + verse
else:
self.image_manager.del_image(self.theme_data.theme_name)
footer = [] footer = []
footer.append(u'Arky Arky (Unknown)' ) footer.append(u'Arky Arky (Unknown)' )
footer.append(u'Public Domain') footer.append(u'Public Domain')

View File

@ -560,7 +560,7 @@ class SlideController(QtGui.QWidget):
[serviceItem, self.isLive, blanked, slideno]) [serviceItem, self.isLive, blanked, slideno])
self.slideList = {} self.slideList = {}
width = self.parent.ControlSplitter.sizes()[self.split] 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.PreviewListWidget.setCursor(QtCore.Qt.PointingHandCursor)
self.serviceItem = serviceItem self.serviceItem = serviceItem
self.PreviewListWidget.clear() self.PreviewListWidget.clear()

View File

@ -444,7 +444,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
def setPreviewTabValues(self): def setPreviewTabValues(self):
self.setField(u'name', QtCore.QVariant(self.theme.theme_name)) 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) self.themeNameEdit.setEnabled(False)
else: else:
self.themeNameEdit.setEnabled(True) self.themeNameEdit.setEnabled(True)

View File

@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \ from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
context_menu_action, ItemCapabilities, SettingsManager, translate, \ context_menu_action, ItemCapabilities, SettingsManager, translate, \
check_item_selected check_item_selected, Receiver
from openlp.core.utils import AppLocation, get_images_filter from openlp.core.utils import AppLocation, get_images_filter
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -139,6 +139,8 @@ class ImageMediaItem(MediaManagerItem):
self.settingsSection, self.getFileList()) self.settingsSection, self.getFileList())
def loadList(self, list): def loadList(self, list):
self.listView.setCursor(QtCore.Qt.BusyCursor)
Receiver.send_message(u'openlp_process_events')
for file in list: for file in list:
filename = os.path.split(unicode(file))[1] filename = os.path.split(unicode(file))[1]
thumb = os.path.join(self.servicePath, filename) thumb = os.path.join(self.servicePath, filename)
@ -153,6 +155,8 @@ class ImageMediaItem(MediaManagerItem):
item_name.setIcon(icon) item_name.setIcon(icon)
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file)) item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
self.listView.addItem(item_name) 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): def generateSlideData(self, service_item, item=None, xmlVersion=False):
items = self.listView.selectedIndexes() items = self.listView.selectedIndexes()