]> Dogcows Code - chaz/openbox/blobdiff - src/python.cc
use otk objects in the ob scripts by importing otk
[chaz/openbox] / src / python.cc
index f95d4723772f0b89e4af3ad38a82cd26c1fcdea4..a7e2eada9e086a63aab4408b7bb172dfa2b6176c 100644 (file)
@@ -9,8 +9,9 @@
 #include "otk/util.hh"
 
 extern "C" {
-// The initializer in openbox_wrap.cc
+// The initializer in openbox_wrap.cc / otk_wrap.cc
 extern void init_ob(void);
+extern void init_otk(void);
 }
 
 namespace ob {
@@ -23,6 +24,7 @@ void python_init(char *argv0)
   Py_SetProgramName(argv0);
   Py_Initialize();
   // initialize the C python module
+  init_otk();
   init_ob();
   // include the openbox directories for python scripts in the sys path
   PyRun_SimpleString("import sys");
@@ -30,10 +32,10 @@ void python_init(char *argv0)
                                         otk::expandTilde("~/.openbox/python") +
                                         "')").c_str()));
   PyRun_SimpleString("sys.path.append('" SCRIPTDIR "')");
-  PyRun_SimpleString("import ob;");
+  PyRun_SimpleString("import ob; import otk;");
   // set up convenience global variables
   PyRun_SimpleString("ob.openbox = ob.Openbox_instance()");
-  PyRun_SimpleString("ob.display = ob.Display_instance()");
+  PyRun_SimpleString("otk.display = otk.Display_instance()");
 
   // set up access to the python global variables
   PyObject *obmodule = PyImport_AddModule("config");
This page took 0.027538 seconds and 4 git commands to generate.