Merge pull request #544 from samj1912/picard884

PICARD-884: Add the parent directory if file selected from filebrowser
This commit is contained in:
Wieland Hoffmann
2017-01-11 19:50:29 +01:00

View File

@@ -129,15 +129,21 @@ class FileBrowser(QtGui.QTreeView):
self.expand(index)
self.scrollTo(index, scrolltype)
def _get_destination_from_path(self, path):
destination = os.path.normpath(unicode(path))
if not os.path.isdir(destination):
destination = os.path.dirname(destination)
return destination
def move_files_here(self):
indexes = self.selectedIndexes()
if not indexes:
return
path = self.model.filePath(indexes[0])
config.setting["move_files_to"] = os.path.normpath(unicode(path))
config.setting["move_files_to"] = self._get_destination_from_path(path)
def set_as_starting_directory(self):
indexes = self.selectedIndexes()
if indexes:
path = self.model.filePath(indexes[0])
config.setting["starting_directory_path"] = os.path.normpath(unicode(path))
config.setting["starting_directory_path"] = self._get_destination_from_path(path)