mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-02 22:48:40 +00:00
Tweaks to open folder feature.
This commit is contained in:
parent
0053ae4f59
commit
c2bd8b7ac3
1 changed files with 19 additions and 10 deletions
|
@ -636,19 +636,28 @@ class DelugeGTK:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def open_folder(self, widget):
|
def open_folder(self, widget):
|
||||||
|
if self.config.get("open_folder_stock"):
|
||||||
|
if self.config.get("file_manager") == 0:
|
||||||
|
file_manager = "konqueror"
|
||||||
|
if self.config.get("file_manager") == 1:
|
||||||
|
file_manager = "nautilus"
|
||||||
|
if self.config.get("file_manager") == 2:
|
||||||
|
file_manager = "thunar"
|
||||||
|
elif self.config.get("open_folder_custom"):
|
||||||
|
file_manager = self.config.get("open_folder_location")
|
||||||
|
|
||||||
unique_ids = self.get_selected_torrent_rows()
|
unique_ids = self.get_selected_torrent_rows()
|
||||||
try:
|
try:
|
||||||
for uid in unique_ids:
|
for uid in unique_ids:
|
||||||
if self.config.get("open_folder_stock"):
|
torrent_path = self.manager.unique_IDs[uid].save_dir
|
||||||
if self.config.get("file_manager") == 0:
|
torrent_state = self.manager.get_torrent_state(uid)
|
||||||
command = "konqueror"
|
if torrent_state["num_files"] > 1:
|
||||||
if self.config.get("file_manager") == 1:
|
# Assume torrent has only one root dir.
|
||||||
command = "nautilus"
|
file = self.manager.get_torrent_file_info(uid)[0]
|
||||||
if self.config.get("file_manager") == 2:
|
torrent_path = os.path.join(torrent_path,
|
||||||
command = "thunar"
|
file["path"].split("/", 1)[0])
|
||||||
elif self.config.get("open_folder_custom"):
|
|
||||||
command = self.config.get("open_folder_location")
|
os.system('%s "%s"' % (file_manager, torrent_path))
|
||||||
os.system('%s %s' %(command, self.manager.unique_IDs[uid].save_dir))
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue