Skip to content

Commit

Permalink
Fix moving items to the trash when an item already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
krathjen committed Feb 28, 2018
1 parent 8df546a commit 5053f92
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions librarywidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -1486,13 +1486,14 @@ def showMoveItemsDialog(self, items, dst):

self.moveItems(items, dst, copy=copy)

def moveItems(self, items, dst, copy=False):
def moveItems(self, items, dst, copy=False, force=False):
"""
Move the given items to the destination folder path.
:type items: list[studiolibrary.LibraryItem]
:type dst: str
:type copy: bool
:type force: bool
:rtype: None
"""
self.itemsWidget().clearSelection()
Expand All @@ -1504,6 +1505,9 @@ def moveItems(self, items, dst, copy=False):

path = dst + "/" + item.name()

if force:
path = studiolibrary.generateUniquePath(path)

if copy:
item.copy(path)
else:
Expand Down Expand Up @@ -2355,7 +2359,7 @@ def moveItemsToTrash(self, items):
:rtype: None
"""
self.createTrashFolder()
self.moveItems(items, dst=self.trashPath())
self.moveItems(items, dst=self.trashPath(), force=True)

def moveFolderToTrash(self, folder):
"""
Expand All @@ -2369,6 +2373,7 @@ def moveFolderToTrash(self, folder):

src = folder.path()
dst = os.path.join(self.trashPath(), os.path.basename(src))
dst = studiolibrary.generateUniquePath(dst)

self.renameFolder(src, dst=dst)

Expand Down

0 comments on commit 5053f92

Please sign in to comment.