summaryrefslogtreecommitdiff
path: root/navit/binding/python
diff options
context:
space:
mode:
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2009-11-02 11:33:08 +0000
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2009-11-02 11:33:08 +0000
commit28c60a8a02f3d17a600e73c18db7dfc4d3b443d4 (patch)
treea4c657655cab13f15074287d1adb9d54e2de2f67 /navit/binding/python
parentbfa7a1a89b64134f3bba9d1e82bca352ab909377 (diff)
downloadnavit-28c60a8a02f3d17a600e73c18db7dfc4d3b443d4.tar.gz
Fix:binding_python:Converted to new api
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@2717 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/binding/python')
-rw-r--r--navit/binding/python/Makefile.am2
-rw-r--r--navit/binding/python/binding_python.c2
-rw-r--r--navit/binding/python/common.h2
-rw-r--r--navit/binding/python/config.c (renamed from navit/binding/python/main.c)40
-rw-r--r--navit/binding/python/startup.py2
5 files changed, 25 insertions, 23 deletions
diff --git a/navit/binding/python/Makefile.am b/navit/binding/python/Makefile.am
index dd74229ae..a71632317 100644
--- a/navit/binding/python/Makefile.am
+++ b/navit/binding/python/Makefile.am
@@ -1,6 +1,6 @@
include $(top_srcdir)/Makefile.inc
AM_CPPFLAGS = @NAVIT_CFLAGS@ @PYTHON_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=binding_python
modulebinding_LTLIBRARIES = libbinding_python.la
-libbinding_python_la_SOURCES = binding_python.c main.c navit.c pcoord.c route.c navigation.c attr.c common.h
+libbinding_python_la_SOURCES = binding_python.c config.c navit.c pcoord.c route.c navigation.c attr.c common.h
libbinding_python_la_LIBADD = @PYTHON_LIBS@
libbinding_python_la_LDFLAGS = -module -avoid-version
diff --git a/navit/binding/python/binding_python.c b/navit/binding/python/binding_python.c
index 6d4fcc786..318ef0fd6 100644
--- a/navit/binding/python/binding_python.c
+++ b/navit/binding/python/binding_python.c
@@ -328,7 +328,7 @@ static PyMethodDef navitMethods[]={
{"map", map_new_py, METH_VARARGS, "Create a new map."},
{"mapset", mapset_new_py, METH_VARARGS, "Create a new mapset."},
{"config_load", config_load_py, METH_VARARGS, "Load a config"},
- {"main", main_py, METH_VARARGS, "Get Main Object"},
+ {"config", config_py, METH_VARARGS, "Get Config Object"},
{"pcoord", pcoord_py, METH_VARARGS},
{NULL, NULL, 0, NULL}
};
diff --git a/navit/binding/python/common.h b/navit/binding/python/common.h
index 5c1a270ca..c9af7a8ce 100644
--- a/navit/binding/python/common.h
+++ b/navit/binding/python/common.h
@@ -31,7 +31,7 @@ struct map;
PyObject * python_object_from_attr(struct attr *attr);
-PyObject * main_py(PyObject *self, PyObject *args);
+PyObject * config_py(PyObject *self, PyObject *args);
PyObject * map_py_ref(struct map *map);
diff --git a/navit/binding/python/main.c b/navit/binding/python/config.c
index 5a782cc7c..ffcaed2cd 100644
--- a/navit/binding/python/main.c
+++ b/navit/binding/python/config.c
@@ -18,54 +18,56 @@
*/
#include "common.h"
-#include "main.h"
+#include "item.h"
+#include "config_.h"
typedef struct {
PyObject_HEAD
-} mainObject;
+} configObject;
static PyObject *
-main_navit(PyObject *self, PyObject *args)
+config_navit(PyObject *self, PyObject *args)
{
- struct navit *navit;
- navit=main_get_navit(NULL);
- return navit_py_ref(navit);
+ struct attr navit;
+ if (config_get_attr(config, attr_navit, &navit, NULL))
+ return navit_py_ref(navit.u.navit);
+ return NULL;
}
-static PyMethodDef main_methods[] = {
- {"navit", (PyCFunction) main_navit, METH_VARARGS },
+static PyMethodDef config_methods[] = {
+ {"navit", (PyCFunction) config_navit, METH_VARARGS },
{NULL, NULL },
};
static PyObject *
-main_getattr_py(PyObject *self, char *name)
+config_getattr_py(PyObject *self, char *name)
{
- return Py_FindMethod(main_methods, self, name);
+ return Py_FindMethod(config_methods, self, name);
}
static void
-main_destroy_py(mainObject *self)
+config_destroy_py(configObject *self)
{
}
-PyTypeObject main_Type = {
+PyTypeObject config_Type = {
Obj_HEAD
- .tp_name="main",
- .tp_basicsize=sizeof(mainObject),
- .tp_dealloc=(destructor)main_destroy_py,
- .tp_getattr=main_getattr_py,
+ .tp_name="config",
+ .tp_basicsize=sizeof(configObject),
+ .tp_dealloc=(destructor)config_destroy_py,
+ .tp_getattr=config_getattr_py,
};
PyObject *
-main_py(PyObject *self, PyObject *args)
+config_py(PyObject *self, PyObject *args)
{
- mainObject *ret;
+ configObject *ret;
dbg(0,"enter\n");
- ret=PyObject_NEW(mainObject, &main_Type);
+ ret=PyObject_NEW(configObject, &config_Type);
return (PyObject *)ret;
}
diff --git a/navit/binding/python/startup.py b/navit/binding/python/startup.py
index 02b207003..f8e801551 100644
--- a/navit/binding/python/startup.py
+++ b/navit/binding/python/startup.py
@@ -2,7 +2,7 @@ import navit
navit.config_load("navit.xml.local")
pos=navit.pcoord("5023.7493 N 00730.2898 E",1);
dest=navit.pcoord("5023.6604 N 00729.8500 E",1);
-inst=navit.main().navit();
+inst=navit.config().navit();
inst.set_position(pos);
inst.set_destination(dest,"Test");
inst.set_center(pos);