comparison frontends/src/jp/cmd_profile.py @ 2336:a7438fe4e24d

jp (profile): added disconnect command
author Goffi <goffi@goffi.org>
date Sun, 20 Aug 2017 10:26:10 +0200
parents a6c9bc4d1de0
children 8b37a62336c3
comparison
equal deleted inserted replaced
2335:b226f545f67e 2336:a7438fe4e24d
33 class ProfileConnect(base.CommandBase): 33 class ProfileConnect(base.CommandBase):
34 """Dummy command to use profile_session parent, i.e. to be able to connect without doing anything else""" 34 """Dummy command to use profile_session parent, i.e. to be able to connect without doing anything else"""
35 35
36 def __init__(self, host): 36 def __init__(self, host):
37 # it's weird to have a command named "connect" with need_connect=False, but it can be handy to be able 37 # it's weird to have a command named "connect" with need_connect=False, but it can be handy to be able
38 # to launch just the session, so some paradox don't hurt 38 # to launch just the session, so some paradoxes don't hurt
39 super(ProfileConnect, self).__init__(host, 'connect', need_connect=False, help=(u'connect a profile')) 39 super(ProfileConnect, self).__init__(host, 'connect', need_connect=False, help=(u'connect a profile'))
40 40
41 def add_parser_options(self): 41 def add_parser_options(self):
42 pass 42 pass
43
44
45 class ProfileDisconnect(base.CommandBase):
46
47 def __init__(self, host):
48 super(ProfileDisconnect, self).__init__(host, 'disconnect', need_connect=False, help=(u'disconnect a profile'))
49 self.need_loop = True
50
51 def add_parser_options(self):
52 pass
53
54 def start(self):
55 self.host.bridge.disconnect(self.args.profile, callback=self.host.quit)
43 56
44 57
45 class ProfileDefault(base.CommandBase): 58 class ProfileDefault(base.CommandBase):
46 def __init__(self, host): 59 def __init__(self, host):
47 super(ProfileDefault, self).__init__(host, 'default', use_profile=False, help=(u'print default profile')) 60 super(ProfileDefault, self).__init__(host, 'default', use_profile=False, help=(u'print default profile'))
182 if self.args.default: 195 if self.args.default:
183 self.host.bridge.profileSetDefault(self.host.profile) 196 self.host.bridge.profileSetDefault(self.host.profile)
184 197
185 198
186 class Profile(base.CommandBase): 199 class Profile(base.CommandBase):
187 subcommands = (ProfileConnect, ProfileCreate, ProfileDefault, ProfileDelete, ProfileInfo, ProfileList, ProfileModify) 200 subcommands = (ProfileConnect, ProfileDisconnect, ProfileCreate, ProfileDefault, ProfileDelete, ProfileInfo, ProfileList, ProfileModify)
188 201
189 def __init__(self, host): 202 def __init__(self, host):
190 super(Profile, self).__init__(host, 'profile', use_profile=False, help=_(u'profile commands')) 203 super(Profile, self).__init__(host, 'profile', use_profile=False, help=_(u'profile commands'))