From a5bf83810f1077056258ddf48f263072577aa9dd Mon Sep 17 00:00:00 2001 From: Victor Godoy Poluceno Date: Wed, 22 Apr 2009 19:26:25 -0400 Subject: [PATCH] Update the Python bindings to have ChamplainBaseMarker --- AUTHORS | 1 + bindings/python/champlain/pychamplain.defs | 261 +++++++++++++++++++-- bindings/python/demos/capitals.py | 4 +- bindings/python/demos/launcher-gtk.py | 6 +- bindings/python/update-binding.sh | 1 + 5 files changed, 245 insertions(+), 28 deletions(-) diff --git a/AUTHORS b/AUTHORS index ced84f4..7b02e6e 100644 --- a/AUTHORS +++ b/AUTHORS @@ -15,3 +15,4 @@ Kritarth Upadhyay Debarshi Ray Paulo Cabido Sjoerd Simons +Victor Godoy Poluceno diff --git a/bindings/python/champlain/pychamplain.defs b/bindings/python/champlain/pychamplain.defs index 2eb59f1..d05594b 100644 --- a/bindings/python/champlain/pychamplain.defs +++ b/bindings/python/champlain/pychamplain.defs @@ -1,5 +1,12 @@ ;; -*- scheme -*- ; object definitions ... +(define-object BaseMarker + (in-module "Champlain") + (parent "ClutterGroup") + (c-name "ChamplainBaseMarker") + (gtype-id "CHAMPLAIN_TYPE_BASE_MARKER") +) + (define-object Layer (in-module "Champlain") (parent "ClutterGroup") @@ -16,7 +23,7 @@ (define-object Marker (in-module "Champlain") - (parent "ClutterGroup") + (parent "ChamplainBaseMarker") (c-name "ChamplainMarker") (gtype-id "CHAMPLAIN_TYPE_MARKER") ) @@ -183,7 +190,7 @@ (c-name "champlain_view_ensure_markers_visible") (return-type "none") (parameters - '("ChamplainMarker*[]" "markers") + '("ChamplainBaseMarker*[]" "markers") '("gboolean" "animate") ) ) @@ -523,21 +530,11 @@ (return-type "ClutterActor*") ) -(define-method set_position - (of-object "ChamplainMarker") - (c-name "champlain_marker_set_position") - (return-type "none") - (parameters - '("gdouble" "longitude") - '("gdouble" "latitude") - ) -) - -(define-function marker_new_with_label - (c-name "champlain_marker_new_with_label") +(define-function marker_new_with_text + (c-name "champlain_marker_new_with_text") (return-type "ClutterActor*") (parameters - '("const-gchar*" "label") + '("const-gchar*" "text") '("const-gchar*" "font") '("ClutterColor*" "text_color") '("ClutterColor*" "marker_color") @@ -548,24 +545,242 @@ (c-name "champlain_marker_new_with_image") (return-type "ClutterActor*") (parameters - '("const-gchar*" "filename") - '("GError**" "error") + '("ClutterActor*" "actor") ) ) -(define-function marker_new_with_image_full - (c-name "champlain_marker_new_with_image_full") +(define-function marker_new_from_file + (c-name "champlain_marker_new_from_file") (return-type "ClutterActor*") (parameters '("const-gchar*" "filename") - '("gint" "width") - '("gint" "height") - '("gint" "anchor_x") - '("gint" "anchor_y") '("GError**" "error") ) ) +(define-function marker_new_full + (c-name "champlain_marker_new_full") + (return-type "ClutterActor*") + (parameters + '("const-gchar*" "text") + '("ClutterActor*" "actor") + ) +) + +(define-method set_text + (of-object "ChamplainMarker") + (c-name "champlain_marker_set_text") + (return-type "none") + (parameters + '("const-gchar*" "text") + ) +) + +(define-method set_image + (of-object "ChamplainMarker") + (c-name "champlain_marker_set_image") + (return-type "none") + (parameters + '("ClutterActor*" "image") + ) +) + +(define-method set_use_markup + (of-object "ChamplainMarker") + (c-name "champlain_marker_set_use_markup") + (return-type "none") + (parameters + '("gboolean" "use_markup") + ) +) + +(define-method set_alignment + (of-object "ChamplainMarker") + (c-name "champlain_marker_set_alignment") + (return-type "none") + (parameters + '("PangoAlignment" "alignment") + ) +) + +(define-method set_color + (of-object "ChamplainMarker") + (c-name "champlain_marker_set_color") + (return-type "none") + (parameters + '("const-ClutterColor*" "color") + ) +) + +(define-method set_text_color + (of-object "ChamplainMarker") + (c-name "champlain_marker_set_text_color") + (return-type "none") + (parameters + '("const-ClutterColor*" "color") + ) +) + +(define-method set_font_name + (of-object "ChamplainMarker") + (c-name "champlain_marker_set_font_name") + (return-type "none") + (parameters + '("const-gchar*" "font_name") + ) +) + +(define-method set_wrap + (of-object "ChamplainMarker") + (c-name "champlain_marker_set_wrap") + (return-type "none") + (parameters + '("gboolean" "wrap") + ) +) + +(define-method set_wrap_mode + (of-object "ChamplainMarker") + (c-name "champlain_marker_set_wrap_mode") + (return-type "none") + (parameters + '("PangoWrapMode" "wrap_mode") + ) +) + +(define-method set_attributes + (of-object "ChamplainMarker") + (c-name "champlain_marker_set_attributes") + (return-type "none") + (parameters + '("PangoAttrList*" "list") + ) +) + +(define-method set_single_line_mode + (of-object "ChamplainMarker") + (c-name "champlain_marker_set_single_line_mode") + (return-type "none") + (parameters + '("gboolean" "mode") + ) +) + +(define-method set_ellipsize + (of-object "ChamplainMarker") + (c-name "champlain_marker_set_ellipsize") + (return-type "none") + (parameters + '("PangoEllipsizeMode" "mode") + ) +) + +(define-method set_draw_background + (of-object "ChamplainMarker") + (c-name "champlain_marker_set_draw_background") + (return-type "none") + (parameters + '("gboolean" "wrap") + ) +) + +(define-method get_use_markup + (of-object "ChamplainMarker") + (c-name "champlain_marker_get_use_markup") + (return-type "gboolean") +) + +(define-method get_text + (of-object "ChamplainMarker") + (c-name "champlain_marker_get_text") + (return-type "const-gchar*") +) + +(define-method get_image + (of-object "ChamplainMarker") + (c-name "champlain_marker_get_image") + (return-type "ClutterActor*") +) + +(define-method get_alignment + (of-object "ChamplainMarker") + (c-name "champlain_marker_get_alignment") + (return-type "PangoAlignment") +) + +(define-method get_color + (of-object "ChamplainMarker") + (c-name "champlain_marker_get_color") + (return-type "ClutterColor*") +) + +(define-method get_text_color + (of-object "ChamplainMarker") + (c-name "champlain_marker_get_text_color") + (return-type "ClutterColor*") +) + +(define-method get_font_name + (of-object "ChamplainMarker") + (c-name "champlain_marker_get_font_name") + (return-type "const-gchar*") +) + +(define-method get_wrap + (of-object "ChamplainMarker") + (c-name "champlain_marker_get_wrap") + (return-type "gboolean") +) + +(define-method get_wrap_mode + (of-object "ChamplainMarker") + (c-name "champlain_marker_get_wrap_mode") + (return-type "PangoWrapMode") +) + +(define-method get_ellipsize + (of-object "ChamplainMarker") + (c-name "champlain_marker_get_ellipsize") + (return-type "PangoEllipsizeMode") +) + +(define-method get_single_line_mode + (of-object "ChamplainMarker") + (c-name "champlain_marker_get_single_line_mode") + (return-type "gboolean") +) + +(define-method get_draw_background + (of-object "ChamplainMarker") + (c-name "champlain_marker_get_draw_background") + (return-type "gboolean") +) + + + +;; From champlain-base-marker.h + +(define-function base_marker_get_type + (c-name "champlain_base_marker_get_type") + (return-type "GType") +) + +(define-function base_marker_new + (c-name "champlain_base_marker_new") + (is-constructor-of "ChamplainBaseMarker") + (return-type "ClutterActor*") +) + +(define-method set_position + (of-object "ChamplainBaseMarker") + (c-name "champlain_base_marker_set_position") + (return-type "none") + (parameters + '("gdouble" "longitude") + '("gdouble" "latitude") + ) +) + ;; From champlain-tile.h diff --git a/bindings/python/demos/capitals.py b/bindings/python/demos/capitals.py index 4af7878..a2782ad 100755 --- a/bindings/python/demos/capitals.py +++ b/bindings/python/demos/capitals.py @@ -103,13 +103,13 @@ class Capitals: #Change the colour of the last marker's text last = self.markers.pop() self.layer.remove(last) - marker = champlain.marker_new_with_label(last.name, font, black, orange) + marker = champlain.marker_new_with_text(last.name, font, black, orange) marker.set_position(last.get_property("latitude"), last.get_property("longitude")) self.markers.append(marker) self.layer.add(marker) marker.raise_top() - marker = champlain.marker_new_with_label(name, font, white, orange) + marker = champlain.marker_new_with_text(name, font, white, orange) marker.set_position(latitude, longitude) marker.name = name self.markers.append(marker) diff --git a/bindings/python/demos/launcher-gtk.py b/bindings/python/demos/launcher-gtk.py index 0dd6b6d..83a2ba7 100755 --- a/bindings/python/demos/launcher-gtk.py +++ b/bindings/python/demos/launcher-gtk.py @@ -47,15 +47,15 @@ class champlainDemo: orange = clutter.Color(0xf3, 0x94, 0x07, 0xbb) white = clutter.Color(0xff, 0xff, 0xff, 0xff) black = clutter.Color(0x00, 0x00, 0x00, 0xff) - marker = champlain.marker_new_with_label("Montréal", "Airmole 14", black, orange) + marker = champlain.marker_new_with_text("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, orange); + marker = champlain.marker_new_with_text("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", black, orange); + marker = champlain.marker_new_with_text("Saint-Tite-des-Caps", "Serif 12", black, orange); marker.set_position(47.130885, -70.764141); layer.add(marker) diff --git a/bindings/python/update-binding.sh b/bindings/python/update-binding.sh index 42cfc74..32bc859 100755 --- a/bindings/python/update-binding.sh +++ b/bindings/python/update-binding.sh @@ -12,6 +12,7 @@ python /usr/share/pygobject/2.0/codegen/h2def.py \ champlain-map-source.h \ champlain-network-map-source.h \ champlain-marker.h \ + champlain-base-marker.h \ champlain-tile.h \ champlain-zoom-level.h \ > ../bindings/python/champlain/pychamplain.defs -- 2.39.5