forked from openlp/openlp
Fix Impress off-by-one and slow slide update problems Meths found
This commit is contained in:
parent
65736ef8d1
commit
337df8da9f
@ -443,7 +443,7 @@ class SlideController(QtGui.QWidget):
|
||||
if self.commandItem and \
|
||||
self.commandItem.service_item_type == ServiceItemType.Command:
|
||||
Receiver().send_message(u'%s_first'% self.commandItem.name.lower())
|
||||
QtCore.QTimer.singleShot(0.5, self.grabMainDisplay)
|
||||
self.updatePreview()
|
||||
else:
|
||||
self.PreviewListWidget.selectRow(0)
|
||||
self.onSlideSelected()
|
||||
@ -472,7 +472,7 @@ class SlideController(QtGui.QWidget):
|
||||
if self.commandItem.service_item_type == ServiceItemType.Command:
|
||||
Receiver().send_message(u'%s_slide'% self.commandItem.name.lower(), [row])
|
||||
if self.isLive:
|
||||
QtCore.QTimer.singleShot(0.5, self.grabMainDisplay)
|
||||
self.updatePreview()
|
||||
else:
|
||||
frame = self.serviceitem.frames[row][u'image']
|
||||
before = time.time()
|
||||
@ -489,18 +489,24 @@ class SlideController(QtGui.QWidget):
|
||||
The slide has been changed. Update the slidecontroller accordingly
|
||||
"""
|
||||
self.PreviewListWidget.selectRow(row)
|
||||
QtCore.QTimer.singleShot(0.5, self.grabMainDisplay)
|
||||
self.updatePreview()
|
||||
|
||||
def grabMainDisplay(self):
|
||||
def updatePreview(self):
|
||||
rm = self.parent.RenderManager
|
||||
if not rm.screen_list[rm.current_display][u'primary']:
|
||||
winid = QtGui.QApplication.desktop().winId()
|
||||
rect = rm.screen_list[rm.current_display][u'size']
|
||||
winimg = QtGui.QPixmap.grabWindow(winid, rect.x(), rect.y(), rect.width(), rect.height())
|
||||
self.SlidePreview.setPixmap(winimg)
|
||||
# Grab now, but try again in a couple of seconds if slide change is slow
|
||||
QtCore.QTimer.singleShot(0.5, self.grabMainDisplay)
|
||||
QtCore.QTimer.singleShot(2.5, self.grabMainDisplay)
|
||||
else:
|
||||
label = self.PreviewListWidget.cellWidget(self.PreviewListWidget.currentRow(), 0)
|
||||
self.SlidePreview.setPixmap(label.pixmap())
|
||||
|
||||
def grabMainDisplay(self):
|
||||
rm = self.parent.RenderManager
|
||||
winid = QtGui.QApplication.desktop().winId()
|
||||
rect = rm.screen_list[rm.current_display][u'size']
|
||||
winimg = QtGui.QPixmap.grabWindow(winid, rect.x(), rect.y(), rect.width(), rect.height())
|
||||
self.SlidePreview.setPixmap(winimg)
|
||||
|
||||
def onSlideSelectedNext(self):
|
||||
"""
|
||||
@ -509,7 +515,7 @@ class SlideController(QtGui.QWidget):
|
||||
if self.commandItem and \
|
||||
self.commandItem.service_item_type == ServiceItemType.Command:
|
||||
Receiver().send_message(u'%s_next'% self.commandItem.name.lower())
|
||||
QtCore.QTimer.singleShot(0.5, self.grabMainDisplay)
|
||||
self.updatePreview()
|
||||
else:
|
||||
row = self.PreviewListWidget.currentRow() + 1
|
||||
if row == self.PreviewListWidget.rowCount():
|
||||
@ -525,7 +531,7 @@ class SlideController(QtGui.QWidget):
|
||||
self.commandItem.service_item_type == ServiceItemType.Command:
|
||||
Receiver().send_message(
|
||||
u'%s_previous'% self.commandItem.name.lower())
|
||||
QtCore.QTimer.singleShot(0.5, self.grabMainDisplay)
|
||||
self.updatePreview()
|
||||
else:
|
||||
row = self.PreviewListWidget.currentRow() - 1
|
||||
if row == -1:
|
||||
@ -540,7 +546,7 @@ class SlideController(QtGui.QWidget):
|
||||
if self.commandItem and \
|
||||
self.commandItem.service_item_type == ServiceItemType.Command:
|
||||
Receiver().send_message(u'%s_last'% self.commandItem.name.lower())
|
||||
QtCore.QTimer.singleShot(0.5, self.grabMainDisplay)
|
||||
self.updatePreview()
|
||||
else:
|
||||
self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount() - 1)
|
||||
self.onSlideSelected()
|
||||
|
@ -272,7 +272,7 @@ class ImpressController(PresentationController):
|
||||
self.goto_slide(1)
|
||||
|
||||
def get_slide_number(self):
|
||||
return self.controller.getCurrentSlideIndex()
|
||||
return self.controller.getCurrentSlideIndex() + 1
|
||||
|
||||
def get_slide_count(self):
|
||||
return self.document.getDrawPages().getCount()
|
||||
|
Loading…
Reference in New Issue
Block a user