File action menu edits
This commit is contained in:
parent
77872aca35
commit
8d877eb71b
@ -82,6 +82,11 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="GtkImage" id="createImage">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="stock">gtk-new</property>
|
||||||
|
</object>
|
||||||
<object class="GtkImage" id="trashImage">
|
<object class="GtkImage" id="trashImage">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
@ -91,24 +96,28 @@
|
|||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="resizable">False</property>
|
<property name="resizable">False</property>
|
||||||
<property name="modal">True</property>
|
<property name="modal">True</property>
|
||||||
|
<property name="window_position">center</property>
|
||||||
|
<property name="type_hint">splashscreen</property>
|
||||||
<property name="decorated">False</property>
|
<property name="decorated">False</property>
|
||||||
|
<property name="gravity">center</property>
|
||||||
<signal name="focus-out-event" handler="closePopup" swapped="no"/>
|
<signal name="focus-out-event" handler="closePopup" swapped="no"/>
|
||||||
<child>
|
<child>
|
||||||
<placeholder/>
|
<placeholder/>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
|
<property name="width_request">500</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkEntry" id="iconRenameInput">
|
<object class="GtkEntry" id="filenameInput">
|
||||||
<property name="width_request">500</property>
|
<property name="width_request">500</property>
|
||||||
<property name="height_request">26</property>
|
<property name="height_request">26</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="primary_icon_stock">gtk-edit</property>
|
<property name="primary_icon_stock">gtk-edit</property>
|
||||||
<signal name="key-release-event" handler="updateFile" swapped="no"/>
|
<signal name="key-release-event" handler="rename" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@ -117,7 +126,7 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox" id="iconsButtonBox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
@ -154,6 +163,126 @@
|
|||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child type="center">
|
||||||
|
<object class="GtkButton">
|
||||||
|
<property name="label">gtk-delete</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="tooltip_text" translatable="yes">Delete...</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
<property name="always_show_image">True</property>
|
||||||
|
<signal name="clicked" handler="delete" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">4</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton">
|
||||||
|
<property name="label" translatable="yes">Trash</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="tooltip_text" translatable="yes">Move to Trash...</property>
|
||||||
|
<property name="image">trashImage</property>
|
||||||
|
<property name="always_show_image">True</property>
|
||||||
|
<signal name="clicked" handler="trash" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="pack_type">end</property>
|
||||||
|
<property name="position">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="menuButtonBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_top">15</property>
|
||||||
|
<property name="label" translatable="yes">Folder</property>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="size" value="12000"/>
|
||||||
|
</attributes>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_top">15</property>
|
||||||
|
<property name="label" translatable="yes">File</property>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="size" value="12000"/>
|
||||||
|
</attributes>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSwitch" id="createSwitch">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="tooltip_text" translatable="yes">File/Folder</property>
|
||||||
|
<property name="active">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton">
|
||||||
|
<property name="label" translatable="yes">Create</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="tooltip_text" translatable="yes">Create File/Folder...</property>
|
||||||
|
<property name="image">createImage</property>
|
||||||
|
<property name="always_show_image">True</property>
|
||||||
|
<signal name="clicked" handler="create" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton">
|
<object class="GtkButton">
|
||||||
<property name="label">gtk-paste</property>
|
<property name="label">gtk-paste</property>
|
||||||
@ -168,48 +297,14 @@
|
|||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">2</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkButton">
|
|
||||||
<property name="label" translatable="yes">Trash</property>
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="receives_default">True</property>
|
|
||||||
<property name="image">trashImage</property>
|
|
||||||
<property name="always_show_image">True</property>
|
|
||||||
<signal name="clicked" handler="trashFiles" swapped="no"/>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="pack_type">end</property>
|
|
||||||
<property name="position">3</property>
|
<property name="position">3</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<object class="GtkButton">
|
|
||||||
<property name="label">gtk-delete</property>
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="receives_default">True</property>
|
|
||||||
<property name="use_stock">True</property>
|
|
||||||
<property name="always_show_image">True</property>
|
|
||||||
<signal name="clicked" handler="deleteFiles" swapped="no"/>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="pack_type">end</property>
|
|
||||||
<property name="position">4</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">1</property>
|
<property name="position">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
@ -23,11 +23,11 @@ class GridSignals:
|
|||||||
self.selectedFiles = []
|
self.selectedFiles = []
|
||||||
self.grid = None
|
self.grid = None
|
||||||
self.currentPath = ""
|
self.currentPath = ""
|
||||||
|
self.pasteType = 1 # copy == 1 and cut == 2
|
||||||
|
|
||||||
# Add filter to allow only folders to be selected
|
# Add filter to allow only folders to be selected
|
||||||
selectedDirDialog.add_filter(filefilter)
|
selectedDirDialog.add_filter(filefilter)
|
||||||
selectedDirDialog.set_filename(self.desktopPath)
|
selectedDirDialog.set_filename(self.desktopPath)
|
||||||
|
|
||||||
self.setIconViewDir(selectedDirDialog)
|
self.setIconViewDir(selectedDirDialog)
|
||||||
|
|
||||||
|
|
||||||
@ -38,50 +38,64 @@ class GridSignals:
|
|||||||
|
|
||||||
|
|
||||||
# File control events
|
# File control events
|
||||||
def createFile(arg):
|
def create(self, wdget):
|
||||||
pass
|
self.currentPath = self.grid.returnCurrentPath()
|
||||||
|
fileName = self.builder.get_object("filenameInput").get_text().strip()
|
||||||
|
type = self.builder.get_object("createSwitch").get_state()
|
||||||
|
|
||||||
def updateFile(self, widget, data):
|
if fileName != "":
|
||||||
|
fileName = self.currentPath + "/" + fileName
|
||||||
|
status = self.filehandler.create(fileName, type)
|
||||||
|
if status == 0:
|
||||||
|
self.grid.setIconViewDir(self.currentPath)
|
||||||
|
|
||||||
|
def copy(self, widget):
|
||||||
|
self.pasteType = 1
|
||||||
|
self.copyCutArry = self.grid.returnSelectedFiles()
|
||||||
|
|
||||||
|
def cut(self, widget):
|
||||||
|
self.pasteType = 2
|
||||||
|
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
|
||||||
|
self.copyCutArry = []
|
||||||
|
|
||||||
|
def delete(self, widget):
|
||||||
|
self.getGridInfo()
|
||||||
|
status = self.filehandler.delete(self.selectedFiles)
|
||||||
|
|
||||||
|
if status == 0:
|
||||||
|
self.selectedFiles = []
|
||||||
|
self.grid.setIconViewDir(self.currentPath)
|
||||||
|
|
||||||
|
def trash(self, widget):
|
||||||
|
self.getGridInfo()
|
||||||
|
status = self.filehandler.trash(self.selectedFiles)
|
||||||
|
|
||||||
|
if status == 0:
|
||||||
|
self.selectedFiles = []
|
||||||
|
self.grid.setIconViewDir(self.currentPath)
|
||||||
|
|
||||||
|
def rename(self, widget, data):
|
||||||
if data.keyval == 65293: # Enter key press
|
if data.keyval == 65293: # Enter key press
|
||||||
self.getGridInfo()
|
self.getGridInfo()
|
||||||
file = widget.get_text();
|
file = widget.get_text();
|
||||||
if len(self.selectedFiles) == 1:
|
if len(self.selectedFiles) == 1:
|
||||||
newName = self.currentPath + "/" + file
|
newName = self.currentPath + "/" + file
|
||||||
status = self.filehandler.updateFile(self.selectedFiles[0], newName)
|
|
||||||
print("Old Name: " + self.selectedFiles[0])
|
print("Old Name: " + self.selectedFiles[0])
|
||||||
print("New Name: " + newName)
|
print("New Name: " + newName.strip())
|
||||||
|
|
||||||
|
status = self.filehandler.rename(self.selectedFiles[0], newName.strip())
|
||||||
if status == 0:
|
if status == 0:
|
||||||
self.selectedFiles = [newName]
|
self.selectedFiles = [newName]
|
||||||
self.grid.setIconViewDir(self.currentPath)
|
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)
|
|
||||||
|
|
||||||
if status == 0:
|
|
||||||
self.selectedFiles = []
|
|
||||||
self.grid.setIconViewDir(self.currentPath)
|
|
||||||
|
|
||||||
def copy(self):
|
|
||||||
self.copyCutArry = self.grid.returnSelectedFiles()
|
|
||||||
|
|
||||||
def cut(self):
|
|
||||||
self.copyCutArry = self.grid.returnSelectedFiles()
|
|
||||||
|
|
||||||
def paste(self):
|
|
||||||
self.currentPath = self.grid.returnCurrentPath()
|
|
||||||
|
|
||||||
def getGridInfo(self):
|
def getGridInfo(self):
|
||||||
self.selectedFiles = self.grid.returnSelectedFiles()
|
self.selectedFiles = self.grid.returnSelectedFiles()
|
||||||
self.currentPath = self.grid.returnCurrentPath()
|
self.currentPath = self.grid.returnCurrentPath()
|
||||||
|
@ -55,33 +55,58 @@ class FileHandler:
|
|||||||
subprocess.Popen(['xdg-open', file])
|
subprocess.Popen(['xdg-open', file])
|
||||||
|
|
||||||
|
|
||||||
def createFile(self, newFileName):
|
def create(self, name, type):
|
||||||
pass
|
|
||||||
|
|
||||||
def updateFile(self, oldFileName, newFileName):
|
|
||||||
try:
|
try:
|
||||||
print("Renaming...")
|
if type == True: # Create File
|
||||||
print(oldFileName + " --> " + newFileName)
|
open(name, 'w')
|
||||||
os.rename(oldFileName, newFileName)
|
else: # Create Folder
|
||||||
return 0
|
os.mkdir(name)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("An error occured renaming the file:")
|
return 1
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
print(toBePath)
|
||||||
|
print(finalForm)
|
||||||
|
except Exception as 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)
|
||||||
|
|
||||||
|
def delete(self, toDeleteFiles):
|
||||||
|
try:
|
||||||
|
print("Deleting...")
|
||||||
|
for file in toDeleteFiles:
|
||||||
|
print(file)
|
||||||
|
if os.path.exists(file):
|
||||||
|
if os.path.isfile(file):
|
||||||
|
os.remove(file)
|
||||||
|
elif os.path.isdir(file):
|
||||||
|
shutil.rmtree(file)
|
||||||
|
else:
|
||||||
|
print("The folder/file does not exist")
|
||||||
|
return 1
|
||||||
|
except Exception as e:
|
||||||
|
print("An error occured deleting the file:")
|
||||||
print(e)
|
print(e)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
def dedupPathIter(self, toBeTrashPath):
|
return 0
|
||||||
i = 0
|
|
||||||
duplicateFix = ""
|
|
||||||
|
|
||||||
if os.path.exists(toBeTrashPath):
|
def trash(self, toTrashFiles):
|
||||||
while os.path.exists(toBeTrashPath + duplicateFix) == True:
|
|
||||||
i+=1
|
|
||||||
duplicateFix = "-" + str(i)
|
|
||||||
|
|
||||||
return duplicateFix
|
|
||||||
|
|
||||||
|
|
||||||
def moveToTrash(self, toTrashFiles):
|
|
||||||
try:
|
try:
|
||||||
print("Moving to Trash...")
|
print("Moving to Trash...")
|
||||||
for file in toTrashFiles:
|
for file in toTrashFiles:
|
||||||
@ -105,34 +130,30 @@ class FileHandler:
|
|||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def deleteFiles(self, toDeleteFiles):
|
def rename(self, oldFileName, newFileName):
|
||||||
try:
|
try:
|
||||||
print("Deleting...")
|
if os.path.exists(oldFileName):
|
||||||
for file in toDeleteFiles:
|
print("Renaming...")
|
||||||
print(file)
|
print(oldFileName + " --> " + newFileName)
|
||||||
if os.path.exists(file):
|
os.rename(oldFileName, newFileName)
|
||||||
if os.path.isfile(file):
|
else:
|
||||||
os.remove(file)
|
print("The folder/file does not exist")
|
||||||
elif os.path.isdir(file):
|
return 1
|
||||||
shutil.rmtree(file)
|
|
||||||
else:
|
|
||||||
print("An error occured deleting the file:")
|
|
||||||
return 1
|
|
||||||
else:
|
|
||||||
print("The folder/file does not exist")
|
|
||||||
return 1
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("An error occured deleting the file:")
|
print("An error occured renaming the file:")
|
||||||
print(e)
|
print(e)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def copyFile(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def cutFile(self):
|
def dedupPathIter(self, toBeTrashPath):
|
||||||
pass
|
duplicateFix = ""
|
||||||
|
i = 0
|
||||||
|
|
||||||
def pasteFile(self):
|
if os.path.exists(toBeTrashPath):
|
||||||
pass
|
while os.path.exists(toBeTrashPath + duplicateFix) == True:
|
||||||
|
i+=1
|
||||||
|
duplicateFix = "-" + str(i)
|
||||||
|
|
||||||
|
return duplicateFix
|
||||||
|
@ -39,14 +39,14 @@ class Grid:
|
|||||||
self.threadLock = False # Gtk checks for thread lock
|
self.threadLock = False # Gtk checks for thread lock
|
||||||
self.helperThread = None # Helper thread object
|
self.helperThread = None # Helper thread object
|
||||||
self.toWorkPool = [] # Thread fills pool and gtk empties it
|
self.toWorkPool = [] # Thread fills pool and gtk empties it
|
||||||
self.SelectedFiles = []
|
self.selectedFiles = []
|
||||||
self.currentPath = ""
|
self.currentPath = ""
|
||||||
|
|
||||||
self.desktop.set_model(self.store)
|
self.desktop.set_model(self.store)
|
||||||
self.desktop.set_pixbuf_column(0)
|
self.desktop.set_pixbuf_column(0)
|
||||||
self.desktop.set_text_column(1)
|
self.desktop.set_text_column(1)
|
||||||
self.desktop.connect("item-activated", self.iconDblLeftClick)
|
self.desktop.connect("item-activated", self.iconDblLeftClick)
|
||||||
self.desktop.connect("button_press_event", self.iconRightClick, (self.desktop,))
|
self.desktop.connect("button_release_event", self.iconSingleClick, (self.desktop,))
|
||||||
|
|
||||||
|
|
||||||
def setIconViewDir(self, path):
|
def setIconViewDir(self, path):
|
||||||
@ -151,39 +151,53 @@ class Grid:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|
||||||
def iconRightClick(self, widget, eve, rclicked_icon):
|
def iconSingleClick(self, widget, eve, rclicked_icon):
|
||||||
try:
|
try:
|
||||||
if eve.type == gdk.EventType.BUTTON_PRESS and eve.button == 3:
|
if eve.type == gdk.EventType.BUTTON_RELEASE and eve.button == 1:
|
||||||
input = self.builder.get_object("iconRenameInput")
|
self.selectedFiles.clear()
|
||||||
controls = self.builder.get_object("iconControlsWindow")
|
|
||||||
items = widget.get_selected_items()
|
items = widget.get_selected_items()
|
||||||
model = widget.get_model()
|
model = widget.get_model()
|
||||||
self.SelectedFiles.clear()
|
dir = self.currentPath
|
||||||
|
|
||||||
if len(items) == 1:
|
for item in items:
|
||||||
fileName = model[items[0]][1]
|
fileName = model[item][1]
|
||||||
dir = self.currentPath
|
|
||||||
file = dir + "/" + fileName
|
|
||||||
|
|
||||||
self.SelectedFiles.append(file) # Used for return to caller
|
if fileName != "." and fileName != "..":
|
||||||
input.set_text(fileName)
|
file = dir + "/" + fileName
|
||||||
controls.show_all()
|
self.selectedFiles.append(file) # Used for return to caller
|
||||||
elif len(items) > 1:
|
|
||||||
dir = self.currentPath
|
|
||||||
for item in items:
|
|
||||||
fileName = model[item][1]
|
|
||||||
file = dir + "/" + fileName
|
|
||||||
self.SelectedFiles.append(file) # Used for return to caller
|
|
||||||
|
|
||||||
|
elif eve.type == gdk.EventType.BUTTON_RELEASE and eve.button == 3:
|
||||||
|
input = self.builder.get_object("filenameInput")
|
||||||
|
controls = self.builder.get_object("iconControlsWindow")
|
||||||
|
iconsButtonBox = self.builder.get_object("iconsButtonBox")
|
||||||
|
menuButtonBox = self.builder.get_object("menuButtonBox")
|
||||||
|
|
||||||
|
|
||||||
|
if len(self.selectedFiles) == 1:
|
||||||
|
parts = self.selectedFiles[0].split("/")
|
||||||
|
input.set_text(parts[len(parts) - 1])
|
||||||
|
input.show()
|
||||||
|
iconsButtonBox.show()
|
||||||
|
menuButtonBox.hide()
|
||||||
|
controls.show()
|
||||||
|
elif len(self.selectedFiles) > 1:
|
||||||
input.set_text("")
|
input.set_text("")
|
||||||
input.hide()
|
input.hide()
|
||||||
|
menuButtonBox.hide()
|
||||||
|
iconsButtonBox.show()
|
||||||
|
controls.show()
|
||||||
|
else:
|
||||||
|
input.set_text("")
|
||||||
|
input.show()
|
||||||
|
menuButtonBox.show()
|
||||||
|
iconsButtonBox.hide()
|
||||||
controls.show()
|
controls.show()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|
||||||
def returnSelectedFiles(self):
|
def returnSelectedFiles(self):
|
||||||
return self.SelectedFiles
|
return self.selectedFiles
|
||||||
|
|
||||||
def returnCurrentPath(self):
|
def returnCurrentPath(self):
|
||||||
return self.currentPath
|
return self.currentPath
|
||||||
|
Loading…
Reference in New Issue
Block a user