mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
* implement effects included in hyperiond binary * cleanup * remove install of effects dir. People who wants to develop effects has to copy them from github effect params for initial effects can be changed in config permanently and other effect params can be changed via json (currently only temporarily) * fix schema of fadecandy webui fix display of specific led options * add leddevice write support * cleanup * webui: tune hue code * when use json effect definition from putsiede hyperiond but want to use py script from inside hyperiond use ad a : e.g. fade.py needs a fade.py near the json file, but :fade.py is taken from resource inside hyperiond * add ability to di * add abiloty to diable effcts via hyperion config * use effect name instead of script in active effects and prio register * finally solve open file handle during effect is playing. Now script is read before, then file closed and then t is run by python * fix some webui things - led config tabs - inital loading screen optimize qrc file generation fix compile warning in hyperion.cpp * cleanup * more cleanup
89 lines
1.9 KiB
C++
89 lines
1.9 KiB
C++
#pragma once
|
|
|
|
// Python includes
|
|
#include <Python.h>
|
|
|
|
// Qt includes
|
|
#include <QThread>
|
|
|
|
// Hyperion includes
|
|
#include <hyperion/ImageProcessor.h>
|
|
|
|
class Effect : public QThread
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
Effect(PyThreadState * mainThreadState, int priority, int timeout, const QString & script, const QString & name, const Json::Value & args = Json::Value());
|
|
virtual ~Effect();
|
|
|
|
virtual void run();
|
|
|
|
int getPriority() const;
|
|
|
|
QString getScript() const { return _script; }
|
|
QString getName() const { return _name; }
|
|
|
|
int getTimeout() const {return _timeout; }
|
|
|
|
Json::Value getArgs() const { return _args; }
|
|
|
|
bool isAbortRequested() const;
|
|
|
|
/// This function registers the extension module in Python
|
|
static void registerHyperionExtensionModule();
|
|
|
|
public slots:
|
|
void abort();
|
|
|
|
signals:
|
|
void effectFinished(Effect * effect);
|
|
|
|
void setColors(int priority, const std::vector<ColorRgb> &ledColors, const int timeout_ms, bool clearEffects);
|
|
|
|
private slots:
|
|
void effectFinished();
|
|
|
|
private:
|
|
PyObject * json2python(const Json::Value & json) const;
|
|
|
|
// Wrapper methods for Python interpreter extra buildin methods
|
|
static PyMethodDef effectMethods[];
|
|
static PyObject* wrapSetColor(PyObject *self, PyObject *args);
|
|
static PyObject* wrapSetImage(PyObject *self, PyObject *args);
|
|
static PyObject* wrapAbort(PyObject *self, PyObject *args);
|
|
static Effect * getEffect();
|
|
|
|
#if PY_MAJOR_VERSION >= 3
|
|
static struct PyModuleDef moduleDef;
|
|
static PyObject* PyInit_hyperion();
|
|
#else
|
|
static void PyInit_hyperion();
|
|
#endif
|
|
|
|
private:
|
|
PyThreadState * _mainThreadState;
|
|
|
|
const int _priority;
|
|
|
|
const int _timeout;
|
|
|
|
const QString _script;
|
|
const QString _name;
|
|
|
|
const Json::Value _args;
|
|
|
|
int64_t _endTime;
|
|
|
|
PyThreadState * _interpreterThreadState;
|
|
|
|
bool _abortRequested;
|
|
|
|
/// The processor for translating images to led-values
|
|
ImageProcessor * _imageProcessor;
|
|
|
|
/// Buffer for colorData
|
|
std::vector<ColorRgb> _colors;
|
|
};
|
|
|