pygtksourceview r72 - in trunk: . docs/reference



Author: gianmt
Date: Mon Jan 21 14:18:01 2008
New Revision: 72
URL: http://svn.gnome.org/viewvc/pygtksourceview?rev=72&view=rev

Log:
manual wrappers for iter_backward_search and iter_forward_search with docs

Modified:
   trunk/ChangeLog
   trunk/docs/reference/gtksourceview2-gtksourcebuffer.xml
   trunk/gtksourceview2.override

Modified: trunk/docs/reference/gtksourceview2-gtksourcebuffer.xml
==============================================================================
--- trunk/docs/reference/gtksourceview2-gtksourcebuffer.xml	(original)
+++ trunk/docs/reference/gtksourceview2-gtksourcebuffer.xml	Mon Jan 21 14:18:01 2008
@@ -147,6 +147,23 @@
     </methodsynopsis>
 </classsynopsis>
 
+<programlisting>
+<emphasis role="bold">Functions</emphasis>
+
+<methodsynopsis language="python">
+<methodname><link linkend="function-gtksourcebuffer2--iter-backward-search">gtksourceview2.iter_backward_search</link></methodname>
+<methodparam><parameter role="keyword">iter</parameter></methodparam>
+<methodparam><parameter role="keyword">str</parameter></methodparam>
+<methodparam><parameter role="keyword">flags</parameter></methodparam>
+<methodparam><parameter role="keyword">limit</parameter></methodparam>
+</methodsynopsis><methodsynopsis language="python">
+<methodname><link linkend="function-gtksourcebuffer2--iter-forward-search">gtksourceview2.iter_forward_search</link></methodname>
+<methodparam><parameter role="keyword">iter</parameter></methodparam>
+<methodparam><parameter role="keyword">str</parameter></methodparam>
+<methodparam><parameter role="keyword">flags</parameter></methodparam>
+<methodparam><parameter role="keyword">limit</parameter></methodparam>
+</methodsynopsis></programlisting>
+
 </refsect1>
 
 <!-- ********************************* -->
@@ -953,4 +970,127 @@
     </para>
   </refsect2>
 </refsect1>
