[gnome-devel-docs] tutorials python: pages for window widgets with sections



commit 8530651095d2cff7fd8d8a38b179ecb420664f71
Author: Marta Maria Casetti <mmcasetti gmail com>
Date:   Thu Jun 14 17:05:08 2012 +0100

    tutorials python: pages for window widgets with sections

 platform-demos/C/GtkApplicationWindow.py.page |   17 ++++++++++++++---
 platform-demos/C/aboutdialog.py.page          |   10 ++++++++++
 platform-demos/C/dialog.py.page               |   16 +++++++++++++---
 platform-demos/C/messagedialog.py.page        |   17 ++++++++++++++---
 platform-demos/C/samples/aboutdialog.py       |    2 +-
 platform-demos/C/window.py.page               |   23 +++++++++++++++++------
 6 files changed, 69 insertions(+), 16 deletions(-)
---
diff --git a/platform-demos/C/GtkApplicationWindow.py.page b/platform-demos/C/GtkApplicationWindow.py.page
index 2cef8a9..8f9dd60 100644
--- a/platform-demos/C/GtkApplicationWindow.py.page
+++ b/platform-demos/C/GtkApplicationWindow.py.page
@@ -25,14 +25,24 @@
   <media type="image" mime="image/png" src="media/window.png"/>
   <p>The simplest GtkApplication Window which can support Menus.</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/GtkApplicationWindow.py" parse="text"><xi:fallback/></xi:include></code>
-  <p>
-    Useful methods for a Gtk.ApplicationWindow widget (to be used in the class MyWindow with self. or in the function do_activate() with win.):
-  </p>
+
+  </section>
+  <section id="methods">
+  <title>Useful methods for a Gtk.ApplicationWindow widget</title>
+  <p>These be used in the class MyWindow with or in the function do_activate().</p>
   <list>
     <item><p><code>set_default_size(200, 100)</code> sets the default size of the window to a width of <code>200</code> and a height of <code>100</code>; if instead of a positive number we pass <code>-1</code> we have the default size.</p></item>
     <item><p><code>set_position(Gtk.WindowPosition.CENTER)</code> centers the window. Other options are described in the <link href="http://developer.gnome.org/gtk3/3.4/gtk3-Standard-Enumerations.html#GtkWindowPosition";>standard enumerations</link> (with the caveat that they should be changed on the model of Gtk.WindowPosition.CENTER).</p></item>
   </list>
+  </section>
+  <section id="references">
+  <title>References</title>
   <p>
     In this sample we used the following:
   </p>
@@ -40,4 +50,5 @@
     <item><p><link href="http://developer.gnome.org/gtk3/3.4/GtkApplication.html";>GtkApplication</link></p></item>
     <item><p><link href="http://developer.gnome.org/gtk3/3.4/GtkApplicationWindow.html";>GtkApplicationWindow</link></p></item>
   </list>
+  </section>
 </page>
diff --git a/platform-demos/C/aboutdialog.py.page b/platform-demos/C/aboutdialog.py.page
index e47839c..05d9121 100644
--- a/platform-demos/C/aboutdialog.py.page
+++ b/platform-demos/C/aboutdialog.py.page
@@ -20,8 +20,17 @@
   <media type="image" mime="image/png" src="media/aboutdialog_GMenu.png"/>
   <p>An AboutDialog example using Gtk.ApplicationWindow and Menu (the "about" is displayed if "About" in the menu is selected).</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/aboutdialog.py" parse="text"><xi:fallback/></xi:include></code>
 
+  </section>
+
+  <section id="references">
+  <title>References</title>
   <p>
     In this sample we used the following:
   </p>
@@ -31,4 +40,5 @@
     <item><p><link href="http://developer.gnome.org/gio/stable/GMenu.html";>GMenu</link></p></item>
     <item><p><link href="http://developer.gnome.org/gtk3/3.4/GtkApplication.html";>GtkApplication</link></p></item>
   </list>
+  </section>
 </page>
diff --git a/platform-demos/C/dialog.py.page b/platform-demos/C/dialog.py.page
index 91b102e..5b26fc5 100644
--- a/platform-demos/C/dialog.py.page
+++ b/platform-demos/C/dialog.py.page
@@ -20,15 +20,24 @@
   <media type="image" mime="image/png" src="media/dialog.png"/>
   <p>A dialog with the response signal connected to a callback function.</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/dialog.py" parse="text"><xi:fallback/></xi:include></code>
 
-  <p>
-    Useful methods for a Dialog widget:
-  </p>
+  </section>
+
+  <section id="methods">
+  <title>Useful methods for a Dialog widget</title>
   <list>
     <item><p>Instead of <code>set_modal(True)</code> we could have <code>set_modal(False)</code> followed by <code>set_destroy_with_parent(True)</code> that would destroy the dialog window if the main window is closed.</p></item>
     <item><p><code>add_button(button_text="The Answer", response_id=42)</code>, where <code>42</code> is any integer, is an alternative to <code>add_button(button_text="text", response_id=Gtk.ResponseType.RESPONSE)</code>, where <code>RESPONSE</code> could be one of <code>OK, CANCEL, CLOSE, YES, NO, APPLY, HELP</code>, which in turn correspond to the integers <code>-5, -6,..., -11</code>.</p></item>
   </list>
