forked from openlp/openlp
completed detection + cleaned detection
This commit is contained in:
parent
360843baf7
commit
2458ffc3bc
@ -322,7 +322,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.slideLayout.insertWidget(0, self.slidePreview)
|
self.slideLayout.insertWidget(0, self.slidePreview)
|
||||||
self.grid.addLayout(self.slideLayout, 0, 0, 1, 1)
|
self.grid.addLayout(self.slideLayout, 0, 0, 1, 1)
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
self.old_shortcut = u''
|
self.current_shortcut = u''
|
||||||
self.shortcutTimer = QtCore.QTimer()
|
self.shortcutTimer = QtCore.QTimer()
|
||||||
self.shortcutTimer.setObjectName(u'shortcutTimer')
|
self.shortcutTimer.setObjectName(u'shortcutTimer')
|
||||||
self.shortcutTimer.setSingleShot(True)
|
self.shortcutTimer.setSingleShot(True)
|
||||||
@ -462,53 +462,37 @@ class SlideController(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
#FIXME: translatable verse types
|
#FIXME: translatable verse types
|
||||||
verse_type = unicode(self.sender().objectName())
|
verse_type = unicode(self.sender().objectName())
|
||||||
key = u''
|
|
||||||
if verse_type.startswith(u'verseShortcut'):
|
if verse_type.startswith(u'verseShortcut'):
|
||||||
key = u'V'
|
print u'"%s"' % self.current_shortcut
|
||||||
|
self.current_shortcut = u'V'
|
||||||
elif verse_type.startswith(u'chorusShortcut'):
|
elif verse_type.startswith(u'chorusShortcut'):
|
||||||
key = u'C'
|
self.current_shortcut = u'C'
|
||||||
elif verse_type.startswith(u'bridgeShortcut'):
|
elif verse_type.startswith(u'bridgeShortcut'):
|
||||||
key = u'B'
|
self.current_shortcut = u'B'
|
||||||
elif verse_type.startswith(u'preChorusShortcut'):
|
elif verse_type.startswith(u'preChorusShortcut'):
|
||||||
key = u'P'
|
self.current_shortcut = u'P'
|
||||||
elif verse_type.startswith(u'introShortcut'):
|
elif verse_type.startswith(u'introShortcut'):
|
||||||
key = u'I'
|
self.current_shortcut = u'I'
|
||||||
elif verse_type.startswith(u'endingShortcut'):
|
elif verse_type.startswith(u'endingShortcut'):
|
||||||
key = u'E'
|
self.current_shortcut = u'E'
|
||||||
elif verse_type.startswith(u'otherShortcut'):
|
elif verse_type.startswith(u'otherShortcut'):
|
||||||
key = u'O'
|
self.current_shortcut = u'O'
|
||||||
elif verse_type.isnumeric():
|
elif verse_type.isnumeric():
|
||||||
key = verse_type
|
self.current_shortcut += verse_type
|
||||||
# The timer was not interrupted by a user input, thus it timed out.
|
matches = [match for match in self.slideList.keys()
|
||||||
elif verse_type == u'shortcutTimer':
|
if match.startswith(self.current_shortcut)]
|
||||||
key = self.old_shortcut
|
if len(matches) == 1:
|
||||||
self.old_shortcut = u''
|
self.shortcutTimer.stop()
|
||||||
keys = self.slideList.keys()
|
self.current_shortcut = u''
|
||||||
if verse_type != u'shortcutTimer':
|
self.__checkUpdateSelectedSlide(self.slideList[matches[0]])
|
||||||
self.old_shortcut += key
|
|
||||||
self.shortcutTimer.start(350)
|
|
||||||
return
|
|
||||||
# matches = [match for match in keys if match.startswith(key)]
|
|
||||||
# # Stop here and start the timer.
|
|
||||||
# if len(matches) > 1:
|
|
||||||
# self.shortcutTimer.start(350)
|
|
||||||
# return
|
|
||||||
# # Stop the timer and use the match we have.
|
|
||||||
# elif len(matches) == 1:
|
|
||||||
# print u'exactly one match', matches[0]
|
|
||||||
# self.shortcutTimer.stop()
|
|
||||||
# key = matches[0]
|
|
||||||
# self.old_shortcut = u''
|
|
||||||
key = self.old_shortcut + key
|
|
||||||
if key in keys:
|
|
||||||
self.__checkUpdateSelectedSlide(self.slideList[key])
|
|
||||||
self.slideSelected()
|
self.slideSelected()
|
||||||
#TODO: remove and use list with matches.
|
elif verse_type != u'shortcutTimer':
|
||||||
elif len(key) == 1:
|
# Start the time as we did not have any match.
|
||||||
key += u'1'
|
self.shortcutTimer.start(350)
|
||||||
if key in keys:
|
else:
|
||||||
self.__checkUpdateSelectedSlide(self.slideList[key])
|
# Reset the key sequenze as we do not have any match and the timer
|
||||||
self.slideSelected()
|
# timed out.
|
||||||
|
self.current_shortcut = u''
|
||||||
|
|
||||||
def setPreviewHotkeys(self, parent=None):
|
def setPreviewHotkeys(self, parent=None):
|
||||||
self.previousItem.setObjectName(u'previousItemPreview')
|
self.previousItem.setObjectName(u'previousItemPreview')
|
||||||
|
Loading…
Reference in New Issue
Block a user