extension-examples icon indicating copy to clipboard operation
extension-examples copied to clipboard

Example for showing save as dialog

Open stefaneidelloth opened this issue 5 years ago • 9 comments

Please provide an extension example for showing a "Save as ..." dialog. Also see

https://github.com/jupyterlab/jupyterlab/issues/9271

stefaneidelloth avatar Nov 15 '20 13:11 stefaneidelloth

Thanks @stefaneidelloth for the suggestion.

Maybe this could be part of a more general dialog example that would also show other types of input dialogs:

image

jtpio avatar Dec 23 '20 16:12 jtpio

Is this issue still open?? I want to work ..

NoobMaster1999 avatar Aug 20 '21 21:08 NoobMaster1999

@NoobMaster1999 You definitely can. Do you need pointers and/or suggestion?

fcollonval avatar Aug 21 '21 09:08 fcollonval

Yes please

NoobMaster1999 avatar Aug 21 '21 09:08 NoobMaster1999

Ok a story could be the following:

  • Open a file test.example using getOpenFiles https://github.com/jupyterlab/jupyterlab/blob/0820455e14586e75b27fc2de80ce30683ce6d7a7/packages/filebrowser/src/opendialog.ts#L73
  • Open the picked up file
  • ~~Click a :heavy_plus_sign: toolbar button~~
  • Prompts to pick up the type of value to enter using getItem
    The possible value will be boolean, number, text or password https://github.com/jupyterlab/jupyterlab/blob/0820455e14586e75b27fc2de80ce30683ce6d7a7/packages/apputils/src/inputdialog.ts#L146
  • Prompts with the appropriate get... function for the value
  • Add the value to the file
  • ~~Click a :floppy_disk: toolbar button~~
  • Prompts with a save as dialog
    That dialog does not exists but we could extend getOpenFiles
  • Save the file

Tip: start by duplicating the hello-world example (and renaming dialogs).

Example of interest:

  • getOpenFile: https://github.com/fcollonval/jupyter-project/blob/91d208b729529b59d9a87f88c6977b46dd44e9c2/src/project.ts#L697
  • getItem: https://github.com/jupyterlab/extension-examples/blob/92e08148a59ee18420cdc22abff279f52d15cc8c/state/src/index.ts#L36
  • getText: https://github.com/jupyterlab/extension-examples/blob/92e08148a59ee18420cdc22abff279f52d15cc8c/kernel-output/src/index.ts#L97

Don't hesitate to open a draft PR early to get help.

Edited: remove toolbar buttons to simplify the example.

fcollonval avatar Aug 21 '21 10:08 fcollonval

@fcollonval I just open a PR can you just review it?

NoobMaster1999 avatar Aug 26 '21 21:08 NoobMaster1999

I'm not sure to get where the PR was opened. Could you provide a link to it @NoobMaster1999 ?

fcollonval avatar Aug 27 '21 13:08 fcollonval

PR: https://github.com/jupyterlab/jupyterlab/pull/10931

NoobMaster1999 avatar Aug 27 '21 13:08 NoobMaster1999

Hey I was wondering if/how easy it would be have an InputDialog that requests several values rather than just one

luis-chaves-visa avatar Jul 13 '22 20:07 luis-chaves-visa