[LP:#1168858] Nautilus window opens behind current window
This commit is contained in:
parent
98dcc3f26e
commit
8bdf1e9044
|
@ -231,12 +231,14 @@ def get_pixmap(fname):
|
|||
return pkg_resources.resource_filename("deluge", os.path.join("data", \
|
||||
"pixmaps", fname))
|
||||
|
||||
def open_file(path):
|
||||
def open_file(path, timestamp=None):
|
||||
"""
|
||||
Opens a file or folder using the system configured program
|
||||
|
||||
:param path: the path to the file or folder to open
|
||||
:type path: string
|
||||
:param timestamp: the timestamp of the event that requested to open
|
||||
:type timestamp: int
|
||||
|
||||
"""
|
||||
if windows_check():
|
||||
|
@ -244,7 +246,12 @@ def open_file(path):
|
|||
elif osx_check():
|
||||
subprocess.Popen(["open", "%s" % path])
|
||||
else:
|
||||
subprocess.Popen(["xdg-open", "%s" % path])
|
||||
if timestamp is None:
|
||||
timestamp = int(time.time())
|
||||
env = os.environ.copy()
|
||||
env["DESKTOP_STARTUP_ID"] = "%s-%u-%s-xdg_open_TIME%d" % \
|
||||
(os.path.basename(sys.argv[0]), os.getpid(), os.uname()[1], timestamp)
|
||||
subprocess.Popen(["xdg-open", "%s" % path], env=env)
|
||||
|
||||
def open_url_in_browser(url):
|
||||
"""
|
||||
|
|
|
@ -361,7 +361,8 @@ class FilesTab(Tab):
|
|||
path = self.get_file_path(select).split("/")
|
||||
filepath = os.path.join(status["save_path"], *path)
|
||||
log.debug("Open file '%s'", filepath)
|
||||
deluge.common.open_file(filepath)
|
||||
timestamp = gtk.get_current_event_time()
|
||||
deluge.common.open_file(filepath, timestamp=timestamp)
|
||||
|
||||
## The following 3 methods create the folder/file view in the treeview
|
||||
def prepare_file_store(self, files):
|
||||
|
|
|
@ -307,7 +307,8 @@ class MenuBar(component.Component):
|
|||
def on_menuitem_open_folder_activate(self, data=None):
|
||||
log.debug("on_menuitem_open_folder")
|
||||
def _on_torrent_status(status):
|
||||
deluge.common.open_file(status["save_path"])
|
||||
timestamp = gtk.get_current_event_time()
|
||||
deluge.common.open_file(status["save_path"], timestamp=timestamp)
|
||||
for torrent_id in component.get("TorrentView").get_selected_torrents():
|
||||
component.get("SessionProxy").get_torrent_status(torrent_id, ["save_path"]).addCallback(_on_torrent_status)
|
||||
|
||||
|
|
Loading…
Reference in New Issue