add some comments to the procedure
This commit is contained in:
parent
678bb52123
commit
6d6082dc7d
1 changed files with 5 additions and 7 deletions
|
@ -21,26 +21,24 @@ static PyObject *obdict = NULL;
|
||||||
|
|
||||||
void python_init(char *argv0)
|
void python_init(char *argv0)
|
||||||
{
|
{
|
||||||
|
// start the python engine
|
||||||
Py_SetProgramName(argv0);
|
Py_SetProgramName(argv0);
|
||||||
Py_Initialize();
|
Py_Initialize();
|
||||||
|
// initialize the C python modules
|
||||||
init_otk();
|
init_otk();
|
||||||
init_openbox();
|
init_openbox();
|
||||||
|
// include the openbox directories for python scripts in the sys path
|
||||||
PyRun_SimpleString("import sys");
|
PyRun_SimpleString("import sys");
|
||||||
PyRun_SimpleString("sys.path.append('" SCRIPTDIR "')");
|
PyRun_SimpleString("sys.path.append('" SCRIPTDIR "')");
|
||||||
PyRun_SimpleString(const_cast<char*>(((std::string)"sys.path.append('" +
|
PyRun_SimpleString(const_cast<char*>(((std::string)"sys.path.append('" +
|
||||||
otk::expandTilde("~/.openbox/python") +
|
otk::expandTilde("~/.openbox/python") +
|
||||||
"')").c_str()));
|
"')").c_str()));
|
||||||
// PyRun_SimpleString("from _otk import *; from _openbox import *;");
|
// import the otk and openbox modules into the main namespace
|
||||||
PyRun_SimpleString("from otk import *; from openbox import *;");
|
PyRun_SimpleString("from otk import *; from openbox import *;");
|
||||||
|
// set up convenience global variables
|
||||||
PyRun_SimpleString("openbox = Openbox_instance()");
|
PyRun_SimpleString("openbox = Openbox_instance()");
|
||||||
PyRun_SimpleString("display = OBDisplay_display()");
|
PyRun_SimpleString("display = OBDisplay_display()");
|
||||||
|
|
||||||
/* XXX
|
|
||||||
sys.path.append('stuff')
|
|
||||||
install the .py wrappers, and include their path with this, then import em
|
|
||||||
and ~/.openbox/python/ !!
|
|
||||||
*/
|
|
||||||
|
|
||||||
// set up access to the python global variables
|
// set up access to the python global variables
|
||||||
PyObject *obmodule = PyImport_AddModule("__main__");
|
PyObject *obmodule = PyImport_AddModule("__main__");
|
||||||
obdict = PyModule_GetDict(obmodule);
|
obdict = PyModule_GetDict(obmodule);
|
||||||
|
|
Loading…
Reference in a new issue