From 079c9a4679e556cf398da0276da482ea6f955211 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 4 Feb 2010 19:25:32 +0000 Subject: [PATCH] Key handling changes --- openlp/core/ui/maindisplay.py | 8 ++++++++ openlp/core/ui/servicemanager.py | 2 ++ openlp/core/ui/slidecontroller.py | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index cda5774d6..65a8843a8 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -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() diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 6a2589a43..b96e47f97 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -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) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 71445b074..8a4aebd8c 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -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()