diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-01-02 21:05:29 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-01-02 21:05:29 +0000 |
| commit | 14cf42ff0780bf58a6b54c9443c87c7402b61faa (patch) | |
| tree | b4517a43cf036fd482b655d978660cf5d7ff990d /src/python.cc | |
| parent | 6d58d84f22887f03ac5471b9775452b90103b6f0 (diff) | |
run scripts before initializing screens. kill the globals.py. add the python_get_stringlist.
Diffstat (limited to 'src/python.cc')
| -rw-r--r-- | src/python.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/python.cc b/src/python.cc index 8fec3b15..f1b7f43c 100644 --- a/src/python.cc +++ b/src/python.cc @@ -212,6 +212,7 @@ void python_init(char *argv0) init_otk(); init_openbox(); PyRun_SimpleString("from _otk import *; from _openbox import *;"); + PyRun_SimpleString("openbox = Openbox_instance()"); // set up access to the python global variables PyObject *obmodule = PyImport_AddModule("__main__"); @@ -302,5 +303,17 @@ bool python_get_string(const char *name, std::string *value) return true; } +bool python_get_stringlist(const char *name, std::vector<std::string> *value) +{ + PyObject *val = PyDict_GetItemString(obdict, const_cast<char*>(name)); + if (!(val && PyList_Check(val))) return false; + + for (int i = 0, end = PyList_Size(val); i < end; ++i) { + PyObject *str = PyList_GetItem(val, i); + if (PyString_Check(str)) + value->push_back(PyString_AsString(str)); + } + return true; +} } |
