Skip to content

Commit

Permalink
Improve Notebook 7 functionality and testing (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
bollwyvl authored Dec 12, 2023
1 parent cb67d32 commit c7882ea
Show file tree
Hide file tree
Showing 30 changed files with 1,476 additions and 822 deletions.
3 changes: 1 addition & 2 deletions .binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ dependencies:
### environment-build.yml ###
### environment-lint.yml ###
# formatters
- black
- ssort
- ruff
- robotframework-tidy >=3.3
Expand All @@ -50,7 +49,7 @@ dependencies:
- pytest-check-links
# lite
- python-libarchive-c
- jupyterlite-core ==0.2.0
- jupyterlite-core ==0.2.1
- jupyterlite-pyodide-kernel ==0.2.0
### environment-docs.yml ###
### environment-test.yml ###
Expand Down
2 changes: 1 addition & 1 deletion .github/environment-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ dependencies:
- pytest-check-links
# lite
- python-libarchive-c
- jupyterlite-core ==0.2.0
- jupyterlite-core ==0.2.1
- jupyterlite-pyodide-kernel ==0.2.0
### environment-docs.yml ###
1 change: 0 additions & 1 deletion .github/environment-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ dependencies:
### environment-build.yml ###
### environment-lint.yml ###
# formatters
- black
- ssort
- ruff
- robotframework-tidy >=3.3
Expand Down
1 change: 0 additions & 1 deletion .github/requirements-build.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
black
doit[toml]
flit
jupyterlab >=4.0.7,<5
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ jobs:
${{ env.CACHE_EPOCH }}-${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
- name: install (conda)
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
environment-file: .binder/environment.yml
miniforge-variant: Mambaforge
Expand Down Expand Up @@ -225,7 +225,7 @@ jobs:
${{ env.CACHE_EPOCH }}-${{ runner.os }}-conda-test-${{ matrix.python-version }}-
- name: install (conda)
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
python-version: ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
${{ env.CACHE_EPOCH }}-${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
- name: install (conda)
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
environment-file: .binder/environment.yml
miniforge-variant: Mambaforge
Expand Down
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<!-- this README can be viewed as a slideshow in jupyterlab-deck -->

---

# `jupyterlab-deck`

| docs | install | extend | demo | ci |
Expand Down Expand Up @@ -31,6 +35,8 @@

> Lightweight presentations for JupyterLab
---

## Installing

```bash
Expand All @@ -47,6 +53,8 @@ mamba install -c conda-forge jupyterlab-deck # or conda, if you must
[contributing]: https://github.com/deathbeds/jupyterlab-deck

---

### Uninstalling

```bash
Expand All @@ -59,8 +67,12 @@ or
mamba remove jupyterlab-deck # or conda if you must
```

---

## Usage

---

### Get started

After [installing](#installing), open or create a _Notebook_.
Expand All @@ -79,6 +91,8 @@ After [installing](#installing), open or create a _Notebook_.
In _Deck Mode_, until you configure any [slide types](#slides), all of your content
should appear in a vertically-scrollable stack.

---

#### Remote

> In _Deck Mode_, navigate with:
Expand All @@ -92,6 +106,8 @@ should appear in a vertically-scrollable stack.
> - <kbd>space</kbd> = <kbd>↓</kbd>, _or_ <kbd>→</kbd>
> - <kbd>shift+space</kbd> = <kbd>↑</kbd>, _or_ <kbd>←</kbd>
---

#### Revealing JupyterLab UX Features

Many of the core JupyterLab UI elements are still available, but hidden by default.
Expand All @@ -100,6 +116,8 @@ Hover over their usual places to reveal them. These include:
- the right and left sidebar
- the _Notebook Toolbar_

---

#### Hidden JupyterLab UX Features

Some elements are _not_ visible, and cannot be revealed:
Expand All @@ -117,13 +135,17 @@ Some elements are _not_ visible, and cannot be revealed:
> - use the [slide layout tools](#slide-layout) to customize the position and size of
> cells
---

#### Exiting Deck Mode

> To exit _Deck Mode_:
>
> - from the remote, click the ![deck-icon]
> - open the [_Command Palette_][command-palette] and run _Stop Deck_
---

### Slides

Build a slideshow by changing the _slideshow type_ per cell using the [_Property
Expand All @@ -145,6 +167,8 @@ Inspector_ sidebar][property-inspector] or the [design tools][design-tools].
[deck-icon]:
https://raw.githubusercontent.com/deathbeds/jupyterlab-deck/main/js/jupyterlab-deck/style/img/deck.svg

---

### Layers

> Pick a layer type from:
Expand All @@ -163,6 +187,8 @@ following _scopes_:
| `slide` | show until the next `slide` _or_ `subslide` |
| `fragment` | only show until the next `fragment` |

---

### Design Tools

> In [Deck mode](#deck-mode), click the _ellipsis_ icon in the bottom left corner
Expand All @@ -182,6 +208,8 @@ The design tools offer lightweight buttons to:
- higher is bigger
- un-check the checkbox to restore to the defaults

---

### Slide Layout

> After opening the [design tools](#design-tools), click the _Show Layout_ button
Expand All @@ -193,21 +221,31 @@ anywhere on the screen, but it will keep the same navigation index.

The keyboard shortcuts and remote should still function as normal.

---

#### Moving Parts

Click and drag a part overlay to move the part underneath.

---

#### Resizing Parts

Click one of the _handles_ in the corners of the part overlay to resize a part.

---

#### Reverting Part Move/Resize

After moving a part to a fixed position, click the **** button on a part overlay to
restore the part to the default layout.

---

## Configuration

---

### Enabling Deck Mode at startup

- see the JupyterLab docs about [settings `overrides.json`][overrides].
Expand All @@ -223,25 +261,35 @@ restore the part to the default layout.
[overrides]:
https://jupyterlab.readthedocs.io/en/stable/user/directories.html#overrides-json

---

## Frequently Asked Questions

---

### Does it work with `notebook 6` aka classic?

**No.** Use [RISE](https://github.com/damianavila/RISE/).

---

### Does it work with `notebook 7`?

**Mostly.** Navigating multiple documents during the same presentation will probably
never work, as this is incompatible with the one-document-at-a-time design constraint of
the Notebook UX. Each skip to another document will open a new browser tab, though deck
should be installed.

---

### Will it generate PowerPoint?

**No.** This would be a fine third-party extension which could consume notebook metadata
created by this extension, [jupyterlab-fonts], and `nbconvert`-compatible
[slides](#slides).

---

### Will it generate single-document static HTML presentations?

**No.** Use [`nbconvert`][nbconvert], but no [layers](#layers) or style customization
Expand All @@ -254,6 +302,8 @@ For a full static viewing experience, try something like [JupyterLite].

[jupyterlite]: https://github.com/jupyterlite/jupyterlite

---

### Will it generate PDF?

**Not yet.**
Expand Down
25 changes: 7 additions & 18 deletions atest/resources/Deck.resource
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,20 @@ ${ZERO_PAD} {0:03d}


*** Keywords ***
Start Deck With Notebook Toolbar Button
[Documentation] Use the notebook toolbar to start deck.
Start Deck With Toolbar Button
[Documentation] Use the toolbar to start deck.
Wait Until Element Is Not Visible css:${CSS_LAB_SPINNER} timeout=1s
Click Element css:${JLAB CSS ACTIVE DOC}
Click Element css:${CSS_DECK_NOTEBOOK_BUTTON}
Click Element css:${CSS_DECK_TOOLBAR_BUTTON}
Wait Until Element Is Visible css:${CSS_DECK_PRESENTING} timeout=1s
Wait Until Element Is Visible css:${CSS_DECK_VISIBLE} timeout=1s
Wait Until Element Is Visible css:${CSS_DECK_REMOTE} timeout=1s

Really Start Deck With Notebook Toolbar Button
[Documentation] REALLY use the notebook toolbar to start deck.
Really Start Deck With Toolbar Button
[Documentation] REALLY use the toolbar to start deck.
Send Error Screenshots To Trash
Wait Until Keyword Succeeds 5x 0.1s Start Deck With Notebook Toolbar Button
Wait Until Keyword Succeeds 5x 0.1s Start Deck With Toolbar Button
[Teardown] Resume Screenshots

Start Markdown Deck From Editor
[Documentation] Start a deck from a markdown editor with the context menu.
[Arguments] ${host}
Select From Context Menu ${CSS_LAB_EDITOR} li${CSS_LAB_CMD_MARKDOWN_PREVIEW}
Close JupyterLab Dock Panel Tab ${host}
Close JupyterLab Dock Panel Tab Launcher
Click Element css:${CSS_LAB_MARKDOWN_VIEWER}
Execute JupyterLab Command Start Deck
Wait Until Element Is Visible css:${CSS_DECK}
Click Element css:${CSS_DECK}

Select From Context Menu
[Documentation] Open the context menu and click an item.
[Arguments] ${host} ${item}
Expand Down
19 changes: 11 additions & 8 deletions atest/resources/DeckSelectors.resource
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
*** Settings ***
Documentation Selectors defined in this repo... could be loaded from JSON?
Resource ./LabSelectors.resource


*** Variables ***
# body
Expand All @@ -10,19 +12,20 @@ ${CSS_DECK_PRESENTING} [data-jp-deck-mode="presenting"]
${CSS_DECK} .jp-Deck

# remote
${CSS_DECK_STOP} .jp-Deck-Remote .jp-deck-mod-stop
${CSS_DECK_FORWARD} .jp-Deck-Remote .jp-deck-mod-direction-forward
${CSS_DECK_BACK} .jp-Deck-Remote .jp-deck-mod-direction-back
${CSS_DECK_UP} .jp-Deck-Remote .jp-deck-mod-direction-up
${CSS_DECK_DOWN} .jp-Deck-Remote .jp-deck-mod-direction-down
${CSS_DECK_DIR_STEM} .jp-Deck-Remote .jp-deck-mod-direction
${CSS_DECK_DIR_STACK} .jp-Deck-Remote .jp-Deck-Remote-WidgetStack
${CSS_DECK_REMOTE} .jp-Deck-Remote
${CSS_DECK_STOP} ${CSS_DECK_REMOTE} .jp-deck-mod-stop
${CSS_DECK_FORWARD} ${CSS_DECK_REMOTE} .jp-deck-mod-direction-forward
${CSS_DECK_BACK} ${CSS_DECK_REMOTE} .jp-deck-mod-direction-back
${CSS_DECK_UP} ${CSS_DECK_REMOTE} .jp-deck-mod-direction-up
${CSS_DECK_DOWN} ${CSS_DECK_REMOTE} .jp-deck-mod-direction-down
${CSS_DECK_DIR_STEM} ${CSS_DECK_REMOTE} .jp-deck-mod-direction
${CSS_DECK_DIR_STACK} ${CSS_DECK_REMOTE} .jp-Deck-Remote-WidgetStack

@{CSS_DECK_NEXT} down forward
@{CSS_DECK_PREV} up back

# notebook
${CSS_DECK_NOTEBOOK_BUTTON} .jp-ToolbarButtonComponent\[data-command="deck:toggle"]
${CSS_DECK_TOOLBAR_BUTTON} ${CSS_LAB_DOC_TOOLBAR_BTN}\[data-command="deck:toggle"]
${CSS_DECK_VISIBLE} .jp-deck-mod-visible
${CSS_DECK_ONSCREEN} .jp-deck-mod-onscreen

Expand Down
2 changes: 1 addition & 1 deletion atest/resources/Docs.resource
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Start Empty Notebook Deck
[Documentation] Start an empty deck
Launch A New JupyterLab Document
Wait Until JupyterLab Kernel Is Idle
Really Start Deck With Notebook Toolbar Button
Really Start Deck With Toolbar Button

Start Basic Notebook Deck
[Documentation] Make a few cells
Expand Down
4 changes: 3 additions & 1 deletion atest/resources/Lab.resource
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ Library JupyterLibrary
Initialize JupyterLab
[Documentation] Get the web app set up for testing.
${executable_path} = Get GeckoDriver Executable Path
Open JupyterLab executable_path=${executable_path}
Open JupyterLab
... executable_path=${executable_path}
... service_log_path=${OUTPUT_DIR}${/}geckodriver.log # this doesn't work yet
Initialize CodeMirror
Set Window Size 1366 768
Reload Page
Expand Down
8 changes: 6 additions & 2 deletions atest/resources/LabSelectors.resource
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Documentation Selectors that should maybe go upstream.

*** Variables ***
# # lumino ##
${CSS_LM_MOD_HIDDEN} .lm-mod-hidden
${CSS_LM_MOD_ACTIVE} .lm-mod-active
${CSS_LM_MENU_ITEM_LABEL} .lm-Menu-itemLabel
${CSS_LM_CLOSE_ICON} .lm-TabBar-tabCloseIcon
Expand All @@ -16,7 +17,6 @@ ${CSS_LAB_MOD_CMD} .jp-mod-commandMode
${CSS_LAB_MOD_ACTIVE} .jp-mod-active
${CSS_LAB_MOD_EDIT} .jp-mod-editMode
${CSS_LAB_MOD_RENDERED} .jp-mod-rendered
${CSS_LAB_MOD_HIDDEN} .lm-mod-hidden

# files
${CSS_LAB_FILES_HOME} .jp-BreadCrumbs-home
Expand All @@ -27,13 +27,17 @@ ${CSS_LAB_NOT_INTERNAL_ANCHOR} a[href*\="#"]:not([href^="https"]):not(${CSS
${CSS_LAB_TAB_NOT_CURRENT} .lm-DockPanel .lm-TabBar-tab:not(.jp-mod-current)

# docs
${CSS_LAB_DOC} .jp-Document
${CSS_LAB_DOC_VISIBLE} ${CSS_LAB_DOC}:not(${CSS_LM_MOD_HIDDEN})
${CSS_LAB_SPINNER} .jp-Spinner
${CSS_LAB_INTERNAL_ANCHOR} .jp-InternalAnchorLink
${CSS_LAB_TOOLBAR_BTN} .jp-ToolbarButtonComponent
${CSS_LAB_DOC_TOOLBAR_BTN} ${CSS_LAB_DOC_VISIBLE} ${CSS_LAB_TOOLBAR_BTN}

# meta
${CSS_LAB_ADVANCED_COLLAPSE} .jp-NotebookTools .jp-Collapse-header
${CSS_LAB_CELL_META_JSON} .jp-MetadataEditorTool
${CSS_LAB_CELL_META_JSON_HIDDEN} ${CSS_LAB_MOD_HIDDEN} ${CSS_LAB_CELL_META_JSON}
${CSS_LAB_CELL_META_JSON_HIDDEN} ${CSS_LM_MOD_HIDDEN} ${CSS_LAB_CELL_META_JSON}

# notebook
${CSS_LAB_NB_TOOLBAR} .jp-NotebookPanel-toolbar
Expand Down
6 changes: 2 additions & 4 deletions atest/suites/lab/01-examples.robot
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ Visit All Example Slides And Fragments
${stem} = Set Variable ${example.lower().replace(" ", "_")}
Open Example ${example}
Capture Page Screenshot ${stem}-00-before-deck.png
IF ${example.endswith('.ipynb')}
Really Start Deck With Notebook Toolbar Button
ELSE IF ${example.endswith('.md')}
Start Markdown Deck From Editor ${example}
IF ${example.endswith('.ipynb')} or ${example.endswith('.md')}
Really Start Deck With Toolbar Button
ELSE
Execute JupyterLab Command Start Deck
END
Expand Down
Loading

0 comments on commit c7882ea

Please sign in to comment.