comparison libervia/frontends/jp/output_xmlui.py @ 4074:26b7ed2817da

refactoring: rename `sat_frontends` to `libervia.frontends`
author Goffi <goffi@goffi.org>
date Fri, 02 Jun 2023 14:12:38 +0200
parents sat_frontends/jp/output_xmlui.py@4b842c1fb686
children
comparison
equal deleted inserted replaced
4073:7c5654c54fed 4074:26b7ed2817da
1 #! /usr/bin/env python3
2
3
4 # jp: a SàT command line tool
5 # Copyright (C) 2009-2021 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 libervia.frontends.jp.constants import Const as C
23 from libervia.frontends.jp import xmlui_manager
24 from libervia.backend.core.log import getLogger
25
26 log = getLogger(__name__)
27
28
29 __outputs__ = ["XMLUI"]
30
31
32 class XMLUI(object):
33 """Outputs for XMLUI"""
34
35 def __init__(self, host):
36 self.host = host
37 host.register_output(C.OUTPUT_XMLUI, "simple", self.xmlui, default=True)
38 host.register_output(
39 C.OUTPUT_LIST_XMLUI, "simple", self.xmlui_list, default=True
40 )
41
42 async def xmlui(self, data):
43 xmlui = xmlui_manager.create(self.host, data)
44 await xmlui.show(values_only=True, read_only=True)
45 self.host.disp("")
46
47 async def xmlui_list(self, data):
48 for d in data:
49 await self.xmlui(d)