Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add freecad icon #21

Merged
merged 4 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 10 additions & 1 deletion src/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
showErrorMessage,
WidgetTracker
} from '@jupyterlab/apputils';
import { LabIcon } from '@jupyterlab/ui-components';

import { JupyterCadWidgetFactory } from '@jupytercad/jupytercad-core';
import {
Expand All @@ -28,6 +29,12 @@ import {
} from '@jupytercad/schema';
import { requestAPI } from '@jupytercad/base';
import { JupyterCadFCModelFactory } from './modelfactory';
import freecadIconSvg from '../style/freecad.svg';

const freecadIcon = new LabIcon({
name: 'jupytercad:stp',
svgstr: freecadIconSvg
});

const FACTORY = 'Jupytercad Freecad Factory';

Expand Down Expand Up @@ -84,7 +91,8 @@ const activate = async (
mimeTypes: ['application/octet-stream'],
extensions: ['.FCStd', 'fcstd'],
fileFormat: 'base64',
contentType: 'FCStd'
contentType: 'FCStd',
icon: freecadIcon
});

const FCStdSharedModelFactory: SharedDocumentFactory = () => {
Expand All @@ -96,6 +104,7 @@ const activate = async (
);

widgetFactory.widgetCreated.connect((sender, widget) => {
widget.title.icon = freecadIcon;
// Notify the instance tracker if restore data needs to update.
widget.context.pathChanged.connect(() => {
tracker.save(widget);
Expand Down
4 changes: 4 additions & 0 deletions src/svg.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.svg' {
const value: string; // @ts-ignore
export default value;
}
37 changes: 37 additions & 0 deletions style/freecad.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading