comparison sat_frontends/jp/xmlui_manager.py @ 3407:2f0be2b7de68

jp: replace `no_lf` argument by `end` in `disp` (same as in `print`)
author Goffi <goffi@goffi.org>
date Thu, 12 Nov 2020 14:53:16 +0100
parents 89d97776fd34
children be6d91572633
comparison
equal deleted inserted replaced
3406:4c15271118a2 3407:2f0be2b7de68
197 try: 197 try:
198 return self._xmlui_for_name 198 return self._xmlui_for_name
199 except AttributeError: 199 except AttributeError:
200 return None 200 return None
201 201
202 async def show(self, no_lf=False, ansi=""): 202 async def show(self, end='\n', ansi=""):
203 """show label 203 """show label
204 204
205 @param no_lf(bool): same as for [JP.disp] 205 @param end(str): same as for [JP.disp]
206 @param ansi(unicode): ansi escape code to print before label 206 @param ansi(unicode): ansi escape code to print before label
207 """ 207 """
208 self.disp(A.color(ansi, self.value), no_lf=no_lf) 208 self.disp(A.color(ansi, self.value), end=end)
209 209
210 210
211 class JidWidget(xmlui_base.JidWidget, TextWidget): 211 class JidWidget(xmlui_base.JidWidget, TextWidget):
212 type = "jid" 212 type = "jid"
213 213
381 class LabelContainer(xmlui_base.PairsContainer, Container): 381 class LabelContainer(xmlui_base.PairsContainer, Container):
382 type = "label" 382 type = "label"
383 383
384 async def show(self): 384 async def show(self):
385 for child in self.children: 385 for child in self.children:
386 no_lf = False 386 end = '\n'
387 # we check linked widget type 387 # we check linked widget type
388 # to see if we want the label on the same line or not 388 # to see if we want the label on the same line or not
389 if child.type == "label": 389 if child.type == "label":
390 for_name = child.for_name 390 for_name = child.for_name
391 if for_name: 391 if for_name:
394 if self.root.values_only or wid_type in ( 394 if self.root.values_only or wid_type in (
395 "text", 395 "text",
396 "string", 396 "string",
397 "jid_input", 397 "jid_input",
398 ): 398 ):
399 no_lf = True 399 end = ' '
400 elif wid_type == "bool" and for_widget.read_only: 400 elif wid_type == "bool" and for_widget.read_only:
401 no_lf = True 401 end = ' '
402 await child.show(no_lf=no_lf, ansi=A.FG_CYAN) 402 await child.show(end=end, ansi=A.FG_CYAN)
403 else: 403 else:
404 await child.show() 404 await child.show()
405 405
406 406
407 ## Dialogs ## 407 ## Dialogs ##