From: Mike Sheldon Date: Sun, 22 Mar 2009 01:50:42 +0000 (+0000) Subject: Update python bindings to support new API changes X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b05910fc0c51db5207abe810cb39e23ceaa3d20;p=libchamplain Update python bindings to support new API changes Disable wrapping of zoom_level_set_actor as this isn't implemented yet. Start adding markers layer to launcher-gtk.py (forgot -a on previous commit) --- diff --git a/bindings/python/champlain-gtk/pychamplaingtk.defs b/bindings/python/champlain-gtk/pychamplaingtk.defs index 7099aae..865a1d1 100644 --- a/bindings/python/champlain-gtk/pychamplaingtk.defs +++ b/bindings/python/champlain-gtk/pychamplaingtk.defs @@ -1,5 +1,12 @@ ;; -*- scheme -*- ; object definitions ... +(define-object ViewEmbed + (in-module "Champlain") + (parent "GtkAlignment") + (c-name "ChamplainViewEmbed") + (gtype-id "CHAMPLAIN_TYPE_VIEW_EMBED") +) + ;; Enumerations and flags ... diff --git a/bindings/python/champlain-gtk/pychamplaingtk.override b/bindings/python/champlain-gtk/pychamplaingtk.override index fe20238..fba152e 100644 --- a/bindings/python/champlain-gtk/pychamplaingtk.override +++ b/bindings/python/champlain-gtk/pychamplaingtk.override @@ -3,11 +3,13 @@ headers #include #include #include +#include #include - +#include "../champlain/pychamplain.h" %% modulename champlain %% +import gtk.Alignment as PyGtkAlignment_Type import clutter.Actor as PyClutterActor_Type import clutter.Group as PyClutterGroup_Type %% diff --git a/bindings/python/champlain-gtk/pychamplaingtkmodule.c b/bindings/python/champlain-gtk/pychamplaingtkmodule.c index c4ba665..f2c9439 100644 --- a/bindings/python/champlain-gtk/pychamplaingtkmodule.c +++ b/bindings/python/champlain-gtk/pychamplaingtkmodule.c @@ -1,8 +1,8 @@ #define NO_IMPORT_PYGOBJECT #include +#include "../champlain/pychamplain.h" -void champlain_register_classes (PyObject *d); DL_EXPORT(void) initchamplaingtk(void); extern PyMethodDef champlain_functions[]; diff --git a/bindings/python/champlain/pychamplain.defs b/bindings/python/champlain/pychamplain.defs index 0a84ef4..4b11232 100644 --- a/bindings/python/champlain/pychamplain.defs +++ b/bindings/python/champlain/pychamplain.defs @@ -7,6 +7,13 @@ (gtype-id "CHAMPLAIN_TYPE_LAYER") ) +(define-object MapSource + (in-module "Champlain") + (parent "GObject") + (c-name "ChamplainMapSource") + (gtype-id "CHAMPLAIN_TYPE_MAP_SOURCE") +) + (define-object Marker (in-module "Champlain") (parent "ClutterGroup") @@ -14,6 +21,20 @@ (gtype-id "CHAMPLAIN_TYPE_MARKER") ) +(define-object NetworkMapSource + (in-module "Champlain") + (parent "ChamplainMapSource") + (c-name "ChamplainNetworkMapSource") + (gtype-id "CHAMPLAIN_TYPE_NETWORK_MAP_SOURCE") +) + +(define-object Tile + (in-module "Champlain") + (parent "GObject") + (c-name "ChamplainTile") + (gtype-id "CHAMPLAIN_TYPE_TILE") +) + (define-object View (in-module "Champlain") (parent "ClutterGroup") @@ -21,21 +42,15 @@ (gtype-id "CHAMPLAIN_TYPE_VIEW") ) -;; Enumerations and flags ... - -(define-enum MapSource +(define-object ZoomLevel (in-module "Champlain") - (c-name "ChamplainMapSource") - (gtype-id "CHAMPLAIN_TYPE_MAP_SOURCE") - (values - '("debug" "CHAMPLAIN_MAP_SOURCE_DEBUG") - '("openstreetmap" "CHAMPLAIN_MAP_SOURCE_OPENSTREETMAP") - '("openarialmap" "CHAMPLAIN_MAP_SOURCE_OPENARIALMAP") - '("mapsforfree-relief" "CHAMPLAIN_MAP_SOURCE_MAPSFORFREE_RELIEF") - '("count" "CHAMPLAIN_MAP_SOURCE_COUNT") - ) + (parent "GObject") + (c-name "ChamplainZoomLevel") + (gtype-id "CHAMPLAIN_TYPE_ZOOM_LEVEL") ) +;; Enumerations and flags ... + (define-enum ScrollMode (in-module "Champlain") (c-name "ChamplainScrollMode") @@ -46,10 +61,10 @@ ) ) -(define-enum StateEnum +(define-enum State (in-module "Champlain") - (c-name "ChamplainStateEnum") - (gtype-id "CHAMPLAIN_TYPE_STATE_ENUM") + (c-name "ChamplainState") + (gtype-id "CHAMPLAIN_TYPE_STATE") (values '("none" "CHAMPLAIN_STATE_NONE") '("init" "CHAMPLAIN_STATE_INIT") @@ -58,6 +73,15 @@ ) ) +(define-enum MapProjection + (in-module "Champlain") + (c-name "ChamplainMapProjection") + (gtype-id "CHAMPLAIN_TYPE_MAP_PROJECTION") + (values + '("r" "CHAMPLAIN_MAP_PROJECTION_MERCATOR") + ) +) + ;; From champlain.h @@ -74,8 +98,6 @@ (c-name "champlain_view_new") (is-constructor-of "ChamplainView") (return-type "ClutterActor*") - (parameters - ) ) (define-method center_on @@ -100,12 +122,21 @@ (return-type "none") ) -(define-method add_layer +(define-method set_zoom_level (of-object "ChamplainView") - (c-name "champlain_view_add_layer") + (c-name "champlain_view_set_zoom_level") (return-type "none") (parameters - '("ClutterActor*" "layer") + '("gint" "zoom_level") + ) +) + +(define-method set_map_source + (of-object "ChamplainView") + (c-name "champlain_view_set_map_source") + (return-type "none") + (parameters + '("ChamplainMapSource*" "map_source") ) ) @@ -119,6 +150,60 @@ ) ) +(define-method set_decel_rate + (of-object "ChamplainView") + (c-name "champlain_view_set_decel_rate") + (return-type "none") + (parameters + '("gdouble" "rate") + ) +) + +(define-method set_scroll_mode + (of-object "ChamplainView") + (c-name "champlain_view_set_scroll_mode") + (return-type "none") + (parameters + '("ChamplainScrollMode" "mode") + ) +) + +(define-method set_keep_center_on_resize + (of-object "ChamplainView") + (c-name "champlain_view_set_keep_center_on_resize") + (return-type "none") + (parameters + '("gboolean" "value") + ) +) + +(define-method set_show_license + (of-object "ChamplainView") + (c-name "champlain_view_set_show_license") + (return-type "none") + (parameters + '("gboolean" "value") + ) +) + +(define-method set_zoom_on_double_click + (of-object "ChamplainView") + (c-name "champlain_view_set_zoom_on_double_click") + (return-type "none") + (parameters + '("gboolean" "value") + ) +) + +(define-method add_layer + (of-object "ChamplainView") + (c-name "champlain_view_add_layer") + (return-type "none") + (parameters + '("ChamplainLayer*" "layer") + ) +) + (define-method get_coords_from_event (of-object "ChamplainView") (c-name "champlain_view_get_coords_from_event") @@ -130,6 +215,17 @@ ) ) +(define-method tile_ready + (of-object "ChamplainView") + (c-name "champlain_view_tile_ready") + (return-type "none") + (parameters + '("ChamplainZoomLevel*" "level") + '("ChamplainTile*" "tile") + '("gboolean" "animate") + ) +) + ;; From champlain-defines.h @@ -151,6 +247,212 @@ +;; From champlain-map-source.h + +(define-function map_source_get_type + (c-name "champlain_map_source_get_type") + (return-type "GType") +) + +(define-method get_min_zoom_level + (of-object "ChamplainMapSource") + (c-name "champlain_map_source_get_min_zoom_level") + (return-type "gint") +) + +(define-method get_max_zoom_level + (of-object "ChamplainMapSource") + (c-name "champlain_map_source_get_max_zoom_level") + (return-type "gint") +) + +(define-method get_tile_size + (of-object "ChamplainMapSource") + (c-name "champlain_map_source_get_tile_size") + (return-type "guint") +) + +(define-method get_x + (of-object "ChamplainMapSource") + (c-name "champlain_map_source_get_x") + (return-type "guint") + (parameters + '("gint" "zoom_level") + '("gdouble" "longitude") + ) +) + +(define-method get_y + (of-object "ChamplainMapSource") + (c-name "champlain_map_source_get_y") + (return-type "guint") + (parameters + '("gint" "zoom_level") + '("gdouble" "latitude") + ) +) + +(define-method get_longitude + (of-object "ChamplainMapSource") + (c-name "champlain_map_source_get_longitude") + (return-type "gdouble") + (parameters + '("gint" "zoom_level") + '("guint" "x") + ) +) + +(define-method get_latitude + (of-object "ChamplainMapSource") + (c-name "champlain_map_source_get_latitude") + (return-type "gdouble") + (parameters + '("gint" "zoom_level") + '("guint" "y") + ) +) + +(define-method get_row_count + (of-object "ChamplainMapSource") + (c-name "champlain_map_source_get_row_count") + (return-type "guint") + (parameters + '("gint" "zoom_level") + ) +) + +(define-method get_column_count + (of-object "ChamplainMapSource") + (c-name "champlain_map_source_get_column_count") + (return-type "guint") + (parameters + '("gint" "zoom_level") + ) +) + +(define-method get_tile + (of-object "ChamplainMapSource") + (c-name "champlain_map_source_get_tile") + (return-type "none") + (parameters + '("ChamplainView*" "view") + '("ChamplainZoomLevel*" "level") + '("ChamplainTile*" "tile") + ) +) + +(define-method set_name + (of-object "ChamplainMapSource") + (c-name "champlain_map_source_set_name") + (return-type "none") + (parameters + '("const-gchar*" "name") + ) +) + +(define-method get_name + (of-object "ChamplainMapSource") + (c-name "champlain_map_source_get_name") + (return-type "const-gchar*") +) + +(define-method set_license + (of-object "ChamplainMapSource") + (c-name "champlain_map_source_set_license") + (return-type "none") + (parameters + '("const-gchar*" "license") + ) +) + +(define-method get_license + (of-object "ChamplainMapSource") + (c-name "champlain_map_source_get_license") + (return-type "const-gchar*") +) + + + +;; From champlain-network-map-source.h + +(define-function network_map_source_get_type + (c-name "champlain_network_map_source_get_type") + (return-type "GType") +) + +(define-function network_map_source_new_full + (c-name "champlain_network_map_source_new_full") + (return-type "ChamplainNetworkMapSource*") + (parameters + '("const-gchar*" "name") + '("const-gchar*" "license") + '("const-gchar*" "license_uri") + '("guint" "min_zoom") + '("guint" "map_zoom") + '("guint" "tile_size") + '("ChamplainMapProjection" "projection") + '("const-gchar*" "uri_format") + ) +) + +(define-function map_source_new_osm_mapnik + (c-name "champlain_map_source_new_osm_mapnik") + (return-type "ChamplainMapSource*") +) + +(define-function map_source_new_osm_cyclemap + (c-name "champlain_map_source_new_osm_cyclemap") + (return-type "ChamplainMapSource*") +) + +(define-function map_source_new_osm_osmarender + (c-name "champlain_map_source_new_osm_osmarender") + (return-type "ChamplainMapSource*") +) + +(define-function map_source_new_oam + (c-name "champlain_map_source_new_oam") + (return-type "ChamplainMapSource*") +) + +(define-function map_source_new_mff_relief + (c-name "champlain_map_source_new_mff_relief") + (return-type "ChamplainMapSource*") +) + +(define-method get_tile_uri + (of-object "ChamplainNetworkMapSource") + (c-name "champlain_network_map_source_get_tile_uri") + (return-type "const-gchar*") + (parameters + '("gint" "x") + '("gint" "y") + '("gint" "z") + ) +) + +(define-method set_tile_uri + (of-object "ChamplainNetworkMapSource") + (c-name "champlain_network_map_source_set_tile_uri") + (return-type "none") + (parameters + '("const-gchar*" "uri_format") + ) +) + +(define-function network_map_source_get_tile + (c-name "champlain_network_map_source_get_tile") + (return-type "none") + (parameters + '("ChamplainMapSource*" "map_source") + '("ChamplainView*" "view") + '("ChamplainZoomLevel*" "level") + '("ChamplainTile*" "tile") + ) +) + + + ;; From champlain-marker.h (define-function marker_get_type @@ -162,8 +464,6 @@ (c-name "champlain_marker_new") (is-constructor-of "ChamplainMarker") (return-type "ClutterActor*") - (parameters - ) ) (define-method set_position @@ -210,3 +510,257 @@ ) + +;; From champlain-tile.h + +(define-function tile_get_type + (c-name "champlain_tile_get_type") + (return-type "GType") +) + +(define-function tile_new + (c-name "champlain_tile_new") + (is-constructor-of "ChamplainTile") + (return-type "ChamplainTile*") +) + +(define-function tile_new_full + (c-name "champlain_tile_new_full") + (return-type "ChamplainTile*") + (parameters + '("gint" "x") + '("gint" "y") + '("guint" "size") + '("gint" "zoom_level") + ) +) + +(define-method get_x + (of-object "ChamplainTile") + (c-name "champlain_tile_get_x") + (return-type "gint") +) + +(define-method get_y + (of-object "ChamplainTile") + (c-name "champlain_tile_get_y") + (return-type "gint") +) + +(define-method get_zoom_level + (of-object "ChamplainTile") + (c-name "champlain_tile_get_zoom_level") + (return-type "gint") +) + +(define-method get_size + (of-object "ChamplainTile") + (c-name "champlain_tile_get_size") + (return-type "guint") +) + +(define-method get_state + (of-object "ChamplainTile") + (c-name "champlain_tile_get_state") + (return-type "ChamplainState") +) + +(define-method get_uri + (of-object "ChamplainTile") + (c-name "champlain_tile_get_uri") + (return-type "const-gchar*") +) + +(define-method get_filename + (of-object "ChamplainTile") + (c-name "champlain_tile_get_filename") + (return-type "const-gchar*") +) + +(define-method get_actor + (of-object "ChamplainTile") + (c-name "champlain_tile_get_actor") + (return-type "ClutterActor*") +) + +(define-method set_x + (of-object "ChamplainTile") + (c-name "champlain_tile_set_x") + (return-type "none") + (parameters + '("gint" "x") + ) +) + +(define-method set_y + (of-object "ChamplainTile") + (c-name "champlain_tile_set_y") + (return-type "none") + (parameters + '("gint" "y") + ) +) + +(define-method set_zoom_level + (of-object "ChamplainTile") + (c-name "champlain_tile_set_zoom_level") + (return-type "none") + (parameters + '("gint" "zoom_level") + ) +) + +(define-method set_size + (of-object "ChamplainTile") + (c-name "champlain_tile_set_size") + (return-type "none") + (parameters + '("guint" "size") + ) +) + +(define-method set_state + (of-object "ChamplainTile") + (c-name "champlain_tile_set_state") + (return-type "none") + (parameters + '("ChamplainState" "state") + ) +) + +(define-method set_uri + (of-object "ChamplainTile") + (c-name "champlain_tile_set_uri") + (return-type "none") + (parameters + '("const-gchar*" "uri") + ) +) + +(define-method set_filename + (of-object "ChamplainTile") + (c-name "champlain_tile_set_filename") + (return-type "none") + (parameters + '("const-gchar*" "filename") + ) +) + +(define-method set_actor + (of-object "ChamplainTile") + (c-name "champlain_tile_set_actor") + (return-type "none") + (parameters + '("ClutterActor*" "actor") + ) +) + + + +;; From champlain-zoom-level.h + +(define-function zoom_level_get_type + (c-name "champlain_zoom_level_get_type") + (return-type "GType") +) + +(define-function zoom_level_new + (c-name "champlain_zoom_level_new") + (is-constructor-of "ChamplainZoomLevel") + (return-type "ChamplainZoomLevel*") +) + +(define-method get_width + (of-object "ChamplainZoomLevel") + (c-name "champlain_zoom_level_get_width") + (return-type "gint") +) + +(define-method get_height + (of-object "ChamplainZoomLevel") + (c-name "champlain_zoom_level_get_height") + (return-type "gint") +) + +(define-method get_zoom_level + (of-object "ChamplainZoomLevel") + (c-name "champlain_zoom_level_get_zoom_level") + (return-type "gint") +) + +(define-method get_actor + (of-object "ChamplainZoomLevel") + (c-name "champlain_zoom_level_get_actor") + (return-type "ClutterActor*") +) + +(define-method set_width + (of-object "ChamplainZoomLevel") + (c-name "champlain_zoom_level_set_width") + (return-type "none") + (parameters + '("guint" "width") + ) +) + +(define-method set_height + (of-object "ChamplainZoomLevel") + (c-name "champlain_zoom_level_set_height") + (return-type "none") + (parameters + '("guint" "height") + ) +) + +(define-method set_zoom_level + (of-object "ChamplainZoomLevel") + (c-name "champlain_zoom_level_set_zoom_level") + (return-type "none") + (parameters + '("gint" "zoom_level") + ) +) + +(define-method set_actor + (of-object "ChamplainZoomLevel") + (c-name "champlain_zoom_level_set_actor") + (return-type "none") + (parameters + '("ClutterActor*" "actor") + ) +) + +(define-method add_tile + (of-object "ChamplainZoomLevel") + (c-name "champlain_zoom_level_add_tile") + (return-type "none") + (parameters + '("ChamplainTile*" "tile") + ) +) + +(define-method remove_tile + (of-object "ChamplainZoomLevel") + (c-name "champlain_zoom_level_remove_tile") + (return-type "none") + (parameters + '("ChamplainTile*" "tile") + ) +) + +(define-method tile_count + (of-object "ChamplainZoomLevel") + (c-name "champlain_zoom_level_tile_count") + (return-type "guint") +) + +(define-method get_nth_tile + (of-object "ChamplainZoomLevel") + (c-name "champlain_zoom_level_get_nth_tile") + (return-type "ChamplainTile*") + (parameters + '("guint" "index") + ) +) + + diff --git a/bindings/python/champlain/pychamplain.override b/bindings/python/champlain/pychamplain.override index 1511cf0..33a84d4 100644 --- a/bindings/python/champlain/pychamplain.override +++ b/bindings/python/champlain/pychamplain.override @@ -4,13 +4,18 @@ headers #include #include #include +#include "pychamplain.h" %% modulename champlain %% +import gobject.GObject as PyGObject_Type import clutter.Actor as PyClutterActor_Type import clutter.Group as PyClutterGroup_Type %% ignore-glob *_get_type %% +ignore + champlain_zoom_level_set_actor +%% diff --git a/bindings/python/champlain/pychamplainmodule.c b/bindings/python/champlain/pychamplainmodule.c index 5c87cb9..5d89229 100644 --- a/bindings/python/champlain/pychamplainmodule.c +++ b/bindings/python/champlain/pychamplainmodule.c @@ -1,9 +1,8 @@ #define NO_IMPORT_PYGOBJECT #include +#include "pychamplain.h" -void champlain_register_classes (PyObject *d); -void champlain_add_constants(PyObject *module, const gchar *strip_prefix); DL_EXPORT(void) initchamplain(void); extern PyMethodDef champlain_functions[]; diff --git a/bindings/python/pychamplain.patch b/bindings/python/pychamplain.patch deleted file mode 100644 index f907b66..0000000 --- a/bindings/python/pychamplain.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- champlain/pychamplain.defs.orig 2009-03-22 01:23:50.000000000 +0000 -+++ champlain/pychamplain.defs 2009-03-22 01:23:50.000000000 +0000 -@@ -721,14 +721,14 @@ - ) - ) - --(define-method set_actor -- (of-object "ChamplainZoomLevel") -- (c-name "champlain_zoom_level_set_actor") -- (return-type "none") -- (parameters -- '("ClutterActor*" "actor") -- ) --) -+;(define-method set_actor -+; (of-object "ChamplainZoomLevel") -+; (c-name "champlain_zoom_level_set_actor") -+; (return-type "none") -+; (parameters -+; '("ClutterActor*" "actor") -+; ) -+;) - - (define-method add_tile - (of-object "ChamplainZoomLevel") diff --git a/bindings/python/update-binding.sh b/bindings/python/update-binding.sh index 4ea6b5b..42cfc74 100755 --- a/bindings/python/update-binding.sh +++ b/bindings/python/update-binding.sh @@ -9,7 +9,11 @@ python /usr/share/pygobject/2.0/codegen/h2def.py \ champlain-view.h \ champlain-defines.h \ champlain-layer.h \ + champlain-map-source.h \ + champlain-network-map-source.h \ champlain-marker.h \ + champlain-tile.h \ + champlain-zoom-level.h \ > ../bindings/python/champlain/pychamplain.defs # Update the list of headers from Makefile.am