forked from openlp/openlp
Only update presentation thumbnails if needed. Fixes bug 1424330.
Fixes: https://launchpad.net/bugs/1424330
This commit is contained in:
parent
976408fe8e
commit
79c1335d41
|
@ -230,15 +230,24 @@ class PresentationMediaItem(MediaManagerItem):
|
|||
Settings().setValue(self.settings_section + '/presentations files', self.get_file_list())
|
||||
self.application.set_normal_cursor()
|
||||
|
||||
def clean_up_thumbnails(self, filepath):
|
||||
def clean_up_thumbnails(self, filepath, clean_for_update=False):
|
||||
"""
|
||||
Clean up the files created such as thumbnails
|
||||
|
||||
:param filepath: File path of the presention to clean up after
|
||||
:param clean_for_update: Only clean thumbnails if update is needed
|
||||
:return: None
|
||||
"""
|
||||
for cidx in self.controllers:
|
||||
root, file_ext = os.path.splitext(filepath)
|
||||
file_ext = file_ext[1:]
|
||||
if file_ext in self.controllers[cidx].supports or file_ext in self.controllers[cidx].also_supports:
|
||||
doc = self.controllers[cidx].add_document(filepath)
|
||||
if clean_for_update:
|
||||
thumb_path = doc.get_thumbnail_path(1, True)
|
||||
if not thumb_path or os.path.getmtime(thumb_path) < os.path.getmtime(filepath):
|
||||
doc.presentation_deleted()
|
||||
else:
|
||||
doc.presentation_deleted()
|
||||
doc.close_presentation()
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ class PresentationPlugin(Plugin):
|
|||
files_from_config = Settings().value('presentations/presentations files')
|
||||
for file in files_from_config:
|
||||
try:
|
||||
self.media_item.clean_up_thumbnails(file)
|
||||
self.media_item.clean_up_thumbnails(file, True)
|
||||
except AttributeError:
|
||||
pass
|
||||
self.media_item.list_view.clear()
|
||||
|
|
Loading…
Reference in New Issue