mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-17 07:38:42 +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
1 changed files with 30 additions and 18 deletions
|
@ -476,6 +476,8 @@ 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]
|
||||||
|
if index > -1:
|
||||||
|
# We are renaming a file
|
||||||
itr = self.treestore.get_iter(path)
|
itr = self.treestore.get_iter(path)
|
||||||
# Recurse through the treestore to get the actual path of the file
|
# Recurse through the treestore to get the actual path of the file
|
||||||
def get_filepath(i, fp):
|
def get_filepath(i, fp):
|
||||||
|
@ -495,6 +497,11 @@ class FilesTab(Tab):
|
||||||
log.debug("filepath: %s", filepath)
|
log.debug("filepath: %s", filepath)
|
||||||
|
|
||||||
client.rename_files(self.torrent_id, [(index, 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
|
||||||
|
|
||||||
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…
Add table
Add a link
Reference in a new issue