File action menu edits
This commit is contained in:
parent
8d877eb71b
commit
634de3f6b0
Binary file not shown.
@ -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)
|
||||
|
||||
if status == 0:
|
||||
self.grid.setIconViewDir(self.currentPath)
|
||||
if self.pasteType == 2: # cut == 2
|
||||
|
@ -62,6 +62,7 @@ class FileHandler:
|
||||
else: # Create Folder
|
||||
os.mkdir(name)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return 1
|
||||
|
||||
return 0
|
||||
@ -70,21 +71,25 @@ class FileHandler:
|
||||
try:
|
||||
for file in files:
|
||||
parts = file.split("/")
|
||||
toBePath = toPath + parts[len(parts) - 1]
|
||||
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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user