Changed up arrow to jump to last slide of previous service item (when applicable)

This commit is contained in:
Jonathan Stafford 2012-01-22 17:07:59 +08:00
parent 210d88ac79
commit cc04a82c08
2 changed files with 23 additions and 6 deletions

View File

@ -826,7 +826,7 @@ class ServiceManager(QtGui.QWidget):
lookFor = 1
serviceIterator += 1
def previousItem(self):
def previousItem(self, message):
"""
Called by the SlideController to select the previous service item.
"""
@ -834,20 +834,31 @@ class ServiceManager(QtGui.QWidget):
return
selected = self.serviceManagerList.selectedItems()[0]
prevItem = None
prevItemLastSlide = None
serviceIterator = QtGui.QTreeWidgetItemIterator(self.serviceManagerList)
while serviceIterator.value():
if serviceIterator.value() == selected:
if prevItem:
if message == 'last slide' and prevItemLastSlide:
pos = prevItem.data(0, QtCore.Qt.UserRole).toInt()[0]
check_expanded = self.serviceItems[pos - 1][u'expanded']
self.serviceManagerList.setCurrentItem(prevItemLastSlide)
if not check_expanded:
self.serviceManagerList.collapseItem(prevItem)
self.makeLive()
self.serviceManagerList.setCurrentItem(prevItem)
elif prevItem:
self.serviceManagerList.setCurrentItem(prevItem)
self.makeLive()
return
if serviceIterator.value().parent() is None:
prevItem = serviceIterator.value()
if serviceIterator.value().parent() is prevItem:
prevItemLastSlide = serviceIterator.value()
serviceIterator += 1
def onSetItem(self, message):
"""
Called by a signal to select a specific item.
Called by a signal to select a specific item.signal
"""
self.setItem(int(message))

View File

@ -616,8 +616,12 @@ class SlideController(Controller):
if len(self.keypress_queue):
while len(self.keypress_queue) and not self.keypress_loop:
self.keypress_loop = True
if self.keypress_queue.popleft() == u'previous':
Receiver.send_message('servicemanager_previous_item')
keypressCommand = self.keypress_queue.popleft()
if keypressCommand == u'previous':
Receiver.send_message('servicemanager_previous_item', None)
elif keypressCommand == u'previous last slide':
# Go to the last slide of the previous item
Receiver.send_message('servicemanager_previous_item', 'last slide')
else:
Receiver.send_message('servicemanager_next_item')
self.keypress_loop = False
@ -1221,7 +1225,9 @@ class SlideController(Controller):
if self.slide_advance == SlideAdvance.Wrap:
row = self.previewListWidget.rowCount() - 1
elif self.slide_advance == SlideAdvance.Next:
self.servicePrevious()
# self.servicePrevious()
self.keypress_queue.append(u'previous last slide')
self._process_queue()
return
else:
row = 0