Always make sure the powerpoint slide index map is created

This commit is contained in:
Tomas Groth 2019-05-21 22:07:25 +02:00
parent 89ecdf2a96
commit 3d8d573389
2 changed files with 12 additions and 3 deletions

View File

@ -975,8 +975,10 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
prev_item_last_slide = None
service_iterator = QtWidgets.QTreeWidgetItemIterator(self.service_manager_list)
while service_iterator.value():
# Found the selected/current service item
if service_iterator.value() == selected:
if last_slide and prev_item_last_slide:
# Go to the last slide of the previous service item
pos = prev_item.data(0, QtCore.Qt.UserRole)
check_expanded = self.service_items[pos - 1]['expanded']
self.service_manager_list.setCurrentItem(prev_item_last_slide)
@ -985,13 +987,17 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
self.make_live()
self.service_manager_list.setCurrentItem(prev_item)
elif prev_item:
# Go to the first slide of the previous service item
self.service_manager_list.setCurrentItem(prev_item)
self.make_live()
return
# Found the previous service item root
if service_iterator.value().parent() is None:
prev_item = service_iterator.value()
# Found the last slide of the previous item
if service_iterator.value().parent() is prev_item:
prev_item_last_slide = service_iterator.value()
# Go to next item in the tree
service_iterator += 1
def on_set_item(self, message):

View File

@ -170,14 +170,17 @@ class PowerpointDocument(PresentationDocument):
However, for the moment, we want a physical file since it makes life easier elsewhere.
"""
log.debug('create_thumbnails')
generate_thumbs = True
if self.check_thumbnails():
return
# No need for thumbnails but we still need the index
generate_thumbs = False
key = 1
for num in range(self.presentation.Slides.Count):
if not self.presentation.Slides(num + 1).SlideShowTransition.Hidden:
self.index_map[key] = num + 1
self.presentation.Slides(num + 1).Export(
str(self.get_thumbnail_folder() / 'slide{key:d}.png'.format(key=key)), 'png', 320, 240)
if generate_thumbs:
self.presentation.Slides(num + 1).Export(
str(self.get_thumbnail_folder() / 'slide{key:d}.png'.format(key=key)), 'png', 320, 240)
key += 1
self.slide_count = key - 1