<div dir="ltr">So do I want to change calls to <div><br></div><div style>add_class()</div><div style>remove_class()</div><div style><br></div><div style>With calls to the _dcom_class attribute?<br><br>For example:</div><div style><br></div><div style><div>    def displayed(self, _):</div><div>        self.add_class("panel-body")</div><div><br></div><div style>Becomes:</div><div style><br></div><div style><div>    def displayed(self, _):</div><div>        self._dcom_class = "panel-body"</div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 29, 2014 at 11:20 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">Hey, no problem: the API is definitely changing a lot right now, so it's a bit of a moving target...<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 29, 2014 at 7:40 PM, Adam Hughes <span dir="ltr"><<a href="mailto:hughesadam87@gmail.com" target="_blank">hughesadam87@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Ah ok.  Thanks will try to get up to speed so not always asking such simple questions</p><div><div>
<div class="gmail_quote">On Oct 29, 2014 7:06 PM, "Nicholas Bollweg" <<a href="mailto:nick.bollweg@gmail.com" target="_blank">nick.bollweg@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Yes, add_class was replaced with _dom_classes. It should actually simplify a lot of your code!<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 29, 2014 at 6:53 PM, Adam Hughes <span dir="ltr"><<a href="mailto:hughesadam87@gmail.com" target="_blank">hughesadam87@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">Hi Nicholas,<div><br></div><div>After I updated to the recent dev, part of our code broke.  It's from the part that you showed to us, so I figured you might be aware of what has been changed:<br><br><pre style="overflow:auto;font-size:14px;padding:0px;margin-top:0px;margin-bottom:0px;line-height:17px;word-break:break-all;word-wrap:break-word;color:rgb(0,0,0);background-color:rgb(255,255,240);border:0px;border-top-left-radius:0px;border-top-right-radius:0px;border-bottom-right-radius:0px;border-bottom-left-radius:0px;white-space:pre-wrap;vertical-align:baseline"><span style="color:rgb(139,0,0)">AttributeError</span>                            Traceback (most recent call last)
<span style="color:rgb(0,100,0)"><ipython-input-8-70485b3b7990></span> in <span style="color:rgb(70,130,180)">displayed<span style="color:rgb(0,0,139)">(self, _)</span>
<span style="color:rgb(0,100,0)">    113</span>     <span style="color:rgb(139,0,0)"># -----</span><span style="color:rgb(196,160,0)"></span><span style="color:rgb(196,160,0)"></span>
<span style="color:rgb(0,100,0)">    114</span>     <span style="color:rgb(0,100,0)">def</span> displayed<span style="color:rgb(196,160,0)">(</span>self<span style="color:rgb(196,160,0)">,</span> _<span style="color:rgb(196,160,0)">)</span><span style="color:rgb(196,160,0)">:</span><span style="color:rgb(196,160,0)"></span>
<span style="color:rgb(0,100,0)">--> 115<span style="color:rgb(196,160,0)">         </span>self<span style="color:rgb(196,160,0)">.</span>add_class<span style="color:rgb(196,160,0)">(</span><span style="color:rgb(0,0,139)">"col-xs-9"</span><span style="color:rgb(196,160,0)">)</span><span style="color:rgb(196,160,0)"></span>
<span>    116</span>         <span style="color:rgb(139,0,0)"># THIS IS WHERE DRAW IS CALLED AFTER DISPLAYS CHANGE</span><span style="color:rgb(196,160,0)"></span><span style="color:rgb(196,160,0)"></span>
<span>    117</span>         self<span style="color:rgb(196,160,0)">.</span>draw<span style="color:rgb(196,160,0)">(</span><span style="color:rgb(196,160,0)">)</span><span style="color:rgb(196,160,0)"></span>

<span style="color:rgb(139,0,0)">AttributeError</span>: 'Spectrogram' object has no attribute 'add_class'
</span></span></pre><div><span style="color:rgb(70,130,180)"><span style="color:rgb(0,100,0)"><br></span></span></div></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 28, 2014 at 12:07 AM, Adam Hughes <span dir="ltr"><<a href="mailto:hughesadam87@gmail.com" target="_blank">hughesadam87@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">Ah gotcha!  Thanks for clearing that up, much appreciated!  I guess my dev is way older than I recall.</div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 27, 2014 at 10:45 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>For reference, I see this:<br><br><img alt="Inline image 3" src="cid:ii_14954a313d677558" height="201" width="520"><br><br>ah, the _dom_classes may have been more recent than that. Here's the change, landed sept 23: <a href="https://github.com/ipython/ipython/pull/6235" target="_blank">https://github.com/ipython/ipython/pull/6235</a><br><br>you may have to go back to something like:<br></div><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">w = HTML("text")<br>w.on_displayed(lambda x: w.add_class("alert-warning")<br></blockquote><br></div>When you want to change it, you'd then have to:<br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">w.remove_class("alert-warning")<br>w.add_class("alert-success")<br></blockquote><div><br></div><div>In the new core widgets, a traitlet manages these directly:<br><a href="https://github.com/ipython/ipython/blob/master/IPython/html/widgets/widget_button.py#L36" target="_blank">https://github.com/ipython/ipython/blob/master/IPython/html/widgets/widget_button.py#L36</a><br></div><div>And all the class adding/removing is done on the client side.<br></div><div><br>In my <a href="https://github.com/bollwyvl/ip-bootstrap" target="_blank">bootstrap librar</a>y i have been tinkering with, I did the same, though a little differently.<br></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 27, 2014 at 8:55 PM, Adam Hughes <span dir="ltr"><<a href="mailto:hughesadam87@gmail.com" target="_blank">hughesadam87@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">Yes, but when you do this in your notebook, does it appear in a different colors?  Mine looks like plain text.  IE I literally see:<div><br></div><div><div style="color:rgb(0,0,0);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;line-height:20px">info</div><div style="color:rgb(0,0,0);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;line-height:20px">danger</div><div style="color:rgb(0,0,0);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;line-height:20px">warning</div><div style="color:rgb(0,0,0);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;line-height:20px">success</div></div><div style="color:rgb(0,0,0);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;line-height:20px"><br></div><div style="color:rgb(0,0,0);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;line-height:20px">In my output cell, instead of pretty colors like the example on the bootstrap link.  Using about a 2week-old version of 3.0 dev, if that matters.</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Mon, Oct 27, 2014 at 8:50 PM, Nicholas Bollweg <span dir="ltr"><<a href="mailto:nick.bollweg@gmail.com" target="_blank">nick.bollweg@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">right, you'd switch it out to another context:<br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">from IPython.html import widgets<br>from IPython.display import display<br>for context in ["info", "danger", "warning", "success"]:<br>    display(widgets.HTML(value=context, _dom_classes=["alert", "alert-" + context]))<br></blockquote></div>
<br></div></div><span>_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org" target="_blank">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></span></blockquote></div><br></div>
<br>_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org" target="_blank">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>
</div></div><br>_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org" target="_blank">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>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org" target="_blank">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>
<br>_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org" target="_blank">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>
</div></div><br>_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org" target="_blank">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>
</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>