This file is indexed.

/usr/share/doc/python-gtk2-tutorial/html/sec-ComboWidget.html is in python-gtk2-tutorial 2.4-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
80
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>9.11. Combo Widget</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="PyGTK 2.0 Tutorial"><link rel="up" href="ch-MiscellaneousWidgets.html" title="Chapter 9. Miscellaneous Widgets"><link rel="previous" href="sec-SpinButtons.html" title="9.10. Spin Buttons"><link rel="next" href="sec-Calendar.html" title="9.12. Calendar"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">9.11. Combo Widget</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="sec-SpinButtons.html">Prev</a> </td><th width="60%" align="center">Chapter 9. Miscellaneous Widgets</th><td width="20%" align="right"> <a accesskey="n" href="sec-Calendar.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sec-ComboWidget"></a>9.11. Combo Widget</h2></div></div><div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>The <tt class="classname">Combo</tt> widget is deprecated in PyGTK
2.4 and above.</p></div><p>The <tt class="classname">Combo</tt> widget is another fairly simple
widget that is really just a collection of other widgets. From the user's
point of view, the widget consists of a text entry box and a pull down menu
from which the user can select one of a set of predefined
entries. Alternatively, the user can type a different option directly into
the text box.</p><p>The <tt class="classname">Combo</tt> has two principal parts that
you really care about: an <i class="parameter"><tt>entry</tt></i> and a
<i class="parameter"><tt>list</tt></i>. These are accessed using the attributes:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  combo.entry

  combo.list
</pre></td></tr></table><p>First off, to create a <tt class="classname">Combo</tt>, use:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  combo = gtk.Combo()
</pre></td></tr></table><p>Now, if you want to set the string in the entry section of the
combo, this is done by manipulating the entry widget directly:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  combo.entry.set_text(<b class="parameter"><tt>text</tt></b>)
</pre></td></tr></table><p>To set the values in the popdown <i class="parameter"><tt>list</tt></i>,
one uses the method:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  combo.set_popdown_strings(<b class="parameter"><tt>strings</tt></b>)
</pre></td></tr></table><p>Before you can do this, you have to assemble a list of the
strings that you want.</p><p>Here's a typical code segment for creating a set of
options:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  slist = [ "String 1", "String 2", "String 3", "String 4" ]

  combo.set_popdown_strings(slist)
</pre></td></tr></table><p>At this point you have set up a working
<tt class="classname">Combo</tt>. There are a few aspects of its behavior that
you can change. These are accomplished with the methods:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  combo.set_use_arrows(<b class="parameter"><tt>val</tt></b>)

  combo.set_use_arrows_always(<b class="parameter"><tt>val</tt></b>)

  combo.set_case_sensitive(<b class="parameter"><tt>val</tt></b>)
</pre></td></tr></table><p>The <tt class="methodname">set_use_arrows</tt>() method lets the
user change the value in the entry using the up/down arrow keys when
<i class="parameter"><tt>val</tt></i> is set to <tt class="literal">TRUE</tt>. This doesn't
bring up the list, but rather replaces the current text in the entry with
the next list entry (up or down, as your key choice indicates). It does this
by searching in the list for the item corresponding to the current value in
the <i class="parameter"><tt>entry</tt></i> and selecting the previous/next item
accordingly.  Usually in an <i class="parameter"><tt>entry</tt></i> the arrow keys are
used to change focus (you can do that anyway using
<span><b class="keycap">Tab</b></span>). Note that when the current item is the last of the
list and you press arrow-down it changes the focus (the same applies with
the first item and arrow-up).</p><p>If the current value in the <i class="parameter"><tt>entry</tt></i> is not
in the list, then the <tt class="methodname">set_use_arrows</tt>() method is
disabled.</p><p>The <tt class="methodname">set_use_arrows_always</tt>() method,
when <i class="parameter"><tt>val</tt></i> is <tt class="literal">TRUE</tt>, similarly allows
the use of the up/down arrow keys to cycle through the choices in the
dropdown list, except that it wraps around the values in the list,
completely disabling the use of the up and down arrow keys for changing
focus.</p><p>The <tt class="methodname">set_case_sensitive</tt>() method toggles
whether or not GTK+ searches for entries in a case sensitive manner. This is
used when the <tt class="classname">Combo</tt> widget is asked to find a value
from the list using the current entry in the text box. This completion can
be performed in either a case sensitive or insensitive manner, depending
upon the setting of this method. The <tt class="classname">Combo</tt> widget can
also simply complete the current entry if the user presses the key
combination <span class="keysym">MOD-1</span>-<span><b class="keycap">Tab</b></span>.  <span class="keysym">MOD-1</span> is often mapped to
the <span><b class="keycap">Alt</b></span> key, by the <span><b class="command">xmodmap</b></span>
utility. Note, however that some window managers also use this key
combination, which will override its use within GTK.</p><p>Now that we have a combo, tailored to look and act how we want
it, all that remains is being able to get data from the combo. This is
relatively straightforward. The majority of the time, all you are going to
care about getting data from is the entry. The entry is accessed simply as
<i class="parameter"><tt>combo.entry</tt></i>. The two principal things that you are
going to want to do with it are attach to the "activate" signal, which
indicates that the user has pressed the <span><b class="keycap">Return</b></span> or
<span><b class="keycap">Enter</b></span> key, and read the text. The first is accomplished
using something like:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  combo.entry.connect("activate", my_callback, my_data)
</pre></td></tr></table><p>Getting the text at any arbitrary time is accomplished by simply
using the entry method:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  string = combo.entry.get_text()
</pre></td></tr></table><p>That's about all there is to it. There is a method:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  combo.disable_activate()
</pre></td></tr></table><p>that will disable the activate signal on the entry widget in the
combo. Personally, I can't think of why you'd want to use it, but it does
exist.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sec-SpinButtons.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch-MiscellaneousWidgets.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sec-Calendar.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">9.10. Spin Buttons </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 9.12. Calendar</td></tr></table></div></body></html>