mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-19 22:58:30 +00:00
Only update the specific row's filename instead of requesting a whole
new files list when the file_renamed signal is received.
This commit is contained in:
parent
4e720b9364
commit
7b3f6a31f6
@ -476,25 +476,32 @@ class FilesTab(Tab):
|
|||||||
|
|
||||||
def _on_filename_edited(self, renderer, path, new_text):
|
def _on_filename_edited(self, renderer, path, new_text):
|
||||||
index = self.treestore[path][5]
|
index = self.treestore[path][5]
|
||||||
itr = self.treestore.get_iter(path)
|
if index > -1:
|
||||||
# Recurse through the treestore to get the actual path of the file
|
# We are renaming a file
|
||||||
def get_filepath(i, fp):
|
itr = self.treestore.get_iter(path)
|
||||||
if self.treestore.iter_parent(i):
|
# Recurse through the treestore to get the actual path of the file
|
||||||
fp = get_filepath(self.treestore.iter_parent(i), fp)
|
def get_filepath(i, fp):
|
||||||
else:
|
if self.treestore.iter_parent(i):
|
||||||
fp += self.treestore[i][0]
|
fp = get_filepath(self.treestore.iter_parent(i), fp)
|
||||||
|
else:
|
||||||
|
fp += self.treestore[i][0]
|
||||||
|
return fp
|
||||||
return fp
|
return fp
|
||||||
return fp
|
|
||||||
|
# Only recurse if file is in a folder..
|
||||||
# Only recurse if file is in a folder..
|
if self.treestore.iter_parent(itr):
|
||||||
if self.treestore.iter_parent(itr):
|
filepath = get_filepath(itr, str()) + new_text
|
||||||
filepath = get_filepath(itr, str()) + new_text
|
else:
|
||||||
else:
|
filepath = new_text
|
||||||
filepath = new_text
|
|
||||||
|
log.debug("filepath: %s", filepath)
|
||||||
|
|
||||||
|
client.rename_files(self.torrent_id, [(index, filepath)])
|
||||||
|
else:
|
||||||
|
# We are renaming a folder
|
||||||
|
# This requires us to change all the files under this folder
|
||||||
|
pass
|
||||||
|
|
||||||
log.debug("filepath: %s", filepath)
|
|
||||||
|
|
||||||
client.rename_files(self.torrent_id, [(index, filepath)])
|
|
||||||
self._editing_index = None
|
self._editing_index = None
|
||||||
|
|
||||||
def _on_filename_editing_start(self, renderer, editable, path):
|
def _on_filename_editing_start(self, renderer, editable, path):
|
||||||
@ -509,4 +516,9 @@ class FilesTab(Tab):
|
|||||||
# We need to update the filename displayed if we're currently viewing
|
# We need to update the filename displayed if we're currently viewing
|
||||||
# this torrents files.
|
# this torrents files.
|
||||||
if torrent_id == self.torrent_id:
|
if torrent_id == self.torrent_id:
|
||||||
self.update_files()
|
def set_file_name(model, path, itr, user_data):
|
||||||
|
if model[itr][5] == index:
|
||||||
|
model[itr][0] = os.path.split(name)[-1]
|
||||||
|
return True
|
||||||
|
self.treestore.foreach(set_file_name, None)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user