Add Enter on ServiceManager

This commit is contained in:
Tim Bentley 2009-06-29 18:37:46 +01:00
parent 409383add2
commit 9318cc3ec0
1 changed files with 17 additions and 1 deletions

View File

@ -29,6 +29,22 @@ from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, Event, \
contextMenuAction, contextMenuSeparator
from openlp.core.utils import ConfigHelper
class ServiceManagerList(QtGui.QTreeWidget):
def __init__(self,parent=None,name=None):
QtGui.QListView.__init__(self,parent)
self.parent = parent
def keyPressEvent(self, event):
if type(event) == QtGui.QKeyEvent:
#here accept the event and do something
if event.key() == QtCore.Qt.Key_Enter:
self.parent.makeLive()
event.accept()
event.ignore()
else:
event.ignore()
class ServiceManager(QtGui.QWidget):
"""
Manages the orders of service. Currently this involves taking
@ -66,7 +82,7 @@ class ServiceManager(QtGui.QWidget):
self.Toolbar.addAction(self.ThemeWidget)
self.Layout.addWidget(self.Toolbar)
# Create the service manager list
self.ServiceManagerList = QtGui.QTreeWidget(self)
self.ServiceManagerList = ServiceManagerList(self)
self.ServiceManagerList.setEditTriggers(QtGui.QAbstractItemView.CurrentChanged|QtGui.QAbstractItemView.DoubleClicked|QtGui.QAbstractItemView.EditKeyPressed)
self.ServiceManagerList.setDragDropMode(QtGui.QAbstractItemView.DragDrop)
self.ServiceManagerList.setAlternatingRowColors(True)