+  </section>
+  <section id="references">
+  <title>References</title>
   <p>
     In this sample we used the following:
   </p>
@@ -36,4 +45,5 @@
     <item><p><link href="http://developer.gnome.org/gtk3/3.4/GtkDialog.html";>GtkDialog</link></p></item>
     <item><p><link href="http://developer.gnome.org/gtk3/3.4/GtkWindow.html";>GtkWindow</link></p></item>
   </list>
+  </section>
 </page>
diff --git a/platform-demos/C/messagedialog.py.page b/platform-demos/C/messagedialog.py.page
index c51b7cc..ce48fe5 100644
--- a/platform-demos/C/messagedialog.py.page
+++ b/platform-demos/C/messagedialog.py.page
@@ -20,11 +20,17 @@
   <media type="image" mime="image/png" src="media/messagedialog.png"/>
   <p>A message dialog which prints messages on the terminal, depending on your choices.</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/messagedialog.py" parse="text"><xi:fallback/></xi:include></code>
 
-  <p>
-    Useful methods for a MessageDialog widget:
-  </p>
+  </section>
+
+  <section id="methods">
+  <title>Useful methods for a MessageDialog widget</title>
   <list>
     <item><p>In the constructor of MessageDialog we could set flags as <code>Gtk.DialogFlags.DESTROY_WITH_PARENT</code> (to destroy the messagedialog window when its parent window is destroyed) or as <code>Gtk.DialogFlags.MODAL</code> (no interaction with other windows of the application).</p></item>
     <item><p>In the constructor of MessageDialog we could set type as any of <code>Gtk.MessageType.INFO, Gtk.MessageType.WARNING, Gtk.MessageType.QUESTION, Gtk.MessageType.ERROR, Gtk.MessageType.OTHER</code> depending on what type of message we want.</p></item>
@@ -38,6 +44,10 @@ messagedialog.set_image(image)</code>
     <p>where <code>Gtk.STOCK_CAPS_LOCK_WARNING</code> is any image from <link href="http://developer.gnome.org/gtk3/3.4/gtk3-Stock-Items.html";>Stock Items</link>. We could also set any image as in the Image widget, as <code>image.set_from_file("filename.png")</code>.</p></item>
     <item><p><code>format_secondary_text("some secondary message")</code> sets a secondary message. The primary text becomes bold.</p></item>
   </list>
+  </section>
+
+  <section id="references">
+  <title>References</title>
   <p>
     In this sample we used the following:
   </p>
@@ -50,4 +60,5 @@ messagedialog.set_image(image)</code>
     <item><p><link href="http://developer.gnome.org/gio/stable/GMenu.html";>GMenu</link></p></item>
     <item><p><link href="http://developer.gnome.org/gtk3/3.4/GtkApplication.html";>GtkApplication</link></p></item>
   </list>
+  </section>
 </page>
diff --git a/platform-demos/C/samples/aboutdialog.py b/platform-demos/C/samples/aboutdialog.py
index f2312b1..4ef29e6 100644
--- a/platform-demos/C/samples/aboutdialog.py
+++ b/platform-demos/C/samples/aboutdialog.py
@@ -16,7 +16,7 @@ class MyWindow(Gtk.ApplicationWindow):
         # add the action to the application
         app.add_action(about_action)
 
-    # callback function for the signal "about" from the action in the menu of the main window
+    # callback function for the about_action's "activate" signal
     def about_cb(self, action, parameter):
         # a  Gtk.AboutDialog
         aboutdialog = Gtk.AboutDialog()
diff --git a/platform-demos/C/window.py.page b/platform-demos/C/window.py.page
index b8e841b..0cc6668 100644
--- a/platform-demos/C/window.py.page
+++ b/platform-demos/C/window.py.page
@@ -35,20 +35,31 @@
     </tr>
   </table>
 
+  <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/window.py" parse="text"><xi:fallback/></xi:include></code>
-  <p>
-    Useful methods for a Window widget:
-  </p>
+
+  </section>
+
+  <section id="methods">
+  <title>Useful methods for a Window widget</title>
   <list>
     <item><p><code>window = Gtk.Window(application=self, title="Welcome to GNOME")</code> sets the title as well, without the need for the line <code>window.set_title("Welcome to GNOME")</code>.</p></item>
     <item><p><code>set_default_size(200, 100)</code> sets the default size of the window to a width of <code>200</code> and a height of <code>100</code>; if instead of a positive number we pass <code>-1</code> we have the default size.</p></item>
     <item><p><code>set_position(Gtk.WindowPosition.CENTER)</code> centers the window. Other options are described in the <link href="http://developer.gnome.org/gtk3/3.4/gtk3-Standard-Enumerations.html#GtkWindowPosition";>standard enumerations</link> (with the caveat that they should be changed on the model of Gtk.WindowPosition.CENTER).</p></item>
   </list>
-  <p>
-    In this sample we used the following:
-  </p>
+  </section>
+
+  <section id="references">
+  <title>References</title>
+
+  <p>In this sample we used the following:</p>
   <list>
     <item><p><link href="http://developer.gnome.org/gtk3/3.4/GtkApplication.html";>GtkApplication</link></p></item>
     <item><p><link href="http://developer.gnome.org/gtk3/3.4/GtkWindow.html";>GtkWindow</link></p></item>
   </list>
+  </section>
 </page>



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