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
{"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}
};
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);
--- /dev/null
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "common.h"
+#include "item.h"
+#include "config_.h"
+
+typedef struct {
+ PyObject_HEAD
+} configObject;
+
+static PyObject *
+config_navit(PyObject *self, PyObject *args)
+{
+ struct attr navit;
+ if (config_get_attr(config, attr_navit, &navit, NULL))
+ return navit_py_ref(navit.u.navit);
+ return NULL;
+}
+
+
+
+static PyMethodDef config_methods[] = {
+ {"navit", (PyCFunction) config_navit, METH_VARARGS },
+ {NULL, NULL },
+};
+
+
+static PyObject *
+config_getattr_py(PyObject *self, char *name)
+{
+ return Py_FindMethod(config_methods, self, name);
+}
+
+static void
+config_destroy_py(configObject *self)
+{
+}
+
+PyTypeObject config_Type = {
+ Obj_HEAD
+ .tp_name="config",
+ .tp_basicsize=sizeof(configObject),
+ .tp_dealloc=(destructor)config_destroy_py,
+ .tp_getattr=config_getattr_py,
+};
+
+PyObject *
+config_py(PyObject *self, PyObject *args)
+{
+ configObject *ret;
+
+ dbg(0,"enter\n");
+ ret=PyObject_NEW(configObject, &config_Type);
+ return (PyObject *)ret;
+}
+
+++ /dev/null
-/**
- * Navit, a modular navigation system.
- * Copyright (C) 2005-2008 Navit Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "common.h"
-#include "main.h"
-
-typedef struct {
- PyObject_HEAD
-} mainObject;
-
-static PyObject *
-main_navit(PyObject *self, PyObject *args)
-{
- struct navit *navit;
- navit=main_get_navit(NULL);
- return navit_py_ref(navit);
-}
-
-
-
-static PyMethodDef main_methods[] = {
- {"navit", (PyCFunction) main_navit, METH_VARARGS },
- {NULL, NULL },
-};
-
-
-static PyObject *
-main_getattr_py(PyObject *self, char *name)
-{
- return Py_FindMethod(main_methods, self, name);
-}
-
-static void
-main_destroy_py(mainObject *self)
-{
-}
-
-PyTypeObject main_Type = {
- Obj_HEAD
- .tp_name="main",
- .tp_basicsize=sizeof(mainObject),
- .tp_dealloc=(destructor)main_destroy_py,
- .tp_getattr=main_getattr_py,
-};
-
-PyObject *
-main_py(PyObject *self, PyObject *args)
-{
- mainObject *ret;
-
- dbg(0,"enter\n");
- ret=PyObject_NEW(mainObject, &main_Type);
- return (PyObject *)ret;
-}
-
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);