From d97fe654e997b0f48a27f7a7c86201fbd6bfe798 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 23:57:45 +0200 Subject: [PATCH 1/4] [pre-commit.ci] pre-commit autoupdate (#453) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.6.0 → v5.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.6.0...v5.0.0) - [github.com/astral-sh/ruff-pre-commit: v0.6.3 → v0.6.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.3...v0.6.9) - [github.com/pre-commit/mirrors-eslint: v9.9.1 → v9.12.0](https://github.com/pre-commit/mirrors-eslint/compare/v9.9.1...v9.12.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3c0267a0..4de062b6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 @@ -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'] @@ -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?$ From 7f7d28a4490730f1deb025d6e6493bbdd7c31589 Mon Sep 17 00:00:00 2001 From: Arjun Verma Date: Tue, 8 Oct 2024 20:44:59 +0530 Subject: [PATCH 2/4] Toggle buttons working correctly when multiple editors are open (#447) * Toggle buttons working correctly when multiple editors are open * Move context change logic out of the commands * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- packages/base/src/commands.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/base/src/commands.ts b/packages/base/src/commands.ts index 1d150eab..9f1ed3c4 100644 --- a/packages/base/src/commands.ts +++ b/packages/base/src/commands.ts @@ -946,6 +946,10 @@ export function addCommands( icon: wireframeIcon }); + tracker.currentChanged.connect(() => { + commands.notifyCommandChanged(CommandIDs.wireframe); + }); + commands.addCommand(CommandIDs.chamfer, { label: trans.__('Make chamfer'), isEnabled: () => { @@ -1071,6 +1075,10 @@ export function addCommands( } }); + tracker.currentChanged.connect(() => { + commands.notifyCommandChanged(CommandIDs.updateClipView); + }); + commands.addCommand(CommandIDs.exportJcad, { label: trans.__('Export to .jcad'), isEnabled: () => { From 9d01e1d8953681d35588f55f6b74262893426649 Mon Sep 17 00:00:00 2001 From: martinRenou Date: Tue, 8 Oct 2024 17:10:58 +0100 Subject: [PATCH 3/4] Add icons in filebrowser (#460) --- python/jupytercad_core/src/jcadplugin/plugins.ts | 3 ++- python/jupytercad_core/src/stepplugin/plugins.ts | 4 +++- python/jupytercad_core/src/stlplugin/plugins.ts | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/python/jupytercad_core/src/jcadplugin/plugins.ts b/python/jupytercad_core/src/jcadplugin/plugins.ts index 7a452dd2..c6e2b9bc 100644 --- a/python/jupytercad_core/src/jcadplugin/plugins.ts +++ b/python/jupytercad_core/src/jcadplugin/plugins.ts @@ -85,7 +85,8 @@ const activate = ( mimeTypes: ['text/json'], extensions: ['.jcad', '.JCAD'], fileFormat: 'text', - contentType: 'jcad' + contentType: 'jcad', + icon: logoIcon }); const jcadSharedModelFactory: SharedDocumentFactory = () => { diff --git a/python/jupytercad_core/src/stepplugin/plugins.ts b/python/jupytercad_core/src/stepplugin/plugins.ts index 2e268f8f..b7836cef 100644 --- a/python/jupytercad_core/src/stepplugin/plugins.ts +++ b/python/jupytercad_core/src/stepplugin/plugins.ts @@ -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'; @@ -53,7 +54,8 @@ const activate = ( mimeTypes: ['text/json'], extensions: ['.step', '.STEP'], fileFormat: 'text', - contentType: 'step' + contentType: 'step', + icon: logoIcon }); const stepSharedModelFactory: SharedDocumentFactory = () => { diff --git a/python/jupytercad_core/src/stlplugin/plugins.ts b/python/jupytercad_core/src/stlplugin/plugins.ts index 86aeada3..7711890f 100644 --- a/python/jupytercad_core/src/stlplugin/plugins.ts +++ b/python/jupytercad_core/src/stlplugin/plugins.ts @@ -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'; @@ -53,7 +54,8 @@ const activate = ( mimeTypes: ['text/json'], extensions: ['.stl', '.STL'], fileFormat: 'text', - contentType: 'stl' + contentType: 'stl', + icon: logoIcon }); const stlSharedModelFactory: SharedDocumentFactory = () => { From 305b0d652771fdf89c3938e5168aaad8b9952ed3 Mon Sep 17 00:00:00 2001 From: martinRenou Date: Tue, 8 Oct 2024 18:06:08 +0100 Subject: [PATCH 4/4] Rename launcher button (#461) * Rename launcher button * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .../jupytercad_app/src/app/plugins/launcher/index.ts | 2 +- python/jupytercad_core/src/jcadplugin/plugins.ts | 2 +- ui-tests/tests/ui.spec.ts | 12 +++--------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/python/jupytercad_app/src/app/plugins/launcher/index.ts b/python/jupytercad_app/src/app/plugins/launcher/index.ts index e21844b5..f3cd7039 100644 --- a/python/jupytercad_app/src/app/plugins/launcher/index.ts +++ b/python/jupytercad_app/src/app/plugins/launcher/index.ts @@ -22,7 +22,7 @@ const launcherPlugin: JupyterFrontEndPlugin = { 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); diff --git a/python/jupytercad_core/src/jcadplugin/plugins.ts b/python/jupytercad_core/src/jcadplugin/plugins.ts index c6e2b9bc..5f1f5daf 100644 --- a/python/jupytercad_core/src/jcadplugin/plugins.ts +++ b/python/jupytercad_core/src/jcadplugin/plugins.ts @@ -112,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 => { diff --git a/ui-tests/tests/ui.spec.ts b/ui-tests/tests/ui.spec.ts index 50f7413d..23a84841 100644 --- a/ui-tests/tests/ui.spec.ts +++ b/ui-tests/tests/ui.spec.ts @@ -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(); @@ -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();