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

Hacking a JupyterLab Fix #139

Open
psychemedia opened this issue Jul 25, 2022 · 2 comments
Open

Hacking a JupyterLab Fix #139

psychemedia opened this issue Jul 25, 2022 · 2 comments

Comments

@psychemedia
Copy link
Contributor

psychemedia commented Jul 25, 2022

nbev3devsim will display in a sidecar widget in the following circumstances:

  • launch jp_proxy_widget repo using MyBinder [here]; ensure that the URL is trusted as far as Ghiotery is concerned, or the Lab doesn't render;
  • install sidecar from the repo, NOT pypi;

Issues:

  • trying to load a background gives a 404; we really need to find how to bundle the images in a proper location that so they can be loaded into the simulator;
  • there are a couple of references to Jupyter object, relating to handling of mouseenter (Jupyter.keyboard_manager.disable()) and mopuseleave (Jupyter.keyboard_manager.enable()) events.
@psychemedia
Copy link
Contributor Author

Background image URL of form:

https://hub-binder.mybinder.ovh/user/aaronwatters-jp_proxy_widget-hu222s29/files/nb_backgrounds/_loop.png

Background image URL 404s with the form:

https://hub-binder.mybinder.ovh/nb_backgrounds/_grey_and_black.png

So we need to find the /user/aaronwatters-jp_proxy_widget-hu222s29/files path somewhere. Or find a way to go relative to that?

In the head there is a cript tag w/ config info?

<script id="jupyter-config-data" type="application/json">
    {"allow_hidden_files": false, "appName": "JupyterLab", "appNamespace": "lab", 
"appSettingsDir": "/srv/conda/envs/notebook/share/jupyter/lab/settings", 
"appUrl": "/lab", "appVersion": "3.4.4", "asset_url": "", 
"baseUrl": "/user/aaronwatters-jp_proxy_widget-hu222s29/",
 "buildAvailable": true, "buildCheck": true, "cacheFiles": false, "collaborative": false,
 "devMode": false, "disabledExtensions": [], "exposeAppInBrowser": false, 
"extraLabextensionsPath": [], 
"federated_extensions": [{"extension": "./extension", "load": "static/remoteEntry.fc1c31abb754cd005250.js", "name": "jupyterlab_pygments", "style": "./style"}, {"extension": "./extension", "load": "static/remoteEntry.cb73ba563cb859c17504.js", "name": "jupyter-offlinenotebook", "style": "./style"}, {"extension": "./extension", "load": "static/remoteEntry.0f47a9a97e7ce6a3c959.js", "name": "jupyterlab-stickyland", "style": "./style"}, {"extension": "./extension", "load": "static/remoteEntry.3421943a0ce73f10909d.js", "name": "@jupyter-widgets/jupyterlab-manager"}, {"extension": "./extension", "load": "static/remoteEntry.67bb198e0cc8ce904343.js", "name": "@jupyter-widgets/jupyterlab-sidecar"}, {"extension": "./extension", "load": "static/remoteEntry.b4fdbac59195db951ba7.js", "name": "@jupyter-server/resource-usage"}], 
"fullAppUrl": "/user/aaronwatters-jp_proxy_widget-hu222s29/lab",
 "fullLabextensionsUrl": "/user/aaronwatters-jp_proxy_widget-hu222s29/lab/extensions", "fullLicensesUrl": "/user/aaronwatters-jp_proxy_widget-hu222s29/lab/api/licenses", "fullListingsUrl": "/user/aaronwatters-jp_proxy_widget-hu222s29/lab/api/listings", "fullMathjaxUrl": "/user/aaronwatters-jp_proxy_widget-hu222s29/static/components/MathJax/MathJax.js", "fullSettingsUrl": "/user/aaronwatters-jp_proxy_widget-hu222s29/lab/api/settings", "fullStaticUrl": "/user/aaronwatters-jp_proxy_widget-hu222s29/static/lab", "fullThemesUrl": "/user/aaronwatters-jp_proxy_widget-hu222s29/lab/api/themes", 
"fullTranslationsApiUrl": "/user/aaronwatters-jp_proxy_widget-hu222s29/lab/api/translations", 
"fullTreeUrl": "/user/aaronwatters-jp_proxy_widget-hu222s29/lab/tree", "fullWorkspacesApiUrl": "/user/aaronwatters-jp_proxy_widget-hu222s29/lab/api/workspaces",
 "ga_code": "", "ignorePlugins": [], "labextensionsPath": ["/home/jovyan/.local/share/jupyter/labextensions", "/srv/conda/envs/notebook/share/jupyter/labextensions", "/usr/local/share/jupyter/labextensions", "/usr/share/jupyter/labextensions"],
 "labextensionsUrl": "/lab/extensions", "licensesUrl": "/lab/api/licenses", "listingsUrl": "/lab/api/listings", "mathjaxConfig": "TeX-AMS-MML_HTMLorMML-full,Safe", "mode": "multiple-document", "notebookStartsKernel": true, "notebookVersion": "[1, 16, 0, \"\", \"\"]",
 "preferredPath": "/", "quitButton": true, "schemasDir": "/srv/conda/envs/notebook/share/jupyter/lab/schemas",
 "serverRoot": "/home/jovyan", "settingsUrl": "/lab/api/settings", "staticDir": "/srv/conda/envs/notebook/share/jupyter/lab/static",
 "store_id": 5, "templatesDir": "/srv/conda/envs/notebook/share/jupyter/lab/static", "terminalsAvailable": true, 
"themesDir": "/srv/conda/envs/notebook/share/jupyter/lab/themes", "themesUrl": "/lab/api/themes", "token": "Ry4eYfOUSSq6lwyciYb53g",
 "translationsApiUrl": "/lab/api/translations", "treePath": "nb_backgrounds/_loop.png", "treeUrl": "/lab/tree",
 "userSettingsDir": "/home/jovyan/.jupyter/lab/user-settings", "workspace": "default", "workspacesApiUrl": "/lab/api/workspaces",
 "workspacesDir": "/home/jovyan/.jupyter/lab/workspaces", "wsUrl": ""}
  </script>

If we can access the baseURL somehow, then we should be able to resolve the image paths.

@psychemedia
Copy link
Contributor Author

Need to fix the path to the background images here:

var _basepath_ix = path_elements.findIndex(element=> element==="notebooks")+1;

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

No branches or pull requests

1 participant