fixed detection for more than one match

This commit is contained in:
Andreas Preikschat 2011-10-31 10:13:25 +01:00
parent e856fa9aed
commit 94c99d1b3d

View File

@ -517,7 +517,8 @@ class SlideController(QtGui.QWidget):
elif verse_type.isnumeric(): elif verse_type.isnumeric():
self.current_shortcut += verse_type self.current_shortcut += verse_type
self.current_shortcut = self.current_shortcut.upper() self.current_shortcut = self.current_shortcut.upper()
matches = [match for match in self.slideList.keys() keys = self.slideList.keys()
matches = [match for match in keys
if match.startswith(self.current_shortcut)] if match.startswith(self.current_shortcut)]
if len(matches) == 1: if len(matches) == 1:
self.shortcutTimer.stop() self.shortcutTimer.stop()
@ -528,8 +529,14 @@ class SlideController(QtGui.QWidget):
# Start the time as we did not have any match. # Start the time as we did not have any match.
self.shortcutTimer.start(350) self.shortcutTimer.start(350)
else: else:
# Reset the key sequence as we do not have any match and the timer # The timer timed out.
# timed out. if self.current_shortcut in keys:
# We had more than one match (e. g. "V1" and "V10", but "V1" was
# the slide we wanted to go.
self.__checkUpdateSelectedSlide(
self.slideList[self.current_shortcut])
self.slideSelected()
# Reset the shortcut.
self.current_shortcut = u'' self.current_shortcut = u''
def setPreviewHotkeys(self, parent=None): def setPreviewHotkeys(self, parent=None):