diff --git a/bin/pytop-0-0-1-x64.deb b/bin/pytop-0-0-1-x64.deb index ae01d3c..0e7d59a 100644 Binary files a/bin/pytop-0-0-1-x64.deb and b/bin/pytop-0-0-1-x64.deb 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 ca1d22f..1ac73d9 100644 --- a/src/pytop-0.0.1/Pytop/signal_classes/GridSignals.py +++ b/src/pytop-0.0.1/Pytop/signal_classes/GridSignals.py @@ -58,9 +58,9 @@ class GridSignals: self.copyCutArry = self.grid.returnSelectedFiles() def paste(self, widget): - print(len(self.copyCutArry)) self.currentPath = self.grid.returnCurrentPath() - status = self.filehandler.paste(self.copyCutArry, self.currentPath, self.pasteType) + status = self.filehandler.paste(self.copyCutArry, self.currentPath, self.pasteType) + if status == 0: self.grid.setIconViewDir(self.currentPath) if self.pasteType == 2: # cut == 2 diff --git a/src/pytop-0.0.1/Pytop/utils/FileHandler.py b/src/pytop-0.0.1/Pytop/utils/FileHandler.py index 69577f0..c017ea2 100644 --- a/src/pytop-0.0.1/Pytop/utils/FileHandler.py +++ b/src/pytop-0.0.1/Pytop/utils/FileHandler.py @@ -62,6 +62,7 @@ class FileHandler: else: # Create Folder os.mkdir(name) except Exception as e: + print(e) return 1 return 0 @@ -69,22 +70,26 @@ class FileHandler: def paste(self, files, toPath, pasteType): try: for file in files: - parts = file.split("/") - toBePath = toPath + parts[len(parts) - 1] - finalForm = file + self.dedupPathIter(toBePath) + parts = file.split("/") + toBePath = toPath + "/" + parts[len(parts) - 1] # Used to check for duplicates + finalForm = file + self.dedupPathIter(toBePath) + isDuplicate = finalForm != file + + if isDuplicate: + os.rename(file, finalForm) + + if pasteType == 1: # copy paste = 1 + shutil.copy2(finalForm, toPath) + if isDuplicate: + os.rename(finalForm, file) # Rename back after copy completes + if pasteType == 2: # cut paste = 2 + shutil.move(finalForm, toPath) - print(toBePath) - print(finalForm) except Exception as e: + print(e) return 1 - # if finalForm != file: - # os.rename(file, finalForm) - # - # if pasteType == 1: # copy paste == 1 - # shutil.move(finalForm, toPath) - # if pasteType == 2: # cut paste == 2 - # shutil.copy2(finalForm, toPath) + return 0 def delete(self, toDeleteFiles): try: @@ -124,7 +129,6 @@ class FileHandler: print("The folder/file does not exist") return 1 except Exception as e: - print("An error occured moving the file to trash:") print(e) return 1 @@ -140,7 +144,6 @@ class FileHandler: print("The folder/file does not exist") return 1 except Exception as e: - print("An error occured renaming the file:") print(e) return 1 diff --git a/src/pytop-0.0.1/Pytop/widgets/Grid.py b/src/pytop-0.0.1/Pytop/widgets/Grid.py index a7a57a3..35e44fb 100644 --- a/src/pytop-0.0.1/Pytop/widgets/Grid.py +++ b/src/pytop-0.0.1/Pytop/widgets/Grid.py @@ -197,7 +197,13 @@ class Grid: print(e) def returnSelectedFiles(self): - return self.selectedFiles + # NOTE: Just returning selectedFiles looks like it returns a "pointer" + # to the children. This mean we lose the list if any left click occures + # in this class. + files = [] + for file in self.selectedFiles: + files.append(file) + return files def returnCurrentPath(self): return self.currentPath