diff --git a/deluge/ui/gtkui/common.py b/deluge/ui/gtkui/common.py
index a7715ed..74f04e7 100644
a
|
b
|
def associate_magnet_links(overwrite=False): |
263 | 263 | log.error("Unable to register Deluge as default magnet uri handler.") |
264 | 264 | return False |
265 | 265 | return False |
| 266 | |
| 267 | def current_path_mapping(): |
| 268 | from deluge.configmanager import ConfigManager |
| 269 | host_mapping = ConfigManager("gtkui.conf")["path_mapping"] |
| 270 | host, _, _ = client.connection_info() |
| 271 | return host_mapping[host] if host in host_mapping else [] |
| 272 | |
| 273 | def open_file(filepath): |
| 274 | if client.is_localhost(): |
| 275 | return deluge.common.open_file(filepath) |
| 276 | from re import subn |
| 277 | from os import sep, path |
| 278 | for local, remote in current_path_mapping(): |
| 279 | sub_path, match_found = subn("^%s" % remote, "", filepath) |
| 280 | if(match_found): |
| 281 | filepath = path.join(local, sub_path.lstrip(sep)) |
| 282 | return deluge.common.open_file(filepath) |
diff --git a/deluge/ui/gtkui/files_tab.py b/deluge/ui/gtkui/files_tab.py
index 0856f36..33bb08d 100644
a
|
b
|
def __init__(self): |
237 | 237 | self.torrent_id = None |
238 | 238 | |
239 | 239 | def start(self): |
240 | | attr = "hide" if not client.is_localhost() else "show" |
| 240 | attr = "hide" if not (client.is_localhost() or deluge.ui.gtkui.common.current_path_mapping()) else "show" |
241 | 241 | for widget in self.localhost_widgets: |
242 | 242 | getattr(widget, attr)() |
243 | 243 | |
… |
… |
def clear(self): |
341 | 341 | self.torrent_id = None |
342 | 342 | |
343 | 343 | def _on_row_activated(self, tree, path, view_column): |
344 | | if client.is_localhost: |
| 344 | if client.is_localhost() or deluge.ui.gtkui.common.current_path_mapping(): |
345 | 345 | component.get("SessionProxy").get_torrent_status(self.torrent_id, ["save_path", "files"]).addCallback(self._on_open_file) |
346 | 346 | |
347 | 347 | def get_file_path(self, row, path=""): |
… |
… |
def _on_open_file(self, status): |
361 | 361 | path = self.get_file_path(select).split("/") |
362 | 362 | filepath = os.path.join(status["save_path"], *path) |
363 | 363 | log.debug("Open file '%s'", filepath) |
364 | | deluge.common.open_file(filepath) |
| 364 | deluge.ui.gtkui.common.open_file(filepath) |
365 | 365 | |
366 | 366 | ## The following 3 methods create the folder/file view in the treeview |
367 | 367 | def prepare_file_store(self, files): |
diff --git a/deluge/ui/gtkui/gtkui.py b/deluge/ui/gtkui/gtkui.py
index bbe1195..8ec03a5 100644
a
|
b
|
def start(): |
167 | 167 | "sidebar_position": 170, |
168 | 168 | "show_rate_in_title": False, |
169 | 169 | "focus_main_window_on_add": True, |
170 | | "createtorrent.trackers": [] |
| 170 | "createtorrent.trackers": [], |
| 171 | "path_mapping": {}, |
171 | 172 | } |
172 | 173 | |
173 | 174 | class GtkUI(object): |
diff --git a/deluge/ui/gtkui/menubar.py b/deluge/ui/gtkui/menubar.py
index 214c4b7..7aa7ce6 100644
a
|
b
|
def start(self): |
184 | 184 | "menuitem_open_folder", |
185 | 185 | "separator4" |
186 | 186 | ] |
187 | | if not client.is_localhost(): |
| 187 | if not (client.is_localhost() or deluge.ui.gtkui.common.current_path_mapping()): |
188 | 188 | for widget in non_remote_items: |
189 | 189 | self.torrentmenu_glade.get_widget(widget).hide() |
190 | 190 | self.torrentmenu_glade.get_widget(widget).set_no_show_all(True) |
… |
… |
def on_menuitem_recheck_activate(self, data=None): |
306 | 306 | def on_menuitem_open_folder_activate(self, data=None): |
307 | 307 | log.debug("on_menuitem_open_folder") |
308 | 308 | def _on_torrent_status(status): |
309 | | deluge.common.open_file(status["save_path"]) |
| 309 | deluge.ui.gtkui.common.open_file(status["save_path"]) |
310 | 310 | for torrent_id in component.get("TorrentView").get_selected_torrents(): |
311 | 311 | component.get("SessionProxy").get_torrent_status(torrent_id, ["save_path"]).addCallback(_on_torrent_status) |
312 | 312 | |