openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #22101
[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)
Raoul Snyman (raoul-snyman)
Andreas Preikschat (googol)
For more details, see:
https://code.launchpad.net/~marmyshev/openlp/item_title/+merge/192546
Added ability to rename items in ServiceManager.
--
https://code.launchpad.net/~marmyshev/openlp/item_title/+merge/192546
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2013-10-13 21:07:28 +0000
+++ openlp/core/lib/serviceitem.py 2013-10-24 17:10:51 +0000
@@ -107,6 +107,9 @@
``CanAutoStartForLive``
The capability to ignore the do not play if display blank flag.
+
+ ``CanEditTitle``
+ The capability to edit the title of the item
"""
CanPreview = 1
@@ -125,6 +128,7 @@
CanWordSplit = 14
HasBackgroundAudio = 15
CanAutoStartForLive = 16
+ CanEditTitle = 17
class ServiceItem(object):
@@ -444,7 +448,7 @@
"""
Returns the title of the service item.
"""
- if self.is_text():
+ if self.is_text() or ItemCapabilities.CanEditTitle in self.capabilities:
return self.title
else:
if len(self._raw_frames) > 1:
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2013-10-13 21:07:28 +0000
+++ openlp/core/ui/servicemanager.py 2013-10-24 17:10:51 +0000
@@ -218,6 +218,8 @@
self.menu = QtGui.QMenu()
self.edit_action = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', '&Edit Item'),
icon=':/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=':/general/general_edit.png', triggers=self.on_service_item_edit_form)
self.notes_action = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', '&Notes'),
@@ -779,6 +781,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)
@@ -786,6 +789,8 @@
self.auto_start_action.setVisible(False)
if service_item['service_item'].is_capable(ItemCapabilities.CanEdit) and service_item['service_item'].edit_id:
self.edit_action.setVisible(True)
+ if service_item['service_item'].is_capable(ItemCapabilities.CanEditTitle):
+ self.rename_action.setVisible(True)
if service_item['service_item'].is_capable(ItemCapabilities.CanMaintain):
self.maintain_action.setVisible(True)
if item.parent() is None:
@@ -1391,6 +1396,21 @@
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 not self.service_items[item]['service_item'].is_capable(ItemCapabilities.CanEditTitle):
+ return
+ title = self.service_items[item]['service_item'].title
+ title, ok = QtGui.QInputDialog.getText(self, translate('OpenLP.ServiceManager', 'Rename item title'),
+ translate('OpenLP.ServiceManager', 'Title:'), QtGui.QLineEdit.Normal, self.trUtf8(title))
+ if ok:
+ self.service_items[item]['service_item'].title = 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/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2013-10-13 21:07:28 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2013-10-24 17:10:51 +0000
@@ -847,6 +847,7 @@
service_item.add_capability(ItemCapabilities.CanPreview)
service_item.add_capability(ItemCapabilities.CanLoop)
service_item.add_capability(ItemCapabilities.CanWordSplit)
+ service_item.add_capability(ItemCapabilities.CanEditTitle)
# Service Item: Title
service_item.title = create_separated_list(raw_title)
# Service Item: Theme
=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py 2013-10-13 21:07:28 +0000
+++ openlp/plugins/images/lib/mediaitem.py 2013-10-24 17:10:51 +0000
@@ -559,6 +559,7 @@
service_item.add_capability(ItemCapabilities.CanPreview)
service_item.add_capability(ItemCapabilities.CanLoop)
service_item.add_capability(ItemCapabilities.CanAppend)
+ service_item.add_capability(ItemCapabilities.CanEditTitle)
# force a nonexistent theme
service_item.theme = -1
missing_items_filenames = []
=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py 2013-10-13 20:36:42 +0000
+++ openlp/plugins/media/lib/mediaitem.py 2013-10-24 17:10:51 +0000
@@ -201,6 +201,7 @@
if not self.media_controller.media_length(service_item):
return False
service_item.add_capability(ItemCapabilities.CanAutoStartForLive)
+ service_item.add_capability(ItemCapabilities.CanEditTitle)
service_item.add_capability(ItemCapabilities.RequiresMedia)
if Settings().value(self.settings_section + '/media auto start') == QtCore.Qt.Checked:
service_item.will_auto_start = True
=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py 2013-10-13 21:07:28 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py 2013-10-24 17:10:51 +0000
@@ -251,6 +251,7 @@
return False
service_item.processor = self.display_type_combo_box.currentText()
service_item.add_capability(ItemCapabilities.ProvidesOwnDisplay)
+ service_item.add_capability(ItemCapabilities.CanEditTitle)
if not self.display_type_combo_box.currentText():
return False
for bitem in items:
=== modified file 'tests/interfaces/openlp_core_ui/test_servicemanager.py'
--- tests/interfaces/openlp_core_ui/test_servicemanager.py 2013-10-04 21:45:38 +0000
+++ tests/interfaces/openlp_core_ui/test_servicemanager.py 2013-10-24 17:10:51 +0000
@@ -67,6 +67,7 @@
self.service_manager.notes_action.setVisible = MagicMock()
self.service_manager.time_action.setVisible = MagicMock()
self.service_manager.auto_start_action.setVisible = MagicMock()
+ self.service_manager.rename_action.setVisible = MagicMock()
# WHEN: Show the context menu.
self.service_manager.context_menu(q_point)
@@ -83,3 +84,6 @@
'The action should be set invisible.'
self.service_manager.auto_start_action.setVisible.assert_called_once_with(False), \
'The action should be set invisible.'
+ self.service_manager.rename_action.setVisible.assert_called_once_with(False), \
+ self.service_manager.rename_action.setVisible.assert_called_once_with(False), \
+ 'The action should be set invisible.'
Follow ups