broken to all hell. oh no.
This commit is contained in:
parent
1c70394ce2
commit
19bfac5195
3 changed files with 21 additions and 8 deletions
|
@ -93,6 +93,7 @@ void OBDisplay::initialize(char *name)
|
||||||
(void)junk;
|
(void)junk;
|
||||||
|
|
||||||
// Open the X display
|
// Open the X display
|
||||||
|
printf("getenv(DISPLAY)=%s\n", getenv("DISPLAY"));
|
||||||
if (!(display = XOpenDisplay(name))) {
|
if (!(display = XOpenDisplay(name))) {
|
||||||
printf(_("Unable to open connection to the X server. Please set the \n\
|
printf(_("Unable to open connection to the X server. Please set the \n\
|
||||||
DISPLAY environment variable approriately, or use the '-display' command \n\
|
DISPLAY environment variable approriately, or use the '-display' command \n\
|
||||||
|
|
|
@ -39,6 +39,7 @@ string expandTilde(const string& s) {
|
||||||
|
|
||||||
const char* const home = getenv("HOME");
|
const char* const home = getenv("HOME");
|
||||||
if (home == NULL) return s;
|
if (home == NULL) return s;
|
||||||
|
printf("tilde: getenv(DISPLAY)=%s\n", getenv("DISPLAY"));
|
||||||
|
|
||||||
return string(home + s.substr(s.find('/')));
|
return string(home + s.substr(s.find('/')));
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,17 +19,28 @@ static PyObject *obdict = NULL;
|
||||||
|
|
||||||
void python_init(char *argv0)
|
void python_init(char *argv0)
|
||||||
{
|
{
|
||||||
|
std::string path;
|
||||||
|
|
||||||
// start the python engine
|
// start the python engine
|
||||||
Py_SetProgramName(argv0);
|
//Py_SetProgramName(argv0);
|
||||||
Py_Initialize();
|
//Py_Initialize();
|
||||||
// initialize the C python module
|
// initialize the C python module
|
||||||
init_openbox();
|
//init_openbox();
|
||||||
// include the openbox directories for python scripts in the sys path
|
// 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 "')");
|
printf("SCRIPTDIR=%s\n", SCRIPTDIR);
|
||||||
PyRun_SimpleString(const_cast<char*>(((std::string)"sys.path.append('" +
|
printf("1 getenv(DISPLAY)=%s\n", getenv("DISPLAY"));
|
||||||
otk::expandTilde("~/.openbox/python") +
|
path = "sys.path";
|
||||||
"')").c_str()));
|
printf("2 getenv(DISPLAY)=%s\n", getenv("DISPLAY"));
|
||||||
|
path = "sys.path.append('";
|
||||||
|
printf("3 getenv(DISPLAY)=%s\n", getenv("DISPLAY"));
|
||||||
|
path += SCRIPTDIR;
|
||||||
|
path += "')";
|
||||||
|
PyRun_SimpleString(const_cast<char*>(path.c_str()));
|
||||||
|
path = "sys.path.append('";
|
||||||
|
path += otk::expandTilde("~/.openbox/python");
|
||||||
|
path += "')";
|
||||||
|
PyRun_SimpleString(const_cast<char*>(path.c_str()));
|
||||||
// import the otk and openbox modules into the main namespace
|
// import the otk and openbox modules into the main namespace
|
||||||
PyRun_SimpleString("from openbox import *;");
|
PyRun_SimpleString("from openbox import *;");
|
||||||
// set up convenience global variables
|
// set up convenience global variables
|
||||||
|
|
Loading…
Reference in a new issue