superkaramba
karamba.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef KARAMBA_PYTHON_H
00026 #define KARAMBA_PYTHON_H
00027
00028 class QString;
00029 class KMenu;
00030 class Task;
00031 class Startup;
00032 class Karamba;
00033 class Meter;
00034 struct _object;
00035 typedef struct _object PyObject;
00036 struct _ts;
00037 typedef struct _ts PyThreadState;
00038 class ThemeFile;
00039
00040 class KarambaPython
00041 {
00042 protected:
00043 bool pythonThemeExtensionLoaded;
00044 PyObject *pName, *pModule;
00045 PyObject *pDict;
00046 static PyThreadState* mainThreadState;
00047
00048 void getLock(PyThreadState** myThreadState);
00049 PyObject* getFunc(const char* function);
00050 void releaseLock(PyThreadState* myThreadState);
00051 bool callObject(const char* func, PyObject* pArgs, bool lock = true);
00052
00053 public:
00054 KarambaPython(const ThemeFile& theme, bool reloading);
00055 ~KarambaPython();
00056
00057 static void initPython();
00058 static void shutdownPython();
00059
00060 bool isExtensionLoaded()
00061 {
00062 return pythonThemeExtensionLoaded;
00063 }
00064 bool initWidget(Karamba* k);
00065 bool widgetUpdated(Karamba* k);
00066 bool widgetClosed(Karamba* k);
00067 bool menuOptionChanged(Karamba* k, QString key, bool value);
00068 bool meterClicked(Karamba* k, Meter* meter, int button);
00069 bool meterClicked(Karamba* k, QString anchor, int button);
00070 bool widgetClicked(Karamba* k, int x, int y, int button);
00071 bool keyPressed(Karamba* k, const Meter* meter, const QString& text);
00072 bool widgetMouseMoved(Karamba* k, int x, int y, int button);
00073 bool menuItemClicked(Karamba* k, KMenu* menu, long id);
00074 bool activeTaskChanged(Karamba* k, Task* t);
00075 bool taskAdded(Karamba* k, Task* t);
00076 bool taskRemoved(Karamba* k, Task* t);
00077 bool startupAdded(Karamba* k, Startup* t);
00078 bool startupRemoved(Karamba* k, Startup* t);
00079 bool commandOutput(Karamba* k, int pid, char *buffer);
00080 bool commandFinished(Karamba* k, int pid);
00081 bool itemDropped(Karamba* k, QString text, int x, int y);
00082 bool themeNotify(Karamba* k, const char *from, const char *txt);
00083 bool systrayUpdated(Karamba* k);
00084 bool desktopChanged(Karamba* k, int desktop);
00085 bool wallpaperChanged(Karamba* k, int desktop);
00086 };
00087
00088 PyObject* py_testInterface(PyObject *, PyObject *args);
00089
00090 #endif // KARAMBA_PYTHON_H