[libchamplain] Add minimal.py and minimal-gtk.py to demos



commit c2f48513dfd1e5e0084d383add334cf5f33c74c4
Author: Victor Godoy Poluceno <victorpoluceno gmail com>
Date:   Wed Jun 9 16:57:41 2010 -0300

    Add minimal.py and minimal-gtk.py to demos

 bindings/python/demos/Makefile.am    |    2 +-
 bindings/python/demos/minimal-gtk.py |   37 ++++++++++++++++++++++++++++++++++
 bindings/python/demos/minimal.py     |   24 ++++++++++++++++++++++
 3 files changed, 62 insertions(+), 1 deletions(-)
---
diff --git a/bindings/python/demos/Makefile.am b/bindings/python/demos/Makefile.am
index 9811b95..5a0b4e5 100644
--- a/bindings/python/demos/Makefile.am
+++ b/bindings/python/demos/Makefile.am
@@ -1 +1 @@
-EXTRA_DIST= capitals.py animated-marker.py launcher-gtk.py launcher.py polygons.py markers.py
+EXTRA_DIST= capitals.py animated-marker.py launcher-gtk.py launcher.py polygons.py markers.py minimal.py minimal-gtk.py
diff --git a/bindings/python/demos/minimal-gtk.py b/bindings/python/demos/minimal-gtk.py
new file mode 100644
index 0000000..bf120e6
--- /dev/null
+++ b/bindings/python/demos/minimal-gtk.py
@@ -0,0 +1,37 @@
+import gobject
+import gtk
+
+import champlaingtk # must be the first imported
+import champlain
+import clutter
+
+def main():
+    # initialize threads and clutter
+    gobject.threads_init()
+    clutter.init()
+
+    # create the top-level window and quit the main loop when it's closed
+    window = gtk.Window(gtk.WINDOW_TOPLEVEL)
+    window.connect('destroy', gtk.main_quit)
+    
+    # create the libchamplain widget and set it's size
+    widget = champlaingtk.ChamplainEmbed()
+    widget.set_size_request(640, 480)
+    
+    view = widget.get_view()
+    view.set_property('scroll-mode', champlain.SCROLL_MODE_KINETIC)
+    view.set_property('zoom-level', 5)
+    view.center_on(45.466, -73.75)
+    
+    # insert it into the widget you wish
+    window.add(widget)
+
+    # show everything    
+    window.show_all()
+    
+    # start the main loop
+    gtk.main()
+
+
+if __name__ == '__main__':
+    main()
diff --git a/bindings/python/demos/minimal.py b/bindings/python/demos/minimal.py
new file mode 100644
index 0000000..01e1923
--- /dev/null
+++ b/bindings/python/demos/minimal.py
@@ -0,0 +1,24 @@
+import gobject
+import clutter
+import champlain
+
+def main():
+    gobject.threads_init()
+    clutter.init()
+
+    stage = clutter.Stage(default=True)
+    stage.set_size(800, 600)
+    
+    # Create the map view
+    actor = champlain.View()
+    actor.set_size(800, 600)
+    stage.add(actor)
+    
+    stage.show()
+    clutter.main()
+
+    actor.destroy()
+
+
+if __name__ == '__main__':
+    main()



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