Clear effects if a setColor comes from another source

Former-commit-id: 43084eeee26ee233ac1f0c71d6782b64b154f0da
This commit is contained in:
johan
2013-12-08 17:45:26 +01:00
parent 9872d8f02b
commit f1acf5a9e4
5 changed files with 16 additions and 10 deletions

View File

@@ -174,7 +174,7 @@ PyObject* Effect::wrapSetColor(PyObject *self, PyObject *args)
if (PyArg_ParseTuple(args, "bbb", &color.red, &color.green, &color.blue))
{
std::fill(effect->_colors.begin(), effect->_colors.end(), color);
effect->setColors(effect->_priority, effect->_colors, timeout);
effect->setColors(effect->_priority, effect->_colors, timeout, false);
return Py_BuildValue("");
}
else
@@ -195,7 +195,7 @@ PyObject* Effect::wrapSetColor(PyObject *self, PyObject *args)
{
char * data = PyByteArray_AS_STRING(bytearray);
memcpy(effect->_colors.data(), data, length);
effect->setColors(effect->_priority, effect->_colors, timeout);
effect->setColors(effect->_priority, effect->_colors, timeout, false);
return Py_BuildValue("");
}
else
@@ -265,7 +265,7 @@ PyObject* Effect::wrapSetImage(PyObject *self, PyObject *args)
memcpy(image.memptr(), data, length);
effect->_imageProcessor->process(image, effect->_colors);
effect->setColors(effect->_priority, effect->_colors, timeout);
effect->setColors(effect->_priority, effect->_colors, timeout, false);
return Py_BuildValue("");
}
else

View File

@@ -29,7 +29,7 @@ public slots:
signals:
void effectFinished(Effect * effect);
void setColors(int priority, const std::vector<ColorRgb> &ledColors, const int timeout_ms);
void setColors(int priority, const std::vector<ColorRgb> &ledColors, const int timeout_ms, bool clearEffects);
private slots:
void effectFinished();

View File

@@ -83,7 +83,7 @@ int EffectEngine::runEffectScript(const std::string &script, const Json::Value &
// create the effect
Effect * effect = new Effect(priority, timeout, script, args);
connect(effect, SIGNAL(setColors(int,std::vector<ColorRgb>,int)), _hyperion, SLOT(setColors(int,std::vector<ColorRgb>,int)), Qt::QueuedConnection);
connect(effect, SIGNAL(setColors(int,std::vector<ColorRgb>,int,bool)), _hyperion, SLOT(setColors(int,std::vector<ColorRgb>,int,bool)), Qt::QueuedConnection);
connect(effect, SIGNAL(effectFinished(Effect*)), this, SLOT(effectFinished(Effect*)));
_activeEffects.push_back(effect);