GUI-based Python code generator extension for Jupyter Lab, Jupyter Notebook, and Google Colab
—
Command system integration providing keyboard shortcuts, menu access, and programmatic control of Visual Python functionality within JupyterLab.
Main command for controlling Visual Python panel visibility.
/**
* Command for toggling Visual Python panel visibility
* ID: 'jupyterlab-visualpython:toggle'
*/
'jupyterlab-visualpython:toggle': Command;Command Properties:
'jupyterlab-visualpython:toggle'Execution Behavior:
Usage Examples:
// Execute programmatically
app.commands.execute('jupyterlab-visualpython:toggle');
// Check if command is available
const isEnabled = app.commands.isEnabled('jupyterlab-visualpython:toggle');
// Get command label
const label = app.commands.label('jupyterlab-visualpython:toggle');Commands are registered during extension activation with the JupyterLab command registry.
/**
* Command registration during extension activation
* @param app - JupyterLab application instance
* @param vpPanel - Visual Python panel instance
*/
app.commands.addCommand('jupyterlab-visualpython:toggle', {
label: 'Toggle Visual Python',
execute: () => void
});Registration Process:
Main keyboard shortcut for accessing Visual Python functionality.
// Keyboard shortcut configuration
'Accel Shift V': 'jupyterlab-visualpython:toggle'Shortcut Details:
Accel + Shift + VCtrl + Shift + VCmd + Shift + VUsage: Press the keyboard combination from anywhere in JupyterLab to show/hide Visual Python panel.
Keyboard shortcuts are defined in the plugin schema and automatically registered:
{
"shortcuts": [
{
"command": "jupyterlab-visualpython:toggle",
"keys": ["Accel Shift V"],
"selector": "body"
}
]
}Commands are automatically added to JupyterLab's command palette for easy access.
/**
* Command palette integration
* @param palette - JupyterLab command palette
*/
palette.addItem({
command: 'jupyterlab-visualpython:toggle',
category: 'Visual Python'
});Palette Properties:
'jupyterlab-visualpython:toggle'Access Method:
Ctrl/Cmd + Shift + C)Visual Python integrates with the notebook toolbar for easy access during notebook editing.
// Toolbar button configuration
{
"command": "show-visualpython",
"name": "show-visualpython"
}Toolbar Integration:
Usage: Click the Visual Python toolbar button in notebooks to open the visual programming interface.
Visual Python commands can be accessed through various context menus in JupyterLab.
// Context menu integration (when applicable)
contextMenu.addItem({
command: 'jupyterlab-visualpython:toggle',
selector: '.jp-Notebook'
});Commands automatically manage Visual Python panel state:
// Command execution logic
execute: () => {
if (vpPanel.isVisible) {
vpPanel.hide();
app.shell.remove(vpPanel);
} else {
app.shell.add(vpPanel, 'right');
vpPanel.show();
}
}State Management:
Commands include error handling for various failure scenarios:
execute: () => {
try {
// Panel toggle logic
} catch (error) {
console.error('Failed to toggle Visual Python panel:', error);
// User notification of error
}
}Error Scenarios:
Developers can extend Visual Python commands:
// Adding custom Visual Python commands
app.commands.addCommand('jupyterlab-visualpython:custom-action', {
label: 'Custom Visual Python Action',
execute: () => {
// Custom functionality
}
});Users can customize keyboard shortcuts through JupyterLab settings:
{
"shortcuts": [
{
"command": "jupyterlab-visualpython:toggle",
"keys": ["Ctrl Alt V"],
"selector": "body"
}
]
}// Command-related types
interface Command {
execute(args?: any): Promise<any> | any;
label?: string;
caption?: string;
usage?: string;
iconClass?: string;
iconLabel?: string;
className?: string;
isEnabled?(args?: any): boolean;
isVisible?(args?: any): boolean;
isToggled?(args?: any): boolean;
}
interface ICommandPalette {
addItem(options: IPaletteItem): IDisposable;
}
interface IPaletteItem {
command: string;
category?: string;
args?: any;
rank?: number;
}Install with Tessl CLI
npx tessl i tessl/pypi-jupyterlab-visualpython