This file is indexed.

/usr/share/pyshared/guidata/tests/callbacks.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2011 CEA
# Pierre Raybaut
# Licensed under the terms of the CECILL License
# (see guidata/__init__.py for details)

"""
Demonstrates how items may trigger callbacks when activated
"""

from __future__ import print_function

SHOW = True # Show test in GUI-based test launcher


from guidata.dataset.datatypes import DataSet
from guidata.dataset.dataitems import (ChoiceItem, StringItem, TextItem,
                                       ColorItem, FloatItem)


class TestParameters(DataSet):
    def cb_example(self, item, value):
        print("\nitem: ", item, "\nvalue:", value)
        if self.results is None:
            self.results = ''
        self.results += str(value)+'\n'
        print("results:", self.results)

    def update_x1plusx2(self, item, value):
        print("\nitem: ", item, "\nvalue:", value)
        if self.x1 is not None and self.x2 is not None:
            self.x1plusx2 = self.x1 + self.x2
        else:
            self.x1plusx2 = None

    string = StringItem("String", default="foobar"
                        ).set_prop("display", callback=cb_example)
    x1 = FloatItem("x1").set_prop("display", callback=update_x1plusx2)
    x2 = FloatItem("x2").set_prop("display", callback=update_x1plusx2)
    x1plusx2 = FloatItem("x1+x2").set_prop("display", active=False)
    color = ColorItem("Color", default="red"
                      ).set_prop("display", callback=cb_example)
    choice = ChoiceItem("Single choice",
                        [(16, "first choice"), (32, "second choice"),
                         (64, "third choice")], default=64
                        ).set_pos(col=1, colspan=2
                        ).set_prop("display", callback=cb_example)
    results = TextItem("Results")


if __name__ == "__main__":
    # Create QApplication
    import guidata
    _app = guidata.qapplication()
    
    e = TestParameters()
    print(e)
    if e.edit():
        print(e)
    e.view()