[kupfer] putty: support HostServiceLeaf
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer] putty: support HostServiceLeaf
- Date: Wed, 20 Jan 2010 20:04:44 +0000 (UTC)
commit e6bc9703caa5115442d94a43b6237993e9b47ed9
Author: Karol BÄ?dkowski <karol bedkowsk+gh gmail com>
Date: Sat Jan 9 22:31:50 2010 +0100
putty: support HostServiceLeaf
Putty now can connect to host defined via HostServiceLeaf from i.e. Vinagre
kupfer/plugin/putty.py | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/kupfer/plugin/putty.py b/kupfer/plugin/putty.py
index 65c9650..5d9ec86 100644
--- a/kupfer/plugin/putty.py
+++ b/kupfer/plugin/putty.py
@@ -8,7 +8,8 @@ from kupfer.objects import Action, AppLeafContentMixin
from kupfer.helplib import FilesystemWatchMixin, PicklingHelperMixin
from kupfer import utils, icons
from kupfer.obj.grouping import ToplevelGroupingSource
-from kupfer.obj.hosts import HOST_NAME_KEY, HostLeaf
+from kupfer.obj.hosts import HOST_NAME_KEY, HostLeaf, HOST_ADDRESS_KEY, \
+ HOST_SERVICE_NAME_KEY, HOST_SERVICE_PORT_KEY, HOST_SERVICE_USER_KEY
__kupfer_name__ = _("PuTTY Sessions")
__kupfer_sources__ = ("PuttySessionSource", )
@@ -43,8 +44,18 @@ class PuttyOpenSession(Action):
Action.__init__(self, _('Start Session'))
def activate(self, leaf):
- session = leaf[PUTTY_SESSION_KEY]
- utils.launch_commandline("putty -load '%s'" % session)
+ if leaf.check_key(PUTTY_SESSION_KEY):
+ session = leaf[PUTTY_SESSION_KEY]
+ utils.launch_commandline("putty -load '%s'" % session)
+ else:
+ options = ['putty']
+ if leaf.check_key(HOST_SERVICE_USER_KEY):
+ options.append('-l ' + leaf[HOST_SERVICE_USER_KEY])
+ if leaf.check_key(HOST_SERVICE_PORT_KEY):
+ options.append('-P ' + leaf[HOST_SERVICE_PORT_KEY])
+ options.append(leaf[HOST_ADDRESS_KEY])
+ cmd = ' '.join(options)
+ utils.launch_commandline(cmd)
def get_icon_name(self):
return 'putty'
@@ -53,6 +64,9 @@ class PuttyOpenSession(Action):
yield HostLeaf
def valid_for_item(self, item):
+ if item.check_key(HOST_SERVICE_NAME_KEY):
+ if item[HOST_SERVICE_NAME_KEY] == 'ssh':
+ return True
return item.check_key(PUTTY_SESSION_KEY)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]