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

Zenmode Optional Header and Menubar #1062

Merged
merged 15 commits into from
Sep 10, 2017
Merged

Conversation

soamaven
Copy link
Contributor

I tweaked the Zenmode extension to be able to show the header and menubar. I was getting annoyed from having to exit Zenmode everytime I wanted to access the menubar, so I thought I'd make it an option. Did the same for header because it was easy.

Also, from everything I can tell this extension is 5.x compatible.

@jcb91
Copy link
Member

jcb91 commented Aug 26, 2017

Mainly looks reasonable, but should it also affect the unhiding behaviour? Perhaps just restoring them to their pre-zen state? Perhaps I'm overthinking this though...

@soamaven
Copy link
Contributor Author

soamaven commented Aug 26, 2017

I don't understand. All the js should do is toggle the hidden flag on the header and menubar. Can you elaborate on what you mean affect the unhiding behaviour and restoring their pre-zen state? This is to keep the nice background of zen while having easy access to the menubar (for things like 'close and halt')

@jcb91
Copy link
Member

jcb91 commented Aug 26, 2017

Well, as it currently stands, the modified version now only hides the menubar/header as set by the config. However, when zen is toggled off again, it will unhide both again (circa line 73), regardless of what state they started in. This could be annoying if, for example, one wished zen to just not affect the menubar at all, and set that independently. Perhaps this level of detail is unimportant though, since in that case I'd have to have been prepared to manually hide/unhide the menubar anyway!

@jcb91
Copy link
Member

jcb91 commented Aug 26, 2017

Anyway, I'm happy to merge as-is, but you'll need a quick release/merge to handle the recent change to config loading 😄

@soamaven
Copy link
Contributor Author

However, when zen is toggled off again, it will unhide both again (circa line 73), regardless of what state they started in.

I understand what you mean. That could get annoying if I had header hidden, went zen, and then back out of zen to find the header. I unfortunately don't know how to fix this, but this is how Zenmode operates currently anyway, so it's not decreasing functionality.

The new config loading breaks the functionality... I am not sure what's going on. Before I just mimicked the config loading of the other options, and it worked fine.

@jcb91
Copy link
Member

jcb91 commented Aug 26, 2017

this is how Zenmode operates currently anyway, so it's not decreasing functionality

True, I was being overly picky, this can wait till somebody reports being inconvenienced by it.

The new config loading breaks the functionality... I am not sure what's going on. Before I just mimicked the config loading of the other options, and it worked fine.

Ah... do you mean that the new loading breaks all functionality, or just the bit you've added? Could you push your merged/rebased branch so I can take a look?

@soamaven
Copy link
Contributor Author

or just the bit you've added?

Yeah just the added bits

Could you push your merged/rebased branch so I can take a look?

Done.

Copy link
Member

@jcb91 jcb91 left a comment

Choose a reason for hiding this comment

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

So it looks like rather than merging, you've essentially just gone back to the version before the new config loading mechanism - see individual comments for further details. I can't see an obvious reason why the new behaviour would be broken, but let's get the merge sorted first before we drill down into that!

"base/js/events"
"base/js/events",
'base/js/utils',
'services/config',
Copy link
Member

Choose a reason for hiding this comment

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

None of this hunk is needed, this was changed for the new config loading mechanism

Copy link
Member

Choose a reason for hiding this comment

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

Apologies, when I said "None of this hunk is needed", I meant "none of the changes in this hunk", we still need the events module 😅

events
events,
utils,
configmod
Copy link
Member

Choose a reason for hiding this comment

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

Also not needed (see above)

) {
"use_strict";

var base_url = utils.get_body_data("baseUrl");
var config = new configmod.ConfigSection('notebook', {base_url: base_url});

Copy link
Member

Choose a reason for hiding this comment

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

Also unnecessary now we have the new loading mechanism

@@ -139,7 +161,7 @@ define([
config.data.zenmode_set_zenmode_on_load ? true : false
);
}
};
});
Copy link
Member

Choose a reason for hiding this comment

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

This change isn't needed.

@@ -156,7 +178,7 @@ define([
'zenmode-btn-grp'
);
$("#maintoolbar-container").prepend($('#zenmode-btn-grp'));
return IPython.notebook.config.loaded.then(initialize);
config.load();
Copy link
Member

Choose a reason for hiding this comment

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

This change should be reverted

@@ -111,8 +120,21 @@ define([
if (getZenModeActive() != active) { toggleZenMode(background); }
};

var initialize = function () {
var config = IPython.notebook.config;
config.loaded.then(function() {
Copy link
Member

Choose a reason for hiding this comment

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

This (old lines 114,115 replaced by new 123) needs reverting

hide_menubar = false;
}
}

Copy link
Member

Choose a reason for hiding this comment

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

This bit (new lines 124-137) is still fine :)

@soamaven
Copy link
Contributor Author

soamaven commented Sep 4, 2017

So it looks like rather than merging, you've essentially just gone back to the version before the new config loading mechanism - see individual comments for further details. I can't see an obvious reason why the new behaviour would be broken, but let's get the merge sorted first before we drill down into that!

Sorry. Self taught here. Git is easy to use if you stay in the shallows, but the drop-off is steep. I understand the request now.

So I rebased onto the latest commit. I added in the options, and those can be seen in the configurator. This happens due to the yaml file being correct, so that's not surprising.

The main.js though, doesn't work. None of the options are being implemented, including older ones such as "Set zenmode on when a notebook opens". Going to try to hunt down a bug in the new loader, that seems likely to be the issue, no? Merge pushed according to your comments.

Working now! Pushed commit. Should be as desired.

Also, where can i find the debug log? Reinstalling the extension with --debug isn't giving anything to the console. Starting up with jupyter notebook --debug doesn't give much information either. I imagine this would have saved me some time.

], function(
require,
$,
IPython,
events
Copy link
Member

Choose a reason for hiding this comment

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

The events object is needed in new line 107, so this message to go back in. Everything else looks good :)

@jcb91
Copy link
Member

jcb91 commented Sep 4, 2017

Sorry. Self taught here. Git is easy to use if you stay in the shallows, but the drop-off is steep. I understand the request now.

No worries! Definitely, my apologies, I probably should have provided a better explanation of what I meant!

Also, where can i find the debug log? Reinstalling the extension with --debug isn't giving anything to the console. Starting up with jupyter notebook --debug doesn't give much information either. I imagine this would have saved me some time.

So, for the JavaScript nbextensions, any useful logs will be in the browser's
javascript console. Sometimes you can also get useful information from the server logs when running jupyter notebook --debug, such as which is & CSS files are being requested by the browser.

Thanks for your persistence and patience on this! 😄

@jcb91
Copy link
Member

jcb91 commented Sep 10, 2017

@soamaven apologies for the delay looking at this, but anyway, it looks good now! 👍

@jcb91 jcb91 merged commit 5f97333 into ipython-contrib:master Sep 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants