openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #20292
[Merge] lp:~marmyshev/openlp/item_title into lp:openlp
Dmitriy Marmyshev has proposed merging lp:~marmyshev/openlp/item_title into lp:openlp.
Requested reviews:
Tim Bentley (trb143)
For more details, see:
https://code.launchpad.net/~marmyshev/openlp/item_title/+merge/156694
Added future to rename items in ServiceManager.
Gives more flexability in use onLive and in print service.
--
https://code.launchpad.net/~marmyshev/openlp/item_title/+merge/156694
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2013-03-19 19:43:22 +0000
+++ openlp/core/lib/serviceitem.py 2013-04-02 21:05:42 +0000
@@ -442,7 +442,7 @@
"""
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:
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2013-03-30 08:49:19 +0000
+++ openlp/core/ui/servicemanager.py 2013-04-02 21:05:42 +0000
@@ -219,6 +219,8 @@
self.menu = QtGui.QMenu()
self.edit_action = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', '&Edit Item'),
icon=u':/general/general_edit.png', triggers=self.remote_edit)
+ self.rename_action = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', '&Rename...'),
+ triggers=self.on_service_item_rename)
self.maintain_action = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', '&Reorder Item'),
icon=u':/general/general_edit.png', triggers=self.on_service_item_edit_form)
self.notes_action = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', '&Notes'),
@@ -773,6 +775,7 @@
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)
@@ -780,6 +783,9 @@
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:
@@ -1393,6 +1399,29 @@
if new_item:
self.add_service_item(new_item, replace=True)
+ def on_service_item_rename(self):
+ """
+ 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):
+# get_main_title = False
+# Title = self.service_items[item][u'service_item']._raw_frames[0][u'title']
+# else:
+# get_main_title = True
+ title = self.service_items[item][u'service_item'].title
+ title, ok = QtGui.QInputDialog.getText(self, self.tr(translate('OpenLP.ServiceManager', 'Input title')),
+ self.tr(translate('OpenLP.ServiceManager', 'Title')), QtGui.QLineEdit.Normal, self.trUtf8(title))
+ if ok:
+ self.service_items[item][u'service_item'].title = unicode(title)
+ self.repaint_service_list(item, -1)
+ self.set_modified()
+
def create_custom(self):
"""
Saves the current text item as a custom slide
=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py 2013-03-23 07:07:06 +0000
+++ openlp/plugins/images/lib/mediaitem.py 2013-04-02 21:05:42 +0000
@@ -543,9 +543,11 @@
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)
Follow ups