Fixes keyboard flood where events are switched order by PYQT.

Now a keyboard press is only handled if the previous is finished.  

Fixes: https://launchpad.net/bugs/892571
This commit is contained in:
Tim Bentley 2011-11-23 06:05:42 +00:00
parent d5331f50b3
commit 5e702c1782

View File

@ -79,6 +79,7 @@ class SlideController(QtGui.QWidget):
self.songEdit = False self.songEdit = False
self.selectedRow = 0 self.selectedRow = 0
self.serviceItem = None self.serviceItem = None
self.accept_keypress = True
self.panel = QtGui.QWidget(parent.controlSplitter) self.panel = QtGui.QWidget(parent.controlSplitter)
self.slideList = {} self.slideList = {}
# Layout for holding panel # Layout for holding panel
@ -578,12 +579,17 @@ class SlideController(QtGui.QWidget):
self.display.videoStop() self.display.videoStop()
def servicePrevious(self): def servicePrevious(self):
time.sleep(0.1) if self.accept_keypress:
Receiver.send_message('servicemanager_previous_item') self.accept_keypress = False
Receiver.send_message('servicemanager_previous_item')
self.accept_keypress = True
def serviceNext(self): def serviceNext(self):
time.sleep(0.1) if self.accept_keypress:
Receiver.send_message('servicemanager_next_item') self.accept_keypress = False
Receiver.send_message('servicemanager_next_item')
self.accept_keypress = True
def screenSizeChanged(self): def screenSizeChanged(self):
""" """
@ -771,7 +777,7 @@ class SlideController(QtGui.QWidget):
log.debug(u'processManagerItem live = %s' % self.isLive) log.debug(u'processManagerItem live = %s' % self.isLive)
self.onStopLoop() self.onStopLoop()
old_item = self.serviceItem old_item = self.serviceItem
# take a copy not a link to the servicemeanager copy. # take a copy not a link to the servicemanager copy.
self.serviceItem = copy.copy(serviceItem) self.serviceItem = copy.copy(serviceItem)
if old_item and self.isLive and old_item.is_capable( if old_item and self.isLive and old_item.is_capable(
ItemCapabilities.ProvidesOwnDisplay): ItemCapabilities.ProvidesOwnDisplay):