From 5815d637a7184a33a7a5ff33fcc4a78a959400e7 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 7 May 2012 08:40:34 +0100 Subject: [PATCH 1/4] Add Service delete to Shortcuts and allow from keyboard --- openlp/core/ui/servicemanager.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 4fa36cc2f..e0443a478 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -64,6 +64,10 @@ class ServiceManagerList(QtGui.QTreeWidget): elif event.key() == QtCore.Qt.Key_Down: self.serviceManager.onMoveSelectionDown() event.accept() + elif event.key() == QtCore.Qt.Key_Delete: + self.serviceManager.onDeleteFromService() + event.accept() + print "Key event " + unicode(event.key()) event.ignore() else: event.ignore() @@ -218,6 +222,7 @@ class ServiceManager(QtGui.QWidget): icon=u':/general/general_delete.png', tooltip=translate('OpenLP.ServiceManager', 'Delete the selected item from the service.'), + shortcuts=[QtCore.Qt.Key_Delete], category=UiStrings().Service, triggers=self.onDeleteFromService) self.orderToolbar.addSeparator() self.serviceManagerList.expand = self.orderToolbar.addToolbarAction( From bcb66687929d6c417cbc934ce421c5ac93e962e2 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 7 May 2012 09:21:21 +0100 Subject: [PATCH 2/4] Delete clean ups --- openlp/core/ui/servicemanager.py | 36 +++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index e0443a478..96734bc47 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -67,7 +67,6 @@ class ServiceManagerList(QtGui.QTreeWidget): elif event.key() == QtCore.Qt.Key_Delete: self.serviceManager.onDeleteFromService() event.accept() - print "Key event " + unicode(event.key()) event.ignore() else: event.ignore() @@ -222,7 +221,7 @@ class ServiceManager(QtGui.QWidget): icon=u':/general/general_delete.png', tooltip=translate('OpenLP.ServiceManager', 'Delete the selected item from the service.'), - shortcuts=[QtCore.Qt.Key_Delete], category=UiStrings().Service, + shortcuts=[QtCore.Qt.Key_Delete], triggers=self.onDeleteFromService) self.orderToolbar.addSeparator() self.serviceManagerList.expand = self.orderToolbar.addToolbarAction( @@ -1322,7 +1321,32 @@ class ServiceManager(QtGui.QWidget): def findServiceItem(self): """ - Finds the selected ServiceItem in the list and returns the position of + Finds the first selected ServiceItem in the list and returns the + position of the serviceitem and its selected child item. For example, + if the third child item (in the Slidecontroller known as slide) in the + second service item is selected this will return:: + + (1, 2) + """ + items = self.serviceManagerList.selectedItems() + serviceItem = 0 + serviceItemChild = -1 + for item in items: + parentitem = item.parent() + if parentitem is None: + serviceItem = item.data(0, QtCore.Qt.UserRole).toInt()[0] + else: + serviceItem = parentitem.data(0, QtCore.Qt.UserRole).toInt()[0] + serviceItemChild = item.data(0, QtCore.Qt.UserRole).toInt()[0] + # Adjust for zero based arrays. + serviceItem -= 1 + # Only process the first item on the list for this method. + break + return serviceItem, serviceItemChild + + def findServiceItems(self): + """ + Finds all selected ServiceItems in the list and returns the position of the serviceitem and its selected child item. For example, if the third child item (in the Slidecontroller known as slide) in the second service item is selected this will return:: @@ -1339,8 +1363,10 @@ class ServiceManager(QtGui.QWidget): else: serviceItem = parentitem.data(0, QtCore.Qt.UserRole).toInt()[0] serviceItemChild = item.data(0, QtCore.Qt.UserRole).toInt()[0] - # Adjust for zero based arrays. - serviceItem -= 1 + # Adjust for zero based arrays. + serviceItem -= 1 + # Only process the first item on the list for this method. + break return serviceItem, serviceItemChild def dragEnterEvent(self, event): From f9247078bc4fc4ddf8db4d6b335cbdae09de816e Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 7 May 2012 09:35:52 +0100 Subject: [PATCH 3/4] more Delete clean ups --- openlp/core/ui/servicemanager.py | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 96734bc47..01e624831 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -1344,31 +1344,6 @@ class ServiceManager(QtGui.QWidget): break return serviceItem, serviceItemChild - def findServiceItems(self): - """ - Finds all selected ServiceItems in the list and returns the position of - the serviceitem and its selected child item. For example, if the third - child item (in the Slidecontroller known as slide) in the second service - item is selected this will return:: - - (1, 2) - """ - items = self.serviceManagerList.selectedItems() - serviceItem = 0 - serviceItemChild = -1 - for item in items: - parentitem = item.parent() - if parentitem is None: - serviceItem = item.data(0, QtCore.Qt.UserRole).toInt()[0] - else: - serviceItem = parentitem.data(0, QtCore.Qt.UserRole).toInt()[0] - serviceItemChild = item.data(0, QtCore.Qt.UserRole).toInt()[0] - # Adjust for zero based arrays. - serviceItem -= 1 - # Only process the first item on the list for this method. - break - return serviceItem, serviceItemChild - def dragEnterEvent(self, event): """ Accept Drag events From 7cb1603d12f3510c2331aec4d25af507bddfd240 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 7 May 2012 17:01:53 +0100 Subject: [PATCH 4/4] Fix traceback --- openlp/core/ui/servicemanager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 01e624831..7d3e8289c 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -1329,7 +1329,7 @@ class ServiceManager(QtGui.QWidget): (1, 2) """ items = self.serviceManagerList.selectedItems() - serviceItem = 0 + serviceItem = -1 serviceItemChild = -1 for item in items: parentitem = item.parent()