Skip to content

Commit

Permalink
Merge branch 'main' into syncEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
arjxn-py authored Oct 8, 2024
2 parents 801b495 + 305b0d6 commit 0c32b2a
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 17 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exclude: '.*\.jcad$'
repos:
# Autoformat and linting, misc. details
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: forbid-new-submodules
- id: end-of-file-fixer
Expand All @@ -32,7 +32,7 @@ repos:
- id: black

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.3
rev: v0.6.9
hooks:
- id: ruff
args: ['--fix']
Expand All @@ -44,7 +44,7 @@ repos:
entry: prettier --no-error-on-unmatched-pattern --write --ignore-unknown

- repo: https://github.com/pre-commit/mirrors-eslint
rev: v9.9.1
rev: v9.12.0
hooks:
- id: eslint
files: \.tsx?$
Expand Down
8 changes: 8 additions & 0 deletions packages/base/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,10 @@ export function addCommands(
icon: wireframeIcon
});

tracker.currentChanged.connect(() => {
commands.notifyCommandChanged(CommandIDs.wireframe);
});

commands.addCommand(CommandIDs.chamfer, {
label: trans.__('Make chamfer'),
isEnabled: () => {
Expand Down Expand Up @@ -1073,6 +1077,10 @@ export function addCommands(
}
});

tracker.currentChanged.connect(() => {
commands.notifyCommandChanged(CommandIDs.updateClipView);
});

commands.addCommand(CommandIDs.exportJcad, {
label: trans.__('Export to .jcad'),
isEnabled: () => {
Expand Down
2 changes: 1 addition & 1 deletion python/jupytercad_app/src/app/plugins/launcher/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const launcherPlugin: JupyterFrontEndPlugin<void> = {
if (!label) {
continue;
}
if (label.innerHTML.includes('New JCAD File')) {
if (label.innerHTML.includes('CAD File')) {
const els = element
.getElementsByClassName('jp-Launcher-sectionTitle')
?.item(0);
Expand Down
5 changes: 3 additions & 2 deletions python/jupytercad_core/src/jcadplugin/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ const activate = (
mimeTypes: ['text/json'],
extensions: ['.jcad', '.JCAD'],
fileFormat: 'text',
contentType: 'jcad'
contentType: 'jcad',
icon: logoIcon
});

const jcadSharedModelFactory: SharedDocumentFactory = () => {
Expand All @@ -111,7 +112,7 @@ const activate = (
});

app.commands.addCommand(CommandIDs.createNew, {
label: args => 'New JCAD File',
label: args => 'CAD File',
caption: 'Create a new JCAD Editor',
icon: logoIcon,
execute: async args => {
Expand Down
4 changes: 3 additions & 1 deletion python/jupytercad_core/src/stepplugin/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { IThemeManager, WidgetTracker } from '@jupyterlab/apputils';
import { JupyterCadStepModelFactory } from './modelfactory';
import { JupyterCadWidgetFactory } from '../factory';
import { JupyterCadStepDoc } from './model';
import { logoIcon } from '@jupytercad/base';

const FACTORY = 'JupyterCAD STEP Viewer';

Expand Down Expand Up @@ -53,7 +54,8 @@ const activate = (
mimeTypes: ['text/json'],
extensions: ['.step', '.STEP'],
fileFormat: 'text',
contentType: 'step'
contentType: 'step',
icon: logoIcon
});

const stepSharedModelFactory: SharedDocumentFactory = () => {
Expand Down
4 changes: 3 additions & 1 deletion python/jupytercad_core/src/stlplugin/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { IThemeManager, WidgetTracker } from '@jupyterlab/apputils';
import { JupyterCadStlModelFactory } from './modelfactory';
import { JupyterCadWidgetFactory } from '../factory';
import { JupyterCadStlDoc } from './model';
import { logoIcon } from '@jupytercad/base';

const FACTORY = 'JupyterCAD STL Viewer';

Expand Down Expand Up @@ -53,7 +54,8 @@ const activate = (
mimeTypes: ['text/json'],
extensions: ['.stl', '.STL'],
fileFormat: 'text',
contentType: 'stl'
contentType: 'stl',
icon: logoIcon
});

const stlSharedModelFactory: SharedDocumentFactory = () => {
Expand Down
12 changes: 3 additions & 9 deletions ui-tests/tests/ui.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,9 @@ test.describe('UI Test', () => {

test.describe('JCAD creation test', () => {
test.describe('Extension activation test', () => {
test('should create a new JCAD file', async ({ page, request }) => {
test('should create a CAD File', async ({ page, request }) => {
await page.goto();
await page
.getByLabel('notebook content')
.getByText('New JCAD File')
.click();
await page.getByLabel('notebook content').getByText('CAD File').click();

await page.getByTitle('New Box').getByRole('button').click();
await page.getByRole('button', { name: 'Submit' }).click();
Expand Down Expand Up @@ -361,10 +358,7 @@ test.describe('UI Test', () => {
test.describe('Console activation test', () => {
test('should open console', async ({ page }) => {
await page.goto();
await page
.getByLabel('notebook content')
.getByText('New JCAD File')
.click();
await page.getByLabel('notebook content').getByText('CAD File').click();
await page.getByRole('button', { name: 'Toggle console' }).click();
await page.getByRole('button', { name: 'Remove console' });
await page.getByRole('textbox').nth(1).click();
Expand Down

0 comments on commit 0c32b2a

Please sign in to comment.