code tidies

This commit is contained in:
Phill Ridout 2015-01-22 13:59:46 +00:00
parent 4d749a89ac
commit d6b8cd1d2a
3 changed files with 11 additions and 5 deletions

View File

@ -229,7 +229,7 @@ class PresentationMediaItem(MediaManagerItem):
self.main_window.display_progress_bar(len(row_list))
for item in items:
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.finished_progress_bar()
self.application.set_busy_cursor()
@ -237,7 +237,13 @@ class PresentationMediaItem(MediaManagerItem):
self.list_view.takeItem(row)
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:
doc = self.controllers[cidx].add_document(filepath)
doc.presentation_deleted()

View File

@ -27,7 +27,6 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
import hashlib
import logging
import os
import shutil
@ -140,6 +139,7 @@ class PresentationDocument(object):
"""
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':
folder = md5_hash('', self.file_path)
else:
@ -150,6 +150,7 @@ class PresentationDocument(object):
"""
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':
folder = md5_hash('', self.file_path)
else:

View File

@ -149,8 +149,7 @@ class PresentationPlugin(Plugin):
super().app_startup()
files_from_config = Settings().value('presentations/presentations files')
for file in files_from_config:
self.media_item.delete_presentation(file)
#Settings().setValue('presentations/presentations files', [])
self.media_item.clean_up_thumbnails(file)
self.media_item.list_view.clear()
Settings().setValue('presentations/thumbnail_scheme', 'md5')
self.media_item.validate_and_load(files_from_config)