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
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>gio.AsyncResult</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="PyGObject Reference Manual"><link rel="up" href="gio-class-reference.html" title="PyGio Class Reference"><link rel="prev" href="class-gioapplaunchcontext.html" title="gio.AppLaunchContext"><link rel="next" href="class-giobufferedinputstream.html" title="gio.BufferedInputStream"></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">gio.AsyncResult</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gioapplaunchcontext.html">Prev</a> </td><th width="60%" align="center">PyGio Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="class-giobufferedinputstream.html">Next</a></td></tr></table><hr></div><div class="refentry" title="gio.AsyncResult"><a name="class-gioasyncresult"></a><div class="titlepage"></div><div class="refnamediv"><h2>gio.AsyncResult</h2><p>gio.AsyncResult — Asynchronous Function Results.</p></div><div class="refsect1" title="Synopsis"><a name="id687167"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gio.AsyncResult</span></span>(<span class="ooclass"><span class="classname"><a class="link" href="class-gobjectginterface.html" title="gobject.GInterface">gobject.GInterface</a></span></span>):
<code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gioasyncresult.html#method-gioasyncresult--get-source-object" title="gio.AsyncResult.get_source_object">get_source_object</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table></div><div class="refsect1" title="Ancestry"><a name="id687124"></a><h2>Ancestry</h2><pre class="synopsis">+-- <a class="link" href="class-gobjectginterface.html" title="gobject.GInterface">gobject.GInterface</a>
+-- <a class="link" href="class-gioasyncresult.html" title="gio.AsyncResult">gio.AsyncResult</a>
</pre></div><div class="refsect1" title="Prerequisites"><a name="id687301"></a><h2>Prerequisites</h2><p>
<a class="link" href="class-gioasyncresult.html" title="gio.AsyncResult"><code class="classname">gio.AsyncResult</code></a> is required by
<a class="link" href="class-gobject.html" title="gobject.GObject"><code class="classname">gobject.GObject</code></a>.
</p></div><div class="refsect1" title="Known Implementation"><a name="id687264"></a><h2>Known Implementation</h2><p>
<a class="link" href="class-gioasyncresult.html" title="gio.AsyncResult"><code class="classname">gio.AsyncResult</code></a> is implemented by
<a class="link" href="class-giosimpleasyncresult.html" title="gio.SimpleAsyncResult"><code class="classname">gio.SimpleAsyncResult</code></a>.
</p></div><div class="refsect1" title="Description"><a name="id687259"></a><h2>Description</h2><p>
<a class="link" href="class-gioasyncresult.html" title="gio.AsyncResult"><code class="classname">gio.AsyncResult</code></a>
provides a base class for implementing asynchronous function results.
</p><p>
Asynchronous operations are broken up into two separate operations which are chained
together by a GAsyncReadyCallback. To begin an asynchronous operation, provide a
GAsyncReadyCallback to the asynchronous function. This callback will be triggered when
the operation has completed, and will be passed a GAsyncResult instance filled with the
details of the operation's success or failure, the object the asynchronous function was
started for and any error codes returned. The asynchronous callback function is then expected
to call the corresponding "_finish()" function with the object the function was called for,
and the <a class="link" href="class-gioasyncresult.html" title="gio.AsyncResult"><code class="classname">gio.AsyncResult</code></a>
instance, and optionally, an error to grab any error conditions that may have occurred.
</p><p>
The purpose of the "_finish()" function is to take the generic result of type GAsyncResult and
return the specific result that the operation in question yields (e.g. a
<a class="link" href="class-giofileenumerator.html" title="gio.FileEnumerator"><code class="classname">gio.FileEnumerator</code></a>
for a "enumerate children" operation). If the result or error status of the operation is not needed,
there is no need to call the "_finish()" function, GIO will take care of cleaning up the result and error
information after the GAsyncReadyCallback returns. It is also allowed to take a reference to the
<a class="link" href="class-gioasyncresult.html" title="gio.AsyncResult"><code class="classname">gio.AsyncResult</code></a>
and call "_finish()" later.
</p><p>
The callback for an asynchronous operation is called only once, and is always called, even
in the case of a cancelled operation. On cancellation the result is a gio.ERROR_CANCELLED error.
</p><p>
Some ascynchronous operations are implemented using synchronous calls. These are run in a
separate thread, if GThread has been initialized, but otherwise they are sent to the Main Event
Loop and processed in an idle function. So, if you truly need asynchronous operations, make
sure to initialize GThread.
</p></div><div class="refsect1" title="Methods"><a name="id544776"></a><h2>Methods</h2><div class="refsect2" title="gio.AsyncResult.get_source_object"><a name="method-gioasyncresult--get-source-object"></a><h3>gio.AsyncResult.get_source_object</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_source_object</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the source object for the res.
</td></tr></tbody></table><p>
The <code class="methodname">get_source_object</code>() method gets the source object
from a <a class="link" href="class-gioasyncresult.html" title="gio.AsyncResult"><code class="classname">gio.AsyncResult</code></a>
</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-gioapplaunchcontext.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="gio-class-reference.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="class-giobufferedinputstream.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gio.AppLaunchContext </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> gio.BufferedInputStream</td></tr></table></div></body></html>
|