summaryrefslogtreecommitdiffstats
path: root/docs/reference/pygobject-maincontext.xml
diff options
context:
space:
mode:
Diffstat (limited to 'docs/reference/pygobject-maincontext.xml')
-rw-r--r--docs/reference/pygobject-maincontext.xml152
1 files changed, 152 insertions, 0 deletions
diff --git a/docs/reference/pygobject-maincontext.xml b/docs/reference/pygobject-maincontext.xml
new file mode 100644
index 0000000..129197a
--- /dev/null
+++ b/docs/reference/pygobject-maincontext.xml
@@ -0,0 +1,152 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+ "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
+
+<refentry id="class-gobjectmaincontext">
+ <refnamediv>
+ <refname>gobject.MainContext</refname>
+
+ <refpurpose>an object representing a set of event sources to be handled
+in a <link
+linkend="class-gobjectmainloop"><classname>gobject.MainLoop</classname></link>.</refpurpose>
+ </refnamediv>
+
+ <refsect1>
+ <title>Synopsis</title>
+
+<classsynopsis language="python">
+ <ooclass><classname>gobject.MainContext</classname></ooclass>
+<constructorsynopsis language="python">
+ <methodname><link linkend="constructor-gobjectmaincontext">gobject.MainContext</link></methodname>
+ </constructorsynopsis>
+<methodsynopsis language="python">
+ <methodname><link linkend="method-gobjectmaincontext--iteration">iteration</link></methodname>
+ <methodparam><parameter>may_block</parameter></methodparam>
+ </methodsynopsis>
+<methodsynopsis language="python">
+ <methodname><link linkend="method-gobjectmaincontext--pending">pending</link></methodname>
+ </methodsynopsis>
+</classsynopsis>
+
+</refsect1>
+
+ <refsect1>
+ <title>Ancestry</title>
+
+<synopsis>+-- <link linkend="class-gobjectmaincontext">gobject.MainContext</link>
+</synopsis>
+
+ </refsect1>
+
+ <refsect1>
+ <title>Description</title>
+
+ <para>A <link
+linkend="class-gobjectmaincontext"><classname>gobject.MainContext</classname></link>
+represents a set of event sources that can be run in a single thread. File
+descriptors (plain files, pipes or sockets) and timeouts are the standard
+event sources for <literal>GTK</literal> and <literal>PyGTK</literal> though
+others can be added. Each event source is assigned a priority. The default
+priority, <literal>gobject.PRIORITY_DEFAULT</literal>, is 0. Values less
+than 0 denote higher priorities. Values greater than 0 denote lower
+priorities. Events from high priority sources are always processed before
+events from lower priority sources. Single iterations of a <link
+linkend="class-gobjectmaincontext"><classname>gobject.MainContext</classname></link>
+can be run with the <link
+linkend="method-gobjectmaincontext--iteration"><methodname>iteration</methodname>()</link>
+method.</para>
+
+ </refsect1>
+
+ <refsect1 id="constructor-gobjectmaincontext">
+ <title>Constructor</title>
+
+ <programlisting><constructorsynopsis language="python">
+ <methodname>gobject.MainContext</methodname>
+ </constructorsynopsis></programlisting>
+ <variablelist>
+ <varlistentry>
+ <term><emphasis>Returns</emphasis>&nbsp;:</term>
+ <listitem><simpara>a new <link
+ linkend="class-gobjectmaincontext"><classname>gobject.MainContext</classname></link>
+ object.</simpara></listitem>
+ </varlistentry>
+ </variablelist>
+
+ <para>Creates a new <link
+linkend="class-gobjectmaincontext"><classname>gobject.MainContext</classname></link>
+object.</para>
+
+ </refsect1>
+
+ <refsect1>
+ <title>Methods</title>
+
+ <refsect2 id="method-gobjectmaincontext--iteration">
+ <title>gobject.MainContext.iteration</title>
+
+ <programlisting><methodsynopsis language="python">
+ <methodname>iteration</methodname>
+ </methodsynopsis></programlisting>
+ <variablelist>
+ <varlistentry>
+ <term><parameter>may_block</parameter>&nbsp;:</term>
+ <listitem><simpara>if <literal>TRUE</literal> the call may block
+ waiting for an event.</simpara></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><emphasis>Returns</emphasis>&nbsp;:</term>
+ <listitem><simpara><literal>TRUE</literal> if events were
+ dispatched.</simpara></listitem>
+ </varlistentry>
+ </variablelist>
+
+ <para>The <methodname>iteration</methodname>() method runs a single
+iteration. This involves:</para>
+
+ <itemizedlist>
+ <listitem>
+ <simpara>checking to see if any associated event sources are ready
+to be processed;</simpara>
+ </listitem>
+ <listitem>
+ <simpara>then if no events sources are ready and
+<parameter>may_block</parameter> is <literal>TRUE</literal>, waiting for a
+source to become ready;</simpara>
+ </listitem>
+ <listitem>
+ <simpara>and finally, dispatching the highest priority events
+sources that are ready</simpara>
+ </listitem>
+ </itemizedlist>
+
+ <para>Note that even when <parameter>may_block</parameter> is
+<literal>TRUE</literal>, it is still possible for
+<methodname>iteration</methodname>() to return <literal>FALSE</literal>,
+since the the wait may be interrupted for other reasons than an event source
+becoming ready.</para>
+
+ </refsect2>
+
+ <refsect2 id="method-gobjectmaincontext--pending">
+ <title>gobject.MainContext.pending</title>
+
+ <programlisting><methodsynopsis language="python">
+ <methodname>pending</methodname>
+ </methodsynopsis></programlisting>
+ <variablelist>
+ <varlistentry>
+ <term><emphasis>Returns</emphasis>&nbsp;:</term>
+ <listitem><simpara><literal>TRUE</literal> if events are
+ pending.</simpara></listitem>
+ </varlistentry>
+ </variablelist>
+
+ <para>The <methodname>pending</methodname>() method checks if any
+associated sources have pending events.</para>
+
+ </refsect2>
+
+ </refsect1>
+
+</refentry>