+
+<!-- ********************************** -->
+<!-- BEGIN OF GTKSOURCEBUFFER FUNCTIONS -->
+<!-- ********************************** -->
+
+<refsect1>
+    <title>Functions</title>
+
+  <refsect2 id="function-gtksourcebuffer2--iter-backward-search">
+    <title>gtksourceview2.iter_backward_search</title>
+    <programlisting><methodsynopsis language="python">
+  	  <methodname>gtksourceview2.iter_backward_search</methodname>
+      <methodparam><parameter role="keyword">iter</parameter></methodparam>
+	  <methodparam><parameter role="keyword">str</parameter></methodparam>
+	  <methodparam><parameter role="keyword">flags</parameter></methodparam>
+	  <methodparam><parameter role="keyword">limit</parameter></methodparam>
+      </methodsynopsis></programlisting>
+        
+    <variablelist>
+	  <varlistentry>
+		<term><emphasis>iter</emphasis>&nbsp;:</term>
+		<listitem><simpara>
+		  a <link linkend="class-gtktextiter"><classname>gtk.TextIter</classname></link> where the search begins.
+		</simpara></listitem>
+      </varlistentry>
+	  <varlistentry>
+		<term><emphasis>str</emphasis>&nbsp;:</term>
+		<listitem><simpara>
+		  search string.
+		</simpara></listitem>
+      </varlistentry>
+	  <varlistentry>
+		<term><emphasis>flags</emphasis>&nbsp;:</term>
+		<listitem><simpara>
+		  bitmask of flags affecting the search.
+		</simpara></listitem>
+      </varlistentry>
+	  <varlistentry>
+		<term><emphasis>limit</emphasis>&nbsp;:</term>
+		<listitem><simpara>
+		  location of last possible match_start, or <literal>None</literal> for start of buffer.
+		</simpara></listitem>
+      </varlistentry>
+	  <varlistentry>
+        <term><emphasis>Returns</emphasis>&nbsp;:</term>
+	      <listitem><simpara>
+			start of match and end of match
+		  </simpara></listitem>
+      </varlistentry>
+    </variablelist>
+
+      <para>
+        The <methodname>iter_backward_search</methodname>() function is the same as the
+		<methodname><link linkend="function-gtksourcebuffer2--iter-forward-search">gtksourceview2.iter_forward_search</link></methodname>()
+		function, except searches backward.
+      </para>
+  </refsect2>
+  
+  <refsect2 id="function-gtksourcebuffer2--iter-forward-search">
+    <title>gtksourceview2.iter_forward_search</title>
+    <programlisting><methodsynopsis language="python">
+  	  <methodname>gtksourceview2.iter_forward_search</methodname>
+      <methodparam><parameter role="keyword">iter</parameter></methodparam>
+	  <methodparam><parameter role="keyword">str</parameter></methodparam>
+	  <methodparam><parameter role="keyword">flags</parameter></methodparam>
+	  <methodparam><parameter role="keyword">limit</parameter></methodparam>
+      </methodsynopsis></programlisting>
+        
+    <variablelist>
+	  <varlistentry>
+		<term><emphasis>iter</emphasis>&nbsp;:</term>
+		<listitem><simpara>
+		  a <link linkend="class-gtktextiter"><classname>gtk.TextIter</classname></link> where the search begins.
+		</simpara></listitem>
+      </varlistentry>
+	  <varlistentry>
+		<term><emphasis>str</emphasis>&nbsp;:</term>
+		<listitem><simpara>
+		  search string.
+		</simpara></listitem>
+      </varlistentry>
+	  <varlistentry>
+		<term><emphasis>flags</emphasis>&nbsp;:</term>
+		<listitem><simpara>
+		  bitmask of flags affecting the search.
+		</simpara></listitem>
+      </varlistentry>
+	  <varlistentry>
+		<term><emphasis>limit</emphasis>&nbsp;:</term>
+		<listitem><simpara>
+		  bound for the search, or <literal>None</literal> for the end of the buffer.
+		</simpara></listitem>
+      </varlistentry>
+	  <varlistentry>
+        <term><emphasis>Returns</emphasis>&nbsp;:</term>
+	      <listitem><simpara>
+			start of match and end of match
+		  </simpara></listitem>
+      </varlistentry>
+    </variablelist>
+
+      <para>
+        The <methodname>iter_forward_search</methodname>() function searches forward for <parameter>str</parameter>
+		and returns a tuple containing <link linkend="class-gtktextiter"><classname>gtk.TextIter</classname></link>
+		objects that point at the start and end locations of the match.
+		The search will not continue past limit. Note that a search is a linear or O(n) operation,
+		so you may wish to use limit to avoid locking up your UI on large buffers.
+      </para>
+	  <para>
+		If the gtksourceview2.SOURCE_SEARCH_VISIBLE_ONLY flag is present, the match may have invisible text
+		interspersed in str. i.e. str will be a possibly-noncontiguous subsequence of the matched range.
+		similarly, if you specify gtksourceview2.SOURCE_SEARCH_TEXT_ONLY, the match may have pixbufs or
+		child widgets mixed inside the matched range. If these flags are not given, the match must be exact;
+		the special 0xFFFC character in str will match embedded pixbufs or child widgets. If you specify the
+		gtksourceview2.SOURCE_SEARCH_CASE_INSENSITIVE flag, the text will be matched regardless of what case it is in.
+	  </para>
+	  <para>
+		Same as <methodname><link linkend="method-gtktextiter--forward-search">gtk.TextIter.forward_search</link></methodname>(),
+		but supports case insensitive searching.
+	  </para>
+  </refsect2>
+</refsect1>
+
 </refentry>

