Freeze read only feature fixed for Jupyter 5.x (and compatible with Jupyter 4.x)#958
Freeze read only feature fixed for Jupyter 5.x (and compatible with Jupyter 4.x)#958tnarik wants to merge 14 commits intoipython-contrib:masterfrom
Conversation
…ith Jupyter Notebook 5.0.0
…ith Jupyter Notebook 5.0.0
…nbextensions into freeze_read_only
…ndent Add option to indent comments to current indent level
|
Thanks for this, it looks good to me. As noted in #885 (comment), there's also a |
|
I wasn't sure about what you thought regarding that, but yes, a migration
of the metadata would be good to have for any notebook edited with an old
version of the plugin.
it's also pretty straightforward and I can do that in day or even sooner.
|
…ith Jupyter Notebook 5.0.0
…re compatibility with notebooks modified using previous versions of the freeze extention. Updated compatibility property
|
Updated the notebook to read old format ('run_control>read_only') metadata. |
| continue; | ||
| } | ||
| var state = 'normal'; | ||
| // Old metadata format |
There was a problem hiding this comment.
Oh, I was thinking of something more like
if (cell.metadata.run_control && cell.metadata.run_control.read_only !== undefined) {
if (cell.metadata.run_control.read_only) {
cell.metadata.editable = false;
}
delete cell.metadata.run_control.read_only;
}so that we adopt the new metadata just by loading the notebook - make sense?
|
I just didn't want to change much the existing code, even if refactoring
could make sense.
Opening the notebook will immediately take care of the "upgrade" because
loading the extension triggers the initialization of the cell states and
the setting of the cell metadata (via `set_state`).
Maybe I'm missing your point, it's the first time I touch Jupyter extension
code.
|
Fair enough, that's a reasonable approach 😄
Yes, it will work ok, in the sense that the new |
|
Ah, sorry. Yes, it makes perfect sense. I thought I tested that but I didn't. |
…e plugin in use, as we are setting a fresh one during set_state.
|
Created a new pull request, #968, instead of this one. |
Proposed fix for #940.