summaryrefslogtreecommitdiff
path: root/src/python.cc
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-01-10 03:11:48 +0000
committerDana Jansens <danakj@orodu.net>2003-01-10 03:11:48 +0000
commitb67f5e702e3cc12e4217dd31e2c522dde1ee19b0 (patch)
treef50e72175b41099cece0ba0311f66e05f341d65c /src/python.cc
parent0d00827947ef02749d44802613ca13df284e544f (diff)
new python interface! using the .py shadow wrappers from swig
Diffstat (limited to 'src/python.cc')
-rw-r--r--src/python.cc10
1 files changed, 9 insertions, 1 deletions
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<char*>(((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;