[libchamplain] Merge launcher-gtk.py and markers.py
- From: JiÅÃ Techet <jiritechet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libchamplain] Merge launcher-gtk.py and markers.py
- Date: Sat, 14 Jul 2012 21:38:20 +0000 (UTC)
commit 2002cb15dd5952dbdbcefb2698b881f046a35259
Author: JiÅÃ Techet <techet gmail com>
Date: Sat Jul 14 22:38:11 2012 +0200
Merge launcher-gtk.py and markers.py
demos/launcher-gtk.py | 56 +++++++++++++++++++++++++++++++++++++++++++++---
demos/markers.py | 55 ------------------------------------------------
2 files changed, 52 insertions(+), 59 deletions(-)
---
diff --git a/demos/launcher-gtk.py b/demos/launcher-gtk.py
index b2220d6..1863d8e 100755
--- a/demos/launcher-gtk.py
+++ b/demos/launcher-gtk.py
@@ -3,9 +3,7 @@
from gi.repository import GtkClutter, Clutter
GtkClutter.init([]) # Must be initialized before importing those:
-from gi.repository import GObject, Gtk, Champlain, GtkChamplain
-
-from markers import create_marker_layer
+from gi.repository import GObject, Gtk, Champlain, GtkChamplain, Pango
import os, sys
os.chdir(os.path.dirname(os.path.abspath(sys.argv[0])))
@@ -40,7 +38,7 @@ class LauncherGTK:
self.view.center_on(45.466, -73.75)
- self.layer = create_marker_layer(self.view)
+ self.layer = self.create_marker_layer(self.view)
self.view.add_layer(self.layer)
self.layer.hide_all_markers()
@@ -148,6 +146,56 @@ class LauncherGTK:
else:
image.clear()
+ def marker_button_release_cb(self, actor, event, view):
+ if event.button != 1 and event.click_count > 1:
+ return False
+
+ print "Montreal was clicked\n"
+ return True
+
+
+ def create_marker_layer(self, view):
+ orange = Clutter.Color.new(0xf3, 0x94, 0x07, 0xbb)
+ layer = Champlain.MarkerLayer()
+
+ marker = Champlain.Label.new_with_text(
+ "MontrÃal\n<span size=\"xx-small\">QuÃbec</span>", "Serif 14", None,
+ orange)
+ marker.set_use_markup(True)
+ marker.set_alignment(Pango.Alignment.RIGHT)
+ marker.set_color(orange)
+
+ marker.set_location(45.528178, -73.563788)
+ layer.add_marker(marker)
+ marker.set_reactive(True)
+ marker.connect("button-release-event", self.marker_button_release_cb, view)
+
+ marker = Champlain.Label.new_from_file(
+ "icons/emblem-generic.png")
+ marker.set_text("New York")
+ marker.set_location(40.77, -73.98)
+ layer.add_marker(marker)
+
+ marker = Champlain.Label.new_from_file(
+ "icons/emblem-important.png")
+ marker.set_location(47.130885, -70.764141)
+ layer.add_marker(marker)
+
+ marker = Champlain.Label.new_from_file(
+ "icons/emblem-favorite.png")
+ marker.set_draw_background(False)
+ marker.set_location(45.41484, -71.918907)
+ layer.add_marker(marker)
+
+ marker = Champlain.Label.new_from_file(
+ "icons/emblem-new.png")
+ marker.set_draw_background(False)
+ marker.set_location(50.639663, 5.570798)
+ layer.add_marker(marker)
+
+ layer.set_all_markers_draggable()
+ layer.show()
+ return layer
if __name__ == "__main__":
GObject.threads_init()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]