Mercurial > libervia-backend
diff frontends/src/jp/cmd_bookmarks.py @ 1864:96ba685162f6
jp: all commands now use the new start method and set need_loop in __init__ when needed
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 29 Feb 2016 16:52:51 +0100 |
parents | d17772b0fe22 |
children | 3e168cde7a7d |
line wrap: on
line diff
--- a/frontends/src/jp/cmd_bookmarks.py Mon Feb 29 16:52:51 2016 +0100 +++ b/frontends/src/jp/cmd_bookmarks.py Mon Feb 29 16:52:51 2016 +0100 @@ -17,8 +17,6 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -from logging import debug, info, error, warning - import base from sat.core.i18n import _ @@ -43,8 +41,7 @@ def __init__(self, host): super(BookmarksList, self).__init__(host, 'list', help=_('list bookmarks')) - def connected(self): - super(BookmarksList, self).connected() + def start(self): data = self.host.bridge.bookmarksList(self.args.type, self.args.location, self.host.profile) mess = [] for location in STORAGE_LOCATIONS: @@ -68,17 +65,16 @@ class BookmarksRemove(BookmarksCommon): - need_loop = True def __init__(self, host): super(BookmarksRemove, self).__init__(host, 'remove', help=_('remove a bookmark')) + self.need_loop = True def add_parser_options(self): super(BookmarksRemove, self).add_parser_options() self.parser.add_argument('bookmark', type=base.unicode_decoder, help=_('jid (for muc bookmark) or url of to remove')) - def connected(self): - super(BookmarksRemove, self).connected() + def start(self): self.host.bridge.bookmarksRemove(self.args.type, self.args.bookmark, self.args.location, self.host.profile, callback = lambda: self.host.quit(), errback=self._errback) @@ -86,6 +82,7 @@ def __init__(self, host): super(BookmarksAdd, self).__init__(host, 'add', help=_('add a bookmark')) + self.need_loop = True def add_parser_options(self): super(BookmarksAdd, self).add_parser_options(location_default='auto') @@ -95,9 +92,7 @@ muc_group.add_argument('-N', '--nick', type=base.unicode_decoder, help=_('nickname')) muc_group.add_argument('-a', '--autojoin', action='store_true', help=_('join room on profile connection')) - def connected(self): - self.need_loop = True - super(BookmarksAdd, self).connected() + def start(self): if self.args.type == 'url' and (self.args.autojoin or self.args.nick is not None): # XXX: Argparse doesn't seem to manage this case, any better way ? print _(u"You can't use --autojoin or --nick with --type url")