These are chat archives for ipython/ipython

Sep 2015
Sep 28 2015 19:16
hi, I’m having trouble with a method i’m using to pass values from python to js
in this code i declare a trait object
_zoomtoregion = List(sync=True, trait=Float, allow_none=True)
that is connected to this method :
def zoom_to_region(self, west, south, east, north):
        self._zoomtoregion = [west, south, east, north]
then on the js side :
this code :
this.model.on('change:_zoomtoregion', this.zoom_to_region, this);
is supposed to trig this js function
Sep 28 2015 19:22
            zoom_to_region: function () {
                console.log('view region!');
                // move the camera to a location
                var region = this.model.get('_zoomtoregion');
                if (!$.isEmptyObject(region)) {
                    var pos = region // .split(",");
                    var rectangle = Cesium.Rectangle.fromDegrees(Number(pos[0]), Number(pos[1]), Number(pos[2]), Number(pos[3]));
                    this.model.set('_zoomtoregion', null);
                                this.model.set('_zoomtoregion', null);
everythin works fine in the notebook … as long as i use always different parameters
if I “re-execute” from a notebook cell the same code, like : cesiumExample.zoom_to_region(-100.0, 20.0, -90.0, 30.0)
it works twice .. then to have it working i need to change at least one of the parameters
Sep 28 2015 19:27
.. have you any idea wjhat’s going wrong ?
Sep 28 2015 21:18
in the code : this.model.on('change:_zoomtoregion', this.zoom_to_region, this); is change: the only option we have ?