Skip to content
This repository was archived by the owner on Sep 1, 2022. It is now read-only.

Conversation

@blink1073
Copy link
Contributor

jupyter-multicell

private _tags = '';
private _name = '';
private _tags = '{}';
private _name = '{}';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the default _name be '{}' or '""'? The empty string makes more sense to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can't be empty, since that causes the JSON.parse() to fail, agreed that tags should be [] though.

@blink1073
Copy link
Contributor Author

Metadata defaults updated in f583525

@jasongrout
Copy link
Member

The selection logic is a bit more subtle in the current notebook. Essentially, only the cells between the active cell and the selection anchor are selected. So, for example, shift-J, shift-K should only leave the anchor selected. This is similar to how selection of characters in a word processor works.

@blink1073
Copy link
Contributor Author

Understood, updating.

@jasongrout
Copy link
Member

Thanks. I'm excited to see this get in!

@blink1073
Copy link
Contributor Author

Updated (see gif above).

for (let i = 0; i < this.model.cells.length; i++) {
let cell = this.model.cells.get(i);
if (this.model.isSelected(cell)) {
count++;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we only care if any cell besides prev is selected, we can break as soon as we find one.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, under the current constraints (only a single contiguous selection), we only need to check to see if the cell before prev is selected.

In the future we'll probably have real (non-contiguous) multiple selection, and we'll have to rethink how all this logic works.

@jasongrout
Copy link
Member

Movement without shift should deselect as well: Shift-J J should deselect all cells.

@blink1073
Copy link
Contributor Author

Thanks, updated.

@blink1073 blink1073 force-pushed the multiple-selection branch from a6b3011 to 9a4188c Compare April 6, 2016 21:57

/**
* Select the next cell.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't call this "select.." if we are deselecting cells. Maybe "activateNext" since it is changing the active cell?

@jasongrout
Copy link
Member

@ellisonbg - it looks like @blink1073 has implemented the correct logic. I just wanted to loop you in for terminology: above/below vs prev/next, and select vs. active. I know we had a long discussion and specific definitions of these - I just don't remember exactly what they were :). I see in https://github.com/jupyter/notebook/blob/41d6da235cbf3bcf6d7f818e11a066e0fd12ff8b/notebook/static/notebook/js/actions.js#L14 that it seems like above/below is pretty interchangeable with prev/next. It seems like the actions in the current notebook indicate that the currently active cell is always selected, whereas we've distinguished between selected cells and the active cell (i.e., we can have no cells selected). Thoughts?

@blink1073
Copy link
Contributor Author

We could use currentCellIndex and selected, where the "current" cell is always selected, and then add a class to the "current" cell if it is not the only selected cell.

@blink1073
Copy link
Contributor Author

I also think we should standardize on next/prev or above/below but have no preference.

@jasongrout
Copy link
Member

Yes, I noticed you used both (above/below in the function title, prev/next as variables in the code) 😄

@blink1073
Copy link
Contributor Author

The existing Help Shortcuts dialog uses above/below, and I do remember having this conversation with Brian last October, let's go with that. @jasongrout, you okay with the current/selected semantics I proposed?

@jasongrout
Copy link
Member

@blink1073: +1 to your current/selected semantics, though I think it's still okay to use active instead of current.

@blink1073
Copy link
Contributor Author

I was thinking of it more like a "cursor position".

@blink1073
Copy link
Contributor Author

Let's leave it as active for now though, since a lot of code is using it.

@blink1073
Copy link
Contributor Author

We can discuss tomorrow at the meeting.

@jasongrout
Copy link
Member

Good idea.

On Thu, Apr 7, 2016 at 3:57 PM Steven Silvester notifications@github.com
wrote:

We can discuss tomorrow at the meeting.


You are receiving this because you were mentioned.

Reply to this email directly or view it on GitHub
#151 (comment)

@blink1073
Copy link
Contributor Author

Updated.

@SylvainCorlay
Copy link
Member

Btw, with @Carreau we re-discussed jupyter/notebook#881 at the dev meeting.

@ellisonbg
Copy link

For the above/below and next/preview naming, please see the list of
action/command names in the existing notebook:

https://github.com/jupyter/notebook/blob/master/notebook/static/notebook/js/actions.js#L65

We spent an entire day auditing those back in new york last fall with
JupyterLab in mind and made very careful decisions about the naming of
those things. The short summary is that there are very subtle differences -
sometimes above/below makes sense, other times next/previous does.

Also, as much as possible, please follow the command naming conventions
that we created there in JupyterLab.

On Thu, Apr 7, 2016 at 2:55 PM, Sylvain Corlay notifications@github.com
wrote:

Btw, with @Carreau https://github.com/Carreau we re-discussed
jupyter/notebook#881 jupyter/notebook#881 at
the dev meeting.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#151 (comment)

Brian E. Granger
Associate Professor of Physics and Data Science
Cal Poly State University, San Luis Obispo
@ellisonbg on Twitter and GitHub
bgranger@calpoly.edu and ellisonbg@gmail.com

@ellisonbg
Copy link

Can someone summarize how selected/active are currently being used in
JupyterLab api?

On Thu, Apr 7, 2016 at 10:16 PM, Brian Granger ellisonbg@gmail.com wrote:

For the above/below and next/preview naming, please see the list of
action/command names in the existing notebook:

https://github.com/jupyter/notebook/blob/master/notebook/static/notebook/js/actions.js#L65

We spent an entire day auditing those back in new york last fall with
JupyterLab in mind and made very careful decisions about the naming of
those things. The short summary is that there are very subtle differences -
sometimes above/below makes sense, other times next/previous does.

Also, as much as possible, please follow the command naming conventions
that we created there in JupyterLab.

On Thu, Apr 7, 2016 at 2:55 PM, Sylvain Corlay notifications@github.com
wrote:

Btw, with @Carreau https://github.com/Carreau we re-discussed
jupyter/notebook#881 jupyter/notebook#881 at
the dev meeting.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#151 (comment)

Brian E. Granger
Associate Professor of Physics and Data Science
Cal Poly State University, San Luis Obispo
@ellisonbg on Twitter and GitHub
bgranger@calpoly.edu and ellisonbg@gmail.com

Brian E. Granger
Associate Professor of Physics and Data Science
Cal Poly State University, San Luis Obispo
@ellisonbg on Twitter and GitHub
bgranger@calpoly.edu and ellisonbg@gmail.com

@jasongrout
Copy link
Member

active indicates the current cell (i.e., has edit focus, or command
focus). It's the one with the border, the one shift-enter applies to, etc.

selected sets a selection property on the cell, and there can be more than
one cell selected. I think the current state of this PR has it so that
there can never be just one cell selected, and selected cells are always a
single contiguous block.

On Fri, Apr 8, 2016 at 1:17 AM Brian E. Granger notifications@github.com
wrote:

Can someone summarize how selected/active are currently being used in
JupyterLab api?

On Thu, Apr 7, 2016 at 10:16 PM, Brian Granger ellisonbg@gmail.com
wrote:

For the above/below and next/preview naming, please see the list of
action/command names in the existing notebook:

https://github.com/jupyter/notebook/blob/master/notebook/static/notebook/js/actions.js#L65

We spent an entire day auditing those back in new york last fall with
JupyterLab in mind and made very careful decisions about the naming of
those things. The short summary is that there are very subtle
differences -
sometimes above/below makes sense, other times next/previous does.

Also, as much as possible, please follow the command naming conventions
that we created there in JupyterLab.

On Thu, Apr 7, 2016 at 2:55 PM, Sylvain Corlay <notifications@github.com

wrote:

Btw, with @Carreau https://github.com/Carreau we re-discussed
jupyter/notebook#881 jupyter/notebook#881 at
the dev meeting.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
<
#151 (comment)

Brian E. Granger
Associate Professor of Physics and Data Science
Cal Poly State University, San Luis Obispo
@ellisonbg on Twitter and GitHub
bgranger@calpoly.edu and ellisonbg@gmail.com

Brian E. Granger
Associate Professor of Physics and Data Science
Cal Poly State University, San Luis Obispo
@ellisonbg on Twitter and GitHub
bgranger@calpoly.edu and ellisonbg@gmail.com


You are receiving this because you were mentioned.

Reply to this email directly or view it on GitHub
#151 (comment)

@blink1073
Copy link
Contributor Author

As it stands, the "active" cell is considered selected, as in isSelected() will check to see if it is the active cell index, so there is always at least one cell selected.

@blink1073 blink1073 force-pushed the multiple-selection branch from 457a0a9 to 145dcec Compare April 8, 2016 13:49
@jasongrout
Copy link
Member

Thanks for clarifying, @blink1073

@jasongrout
Copy link
Member

A fresh checkout of the repo, plus the "command line instructions" above to merge this into master, gives this when running npm run build:example

src/index.ts(85,7): error TS2322: Type 'JavascriptRenderer' is not assignable to type 'IRenderer<Widget>'.
  Types of property 'render' are incompatible.
    Type '(mimetype: string, data: string) => Widget' is not assignable to type '(mimetype: string, data: string) => Widget'.
      Type 'Widget' is not assignable to type 'Widget'.
        Types of property 'layout' are incompatible.
          Type 'Layout' is not assignable to type 'Layout'.
            Property 'initialize' is protected but type 'Layout' is not a class derived from 'Layout'.
src/index.ts(89,47): error TS2345: Argument of type 'RenderMime<Widget>' is not assignable to parameter of type 'RenderMime<Widget>'.
  Types of property 'clone' are incompatible.
    Type '() => RenderMime<Widget>' is not assignable to type '() => RenderMime<Widget>'.
      Type 'RenderMime<Widget>' is not assignable to type 'RenderMime<Widget>'.

@jasongrout
Copy link
Member

Here are the conflicts I have when I install:

npm WARN unavoidable conflict lodash { '[snip]/jupyter-js-notebook/node_modules/jupyter-js-ui/node_modules/ansi-to-html/node_modules/karg/node_modules/lodash': '4.9.0',
npm WARN unavoidable conflict   '[snip]/jupyter-js-notebook/node_modules/jupyter-js-ui/node_modules/ansi-to-html/node_modules/karg/node_modules/noon/node_modules/simple-plist/node_modules/plist/node_modules/xmlbuilder/node_modules/lodash': '3.10.1' }
npm WARN unavoidable conflict Not de-duplicating
esnextguardian@1.2.1 node_modules/ansi-to-html/node_modules/karg/node_modules/noon/node_modules/cson/node_modules/esnextguardian
backbone@1.2.0 node_modules/backbone
└── underscore@1.8.3
underscore@1.8.3 node_modules/underscore

> fsevents@1.0.11 install [snip]/jupyter-js-notebook/node_modules/karma/node_modules/chokidar/node_modules/fsevents
> node-pre-gyp install --fallback-to-build

[fsevents] Success: "[snip]/jupyter-js-notebook/node_modules/karma/node_modules/chokidar/node_modules/fsevents/lib/binding/Release/node-v46-darwin-x64/fse.node" is installed via remote

> fsevents@1.0.11 install [snip]/jupyter-js-notebook/node_modules/webpack/node_modules/watchpack/node_modules/chokidar/node_modules/fsevents
> node-pre-gyp install --fallback-to-build

[fsevents] Success: "[snip]/jupyter-js-notebook/node_modules/webpack/node_modules/watchpack/node_modules/chokidar/node_modules/fsevents/lib/binding/Release/node-v46-darwin-x64/fse.node" is installed via remote

> jupyter-js-notebook@0.17.1 postinstall [snip]/app/tmp
> npm dedupe

npm WARN unavoidable conflict lodash { '[snip]/jupyter-js-notebook/node_modules/jupyter-js-ui/node_modules/ansi-to-html/node_modules/karg/node_modules/lodash': '4.9.0',
npm WARN unavoidable conflict   '[snip]/jupyter-js-notebook/node_modules/jupyter-js-ui/node_modules/ansi-to-html/node_modules/karg/node_modules/noon/node_modules/simple-plist/node_modules/plist/node_modules/xmlbuilder/node_modules/lodash': '3.10.1' }
npm WARN unavoidable conflict Not de-duplicating
npm WARN unavoidable conflict jupyter-js-services { '[snip]/jupyter-js-notebook/node_modules/jupyter-js-services': '0.7.1',
npm WARN unavoidable conflict   '[snip]/jupyter-js-notebook/node_modules/jupyter-js-ui/node_modules/jupyter-js-services': '0.6.6' }
npm WARN unavoidable conflict Not de-duplicating

@blink1073
Copy link
Contributor Author

Are you using node 5?

@jasongrout
Copy link
Member

Nope, 4.2.4.

On Fri, Apr 8, 2016 at 7:56 PM Steven Silvester notifications@github.com
wrote:

Are you using node 5?


You are receiving this because you were mentioned.

Reply to this email directly or view it on GitHub
#151 (comment)

@blink1073
Copy link
Contributor Author

Let me try rebasing, Darian had patched something this morning.

@blink1073 blink1073 force-pushed the multiple-selection branch from 145dcec to 0c7995f Compare April 9, 2016 00:11
@blink1073
Copy link
Contributor Author

Rebased.

@jasongrout
Copy link
Member

I'm also looking at merging your jupyter-js-ui PR and upgrading
jupyer-js-ui.

On Fri, Apr 8, 2016 at 8:11 PM Steven Silvester notifications@github.com
wrote:

Let me try rebasing, Darian had patched something this morning.


You are receiving this because you were mentioned.

Reply to this email directly or view it on GitHub
#151 (comment)

@jasongrout
Copy link
Member

I get the same errors with the rebased branch. It still looks to me like there is a dedupe-type problem.

@blink1073
Copy link
Contributor Author

Hmm, you can either upgrade to node 5 or we can wait for phosphor-ui ;)

@jasongrout
Copy link
Member

I'm going to hammer on this for a bit. The error clearly indicates there are some mismatched version numbers that are causing duplication.

@blink1073
Copy link
Contributor Author

Try running npm update now and see if that fixes it.

@blink1073
Copy link
Contributor Author

Actually, you may have to nuke node_modules.

@jasongrout
Copy link
Member

I've been killing node modules every time. I'll try with the updated
dependencies.

On Fri, Apr 8, 2016, 20:58 Steven Silvester notifications@github.com
wrote:

Try running npm update now and see if that fixes it.


You are receiving this because you were mentioned.

Reply to this email directly or view it on GitHub
#151 (comment)

@jasongrout
Copy link
Member

All right, trying with node 5.10.1 worked fine, so I'll merge this and keep digging about the problem on node 4.x. Thanks!

@jasongrout jasongrout merged commit f1b9cd0 into jupyter:master Apr 9, 2016
@blink1073 blink1073 deleted the multiple-selection branch April 14, 2016 19:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants