/usr/share/pyshared/guidata/dataset/textedit.py is in python-guidata 1.6.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | # -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 CEA
# Pierre Raybaut
# Licensed under the terms of the CECILL License
# (see guidata/__init__.py for details)
"""
Text visitor for DataItem objects
(for test purpose only)
"""
from __future__ import print_function
from guidata.py3compat import input
def prompt(item):
"""Get item value"""
return input(item.get_prop("display", "label")+" ? ")
class TextEditVisitor:
"""Text visitor"""
def __init__(self, instance):
self.instance = instance
def visit_generic(self, item):
"""Generic visitor"""
while True:
value = prompt(item)
item.set_from_string(self.instance, value)
if item.check_item(self.instance):
break
print("Incorrect value!")
visit_FloatItem = visit_generic
visit_IntItem = visit_generic
visit_StringItem = visit_generic
|