[kupfer: 42/51] Port Open Terminal Here to use current screen
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [kupfer: 42/51] Port Open Terminal Here to use current screen
- Date: Mon, 28 Mar 2011 15:04:36 +0000 (UTC)
commit 343c0282368d293c2b44a01681cb8b88c9c5eb1e
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Mon Mar 28 16:51:49 2011 +0200
Port Open Terminal Here to use current screen
kupfer/desktop_launch.py | 6 +++---
kupfer/obj/fileactions.py | 9 ++++++---
kupfer/utils.py | 4 ++--
3 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/kupfer/desktop_launch.py b/kupfer/desktop_launch.py
index c7bb52a..cd3e69c 100644
--- a/kupfer/desktop_launch.py
+++ b/kupfer/desktop_launch.py
@@ -321,7 +321,7 @@ def launch_app_info(app_info, gfiles=[], in_terminal=None, timestamp=None,
return False
return True
-def spawn_app_id(app_id, argv, workdir=None, startup_notify=True):
+def spawn_app_id(app_id, argv, workdir=None, startup_notify=True, screen=None):
"""
Spawn @argv trying to notify it as if it is app_id
"""
@@ -330,7 +330,7 @@ def spawn_app_id(app_id, argv, workdir=None, startup_notify=True):
except RuntimeError:
app_info = None
startup_notify = False
- return spawn_app(app_info, argv, [], workdir, startup_notify)
+ return spawn_app(app_info, argv, [], workdir, startup_notify, screen=screen)
def spawn_app(app_info, argv, filelist, workdir=None, startup_notify=True,
timestamp=None, launch_cb=None, screen=None):
@@ -363,7 +363,7 @@ def spawn_app(app_info, argv, filelist, workdir=None, startup_notify=True,
else:
child_env_add = {}
if screen:
- child_env_add["DISPLAY"]=screen.get_display().get_name()
+ child_env_add["DISPLAY"]=screen.make_display_name()
debug_log(child_env_add)
if not workdir or not os.path.exists(workdir):
diff --git a/kupfer/obj/fileactions.py b/kupfer/obj/fileactions.py
index 1ad1cd1..ee16a0a 100644
--- a/kupfer/obj/fileactions.py
+++ b/kupfer/obj/fileactions.py
@@ -93,10 +93,13 @@ class RevealFile (Action):
class OpenTerminal (Action):
def __init__(self, name=_("Open Terminal Here")):
super(OpenTerminal, self).__init__(name)
-
- def activate(self, leaf):
+
+ def wants_context(self):
+ return True
+
+ def activate(self, leaf, ctx):
try:
- utils.spawn_terminal(leaf.object)
+ utils.spawn_terminal(leaf.object, ctx.environment.get_screen())
except utils.SpawnError as exc:
raise OperationError(exc)
diff --git a/kupfer/utils.py b/kupfer/utils.py
index 7c5203a..a9e6eff 100644
--- a/kupfer/utils.py
+++ b/kupfer/utils.py
@@ -184,13 +184,13 @@ class AsyncCommand (object):
os.kill(self.pid, signal.SIGKILL)
-def spawn_terminal(workdir=None):
+def spawn_terminal(workdir=None, screen=None):
" Raises SpawnError "
term = terminal.get_configured_terminal()
notify = term["startup_notify"]
app_id = term["desktopid"]
argv = term["argv"]
- desktop_launch.spawn_app_id(app_id, argv, workdir, notify)
+ desktop_launch.spawn_app_id(app_id, argv, workdir, notify, screen)
def spawn_in_terminal(argv, workdir=None):
" Raises SpawnError "
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]