forked from openlp/openlp
code tidies
This commit is contained in:
parent
4d749a89ac
commit
d6b8cd1d2a
@ -229,7 +229,7 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
self.main_window.display_progress_bar(len(row_list))
|
self.main_window.display_progress_bar(len(row_list))
|
||||||
for item in items:
|
for item in items:
|
||||||
filepath = str(item.data(QtCore.Qt.UserRole))
|
filepath = str(item.data(QtCore.Qt.UserRole))
|
||||||
self.delete_presentation(filepath)
|
self.clean_up_thumbnails(filepath)
|
||||||
self.main_window.increment_progress_bar()
|
self.main_window.increment_progress_bar()
|
||||||
self.main_window.finished_progress_bar()
|
self.main_window.finished_progress_bar()
|
||||||
self.application.set_busy_cursor()
|
self.application.set_busy_cursor()
|
||||||
@ -237,7 +237,13 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
self.list_view.takeItem(row)
|
self.list_view.takeItem(row)
|
||||||
Settings().setValue(self.settings_section + '/presentations files', self.get_file_list())
|
Settings().setValue(self.settings_section + '/presentations files', self.get_file_list())
|
||||||
|
|
||||||
def delete_presentation(self, filepath):
|
def clean_up_thumbnails(self, filepath):
|
||||||
|
"""
|
||||||
|
Clean up the files created such as thumbnails
|
||||||
|
|
||||||
|
:param filepath: File path of the presention to clean up after
|
||||||
|
:return: None
|
||||||
|
"""
|
||||||
for cidx in self.controllers:
|
for cidx in self.controllers:
|
||||||
doc = self.controllers[cidx].add_document(filepath)
|
doc = self.controllers[cidx].add_document(filepath)
|
||||||
doc.presentation_deleted()
|
doc.presentation_deleted()
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
import hashlib
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
@ -140,6 +139,7 @@ class PresentationDocument(object):
|
|||||||
"""
|
"""
|
||||||
The location where thumbnail images will be stored
|
The location where thumbnail images will be stored
|
||||||
"""
|
"""
|
||||||
|
# TODO: If statment can be removed when the upgrade path from 2.0.x to 2.2.x is no longer needed
|
||||||
if Settings().value('presentations/thumbnail_scheme') == 'md5':
|
if Settings().value('presentations/thumbnail_scheme') == 'md5':
|
||||||
folder = md5_hash('', self.file_path)
|
folder = md5_hash('', self.file_path)
|
||||||
else:
|
else:
|
||||||
@ -150,6 +150,7 @@ class PresentationDocument(object):
|
|||||||
"""
|
"""
|
||||||
The location where thumbnail images will be stored
|
The location where thumbnail images will be stored
|
||||||
"""
|
"""
|
||||||
|
# TODO: If statment can be removed when the upgrade path from 2.0.x to 2.2.x is no longer needed
|
||||||
if Settings().value('presentations/thumbnail_scheme') == 'md5':
|
if Settings().value('presentations/thumbnail_scheme') == 'md5':
|
||||||
folder = md5_hash('', self.file_path)
|
folder = md5_hash('', self.file_path)
|
||||||
else:
|
else:
|
||||||
|
@ -149,8 +149,7 @@ class PresentationPlugin(Plugin):
|
|||||||
super().app_startup()
|
super().app_startup()
|
||||||
files_from_config = Settings().value('presentations/presentations files')
|
files_from_config = Settings().value('presentations/presentations files')
|
||||||
for file in files_from_config:
|
for file in files_from_config:
|
||||||
self.media_item.delete_presentation(file)
|
self.media_item.clean_up_thumbnails(file)
|
||||||
#Settings().setValue('presentations/presentations files', [])
|
|
||||||
self.media_item.list_view.clear()
|
self.media_item.list_view.clear()
|
||||||
Settings().setValue('presentations/thumbnail_scheme', 'md5')
|
Settings().setValue('presentations/thumbnail_scheme', 'md5')
|
||||||
self.media_item.validate_and_load(files_from_config)
|
self.media_item.validate_and_load(files_from_config)
|
||||||
|
Loading…
Reference in New Issue
Block a user