← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~marmyshev/openlp/item_title into lp:openlp

 

Dmitriy Marmyshev has proposed merging lp:~marmyshev/openlp/item_title into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~marmyshev/openlp/item_title/+merge/142941

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/142941
Your team OpenLP Core is requested to review the proposed merge of lp:~marmyshev/openlp/item_title into lp:openlp.
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2013-01-02 21:31:11 +0000
+++ openlp/core/ui/servicemanager.py	2013-01-11 16:29:00 +0000
@@ -242,6 +242,8 @@
         self.menu = QtGui.QMenu()
         self.editAction = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', '&Edit Item'),
             icon=u':/general/general_edit.png', triggers=self.remoteEdit)
+        self.RenameAction = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', '&Rename...'),            
+            triggers=self.onServiceItemRename)  
         self.maintainAction = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', '&Reorder Item'),
             icon=u':/general/general_edit.png', triggers=self.onServiceItemEditForm)
         self.notesAction = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', '&Notes'),
@@ -829,6 +831,31 @@
         if self.serviceItemEditForm.exec_():
             self.addServiceItem(self.serviceItemEditForm.getServiceItem(),
                 replace=True, expand=self.serviceItems[item][u'expanded'])
+    
+    def onServiceItemRename(self):
+        """
+        Opens a dialog to rename the service item.
+        """
+        item = self.findServiceItem()[0]
+        if not self.serviceItems[item][u'service_item'].is_text()\
+            and ItemCapabilities.HasDetailedTitleDisplay in self.serviceItems[item][u'service_item'].capabilities\
+            or len(self.serviceItems[item][u'service_item']._raw_frames) == 1:
+            get_main_title = False
+            Title = self.serviceItems[item][u'service_item']._raw_frames[0][u'title']
+        else:
+            get_main_title = True
+            Title = self.serviceItems[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:
+            if get_main_title:
+                self.serviceItems[item][u'service_item'].title = unicode(Title)
+            else:
+                self.serviceItems[item][u'service_item']._raw_frames[0][u'title']= unicode(Title)
+            self.repaintServiceList(item, -1)
+            self.setModified()
 
     def previewLive(self, message):
         """


Follow ups