~ubuntu-branches/ubuntu/hardy/pygobject/hardy

« back to all changes in this revision

Viewing changes to docs/reference/pygobject-maincontext.xml

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2006-08-05 12:08:23 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20060805120823-bzr4wfj03o79zqc9
Tags: 2.11.1-0ubuntu1
* New upstream version:
  - Add John Finlay's reference manual 
  - Fix GOption mem leak 
  - Infrastructure for lazy type registration
  - Enum/Flags fixes
  - Eliminate some GCC warnings
* debian/control.in:
  - Build-Depends on xsltproc, docbook-xsl
  - create a python-gobject-doc package
* debian/python-gobject-doc.install:
  - create a python-gobject-doc package

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" standalone="no"?>
 
2
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
 
3
    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
 
4
 
 
5
<refentry id="class-gobjectmaincontext">
 
6
  <refnamediv>
 
7
    <refname>gobject.MainContext</refname>
 
8
 
 
9
    <refpurpose>an object representing a set of event sources to be handled
 
10
in a <link
 
11
linkend="class-gobjectmainloop"><classname>gobject.MainLoop</classname></link>.</refpurpose>
 
12
  </refnamediv>
 
13
 
 
14
  <refsect1>
 
15
    <title>Synopsis</title>
 
16
 
 
17
<classsynopsis language="python">
 
18
  <ooclass><classname>gobject.MainContext</classname></ooclass>
 
19
<constructorsynopsis language="python">
 
20
    <methodname><link linkend="constructor-gobjectmaincontext">gobject.MainContext</link></methodname>
 
21
  </constructorsynopsis>
 
22
<methodsynopsis language="python">
 
23
    <methodname><link linkend="method-gobjectmaincontext--iteration">iteration</link></methodname>
 
24
    <methodparam><parameter>may_block</parameter></methodparam>
 
25
  </methodsynopsis>
 
26
<methodsynopsis language="python">
 
27
    <methodname><link linkend="method-gobjectmaincontext--pending">pending</link></methodname>
 
28
  </methodsynopsis>
 
29
</classsynopsis>
 
30
 
 
31
</refsect1>
 
32
 
 
33
  <refsect1>
 
34
    <title>Ancestry</title>
 
35
 
 
36
<synopsis>+-- <link linkend="class-gobjectmaincontext">gobject.MainContext</link>
 
37
</synopsis>
 
38
 
 
39
  </refsect1>
 
40
 
 
41
  <refsect1>
 
42
    <title>Description</title>
 
43
 
 
44
    <para>A <link
 
45
linkend="class-gobjectmaincontext"><classname>gobject.MainContext</classname></link>
 
46
represents a set of event sources that can be run in a single thread. File
 
47
descriptors (plain files, pipes or sockets) and timeouts are the standard
 
48
event sources for <literal>GTK</literal> and <literal>PyGTK</literal> though
 
49
others can be added. Each event source is assigned a priority. The default
 
50
priority, <literal>gobject.PRIORITY_DEFAULT</literal>, is 0. Values less
 
51
than 0 denote higher priorities. Values greater than 0 denote lower
 
52
priorities. Events from high priority sources are always processed before
 
53
events from lower priority sources. Single iterations of a <link
 
54
linkend="class-gobjectmaincontext"><classname>gobject.MainContext</classname></link>
 
55
can be run with the <link
 
56
linkend="method-gobjectmaincontext--iteration"><methodname>iteration</methodname>()</link>
 
57
method.</para>
 
58
 
 
59
  </refsect1>
 
60
 
 
61
  <refsect1 id="constructor-gobjectmaincontext">
 
62
    <title>Constructor</title>
 
63
 
 
64
    <programlisting><constructorsynopsis language="python">
 
65
        <methodname>gobject.MainContext</methodname>
 
66
      </constructorsynopsis></programlisting>
 
67
    <variablelist>
 
68
      <varlistentry>
 
69
        <term><emphasis>Returns</emphasis>&nbsp;:</term>
 
70
        <listitem><simpara>a new <link
 
71
        linkend="class-gobjectmaincontext"><classname>gobject.MainContext</classname></link>
 
72
        object.</simpara></listitem>
 
73
      </varlistentry>
 
74
    </variablelist>
 
75
 
 
76
    <para>Creates a new <link
 
77
linkend="class-gobjectmaincontext"><classname>gobject.MainContext</classname></link>
 
78
object.</para>
 
79
 
 
80
  </refsect1>
 
81
 
 
82
  <refsect1>
 
83
    <title>Methods</title>
 
84
 
 
85
    <refsect2 id="method-gobjectmaincontext--iteration">
 
86
      <title>gobject.MainContext.iteration</title>
 
87
 
 
88
      <programlisting><methodsynopsis language="python">
 
89
          <methodname>iteration</methodname>
 
90
        </methodsynopsis></programlisting>
 
91
      <variablelist>
 
92
        <varlistentry>
 
93
          <term><parameter>may_block</parameter>&nbsp;:</term>
 
94
          <listitem><simpara>if <literal>TRUE</literal> the call may block
 
95
          waiting for an event.</simpara></listitem>
 
96
        </varlistentry>
 
97
        <varlistentry>
 
98
        <term><emphasis>Returns</emphasis>&nbsp;:</term>
 
99
          <listitem><simpara><literal>TRUE</literal> if events were
 
100
          dispatched.</simpara></listitem>
 
101
        </varlistentry>
 
102
      </variablelist>
 
103
 
 
104
      <para>The <methodname>iteration</methodname>() method runs a single
 
105
iteration. This involves:</para>
 
106
 
 
107
    <itemizedlist>
 
108
      <listitem>
 
109
        <simpara>checking to see if any associated event sources are ready
 
110
to be processed;</simpara>
 
111
      </listitem>
 
112
      <listitem>
 
113
        <simpara>then if no events sources are ready and
 
114
<parameter>may_block</parameter> is <literal>TRUE</literal>, waiting for a
 
115
source to become ready;</simpara>
 
116
      </listitem>
 
117
      <listitem>
 
118
        <simpara>and finally, dispatching the highest priority events
 
119
sources that are ready</simpara>
 
120
      </listitem>
 
121
   </itemizedlist>
 
122
 
 
123
      <para>Note that even when <parameter>may_block</parameter> is
 
124
<literal>TRUE</literal>, it is still possible for
 
125
<methodname>iteration</methodname>() to return <literal>FALSE</literal>,
 
126
since the the wait may be interrupted for other reasons than an event source
 
127
becoming ready.</para>
 
128
 
 
129
    </refsect2>
 
130
 
 
131
    <refsect2 id="method-gobjectmaincontext--pending">
 
132
      <title>gobject.MainContext.pending</title>
 
133
 
 
134
      <programlisting><methodsynopsis language="python">
 
135
          <methodname>pending</methodname>
 
136
        </methodsynopsis></programlisting>
 
137
      <variablelist>
 
138
        <varlistentry>
 
139
        <term><emphasis>Returns</emphasis>&nbsp;:</term>
 
140
          <listitem><simpara><literal>TRUE</literal> if events are
 
141
          pending.</simpara></listitem>
 
142
        </varlistentry>
 
143
      </variablelist>
 
144
 
 
145
      <para>The <methodname>pending</methodname>() method checks if any
 
146
associated sources have pending events.</para>
 
147
 
 
148
    </refsect2>
 
149
 
 
150
  </refsect1>
 
151
 
 
152
</refentry>