Modified: trunk/gtksourceview2.override
==============================================================================
--- trunk/gtksourceview2.override	(original)
+++ trunk/gtksourceview2.override	Mon Jan 21 14:18:01 2008
@@ -346,3 +346,93 @@
 
     return py_ret; 	 
 } 	 
+
+%%
+override gtk_source_iter_backward_search kwargs
+static PyObject *
+_wrap_gtk_source_iter_backward_search(PyObject *self, PyObject *args,
+                                      PyObject *kwargs)
+{
+    static char *kwlist[] = { "iter", "str", "flags", "limit", NULL };
+    gchar *str;
+    PyObject *py_flags, *py_iter, *py_limit = Py_None;
+    GtkTextIter match_start, match_end, *iter = NULL, *limit = NULL;
+    GtkSourceSearchFlags flags;
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+                                    "OsO|O:gtksourceview2.iter_backward_search",
+                                    kwlist, &py_iter, &str, &py_flags,
+                                    &py_limit))
+        return NULL;
+
+    if (pyg_boxed_check(py_iter, GTK_TYPE_TEXT_ITER))
+        iter = pyg_boxed_get(py_iter, GtkTextIter);
+
+    if (pyg_boxed_check(py_limit, GTK_TYPE_TEXT_ITER))
+        limit = pyg_boxed_get(py_limit, GtkTextIter);
+
+    else if (py_limit != Py_None) {
+        PyErr_SetString(PyExc_TypeError,"limit must be a GtkTextIter or None");
+        return NULL;
+    }
+
+    if (pyg_flags_get_value(GTK_TYPE_TEXT_SEARCH_FLAGS, py_flags,
+                            (gint *)&flags))
+        return NULL;
+
+    if (gtk_source_iter_backward_search(iter, str, flags, &match_start,
+                                        &match_end, limit))
+        return Py_BuildValue("(NN)",
+                             pyg_boxed_new(GTK_TYPE_TEXT_ITER, &match_start,
+                                           TRUE, TRUE),
+                             pyg_boxed_new(GTK_TYPE_TEXT_ITER, &match_end,
+                                           TRUE, TRUE));
+
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
+%%
+override gtk_source_iter_forward_search kwargs
+static PyObject *
+_wrap_gtk_source_iter_forward_search(PyObject *self, PyObject *args,
+                                      PyObject *kwargs)
+{
+    static char *kwlist[] = { "iter", "str", "flags", "limit", NULL };
+    gchar *str;
+    PyObject *py_flags, *py_iter, *py_limit = Py_None;
+    GtkTextIter match_start, match_end, *iter = NULL, *limit = NULL;
+    GtkSourceSearchFlags flags;
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+                                    "OsO|O:gtksourceview2.iter_forward_search",
+                                    kwlist, &py_iter, &str, &py_flags,
+                                    &py_limit))
+        return NULL;
+
+    if (pyg_boxed_check(py_iter, GTK_TYPE_TEXT_ITER))
+        iter = pyg_boxed_get(py_iter, GtkTextIter);
+
+    if (pyg_boxed_check(py_limit, GTK_TYPE_TEXT_ITER))
+        limit = pyg_boxed_get(py_limit, GtkTextIter);
+
+    else if (py_limit != Py_None) {
+        PyErr_SetString(PyExc_TypeError,"limit must be a GtkTextIter or None");
+        return NULL;
+    }
+
+    if (pyg_flags_get_value(GTK_TYPE_TEXT_SEARCH_FLAGS, py_flags,
+                            (gint *)&flags))
+        return NULL;
+
+    if (gtk_source_iter_forward_search(iter, str, flags, &match_start,
+                                        &match_end, limit))
+        return Py_BuildValue("(NN)",
+                             pyg_boxed_new(GTK_TYPE_TEXT_ITER, &match_start,
+                                           TRUE, TRUE),
+                             pyg_boxed_new(GTK_TYPE_TEXT_ITER, &match_end,
+                                           TRUE, TRUE));
+
+    Py_INCREF(Py_None);
+    return Py_None;
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]