This file is indexed.

/usr/share/pyshared/guiqwt/tests/loadsavecanvas.py is in python-guiqwt 2.1.6-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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 CEA
# Pierre Raybaut
# Licensed under the terms of the CECILL License
# (see guiqwt/__init__.py for details)

"""Load/save test"""

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

# WARNING:
# This script requires read/write permissions on current directory

from guidata.qt.QtGui import QFont

import os, os.path as osp
from numpy import linspace, sin

from guiqwt.plot import ImageDialog
from guiqwt.builder import make
from guiqwt.shapes import Axes
from guiqwt.tools import LoadItemsTool, SaveItemsTool

FNAME = "loadsavecanvas.gui"

def build_items():
    x = linspace(-10, 10, 200)
    y = sin(sin(sin(x)))
    filename = osp.join(osp.dirname(__file__), "brain.png")
    items = [ make.curve(x, y, color="b"),
              make.image(filename=filename),
              make.trimage(filename=filename),
              make.label("Relative position <b>outside</b>",
                         (x[0], y[0]), (-10, -10), "BR"),
              make.label("Relative position <i>inside</i>",
                         (x[0], y[0]), (10, 10), "TL"),
              make.label("Absolute position", "R", (0,0), "R"),
              make.legend("TR"),
              make.rectangle(-3, -0.8, -0.5, -1., "rc1"),
              make.ellipse(-10, 0.0, 0, 0, .5, "el1"),
              make.annotated_rectangle(0.5, 0.8, 3, 1., "rc1", "tutu"),
              make.annotated_segment(-1,-1, 1, 1., "rc1", "tutu"),
              Axes( (0,0), (1,0), (0,1) ),
              ]
    return items

def test():
    import guidata
    _app = guidata.qapplication()
    win = ImageDialog(edit=False, toolbar=True, wintitle="Load/save test",
                      options=dict(title="Title", xlabel="xlabel",
                                   ylabel="ylabel"))
    win.add_separator_tool()
    win.add_tool(LoadItemsTool)
    win.add_tool(SaveItemsTool)
    plot = win.get_plot()

    if os.access(FNAME, os.R_OK):
        f = file(FNAME, "rb")
        print "Restoring items...",
        plot.restore_items(f)
        print "OK"
    else:
        for item in build_items():
            plot.add_item(item)
        print "Building items and add them to plotting canvas",
    plot.set_axis_font("left", QFont("Courier"))
    win.get_itemlist_panel().show()
    plot.set_items_readonly(False)
    win.show()
    win.exec_()
    f = file(FNAME, "wb")
    print "Saving items...",
    plot.save_items(f)
    print "OK"

if __name__ == "__main__":
    test()