Fix for samuel_m issue and bug #1672229

This commit is contained in:
Philip Ridout 2017-10-08 18:33:03 +01:00
parent df39497cc1
commit 779e95b523
4 changed files with 7 additions and 4 deletions

View File

@ -85,7 +85,7 @@ class AppLocation(object):
"""
# Check if we have a different data location.
if Settings().contains('advanced/data path'):
path = Settings().value('advanced/data path')
path = Path(Settings().value('advanced/data path'))
else:
path = AppLocation.get_directory(AppLocation.DataDir)
check_directory_exists(path)

View File

@ -341,7 +341,9 @@ class MediaManagerItem(QtWidgets.QWidget, RegistryProperties):
else:
new_files.append(file_name)
if new_files:
self.validate_and_load(new_files, data['target'])
if 'target' in data:
self.validate_and_load(new_files, data['target'])
self.validate_and_load(new_files)
def dnd_move_internal(self, target):
"""

View File

@ -121,7 +121,7 @@ class ListWidgetWithDnD(QtWidgets.QListWidget):
for file in listing:
files.append(os.path.join(local_file, file))
Registry().execute('{mime_data}_dnd'.format(mime_data=self.mime_data_text),
{'files': files, 'target': self.itemAt(event.pos())})
{'files': files})
else:
event.ignore()

View File

@ -364,7 +364,7 @@ class ImageMediaItem(MediaManagerItem):
if validate_thumb(image.file_path, thumbnail_path):
icon = build_icon(thumbnail_path)
else:
icon = create_thumb(image.file_path, thumbnail_path)
icon = create_thumb(str(image.file_path), str(thumbnail_path))
item_name = QtWidgets.QTreeWidgetItem([file_name])
item_name.setText(0, file_name)
item_name.setIcon(0, icon)
@ -388,6 +388,7 @@ class ImageMediaItem(MediaManagerItem):
:param files: A List of strings containing the filenames of the files to be loaded
:param target_group: The QTreeWidgetItem of the group that will be the parent of the added files
"""
file_paths = [Path(file) for file in file_paths]
self.application.set_normal_cursor()
self.load_list(file_paths, target_group)
last_dir = file_paths[0].parent