<div dir="ltr">Hi Nicholas, <div><br></div><div style>I just wanted to say that this suggest worked like a charm and we are very appreciate for your help!</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 6, 2014 at 4:29 PM, Nicholas Bollweg <span dir="ltr"><<a href="mailto:nick.bollweg@gmail.com" target="_blank">nick.bollweg@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Sorry; haven't had much time to tinker on widget stuff much outside of directly work-related stuff. <br><br></div><div>The file stuff sounds like it's getting pretty complicated! Maybe you could add another layer outside of the GUI, like a Workspace, and have all of the file-relevant stuff handled there. Then, when you change datasets, you just re-roll the whole GUI related to that specific dataset.<br></div><div><br></div>However, based on what you have done... first, you could instrument the dataset as a traitlets.Instance: (<i>caveat: the below things are not tested!</i>)<br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span style="font-family:courier new,monospace">class Spectrogram(HTML):<br>    ...<br>    ts = Instance(klass=WhateverTsIs)</span><span style="font-family:courier new,monospace"></span></blockquote><blockquote><span style="font-family:courier new,monospace"></span></blockquote><br></div>Then you can use the nice events to react to that being switched to a new instance on a per-linked-widget basis:<br><br><div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span style="font-family:courier new,monospace">class Spectroscopy(Box):<br>    ...<br>    def _sampling(self):<br>        ...<br>        start = FloatSlider(<br>            description="Slicing Start Value",<br>            value=self.graph.ts.index[0],<br>            min=self.graph.ts.index.min(),<br>            max=self.graph.ts.index.max()<br>        )<br>        ...<br>        <br>        def _ts_changed(name, old, new):<br>            start.value = self.graph.ts.index[0]<br>            start.min = self.graph.ts.index.min()<br>            start.max = self.graph.ts.index.max()<br><br>        self.graph.on_trait_changed(_ts_changed, "ts")</span><br></blockquote><div><div><div><div><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>Now, you'll probably still have the problem of whether you are actually ready to redraw as all those controls re-initialize... the easiest thing would probably be to just add some more error handling to Spectrogram.draw to catch these errors, and let it fail if you are pretty confident that it will work once the inputs are all valid. Or, you could set a time window during which you don't try to redraw. Not sure what would work out best.<br><br></div><div>Maybe this helps?<br></div></div></div></div></div></div></div></div></div>
<br>_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
<br></blockquote></div><br></div>