These are chat archives for ipython/ipython

3rd
Dec 2014
Jason Grout
@jasongrout
Dec 03 2014 18:54
@jdfreder?
Jonathan Frederic
@jdfreder
Dec 03 2014 18:55
hey one sec
Jason Grout
@jasongrout
Dec 03 2014 18:56
I think we may have a race condition still in creating/removing views
If a model is created, then creates a view, and then the comm dies before the view is actually loaded and created, the view is never registered with the model before the model tries to call .remove() on all its views.
The problem is that the view registers itself with the model (appends itself to this.model.views) when it is created. Before then, the model doesn't know about it.
So the model doesn't know about the view until it is actually created. I think it would be better for the widget manager to store a promise for the view with the model right off. Then the model can remove any views or promised views. In other words, the model knows about the view as soon as it is requested, instead of as soon as it is created.
Jonathan Frederic
@jdfreder
Dec 03 2014 19:00
async horse :horse:
Jason Grout
@jasongrout
Dec 03 2014 19:01
nice
you obviously like handing out horses :horse_racing:
Jonathan Frederic
@jdfreder
Dec 03 2014 19:04
Yeah that sounds like the right approach, that would make it behave like our model and comm lists
Jason Grout
@jasongrout
Dec 03 2014 19:04
yep. PR coming up
should we delete the views in the model.views list when the comm is closed? We do remove them.
(i.e., call view.remove())
I'm going to change model.views to a list, since we don't know the view id anymore (so we can't use that as a key in a dict)
Jonathan Frederic
@jdfreder
Dec 03 2014 19:06
Yeah, I think view[id].then(function(view){view.remove;}); delete view[id];
Jason Grout
@jasongrout
Dec 03 2014 19:07
then we have an array with holes, right?
Jonathan Frederic
@jdfreder
Dec 03 2014 19:07
Not if the views are still in a dict of id->view
Jason Grout
@jasongrout
Dec 03 2014 19:08
we don't know the id when we create the entry, though.
Jonathan Frederic
@jdfreder
Dec 03 2014 19:08
You'll probably want to check with @SylvainCorlay before converting that dict
to a list
it used to be a list
Jason Grout
@jasongrout
Dec 03 2014 19:08
yes, of course
Jonathan Frederic
@jdfreder
Dec 03 2014 19:08
I'm pretty sure he converted it to a dict
iirc
I thought he had a reason to convert it to a dict though
Alternatively, you could have both
a private array of promises and a public dictionary by id
Jason Grout
@jasongrout
Dec 03 2014 19:13
why exactly do we need a view.id?
Would it be sufficient to generate it when we create the promise, and then set the view.id attribute to it after we create the promise?
after the view promise is fulfilled?
Jonathan Frederic
@jdfreder
Dec 03 2014 19:15
That should be fine
Jason Grout
@jasongrout
Dec 03 2014 19:15
yeah, I don't see the view id being used anywhere.
Jonathan Frederic
@jdfreder
Dec 03 2014 19:15
I don't think view ids are needed right now
Jason Grout
@jasongrout
Dec 03 2014 19:16
in fact, backbone already creates a cid attribute
I'm going to just delete view.id for now.
we'll see what breaks...
Jonathan Frederic
@jdfreder
Dec 03 2014 19:17
Sounds good
if backbone already provides 'cid' which is globally unique, no reason for us to generate our own
the only reason I see a globally unique view id being useful is to associate views with dom elements
Jason Grout
@jasongrout
Dec 03 2014 19:18
oh, right, I think I did use view ids for that once.
I put the view id as a data attribute on the dom element
so I could easily retrieve the view.
but I could just attach the view object too.
Jonathan Frederic
@jdfreder
Dec 03 2014 19:19
or view.cid if it's unique
Jason Grout
@jasongrout
Dec 03 2014 19:20
it should be, right.
Jason Grout
@jasongrout
Dec 03 2014 19:31
@jdfreder: ipython/ipython#7093
Nathan Goldbaum
@ngoldbaum
Dec 03 2014 19:37
hi all - I just got drafted to give a 30-45 minute introduction to IPython in two weeks as part of an astrocomputing seminar in my department. I'm curious whether there are any sources I can pull from besides the docs and the example notebooks.
Min RK
@minrk
Dec 03 2014 19:37
@ngoldbaum we often present from here: https://github.com/ipython/ipython-in-depth
Jason Grout
@jasongrout
Dec 03 2014 23:35
@jdfreder: I have a question about the visible traitlet
Jonathan Frederic
@jdfreder
Dec 03 2014 23:37
@jasongrout shoot
Jason Grout
@jasongrout
Dec 03 2014 23:38
I talked with you a while ago about changing the visible attribute to be tri-valued
Jonathan Frederic
@jdfreder
Dec 03 2014 23:38
yes
I remember that conversation
Jason Grout
@jasongrout
Dec 03 2014 23:38
None = display: none; False = visibility: hidden; True = visibility: visible
Jonathan Frederic
@jdfreder
Dec 03 2014 23:39
yup
Jason Grout
@jasongrout
Dec 03 2014 23:39
I'm about to submit a PR; are we still good with that?
Jonathan Frederic
@jdfreder
Dec 03 2014 23:39
Yes that would be great
make sure your branch is up to date with master
Jason Grout
@jasongrout
Dec 03 2014 23:39
if we want a backwards compatible solution, we can do visible = 'hidden' for the hidden part
Jonathan Frederic
@jdfreder
Dec 03 2014 23:39
I merged a PR an hour ago which changed all the js comments to jsdoc style
Jason Grout
@jasongrout
Dec 03 2014 23:40
okay, I'll make sure to get that.
Jason Grout
@jasongrout
Dec 03 2014 23:58
@jdfreder: ipython/ipython#7097
Jonathan Frederic
@jdfreder
Dec 03 2014 23:58
thanks