This file is indexed.

/usr/share/pyshared/tryton/common/placeholder_entry.py is in tryton-client 3.0.2-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
#This file is part of Tryton.  The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
import gtk


class PlaceholderEntry(gtk.Entry):

    _placeholder = ''
    _default = True

    def __init__(self, *args, **kwargs):
        super(PlaceholderEntry, self).__init__(*args, **kwargs)
        style = self.get_style()
        self._text_color_normal = style.text[gtk.STATE_NORMAL]
        self._text_color_placeholder = style.text[gtk.STATE_INSENSITIVE]
        self.connect('focus-in-event', PlaceholderEntry._focus_in)
        self.connect('focus-out-event', PlaceholderEntry._focus_out)

    def _focus_in(self, event):
        if self._default:
            super(PlaceholderEntry, self).set_text('')
            self.modify_text(gtk.STATE_NORMAL, self._text_color_normal)
        self._default = False

    def _focus_out(self, event=None):
        if super(PlaceholderEntry, self).get_text() == '':
            super(PlaceholderEntry, self).set_text(self._placeholder)
            self.modify_text(gtk.STATE_NORMAL, self._text_color_placeholder)
            self._default = True
        else:
            self.modify_text(gtk.STATE_NORMAL, self._text_color_normal)
            self._default = False

    def set_placeholder_text(self, text):
        self._placeholder = text
        if not self.has_focus():
            self._focus_out()

    def get_text(self):
        if self._default:
            return ''
        return super(PlaceholderEntry, self).get_text()

    def set_text(self, text):
        super(PlaceholderEntry, self).set_text(text)
        if not self.has_focus():
            self._focus_out()

if __name__ == '__main__':
    win = gtk.Window()
    win.set_title('PlaceholderEntry')

    def cb(window, event):
        gtk.main_quit()
    win.connect('delete-event', cb)
    vbox = gtk.VBox()
    win.add(vbox)

    entry = gtk.Entry()
    vbox.pack_start(entry)

    placeholder_entry = PlaceholderEntry()
    placeholder_entry.set_placeholder_text('Placeholder')
    vbox.pack_start(placeholder_entry)

    win.show_all()
    gtk.main()