From b297c6a7bb459fe5a4418a6420ddafb47162aea1 Mon Sep 17 00:00:00 2001 From: Mike Sheldon Date: Sun, 22 Mar 2009 17:21:48 +0000 Subject: [PATCH] Update launcher-gtk.py to use new API Add label markers to launcher-gtk.py --- .../python/champlain/pychamplain.override | 1 + bindings/python/demos/launcher-gtk.py | 27 ++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/bindings/python/champlain/pychamplain.override b/bindings/python/champlain/pychamplain.override index 33a84d4..fc50853 100644 --- a/bindings/python/champlain/pychamplain.override +++ b/bindings/python/champlain/pychamplain.override @@ -12,6 +12,7 @@ modulename champlain import gobject.GObject as PyGObject_Type import clutter.Actor as PyClutterActor_Type import clutter.Group as PyClutterGroup_Type +import clutter.Color as PyClutterColor_Type %% ignore-glob *_get_type diff --git a/bindings/python/demos/launcher-gtk.py b/bindings/python/demos/launcher-gtk.py index 6231d48..d4ed85a 100755 --- a/bindings/python/demos/launcher-gtk.py +++ b/bindings/python/demos/launcher-gtk.py @@ -24,11 +24,15 @@ def zoom_changed(spinbutton, view): def map_source_changed(widget, view): selection = widget.get_active_text() if selection == "Open Street Map": - view.set_property("map-source", champlain.MAP_SOURCE_OPENSTREETMAP) + view.set_property("map-source", champlain.map_source_new_osm_mapnik()) elif selection == "Open Arial Map": - view.set_property("map-source", champlain.MAP_SOURCE_OPENARIALMAP) + view.set_property("map-source", champlain.map_source_new_oam()) elif selection == "Maps for free - Relief": - view.set_property("map-source", champlain.MAP_SOURCE_MAPSFORFREE_RELIEF) + view.set_property("map-source", champlain.map_source_new_mff_relief()) + elif selection == "OSM Cycle Map": + view.set_property("map-source", champlain.map_source_new_osm_cyclemap()) + elif selection == "OSM Osmarender": + view.set_property("map-source", champlain.map_source_new_osm_osmarender()) else: raise RuntimeException("Illegal state: active text of combobox invalid") @@ -40,17 +44,18 @@ def create_marker_layer(): orange = clutter.Color(0xf3, 0x94, 0x07, 0xbb) white = clutter.Color(0xff, 0xff, 0xff, 0xff) - marker = champlain.Marker("Montréal", "Airmole 14") + black = clutter.Color(0x00, 0x00, 0x00, 0xff) + marker = champlain.marker_new_with_label("Montréal", "Airmole 14", black, orange) marker.set_position(45.528178, -73.563788) layer.add(marker) -# marker = champlain_marker_new_with_label("New York", "Sans 25", &white, NULL); -# champlain_marker_set_position(CHAMPLAIN_MARKER(marker), 40.77, -73.98); -# clutter_container_add(CLUTTER_CONTAINER(layer), marker, NULL); + marker = champlain.marker_new_with_label("New York", "Sans 25", white, orange); + marker.set_position(40.77, -73.98); + layer.add(marker) -# marker = champlain_marker_new_with_label("Saint-Tite-des-Caps", "Serif 12", NULL, &orange); -# champlain_marker_set_position(CHAMPLAIN_MARKER(marker), 47.130885, -70.764141); -# clutter_container_add(CLUTTER_CONTAINER(layer), marker, NULL); + marker = champlain.marker_new_with_label("Saint-Tite-des-Caps", "Serif 12", black, orange); + marker.set_position(47.130885, -70.764141); + layer.add(marker) layer.hide() @@ -93,6 +98,8 @@ combo = gtk.combo_box_new_text() combo.append_text("Open Street Map") combo.append_text("Open Arial Map") combo.append_text("Maps for free - Relief") +combo.append_text("OSM Cycle Map") +combo.append_text("OSM Osmarender") combo.set_active(0) combo.connect("changed", map_source_changed, view) bbox.add(combo) -- 2.39.5