changed image add behavior for title

This commit is contained in:
Dmitriy Marmyshev 2013-04-02 23:28:56 +04:00
parent 6209ad8bb5
commit c443a6702e
3 changed files with 12 additions and 3 deletions

View File

@ -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:

View File

@ -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):

View File

@ -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)