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 81 82 83 84
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>gtk.FileSelection</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="PyGTK 2.0 Reference Manual"><link rel="up" href="gtk-class-reference.html" title="The gtk Class Reference"><link rel="previous" href="class-gtkfilefilter.html" title="gtk.FileFilter"><link rel="next" href="class-gtkfixed.html" title="gtk.Fixed"></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">gtk.FileSelection</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtkfilefilter.html">Prev</a></td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"><a accesskey="n" href="class-gtkfixed.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-gtkfileselection"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>gtk.FileSelection</h2><p>gtk.FileSelection — a dialog used to prompt the user for a file or directory
name</p></div><div class="refsect1" lang="en"><a name="id3421882"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.FileSelection</span></span>(<span class="ooclass"><span class="classname"><a href="class-gtkdialog.html" title="gtk.Dialog">gtk.Dialog</a></span></span>):
<code class="constructorsynopsis"> <span class="methodname"><a href="class-gtkfileselection.html#constructor-gtkfileselection" title="Constructor">gtk.FileSelection</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>title</tt></b></span><span class="initializer">=None</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkfileselection.html#method-gtkfileselection--set-filename" title="gtk.FileSelection.set_filename">set_filename</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>filename</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkfileselection.html#method-gtkfileselection--get-filename" title="gtk.FileSelection.get_filename">get_filename</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkfileselection.html#method-gtkfileselection--complete" title="gtk.FileSelection.complete">complete</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>pattern</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkfileselection.html#method-gtkfileselection--show-fileop-buttons" title="gtk.FileSelection.show_fileop_buttons">show_fileop_buttons</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkfileselection.html#method-gtkfileselection--hide-fileop-buttons" title="gtk.FileSelection.hide_fileop_buttons">hide_fileop_buttons</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkfileselection.html#method-gtkfileselection--get-selections" title="gtk.FileSelection.get_selections">get_selections</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkfileselection.html#method-gtkfileselection--set-select-multiple" title="gtk.FileSelection.set_select_multiple">set_select_multiple</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>select_multiple</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkfileselection.html#method-gtkfileselection--get-select-multiple" title="gtk.FileSelection.get_select_multiple">get_select_multiple</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3422050"></a><h2>Ancestry</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="synopsis">+-- <a href="class-gobject.html" title="gobject.GObject">gobject.GObject</a>
+-- <a href="class-gtkobject.html" title="gtk.Object">gtk.Object</a>
+-- <a href="class-gtkwidget.html" title="gtk.Widget">gtk.Widget</a>
+-- <a href="class-gtkcontainer.html" title="gtk.Container">gtk.Container</a>
+-- <a href="class-gtkbin.html" title="gtk.Bin">gtk.Bin</a>
+-- <a href="class-gtkwindow.html" title="gtk.Window">gtk.Window</a>
+-- <a href="class-gtkdialog.html" title="gtk.Dialog">gtk.Dialog</a>
+-- <a href="class-gtkfileselection.html" title="gtk.FileSelection">gtk.FileSelection</a>
</pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3422101"></a><h2>Properties</h2><div class="blockquote"><table width="100%" border="0" bgcolor="#E0E0E0"><tr><td valign="top"><div class="informaltable"><table width="100%" border="0"><colgroup><col><col><col></colgroup><tbody><tr valign="top"><td valign="top">"show-fileops"</td><td valign="top">Read/Write</td><td valign="top">If <tt class="literal">TRUE</tt> display the buttons for creating
and manipulating files.</td></tr><tr valign="top"><td valign="top">"filename"</td><td valign="top">Read/Write</td><td valign="top">The currently selected filename.</td></tr><tr valign="top"><td valign="top">"select-multiple"</td><td valign="top">Read/Write</td><td valign="top">If <tt class="literal">TRUE</tt> allow multiple files to be
selected.</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id3422198"></a><h2>Attributes</h2><div class="blockquote"><table width="100%" border="0" bgcolor="#E0E0E0"><tr><td valign="top"><div class="informaltable"><table cellpadding="5" width="100%" border="0"><colgroup><col><col><col></colgroup><tbody><tr valign="top"><td valign="top">"dir_list"</td><td valign="top">Read</td><td valign="top">The <a href="class-gtktreeview.html" title="gtk.TreeView"><tt class="classname">gtk.TreeView</tt></a>
widget used to display the directories</td></tr><tr valign="top"><td valign="top">"file_list"</td><td valign="top">Read</td><td valign="top">The <a href="class-gtktreeview.html" title="gtk.TreeView"><tt class="classname">gtk.TreeView</tt></a>
widget used to display the files.</td></tr><tr valign="top"><td valign="top">"selection_entry"</td><td valign="top">Read</td><td valign="top">The <a href="class-gtkentry.html" title="gtk.Entry"><tt class="classname">gtk.Entry</tt></a> widget used
to display the current file selection</td></tr><tr valign="top"><td valign="top">"selection_text"</td><td valign="top">Read</td><td valign="top">The <a href="class-gtklabel.html" title="gtk.Label"><tt class="classname">gtk.Label</tt></a> associated
with the selection entry.</td></tr><tr valign="top"><td valign="top">"main_vbox"</td><td valign="top">Read</td><td valign="top">The <a href="class-gtkvbox.html" title="gtk.VBox"><tt class="classname">gtk.VBox</tt></a> widget that
holds all the widgets of the <a href="class-gtkfileselection.html" title="gtk.FileSelection"><tt class="classname">gtk.FileSelection</tt></a>
dialog.</td></tr><tr valign="top"><td valign="top">"ok_button"</td><td valign="top">Read</td><td valign="top">The "OK" button.</td></tr><tr valign="top"><td valign="top">"cancel_button"</td><td valign="top">Read</td><td valign="top">The "Cancel" button.</td></tr><tr valign="top"><td valign="top">"history_pulldown"</td><td valign="top">Read</td><td valign="top">The <a href="class-gtkoptionmenu.html" title="gtk.OptionMenu"><tt class="classname">gtk.OptionMenu</tt></a>
widget that provides the pulldown list of directory paths.</td></tr><tr valign="top"><td valign="top">"history_menu"</td><td valign="top">Read</td><td valign="top">The <a href="class-gtkmenu.html" title="gtk.Menu"><tt class="classname">gtk.Menu</tt></a> part of the
<i class="parameter"><tt>history_pulldown</tt></i></td></tr><tr valign="top"><td valign="top">"fileop_dialog"</td><td valign="top">Read</td><td valign="top">The dialog box used to display the <a href="class-gtkfileselection.html" title="gtk.FileSelection"><tt class="classname">gtk.FileSelection</tt></a>.
It can be customized by adding or removing widgets from it using the
standard <a href="class-gtkdialog.html" title="gtk.Dialog"><tt class="classname">gtk.Dialog</tt></a>
methods.</td></tr><tr valign="top"><td valign="top">"fileop_entry"</td><td valign="top">Read</td><td valign="top">The <a href="class-gtkentry.html" title="gtk.Entry"><tt class="classname">gtk.Entry</tt></a> in the
fileops dialog that is created when one of the fileops buttons is
clicked.</td></tr><tr valign="top"><td valign="top">"fileop_file"</td><td valign="top">Read</td><td valign="top">The name of the file to be operated on by the
fileops</td></tr><tr valign="top"><td valign="top">"fileop_c_dir"</td><td valign="top">Read</td><td valign="top">The "New Folder" fileops button.</td></tr><tr valign="top"><td valign="top">"fileop_del_file"</td><td valign="top">Read</td><td valign="top">The "Delete File" fileops button</td></tr><tr valign="top"><td valign="top">"fileop_ren_file"</td><td valign="top">Read</td><td valign="top">The "Rename File" fileops button</td></tr><tr valign="top"><td valign="top">"button_area"</td><td valign="top">Read</td><td valign="top">The fileops <a href="class-gtkbuttonbox.html" title="gtk.ButtonBox"><tt class="classname">gtk.ButtonBox</tt></a>.</td></tr><tr valign="top"><td valign="top">"action_area"</td><td valign="top">Read</td><td valign="top">A <a href="class-gtkhbox.html" title="gtk.HBox"><tt class="classname">gtk.HBox</tt></a> that can be
used by the application to add buttons, etc.</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id3422588"></a><h2>Description</h2><p>The <a href="class-gtkfileselection.html" title="gtk.FileSelection"><tt class="classname">gtk.FileSelection</tt></a>
should be used to retrieve file or directory names from the user. It will
create a new dialog window containing a directory list, and a file list
corresponding to the current working directory. The filesystem can be
navigated using the directory list or the drop-down history menu.
Alternatively, the <span><b class="keycap">TAB</b></span> key can be used to navigate using
filename completion - common in text based editors such as emacs and
jed.</p><p>File selection dialogs are created with a call to the <a href="class-gtkfileselection.html#constructor-gtkfileselection" title="Constructor"><tt class="methodname">gtk.FileSelection</tt>()</a>
constructor.</p><p>The default filename can be set using the <a href="class-gtkfileselection.html#method-gtkfileselection--set-filename" title="gtk.FileSelection.set_filename"><tt class="methodname">set_filename</tt>()</a>
method and the selected filename retrieved using the <a href="class-gtkfileselection.html#method-gtkfileselection--get-filename" title="gtk.FileSelection.get_filename"><tt class="methodname">get_filename</tt>()</a>
method.</p><p>Use the <a href="class-gtkfileselection.html#method-gtkfileselection--complete" title="gtk.FileSelection.complete"><tt class="methodname">complete</tt>()</a>
method to display files and directories that match a given pattern. This can
be used for example, to show only *.txt files, or only files beginning with
gtk*.</p><p>Simple file operations; create directory, delete file, and rename
file, are available from buttons at the top of the dialog. These can be
hidden using the <a href="class-gtkfileselection.html#method-gtkfileselection--hide-fileop-buttons" title="gtk.FileSelection.hide_fileop_buttons"><tt class="methodname">hide_fileop_buttons</tt>()</a>
method and shown again using the <a href="class-gtkfileselection.html#method-gtkfileselection--show-fileop-buttons" title="gtk.FileSelection.show_fileop_buttons"><tt class="methodname">show_fileop_buttons</tt>()</a>
method.</p></div><div class="refsect1" lang="en"><a name="constructor-gtkfileselection"></a><h2>Constructor</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="constructorsynopsis"> <span class="methodname">gtk.FileSelection</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>title</tt></b></span><span class="initializer">=None</span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>title</tt></b>:</span></td><td>the text to be used as the title of the
fileselection dialog.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a new fileselection dialog</td></tr></tbody></table><p>Creates a new file selection dialog. By default it will contain
<a href="class-gtktreeview.html" title="gtk.TreeView"><tt class="classname">gtk.TreeViews</tt></a>
displaying the application's current working directory, and its file
listing. File operation buttons that allow the user to create a directory,
delete files and rename files, are also present.</p></div><div class="refsect1" lang="en"><a name="id3422753"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gtkfileselection--set-filename"></a><h3>gtk.FileSelection.set_filename</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_filename</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>filename</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>filename</tt></b>:</span></td><td>a string to set as the default file
name.</td></tr></tbody></table><p>The <tt class="methodname">set_filename</tt>() method sets a
default path for the file requester. If <i class="parameter"><tt>filename</tt></i>
includes a directory path, then the fileselection will open with that path
as its current working directory.</p><p>Note the encoding of <i class="parameter"><tt>filename</tt></i> is the
on-disk encoding, which may not be UTF-8.</p></div><div class="refsect2" lang="en"><a name="method-gtkfileselection--get-filename"></a><h3>gtk.FileSelection.get_filename</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_filename</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>currently-selected filename in the on-disk
encoding</td></tr></tbody></table><p>The <tt class="methodname">get_filename</tt>() method returns the
selected filename in the on-disk encoding, which may or may not be the same
as that used by GTK (UTF-8). If no file is selected then the selected
directory path is returned.</p></div><div class="refsect2" lang="en"><a name="method-gtkfileselection--complete"></a><h3>gtk.FileSelection.complete</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">complete</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>pattern</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>pattern</tt></b>:</span></td><td>a string containing a pattern which may or may
not match any filenames in the current directory.</td></tr></tbody></table><p>The <tt class="methodname">complete</tt>() method will attempt to
match <i class="parameter"><tt>pattern</tt></i> to valid filenames or subdirectories in
the current directory. If a match can be made, the matched filename will
appear in the text entry field of the file selection dialog. If a partial
match can be made, the "Files" list will contain those file names which have
been partially matched, and the "Directories" list those directories which
have been partially matched.</p></div><div class="refsect2" lang="en"><a name="method-gtkfileselection--show-fileop-buttons"></a><h3>gtk.FileSelection.show_fileop_buttons</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">show_fileop_buttons</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><p>The <tt class="methodname">show_fileop_buttons</tt>() method shows
the fileops buttons: "New Folder", "Delete File" and "Rename File".</p></div><div class="refsect2" lang="en"><a name="method-gtkfileselection--hide-fileop-buttons"></a><h3>gtk.FileSelection.hide_fileop_buttons</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">hide_fileop_buttons</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><p>The <tt class="methodname">hide_fileop_buttons</tt>() method hides
the fileops buttons: "New Folder", "Delete File" and "Rename File".</p></div><div class="refsect2" lang="en"><a name="method-gtkfileselection--get-selections"></a><h3>gtk.FileSelection.get_selections</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_selections</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a tuple containing the selected
files.</td></tr></tbody></table><p>The <tt class="methodname">get_selections</tt>() method retrieves a
tuple containing the file selections the user has made in the file selection
dialog. The first file in the list is equivalent to what the <a href="class-gtkfileselection.html#method-gtkfileselection--get-filename" title="gtk.FileSelection.get_filename"><tt class="methodname">get_filename</tt>()</a>
method would return.</p></div><div class="refsect2" lang="en"><a name="method-gtkfileselection--set-select-multiple"></a><h3>gtk.FileSelection.set_select_multiple</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_select_multiple</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>select_multiple</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>select_multiple</tt></b>:</span></td><td>If <tt class="literal">TRUE</tt> the user is allowed
to select multiple files in the file list.</td></tr></tbody></table><p>The <tt class="methodname">set_select_multiple</tt>() method sets
the file list selection mode according to the value of
<i class="parameter"><tt>select_multiple</tt></i>. If
<i class="parameter"><tt>select_multiple</tt></i> is <tt class="literal">TRUE</tt> the user
is allowed to select multiple files in the file list. Use the <a href="class-gtkfileselection.html#method-gtkfileselection--get-selections" title="gtk.FileSelection.get_selections"><tt class="methodname">get_selections</tt>()</a>
method to retrieve the list of selected files.</p></div><div class="refsect2" lang="en"><a name="method-gtkfileselection--get-select-multiple"></a><h3>gtk.FileSelection.get_select_multiple</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_select_multiple</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td><tt class="literal">TRUE</tt> if the user is allowed
to select multiple files in the file list</td></tr></tbody></table><p>The <tt class="methodname">get_select_multiple</tt>() method
determines whether the user is allowed to make multiple file selection in
the file list. If the <tt class="methodname">get_select_multiple</tt>() method
returns <tt class="literal">TRUE</tt> the user is allowed to select multiple files
in the file list. See the <a href="class-gtkfileselection.html#method-gtkfileselection--set-select-multiple" title="gtk.FileSelection.set_select_multiple"><tt class="methodname">set_select_multiple</tt>()</a>
method.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="class-gtkfilefilter.html">Prev</a></td><td width="20%" align="center"><a accesskey="u" href="gtk-class-reference.html">Up</a></td><td width="40%" align="right"><a accesskey="n" href="class-gtkfixed.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.FileFilter</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">gtk.Fixed</td></tr></table></div></body></html>
|