Key handling changes

This commit is contained in:
Tim Bentley 2010-02-04 19:25:32 +00:00
parent 5838495bb4
commit 079c9a4679
3 changed files with 11 additions and 1 deletions

View File

@ -44,6 +44,11 @@ class DisplayWidget(QtGui.QWidget):
def __init__(self, parent=None, name=None):
QtGui.QWidget.__init__(self, parent)
self.parent = parent
self.hotkey_map = {QtCore.Qt.Key_Return: 'servicemanager_next_item',
QtCore.Qt.Key_Space: 'live_slidecontroller_next_noloop',
QtCore.Qt.Key_Enter: 'live_slidecontroller_next_noloop',
QtCore.Qt.Key_0: 'servicemanager_next_item',
QtCore.Qt.Key_Backspace: 'live_slidecontroller_previous_noloop'}
def keyPressEvent(self, event):
if type(event) == QtGui.QKeyEvent:
@ -60,6 +65,9 @@ class DisplayWidget(QtGui.QWidget):
elif event.key() == QtCore.Qt.Key_PageDown:
Receiver.send_message(u'live_slidecontroller_last')
event.accept()
elif event.key() in self.hotkey_map:
Receiver.send_message(self.hotkey_map[event.key()]);
event.accept()
elif event.key() == QtCore.Qt.Key_Escape:
self.resetDisplay()
event.accept()

View File

@ -243,6 +243,8 @@ class ServiceManager(QtGui.QWidget):
Called by the SlideController to select the
next service item
"""
if len(self.ServiceManagerList.selectedItems()) == 0:
return
selected = self.ServiceManagerList.selectedItems()[0]
lookFor = 0
serviceIterator = QtGui.QTreeWidgetItemIterator(self.ServiceManagerList)

View File

@ -62,7 +62,7 @@ class SlideList(QtGui.QTableWidget):
elif event.key() == QtCore.Qt.Key_PageDown:
self.parent.onSlideSelectedLast()
event.accept()
elif event.key() in self.hotkey_map:
elif event.key() in self.hotkey_map and self.parent.isLive:
Receiver.send_message(self.hotkey_map[event.key()]);
event.accept()
event.ignore()