Mercurial > libervia-backend
comparison sat_frontends/jp/output_xmlui.py @ 2601:12bf089f0bf3
jp (output): new OUPUT_XMLUI and OUTPUT_LIST_XMLUI outputs
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 01 Jun 2018 12:15:38 +0200 |
parents | |
children | 56f94936df1e |
comparison
equal
deleted
inserted
replaced
2600:947c4c4c5c53 | 2601:12bf089f0bf3 |
---|---|
1 #! /usr/bin/python | |
2 # -*- coding: utf-8 -*- | |
3 | |
4 # jp: a SàT command line tool | |
5 # Copyright (C) 2009-2018 Jérôme Poisson (goffi@goffi.org) | |
6 | |
7 # This program is free software: you can redistribute it and/or modify | |
8 # it under the terms of the GNU Affero General Public License as published by | |
9 # the Free Software Foundation, either version 3 of the License, or | |
10 # (at your option) any later version. | |
11 | |
12 # This program is distributed in the hope that it will be useful, | |
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 # GNU Affero General Public License for more details. | |
16 | |
17 # You should have received a copy of the GNU Affero General Public License | |
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 """Standard outputs""" | |
20 | |
21 | |
22 from sat_frontends.jp.constants import Const as C | |
23 from sat_frontends.jp import xmlui_manager | |
24 from sat.core.log import getLogger | |
25 log = getLogger(__name__) | |
26 | |
27 | |
28 __outputs__ = ["XMLUI"] | |
29 | |
30 | |
31 class XMLUI(object): | |
32 """Outputs for XMLUI""" | |
33 | |
34 def __init__(self, host): | |
35 self.host = host | |
36 host.register_output(C.OUTPUT_XMLUI, u"simple", self.xmlui, default=True) | |
37 host.register_output(C.OUTPUT_LIST_XMLUI, u"simple", self.xmlui_list, default=True) | |
38 | |
39 def xmlui(self, data): | |
40 xmlui = xmlui_manager.create(self.host, data) | |
41 xmlui.show(values_only=True) | |
42 self.host.disp(u'') | |
43 | |
44 def xmlui_list(self, data): | |
45 for d in data: | |
46 self.xmlui(d) |