Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent render Input Prompt #5883

Open
msuperina opened this issue Jan 18, 2019 · 3 comments
Open

Prevent render Input Prompt #5883

msuperina opened this issue Jan 18, 2019 · 3 comments
Labels
Milestone

Comments

@msuperina
Copy link

msuperina commented Jan 18, 2019

I am writing a notebook client which runs in a web context, following the notebook example.

I have an autorun mode where on load all the cells should be run automatically. Toolbar items and input prompts should be hidden. This question is specific to Input prompts.

At the moment I am preventing the rendering of input prompts by changing the contentFactory injected as configuration into the NotebookWidgetFactory. I am subclassing NotebookPanel.ContentFactory and overriding createInputPrompt to return a widget that I manually dispose right after its creation.

class NoInputContentFactory extends NotebookPanel.ContentFactory {
    constructor(options: Cell.ContentFactory.IOptions) {
        super(options);
    }
    createInputPrompt() { return new NoInputPrompt(); }
}

class NoInputPrompt extends Widget implements IInputPrompt {
    executionCount: string;
    constructor() {
        super();
        this.dispose();
        this.executionCount = "";
    }
}

I have not found another approach so far, and was wondering is this right ?

PS: is there any way to add a Question tag when opening an issue ?

@msuperina msuperina changed the title Prevent render Input Promt Prevent render Input Prompt Jan 18, 2019
@jasongrout jasongrout added this to the Reference milestone Jan 18, 2019
@jasongrout
Copy link
Contributor

You can also hide the widget using this.hide()- it's not leaking anything since you are rendering it without any text. I'm not sure, but the cell itself may rely on having a valid input widget (i.e., not disposed).

CC also @SylvainCorlay, who does similar things with voila

@jasongrout
Copy link
Contributor

@meeseeksdev tag type:Question

@jasongrout
Copy link
Contributor

You can't manually set the tags, but you can ask the bot to do it like I did above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants