[gnome-devel-docs] Python sample: XInculed grid.py into grid.py.page



commit 5f1214de8e0ea0c081da8af1010696c9bd7d4630
Author: Tiffany Antopolski <tiffany antopolski gmail com>
Date:   Sat Apr 28 01:08:36 2012 -0400

    Python sample: XInculed grid.py into grid.py.page
    
    - also updated Makefile.am

 platform-demos/C/grid.py.page |   37 ++++---------------------------------
 platform-demos/Makefile.am    |    1 +
 2 files changed, 5 insertions(+), 33 deletions(-)
---
diff --git a/platform-demos/C/grid.py.page b/platform-demos/C/grid.py.page
index a5fb54d..aa64f7f 100644
--- a/platform-demos/C/grid.py.page
+++ b/platform-demos/C/grid.py.page
@@ -1,4 +1,5 @@
 <page xmlns="http://projectmallard.org/1.0/";
+      xmlns:xi="http://www.w3.org/2001/XInclude";
       type="guide" style="task"
       id="grid.py">
   <info>
@@ -19,39 +20,9 @@
   <media type="image" mime="image/png" src="media/grid.png"/>
   <p>A button widget connected to a progress bar.</p>
 
-      <code mime="text/javascript" style="numbered"><![CDATA[
-from gi.repository import Gtk
-import sys
-
-class GridWindow(Gtk.ApplicationWindow):
-    def __init__(self, app):
-        Gtk.Window.__init__(self, title="Grid Example", application=app)
-
-        grid = Gtk.Grid()
-        button = Gtk.Button(label="Button")
-
-        self.add(grid)
-        grid.attach(button, 1, 1, 1, 1)
-        self.progress_bar = Gtk.ProgressBar()
-        grid.attach_next_to(self.progress_bar, button, 3, 1, 1)
-
-        button.connect("clicked", self.button_clicked_cb)
-
-    def button_clicked_cb(self, widget):
-        self.progress_bar.pulse()
-
-class GridApplication(Gtk.Application):
-    def __init__(self):
-        Gtk.Application.__init__(self, application_id="org.gtk.example.grid")
-
-    def do_activate(self):
-	win = GridWindow(self)
-	win.show_all()
-
-app = GridApplication()
-exit_status = app.run(sys.argv)
-sys.exit(exit_status)
-]]></code>
+      <code mime="text/javascript" style="numbered">
+<xi:include href="samples/grid.py" parse="text"><xi:fallback/></xi:include>
+</code>
 <p>
   In this sample we used the following:
 </p>
diff --git a/platform-demos/Makefile.am b/platform-demos/Makefile.am
index 73bbe4b..85c3d0d 100644
--- a/platform-demos/Makefile.am
+++ b/platform-demos/Makefile.am
@@ -24,6 +24,7 @@ demo_sources = \
 	samples/aboutdialog_GMenu.vala		\
 	samples/button.vala			\
 	samples/dialog.vala			\
+	samples/grid.py				\
 	samples/GtkApplicationWindow.vala	\
 	samples/window.py			\
 	samples/window.vala			\



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