Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
92975be
Init walkthrough with Manim installation check
Splines Nov 14, 2024
43fc25c
Add open sample scene to walkthrough
Splines Nov 14, 2024
21cca0f
Add preview cell SVG
Splines Nov 14, 2024
a7ff694
Remove unknown property
Splines Nov 14, 2024
c8927e5
Remove invalid key from openTextDocument
Splines Nov 17, 2024
bf7ed5a
Fix media JSON key
Splines Nov 17, 2024
f671911
Add open tab to Figma Preview Cell SVG
Splines Nov 17, 2024
9b8ba7c
Add step to show all extension commands in walkthrough
Splines Nov 17, 2024
495c44d
Merge remote-tracking branch 'origin/feature/walkthrough' into featur…
Splines Dec 1, 2024
6f36677
Reexport svg without VSCode theme support
Splines Dec 1, 2024
3849f50
Add open walkthrough command
Splines Dec 1, 2024
3a6b6f2
Improve header of section
Splines Dec 1, 2024
881938a
Make `Preview Manim Cell` clickable in svg
Splines Dec 1, 2024
344f28c
Also make commands svg clickable
Splines Dec 1, 2024
8e8113f
Merge branch 'main' into feature/walkthrough
Splines Dec 1, 2024
196cc94
Improve wording in sample scene file
Splines Dec 1, 2024
48130bf
Add walkthrough step to show keyboard shortcuts
Splines Dec 2, 2024
6ef7989
Add walkthrough step to open settings
Splines Dec 2, 2024
8ab605b
Add walkthrough step to open wiki in browser
Splines Dec 2, 2024
0cf54cd
Add additional linebreak to warning box
Splines Dec 2, 2024
ad2c9c7
Add hotkey comment to python walkthrough example
bhoov Dec 11, 2024
374b88b
Extract the id of the extension from the context, in case the owner c…
bhoov Dec 11, 2024
ba60147
Fix spelling mistake in Python sample file comments
Splines Dec 11, 2024
1d4ce7f
Merge branch 'main' into feature/walkthrough
Splines Dec 12, 2024
01ff7ff
Lint extension.ts file
Splines Dec 12, 2024
3dda6a4
Add accidentally deleted export scene command back
Splines Dec 12, 2024
402f6fe
Directly call `self.frame` in Python sample code
Splines Dec 12, 2024
4620934
Show the terminal for manim version printing
bhoov Dec 12, 2024
0b752f2
Remove wait() in example for quick cell execution
bhoov Dec 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@
"title": "Record Log File",
"category": "Manim Notebook"
},
{
"command": "manim-notebook.openWalkthrough",
"title": "Open Walkthrough",
"category": "Manim Notebook"
},
{
"command": "manim-notebook.exportScene",
"title": "Export current scene as CLI command",
Expand Down Expand Up @@ -149,6 +154,86 @@
"highContrastLight": "#C3DDF7"
}
}
],
"walkthroughs": [
{
"id": "manim-notebook-walkthrough",
"title": "Manim Notebook",
"description": "Welcome 👋 Get to know how to make the best out of Manim Notebook.",
"steps": [
{
"id": "checkManimInstallation",
"title": "Check Manim Installation",
"description": "Let's see if you have installed ManimGL.\n[Check Manim version](command:manim-notebook-walkthrough.checkManimVersion)\n[Open installation guide](https://3b1b.github.io/manim/getting_started/installation.html)",
"media": {
"markdown": "src/walkthrough/manim-installation.md"
},
"completionEvents": [
"onCommand:manim-notebook-walkthrough.checkManimVersion"
]
},
{
"id": "startExample",
"title": "Start with an example",
"description": "Open an example file to see how Manim Notebook works.\n[Open Sample](command:manim-notebook-walkthrough.openSample)",
"media": {
"svg": "src/walkthrough/preview-cell.svg",
"altText": "Preview Manim Cell"
},
"completionEvents": [
"onCommand:manim-notebook-walkthrough.openSample"
]
},
{
"id": "showAllAvailableCommands",
"title": "Show all available commands",
"description": "Get a list of all available commands in Manim Notebook.\n[Show Commands](command:manim-notebook-walkthrough.showCommands)",
"media": {
"svg": "src/walkthrough/commands.svg",
"altText": "Manim Notebook commands"
},
"completionEvents": [
"onCommand:manim-notebook-walkthrough.showCommands"
]
},
{
"id": "showKeyboardShortcuts",
"title": "Show keyboard shortcuts",
"description": "See all available keyboard shortcuts in Manim Notebook and modify them to whatever you like.\n[Show Shortcuts](command:manim-notebook-walkthrough.showShortcuts)",
"media": {
"svg": "src/walkthrough/shortcuts.svg",
"altText": "Manim Notebook keyboard shortcuts"
},
"completionEvents": [
"onCommand:manim-notebook-walkthrough.showShortcuts"
]
},
{
"id": "showSettings",
"title": "Show settings",
"description": "Customize your Manim Notebook experience by changing settings.\n[Show Settings](command:manim-notebook-walkthrough.showSettings)",
"media": {
"svg": "src/walkthrough/settings.svg",
"altText": "Manim Notebook settings"
},
"completionEvents": [
"onCommand:manim-notebook-walkthrough.showSettings"
]
},
{
"id": "openWiki",
"title": "Open Wiki",
"description": "Learn more about Manim Notebook on the GitHub Wiki.\n[Open Wiki](command:manim-notebook-walkthrough.openWiki)",
"media": {
"svg": "src/walkthrough/wiki.svg",
"altText": "Manim Notebook Wiki"
},
"completionEvents": [
"onCommand:manim-notebook-walkthrough.openWiki"
]
}
]
}
]
},
"scripts": {
Expand Down
15 changes: 13 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { previewCode } from './previewCode';
import { startScene, exitScene } from './startStopScene';
import { exportScene } from './export';
import { Logger, Window, LogRecorder } from './logger';
import { registerWalkthroughCommands } from './walkthrough/commands';
import { ExportSceneCodeLens } from './export';

export function activate(context: vscode.ExtensionContext) {
Expand Down Expand Up @@ -53,7 +54,6 @@ export function activate(context: vscode.ExtensionContext) {
await LogRecorder.recordLogFile(context);
});

// Internal commands
const exportSceneCommand = vscode.commands.registerCommand(
'manim-notebook.exportScene', async (sceneName?: string) => {
Logger.info("💠 Command requested: Export Scene");
Expand All @@ -64,21 +64,32 @@ export function activate(context: vscode.ExtensionContext) {
{ language: 'python' }, new ExportSceneCodeLens())
);

const openWalkthroughCommand = vscode.commands.registerCommand(
'manim-notebook.openWalkthrough', async () => {
Logger.info("💠 Command requested: Open Walkthrough");
await vscode.commands.executeCommand('workbench.action.openWalkthrough',
`${context.extension.id}#manim-notebook-walkthrough`, false);
});

// internal command
const finishRecordingLogFileCommand = vscode.commands.registerCommand(
'manim-notebook.finishRecordingLogFile', async () => {
Logger.info("💠 Command requested: Finish Recording Log File");
await LogRecorder.finishRecordingLogFile(context);
});

registerWalkthroughCommands(context);

context.subscriptions.push(
previewManimCellCommand,
previewSelectionCommand,
startSceneCommand,
exitSceneCommand,
clearSceneCommand,
recordLogFileCommand,
openWalkthroughCommand,
exportSceneCommand,
finishRecordingLogFileCommand
finishRecordingLogFileCommand,
);
registerManimCellProviders(context);
}
Expand Down
57 changes: 57 additions & 0 deletions src/walkthrough/commands.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
113 changes: 113 additions & 0 deletions src/walkthrough/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import * as vscode from 'vscode';
import { ExtensionContext, window, workspace, commands, extensions } from 'vscode';
import { Logger, Window } from '../logger';
import { ManimShell } from '../manimShell';
import fs from 'fs';
import path from 'path';

export function registerWalkthroughCommands(context: ExtensionContext) {
const checkManimVersionCommand = commands.registerCommand(
'manim-notebook-walkthrough.checkManimVersion', async () => {
Logger.info("💠 Command Check Manim Version requested");
await checkManimVersion();
});

const openSampleFileCommand = commands.registerCommand(
'manim-notebook-walkthrough.openSample', async () => {
Logger.info("💠 Command Open Sample File requested");
await openSampleFile(context);
});

const showAllCommandsCommand = commands.registerCommand(
'manim-notebook-walkthrough.showCommands', async () => {
Logger.info("💠 Command Show All Commands requested");
await showAllCommands();
}
);

const showKeyboardShortcutsCommand = commands.registerCommand(
'manim-notebook-walkthrough.showShortcuts', async () => {
Logger.info("💠 Command Show Keyboard Shortcuts requested");
await showKeyboardShortcuts();
}
);

const showSettingsCommand = commands.registerCommand(
'manim-notebook-walkthrough.showSettings', async () => {
Logger.info("💠 Command Show Settings requested");
await showSettings();
}
);

const openWikiCommand = commands.registerCommand(
'manim-notebook-walkthrough.openWiki', async () => {
Logger.info("💠 Command Open Wiki requested");
await openWiki();
}
);

context.subscriptions.push(
checkManimVersionCommand,
openSampleFileCommand,
showAllCommandsCommand,
showKeyboardShortcutsCommand,
showSettingsCommand,
openWikiCommand
);
}

async function checkManimVersion() {
const terminal = window.createTerminal("Manim Version");
terminal.show()
await new Promise((resolve) => setTimeout(resolve, 1500));
terminal.sendText("manimgl --version");
}

/**
* Opens a sample Manim file in a new editor that the user can use to get started.
*
* @param context The extension context.
*/
async function openSampleFile(context: ExtensionContext) {
const sampleFilePath = path.join(context.extensionPath,
'src', 'walkthrough', 'sample_scene.py');
const sampleFileContent = fs.readFileSync(sampleFilePath, 'utf-8');

const sampleFile = await workspace.openTextDocument({
language: 'python',
content: sampleFileContent
});

await window.showTextDocument(sampleFile);
}

/**
* Opens the command palette with all the "Manim Notebook" commands.
*/
async function showAllCommands() {
await commands.executeCommand('workbench.action.quickOpen', '>Manim Notebook:');
}

/**
* Opens the keyboard shortcuts page in the settings.
*/
async function showKeyboardShortcuts() {
await commands.executeCommand(
'workbench.action.openGlobalKeybindings', "Manim Notebook");
}

/**
* Opens the settings page for the extension.
*/
async function showSettings() {
await commands.executeCommand(
'workbench.action.openSettings', "Manim Notebook");
}

/**
* Opens the GitHub wiki page for the extension.
*/
async function openWiki() {
const wikiUrl = "https://github.com/Manim-Notebook/manim-notebook/wiki";
await vscode.env.openExternal(vscode.Uri.parse(wikiUrl));
}
17 changes: 17 additions & 0 deletions src/walkthrough/manim-installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 🎈 Manim Installation

> **Manim Notebook only works with ManimGL by 3Blue1Brown,<br>NOT with the community edition of Manim (Manim CE)**.

If you haven't already installed ManimGL, follow the [**Manim installation guide**](https://3b1b.github.io/manim/getting_started/installation.html). This will be the most difficult part of all the steps here and there are quite a few dependencies to install. But don't despair; with a bit of patience and StackOverflow you will get there.

We recommend to install Manim by cloning the GitHub repo and using

```bash
git clone https://github.com/3b1b/manim.git
cd manim
pip install -e .
```

This way, you can easily update Manim by pulling the latest commits from the repo (`git pull`) and don't have to wait for a new release.

Check your Manim version by running `manimgl --version` or just click on the button on the left.
Loading