Mercurial > libervia-backend
comparison frontends/src/jp/cmd_profile.py @ 2179:e42c6c131b52
jp (profile): fixed help gettext calls
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 09 Mar 2017 23:10:17 +0100 |
parents | 0c32ff2f64c4 |
children | a6c9bc4d1de0 |
comparison
equal
deleted
inserted
replaced
2178:b9bfc45cea22 | 2179:e42c6c131b52 |
---|---|
128 def __init__(self, host): | 128 def __init__(self, host): |
129 super(ProfileCreate, self).__init__(host, 'create', use_profile=False, help=(u'create a new profile')) | 129 super(ProfileCreate, self).__init__(host, 'create', use_profile=False, help=(u'create a new profile')) |
130 self.need_loop = True | 130 self.need_loop = True |
131 | 131 |
132 def add_parser_options(self): | 132 def add_parser_options(self): |
133 self.parser.add_argument('profile', type=str, help=(u'the name of the profile')) | 133 self.parser.add_argument('profile', type=str, help=_(u'the name of the profile')) |
134 self.parser.add_argument('-p', '--password', type=str, default='', help=(u'the password of the profile')) | 134 self.parser.add_argument('-p', '--password', type=str, default='', help=_(u'the password of the profile')) |
135 self.parser.add_argument('-j', '--jid', type=str, help=(u'the jid of the profile')) | 135 self.parser.add_argument('-j', '--jid', type=str, help=_(u'the jid of the profile')) |
136 self.parser.add_argument('-x', '--xmpp-password', type=str, help=(u'the password of the XMPP account (use profile password if not specified)'), | 136 self.parser.add_argument('-x', '--xmpp-password', type=str, help=_(u'the password of the XMPP account (use profile password if not specified)'), |
137 metavar='PASSWORD') | 137 metavar='PASSWORD') |
138 self.parser.add_argument('-C', '--component', type=base.unicode_decoder, default='', | 138 self.parser.add_argument('-C', '--component', type=base.unicode_decoder, default='', |
139 help=_(u'set to component import name (entry point) if this is a component')) | 139 help=_(u'set to component import name (entry point) if this is a component')) |
140 | 140 |
141 def _session_started(self, dummy): | 141 def _session_started(self, dummy): |
142 if self.args.jid: | 142 if self.args.jid: |
143 self.host.bridge.setParam("JabberID", self.args.jid, "Connection" ,profile_key=self.args.profile) | 143 self.host.bridge.setParam("JabberID", self.args.jid, "Connection", profile_key=self.args.profile) |
144 xmpp_pwd = self.args.password or self.args.xmpp_password | 144 xmpp_pwd = self.args.password or self.args.xmpp_password |
145 if xmpp_pwd: | 145 if xmpp_pwd: |
146 self.host.bridge.setParam("Password", xmpp_pwd, "Connection", profile_key=self.args.profile) | 146 self.host.bridge.setParam("Password", xmpp_pwd, "Connection", profile_key=self.args.profile) |
147 self.host.quit() | 147 self.host.quit() |
148 | 148 |
157 self.host.bridge.profileCreate(self.args.profile, self.args.password, self.args.component, callback=self._profile_created, errback=None) | 157 self.host.bridge.profileCreate(self.args.profile, self.args.password, self.args.component, callback=self._profile_created, errback=None) |
158 | 158 |
159 | 159 |
160 class ProfileModify(base.CommandBase): | 160 class ProfileModify(base.CommandBase): |
161 def __init__(self, host): | 161 def __init__(self, host): |
162 super(ProfileModify, self).__init__(host, 'modify', need_connect=False, help=(u'modify an existing profile')) | 162 super(ProfileModify, self).__init__(host, 'modify', need_connect=False, help=_(u'modify an existing profile')) |
163 | 163 |
164 def add_parser_options(self): | 164 def add_parser_options(self): |
165 profile_pwd_group = self.parser.add_mutually_exclusive_group() | 165 profile_pwd_group = self.parser.add_mutually_exclusive_group() |
166 profile_pwd_group.add_argument('-w', '--password', type=base.unicode_decoder, help=(u'change the password of the profile')) | 166 profile_pwd_group.add_argument('-w', '--password', type=base.unicode_decoder, help=_(u'change the password of the profile')) |
167 profile_pwd_group.add_argument('--disable-password', action='store_true', help=(u'disable profile password (dangerous!)')) | 167 profile_pwd_group.add_argument('--disable-password', action='store_true', help=_(u'disable profile password (dangerous!)')) |
168 self.parser.add_argument('-j', '--jid', type=base.unicode_decoder, help=(u'the jid of the profile')) | 168 self.parser.add_argument('-j', '--jid', type=base.unicode_decoder, help=_(u'the jid of the profile')) |
169 self.parser.add_argument('-x', '--xmpp-password', type=base.unicode_decoder, help=(u'change the password of the XMPP account'), | 169 self.parser.add_argument('-x', '--xmpp-password', type=base.unicode_decoder, help=_(u'change the password of the XMPP account'), |
170 metavar='PASSWORD') | 170 metavar='PASSWORD') |
171 self.parser.add_argument('-D', '--default', action='store_true', help=_(u'set as default profile')) | 171 self.parser.add_argument('-D', '--default', action='store_true', help=_(u'set as default profile')) |
172 | 172 |
173 def start(self): | 173 def start(self): |
174 if self.args.disable_password: | 174 if self.args.disable_password: |
185 | 185 |
186 class Profile(base.CommandBase): | 186 class Profile(base.CommandBase): |
187 subcommands = (ProfileConnect, ProfileCreate, ProfileDefault, ProfileDelete, ProfileInfo, ProfileList, ProfileModify) | 187 subcommands = (ProfileConnect, ProfileCreate, ProfileDefault, ProfileDelete, ProfileInfo, ProfileList, ProfileModify) |
188 | 188 |
189 def __init__(self, host): | 189 def __init__(self, host): |
190 super(Profile, self).__init__(host, 'profile', use_profile=False, help=(u'Profile commands')) | 190 super(Profile, self).__init__(host, 'profile', use_profile=False, help=_(u'profile commands')) |