-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Disable ForeignHandler by default and add command console:toggle-echo to enable ForeighHandler through context menu #4503
Conversation
… to enable ForeighHandler through context menu jupyterlab#4424
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I've noted some things inline. This was surprisingly straightforward - a testament to @afshin's design.
@@ -399,6 +402,17 @@ function activateConsole(app: JupyterLab, mainMenu: IMainMenu, palette: ICommand | |||
isEnabled | |||
}); | |||
|
|||
commands.addCommand(CommandIDs.toggleEcho, { | |||
label: 'Toggle echo…', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We reserve the ellipsis for commands that require further confirmation, like a dialog box. Since this doesn't require further confirmation, we shouldn't have the ellipsis here.
@@ -148,7 +148,7 @@ describe('@jupyterlab/console', () => { | |||
describe('#enabled', () => { | |||
|
|||
it('should default to `true`', () => { | |||
expect(handler.enabled).to.be(true); | |||
expect(handler.enabled).to.be(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test label is now 'should default to `false`'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test below should probably explicitly set handler.enabled = true
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right. handler.enabled = true;
is added below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, somehow I didn't submit my biggest comment.
packages/console/src/widget.ts
Outdated
* Toggle ForeignHandler | ||
*/ | ||
toggleForeignHandler() { | ||
this._foreignHandler.enabled = ! this._foreignHandler.enabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of a toggle, can we just expose this boolean attribute using a get/set pair? Maybe it could be named .echoForeignData
or simply just .echo
- not sure about a good name?
I think the toggling logic should be in the command, and at this level, it makes more sense to have the strictly more general get/set pair creating a new attribute exposing the enabled attribute.
PR revised according to @jasongrout 's comments. Tests failed due to some sort of timeout error, which I do not know how to address. |
I slept on the name - how about Even better would be calling the menu item "Show all [kernel?] activity", but I think the command palette doesn't support having a checkmark showing state next to an item? @sccolbert, @ian-r-rose? |
@jasongrout That's right. Since the command palette doesn't render check marks, we have used that pattern in a bunch of places. It is accomplished by passing in an jupyterlab/packages/application-extension/src/index.tsx Lines 280 to 285 in afe47dd
I like |
Note that the |
|
Hmmm - then it sounds to me like the default should be showing all activity, and you should check the box to narrow to just this console. And it's a bit confusing if you have two consoles sending things to the same kernel - it sounds a bit like it should show all activity from any console. The other thing I thought of was something along the lines of "Show other activity" - but I like your concentration on showing just my activity language over the word "other". |
@sccolbert - how hard would it be to show the state as a checkmark in the command palette, like in the menus? |
The issue I see with the phrasing that emphasizes "my" or "this" is that a user probably won't have any idea what the "other" is. Even "other activity" isn't really descriptive as to what that "other" thing is. I would prefer something more descriptive to the user that also addresses the usability of the changed default, like "show all kernel activity from all attached notebooks/consoles." I know that is too long... |
"Show all other kernel activity"? |
Yes, that is great!
…On Tue, May 1, 2018 at 11:21 AM, Jason Grout ***@***.***> wrote:
"Show all other kernel activity"?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#4503 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABr0PwBsXqv8z0WgELQpJoYXZV-02deks5tuKe-gaJpZM4TtgbZ>
.
--
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
|
I am personally not a fan of "other", since it is not especially clear what that is opposed to, but I don't consider that blocking. @BoPeng, can you capitalize the words in the label for consistency with the other menu items? |
Changed but I would vote for "Show All Kernel Activity". |
I agree with that. |
Done again. Hopefully this is acceptable to everyone. |
Note that I cannot make change of label work with the following change. diff --git a/packages/console-extension/src/index.ts b/packages/console-extension/src/index.ts
index 6835ebae5..3d3b3cf0b 100644
--- a/packages/console-extension/src/index.ts
+++ b/packages/console-extension/src/index.ts
@@ -403,7 +403,8 @@ function activateConsole(app: JupyterLab, mainMenu: IMainMenu, palette: ICommand
});
commands.addCommand(CommandIDs.toggleShowAllActivity, {
- label: args => 'Show All Kernel Activity',
+ //label: args => 'Show All Kernel Activity',
+ label: args => args['isPalette'] ? 'Show All Kernel Activity' : 'Show Only Console Activity',
execute: args => {
let current = getCurrent(args);
if (!current) { |
You can make it so that the label is context dependent: the arg This is only relevant if you are actually adding the command to the command palette, which, as far as I cant tell, you have not done here. |
Line 430 adds When I trace the label function, it was called with |
Ah, yes, so it does. If |
I see the wrong label (the last part of ? : ) all the time because |
I think we are talking past each other: the command palette (the panel in the the left area) is the part that gets the args
If those two things are different, you can try to distinguish between them by passing different |
Phew, I see what is going on now. We currently have a fixed label |
Now I see that you were not talking about that behavior. Rather to show different labels in context menu and command palette, and there is a problem with showing the status in command palette because the checkmark is not rendered there. Are we on the same pace now? |
Right, that is what I was referring to. Since the command palette does not render checkmarks (at least for now, I would like to change that), the label there would not be really correct. So I am proposing
|
Done. I suppose that is no remaining issue with this PR. |
Inspired by the confusion here, and the workarounds that @ian-r-rose has had to do as well, perhaps we should merge @ian-r-rose's PR at #4510 first that simplifies the commands added to the palette, and then update this PR. On the other hand, if this passes tests now, I'm happy to merge it and update the palette command later along with a lot of other commands. |
I am happy to do either. If we merge this first, I can update the content here in my PR. |
The tests should pass because the Travis test that failed last time has passed and appvoyer passed last time. |
Long delay at AppVoyer but all tests have passed now. |
Thanks @BoPeng, I think this is a nice improvement on the default behavior. |
Thanks again! |
You all are very welcome! |
This patch disables
ForeignHandler
in console window by default so expressions evaluated in notebooks will not be echoed in associated console window. A commandconsole:toggle-echo
is added to the context menu to allow echo.See details in #4424