From c443a6702e1172381b20e6df376072a82a41c17e Mon Sep 17 00:00:00 2001 From: Dmitriy Marmyshev Date: Tue, 2 Apr 2013 23:28:56 +0400 Subject: [PATCH] changed image add behavior for title --- openlp/core/lib/serviceitem.py | 2 +- openlp/core/ui/servicemanager.py | 7 +++++++ openlp/plugins/images/lib/mediaitem.py | 6 ++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index f57243818..466b6808f 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -442,7 +442,7 @@ class ServiceItem(object): """ Returns the title of the service item. """ - if self.is_text(): + if self.is_text() or self.is_image(): return self.title else: if ItemCapabilities.HasDetailedTitleDisplay in self.capabilities: diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 9f609302e..852bcf27f 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -775,6 +775,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): pos = item.data(0, QtCore.Qt.UserRole) service_item = self.service_items[pos - 1] self.edit_action.setVisible(False) + self.rename_action.setVisible(False) self.create_custom_action.setVisible(False) self.maintain_action.setVisible(False) self.notes_action.setVisible(False) @@ -782,6 +783,9 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): self.auto_start_action.setVisible(False) if service_item[u'service_item'].is_capable(ItemCapabilities.CanEdit) and service_item[u'service_item'].edit_id: self.edit_action.setVisible(True) + if not service_item[u'service_item'].is_capable(ItemCapabilities.HasDetailedTitleDisplay)\ + and not service_item[u'service_item'].is_capable(ItemCapabilities.CanEdit): + self.rename_action.setVisible(True) if service_item[u'service_item'].is_capable(ItemCapabilities.CanMaintain): self.maintain_action.setVisible(True) if item.parent() is None: @@ -1400,6 +1404,9 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): Opens a dialog to rename the service item. """ item = self.find_service_item()[0] + if ItemCapabilities.HasDetailedTitleDisplay in self.service_items[item][u'service_item'].capabilities\ + or ItemCapabilities.CanEdit in self.service_items[item][u'service_item'].capabilities: + return # if False and not self.service_items[item][u'service_item'].is_text()\ # and (ItemCapabilities.HasDetailedTitleDisplay in self.service_items[item][u'service_item'].capabilities\ # or len(self.service_items[item][u'service_item']._raw_frames) == 1): diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index d74b1ccab..f9c29c9e0 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -543,9 +543,11 @@ class ImageMediaItem(MediaManagerItem): if not items: return False # Determine service item title - if isinstance(items[0].data(0, QtCore.Qt.UserRole), ImageGroups): + if (isinstance(items[0].data(0, QtCore.Qt.UserRole), ImageGroups) or len(items) == 1)\ + and len(service_item._raw_frames) ==0: service_item.title = items[0].text(0) - else: + elif len(service_item._raw_frames) == 1 and service_item.title == service_item._raw_frames[0][u'title']\ + or len(items) > 1 and len(service_item._raw_frames) ==0: service_item.title = unicode(self.plugin.name_strings[u'plural']) service_item.add_capability(ItemCapabilities.CanMaintain) service_item.add_capability(ItemCapabilities.CanPreview)