From 3620c908014d7395a30cc908ae2e43f90a004053 Mon Sep 17 00:00:00 2001
From: Philipp Rudiger
Date: Fri, 14 Oct 2016 17:56:40 +0100
Subject: [PATCH 1/2] Added stream activate and deactivate methods
---
holoviews/streams.py | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/holoviews/streams.py b/holoviews/streams.py
index 5a6f0c9cce..3394efdce5 100644
--- a/holoviews/streams.py
+++ b/holoviews/streams.py
@@ -106,6 +106,9 @@ def trigger(cls, streams):
for subscriber in subscribers:
subscriber(**dict(union))
+ for stream in streams:
+ stream.deactivate()
+
def __init__(self, preprocessors=[], source=None, subscribers=[], **params):
"""
@@ -125,6 +128,15 @@ def __init__(self, preprocessors=[], source=None, subscribers=[], **params):
if source:
self.registry[id(source)].append(self)
+
+ def deactivate(self):
+ """
+ Allows defining an action after the stream has been triggered,
+ e.g. resetting parameters on streams with transient events.
+ """
+ pass
+
+
@property
def source(self):
return self._source
@@ -153,6 +165,7 @@ def update(self, trigger=True, **kwargs):
If trigger is enabled, the trigger classmethod is invoked on
this particular Stream instance.
"""
+ self.activate()
params = self.params().values()
constants = [p.constant for p in params]
for param in params:
@@ -161,9 +174,6 @@ def update(self, trigger=True, **kwargs):
for (param, const) in zip(params, constants):
param.constant = const
- if trigger:
- self.trigger([self])
-
def __repr__(self):
cls_name = self.__class__.__name__
From 48b8643b3ba3a08500cd535402c95b499273696e Mon Sep 17 00:00:00 2001
From: Philipp Rudiger
Date: Fri, 14 Oct 2016 19:43:50 +0100
Subject: [PATCH 2/2] Added pyqt4 to travis.yml
---
.travis.yml | 2 +-
holoviews/streams.py | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 94b98eefec..9bb6a43524 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -24,7 +24,7 @@ install:
- conda update -q conda
# Useful for debugging any issues with conda
- conda info -a
- - conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION scipy numpy freetype nose bokeh pandas jupyter ipython=4.2.0 param matplotlib=1.5.1 xarray datashader
+ - conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION scipy numpy freetype nose bokeh pandas jupyter ipython=4.2.0 param pyqt=4 matplotlib=1.5.1 xarray datashader
- source activate test-environment
- conda install -c conda-forge -c scitools iris sip=4.18 plotly
- if [[ "$TRAVIS_PYTHON_VERSION" == "3.4" ]]; then
diff --git a/holoviews/streams.py b/holoviews/streams.py
index 3394efdce5..fe8399efd2 100644
--- a/holoviews/streams.py
+++ b/holoviews/streams.py
@@ -165,7 +165,6 @@ def update(self, trigger=True, **kwargs):
If trigger is enabled, the trigger classmethod is invoked on
this particular Stream instance.
"""
- self.activate()
params = self.params().values()
constants = [p.constant for p in params]
for param in params:
@@ -174,6 +173,9 @@ def update(self, trigger=True, **kwargs):
for (param, const) in zip(params, constants):
param.constant = const
+ if trigger:
+ self.trigger([self])
+
def __repr__(self):
cls_name = self.__class__.__name__