diff --git a/src/pytop-0.0.1/Pytop/resources/PyTop.glade b/src/pytop-0.0.1/Pytop/resources/PyTop.glade
index ee62283..5436b5c 100644
--- a/src/pytop-0.0.1/Pytop/resources/PyTop.glade
+++ b/src/pytop-0.0.1/Pytop/resources/PyTop.glade
@@ -82,6 +82,11 @@
+
diff --git a/src/pytop-0.0.1/Pytop/resources/icons/trash.png b/src/pytop-0.0.1/Pytop/resources/icons/trash.png
new file mode 100644
index 0000000..c6514b9
Binary files /dev/null and b/src/pytop-0.0.1/Pytop/resources/icons/trash.png differ
diff --git a/src/pytop-0.0.1/Pytop/signal_classes/GridSignals.py b/src/pytop-0.0.1/Pytop/signal_classes/GridSignals.py
index 5d07099..1117f4f 100644
--- a/src/pytop-0.0.1/Pytop/signal_classes/GridSignals.py
+++ b/src/pytop-0.0.1/Pytop/signal_classes/GridSignals.py
@@ -56,6 +56,15 @@ class GridSignals:
self.grid.setIconViewDir(self.currentPath)
+ def trashFiles(self, widget):
+ self.getGridInfo()
+ status = self.filehandler.moveToTrash(self.selectedFiles)
+
+ if status == 0:
+ self.selectedFiles = []
+ self.grid.setIconViewDir(self.currentPath)
+
+
def deleteFiles(self, widget):
self.getGridInfo()
status = self.filehandler.deleteFiles(self.selectedFiles)
diff --git a/src/pytop-0.0.1/Pytop/utils/FileHandler.py b/src/pytop-0.0.1/Pytop/utils/FileHandler.py
index 1554232..85096ea 100644
--- a/src/pytop-0.0.1/Pytop/utils/FileHandler.py
+++ b/src/pytop-0.0.1/Pytop/utils/FileHandler.py
@@ -69,13 +69,32 @@ class FileHandler:
print(e)
return 1
- def moveToTrash(arg):
+ def dedupPathIter(self, toBeTrashPath):
+ i = 0
+ duplicateFix = ""
+
+ if os.path.exists(toBeTrashPath):
+ while os.path.exists(toBeTrashPath + duplicateFix) == True:
+ i+=1
+ duplicateFix = "-" + str(i)
+
+ return duplicateFix
+
+
+ def moveToTrash(self, toTrashFiles):
try:
print("Moving to Trash...")
- for file in toDeleteFiles:
+ for file in toTrashFiles:
print(file)
if os.path.exists(file):
- shutil.move(file, self.TRASHFILESFOLDER)
+ parts = file.split("/")
+ toBeTrashPath = self.TRASHFILESFOLDER + parts[len(parts) - 1]
+ finalForm = file + self.dedupPathIter(toBeTrashPath)
+
+ if finalForm != file:
+ os.rename(file, finalForm)
+
+ shutil.move(finalForm, self.TRASHFILESFOLDER)
else:
print("The folder/file does not exist")
return 1
diff --git a/src/pytop-0.0.1/Pytop/utils/Settings.py b/src/pytop-0.0.1/Pytop/utils/Settings.py
index 4792b04..d1f1ff7 100644
--- a/src/pytop-0.0.1/Pytop/utils/Settings.py
+++ b/src/pytop-0.0.1/Pytop/utils/Settings.py
@@ -110,7 +110,6 @@ class Settings:
def returnSystemIconImageWH(self): return self.systemIconImageWxH
def returnVIIconWH(self): return self.viIconWxH
def isHideHiddenFiles(self): return self.hideHiddenFiles
- def returnImagesExtensionList(self): return self.imagesExtensionList
# Filter returns
def returnOfficeFilter(self): return self.office
diff --git a/src/pytop-0.0.1/Pytop/widgets/Grid.py b/src/pytop-0.0.1/Pytop/widgets/Grid.py
index 6fbb58f..bdfc736 100644
--- a/src/pytop-0.0.1/Pytop/widgets/Grid.py
+++ b/src/pytop-0.0.1/Pytop/widgets/Grid.py
@@ -46,7 +46,7 @@ class Grid:
self.desktop.set_pixbuf_column(0)
self.desktop.set_text_column(1)
self.desktop.connect("item-activated", self.iconDblLeftClick)
- self.desktop.connect("button_press_event", self.iconClickRight, (self.desktop,))
+ self.desktop.connect("button_press_event", self.iconRightClick, (self.desktop,))
def setIconViewDir(self, path):
@@ -151,7 +151,7 @@ class Grid:
except Exception as e:
print(e)
- def iconClickRight(self, widget, eve, rclicked_icon):
+ def iconRightClick(self, widget, eve, rclicked_icon):
try:
if eve.type == gdk.EventType.BUTTON_PRESS and eve.button == 3:
input = self.builder.get_object("iconRenameInput")