comparison sat_frontends/jp/xmlui_manager.py @ 2961:620bbcec884c

jp (xmlui): check root read_only status in addition to widget one
author Goffi <goffi@goffi.org>
date Fri, 14 Jun 2019 12:49:45 +0200
parents 5d13d357896c
children ab2696e34d29
comparison
equal deleted inserted replaced
2960:5d13d357896c 2961:620bbcec884c
213 213
214 class StringWidget(xmlui_base.StringWidget, InputWidget): 214 class StringWidget(xmlui_base.StringWidget, InputWidget):
215 type = u"string" 215 type = u"string"
216 216
217 def show(self): 217 def show(self):
218 if self.read_only: 218 if self.read_only or self.root.read_only:
219 self.disp(self.value) 219 self.disp(self.value)
220 else: 220 else:
221 elems = [] 221 elems = []
222 self.verboseName(elems) 222 self.verboseName(elems)
223 if self.value: 223 if self.value:
238 type = u"textbox" 238 type = u"textbox"
239 # TODO: use a more advanced input method 239 # TODO: use a more advanced input method
240 240
241 def show(self): 241 def show(self):
242 self.verboseName() 242 self.verboseName()
243 if self.read_only: 243 if self.read_only or self.root.read_only:
244 self.disp(self.value) 244 self.disp(self.value)
245 else: 245 else:
246 if self.value: 246 if self.value:
247 self.disp(A.color(C.A_HEADER, u"↓ current value ↓\n", A.FG_CYAN, self.value, 247 self.disp(A.color(C.A_HEADER, u"↓ current value ↓\n", A.FG_CYAN, self.value,
248 "")) 248 ""))
323 type = u"bool" 323 type = u"bool"
324 324
325 def show(self): 325 def show(self):
326 disp_true = A.color(A.FG_GREEN, u"TRUE") 326 disp_true = A.color(A.FG_GREEN, u"TRUE")
327 disp_false = A.color(A.FG_RED, u"FALSE") 327 disp_false = A.color(A.FG_RED, u"FALSE")
328 if self.read_only: 328 if self.read_only or self.root.read_only:
329 self.disp(disp_true if self.value else disp_false) 329 self.disp(disp_true if self.value else disp_false)
330 else: 330 else:
331 self.disp(A.color(C.A_HEADER, u"0: ", 331 self.disp(A.color(C.A_HEADER, u"0: ",
332 disp_false, A.RESET, 332 disp_false, A.RESET,
333 u" *" if not self.value else u"")) 333 u" *" if not self.value else u""))