ultimatepp/bazaar/PyCon/PyCon.h
kohait 3679491ce2 bazaar: PyCon, PyConsoleCtrl: proper exit() python funciton handling, now exit handler can terminate gui app
git-svn-id: svn://ultimatepp.org/upp/trunk@3337 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2011-04-12 21:54:26 +00:00

36 lines
947 B
C++

#ifndef _PyCon_PyCon_h_
#define _PyCon_PyCon_h_
#include <Py/Py.h>
#include <Core/Core.h>
using namespace Upp;
#include <LogCtrl/LogCtrl.h>
class PyCon
{
public:
static PyObject* ToStdOut(PyObject* self, PyObject* pArgs);
static PyObject* ToStdErr(PyObject* self, PyObject* pArgs);
static void Init();
static void Enable(bool b = true);
static void Disable() { Enable(false); }
static bool IsEnabled() { return enabled; }
static void SetStream(Stream& _ps) { ps = &_ps; }
static Stream& GetStream() { return (ps)?(*ps):(StdLog()); }
static int MyPyRun_SimpleStringFlags(const char *command, PyCompilerFlags *flags, int start);
static inline int Exec(const String& c, bool single = true) { return MyPyRun_SimpleStringFlags(c, NULL, (single)?(Py_single_input):(Py_file_input)); }
static PyMethodDef m[];
static Callback AtExit;
protected:
static bool enabled;
static Stream* ps;
};
#endif