From b67f5e702e3cc12e4217dd31e2c522dde1ee19b0 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Fri, 10 Jan 2003 03:11:48 +0000 Subject: new python interface! using the .py shadow wrappers from swig --- src/python.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/python.cc') diff --git a/src/python.cc b/src/python.cc index 2e490d31..9ea93b4d 100644 --- a/src/python.cc +++ b/src/python.cc @@ -6,6 +6,7 @@ #include "python.hh" #include "bindings.hh" #include "otk/display.hh" +#include "otk/util.hh" extern "C" { // The initializer in openbox_wrap.cc @@ -24,7 +25,13 @@ void python_init(char *argv0) Py_Initialize(); init_otk(); init_openbox(); - PyRun_SimpleString("from _otk import *; from _openbox import *;"); + PyRun_SimpleString("import sys"); + PyRun_SimpleString("sys.path.append('" SCRIPTDIR "')"); + PyRun_SimpleString(const_cast(((std::string)"sys.path.append('" + + otk::expandTilde("~/.openbox/python") + + "')").c_str())); +// PyRun_SimpleString("from _otk import *; from _openbox import *;"); + PyRun_SimpleString("from otk import *; from openbox import *;"); PyRun_SimpleString("openbox = Openbox_instance()"); PyRun_SimpleString("display = OBDisplay_display()"); @@ -143,6 +150,7 @@ PyObject *kbind(PyObject *keylist, ob::KeyContext context, PyObject *func) vectkeylist.push_back(PyString_AsString(str)); } + (void)context; // XXX use this sometime! if (!ob::Openbox::instance->bindings()->addKey(vectkeylist, func)) { PyErr_SetString(PyExc_RuntimeError,"Unable to add binding."); return NULL; -- cgit v1.2.3