[gnome-devel-docs] tutorials python: separator page and sample rewritten and commented



commit 7ea6f01bf2e671c7d2b810774a5b4ff965ef416d
Author: Marta Maria Casetti <mmcasetti gmail com>
Date:   Thu Aug 2 03:39:44 2012 +0100

    tutorials python: separator page and sample rewritten and commented

 platform-demos/C/samples/separator.py |   26 ++++++++++++++------------
 platform-demos/C/separator.py.page    |   31 +++++++++++++++++++------------
 2 files changed, 33 insertions(+), 24 deletions(-)
---
diff --git a/platform-demos/C/samples/separator.py b/platform-demos/C/samples/separator.py
index d06f742..4263a27 100644
--- a/platform-demos/C/samples/separator.py
+++ b/platform-demos/C/samples/separator.py
@@ -1,7 +1,7 @@
 from gi.repository import Gtk
 import sys
 
-class SeparatorsWindow(Gtk.ApplicationWindow):
+class MyWindow(Gtk.ApplicationWindow):
     def __init__(self, app):
         Gtk.Window.__init__(self, title="Separator Example", application=app)
 
@@ -15,28 +15,30 @@ class SeparatorsWindow(Gtk.ApplicationWindow):
         label3 = Gtk.Label()
         label3.set_text("On the left, a vertical separator.")
 
-        # a horizontal and a vertical separator
+        # a horizontal separator
         hseparator = Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL)
+        # a vertical separator
         vseparator = Gtk.Separator(orientation=Gtk.Orientation.VERTICAL)
 
-        # a grid to attach them
+        # a grid to attach labels and separators
         grid = Gtk.Grid()
-        grid.attach(label1, 1, 1, 3, 1)
-        grid.attach(hseparator, 1, 2, 3, 1)
-        grid.attach(label2, 1, 3, 1, 1)
-        grid.attach(vseparator, 2, 3, 1, 1)
-        grid.attach(label3, 3, 3, 1, 1)
+        grid.attach(label1, 0, 0, 3, 1)
+        grid.attach(hseparator, 0, 1, 3, 1)
+        grid.attach(label2, 0, 2, 1, 1)
+        grid.attach(vseparator, 1, 2, 1, 1)
+        grid.attach(label3, 2, 2, 1, 1)
         grid.set_column_homogeneous(True)
+        # add the grid to the window
         self.add(grid)
 
-class GridApplication(Gtk.Application):
+class MyApplication(Gtk.Application):
     def __init__(self):
-        Gtk.Application.__init__(self, application_id="org.gtk.example.separator")
+        Gtk.Application.__init__(self)
 
     def do_activate(self):
-	win = SeparatorsWindow(self)
+	win = MyWindow(self)
 	win.show_all()
 
-app = GridApplication()
+app = MyApplication()
 exit_status = app.run(sys.argv)
 sys.exit(exit_status)
diff --git a/platform-demos/C/separator.py.page b/platform-demos/C/separator.py.page
index 1596167..8d8e6ab 100644
--- a/platform-demos/C/separator.py.page
+++ b/platform-demos/C/separator.py.page
@@ -20,17 +20,24 @@
   <title>Separator</title>
 
   <media type="image" mime="image/png" src="media/separator.png"/>
-  <p>A horizontal and a vertical separator.</p>
-
-<code mime="text/x-python" style="numbered">
-<xi:include href="samples/separator.py" parse="text"><xi:fallback/></xi:include></code>
-<p>
-  In this sample we used the following:
-</p>
-<list>
-  <item><p><link href="http://developer.gnome.org/gtk3/3.4/GtkWindow.html";>GtkWindow</link></p></item>
-  <item><p><link href="http://developer.gnome.org/gtk3/3.4/GtkSeparator.html";>GtkSeparator</link></p></item>
-  <item><p><link href="http://developer.gnome.org/gtk3/3.4/GtkGrid.html";>GtkGrid</link></p></item>
-</list>
+  <p>A horizontal and a vertical separator divide some labels.</p>
+
+  <links type="section"/>
+
+  <section id="code">
+    <title>Code used to generate this example</title>
+    <code mime="text/x-python" style="numbered"><xi:include href="samples/separator.py" parse="text"><xi:fallback/></xi:include></code>
+  </section>
+
+  <section id="reference">
+    <title>API Reference</title>
+    <p>In this sample we used the following:</p>
+    <list>
+      <item><p><link href="http://developer.gnome.org/gtk3/unstable/GtkWindow.html";>GtkWindow</link></p></item>
+      <item><p><link href="http://developer.gnome.org/gtk3/unstable/GtkSeparator.html";>GtkSeparator</link></p></item>
+      <item><p><link href="http://developer.gnome.org/gtk3/unstable/GtkGrid.html";>GtkGrid</link></p></item>
+      <item><p><link href="http://developer.gnome.org/gtk3/unstable/GtkLabel.html";>GtkLabel</link></p></item>
+    </list>
+  </section>
 
 </page>



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