Skip to content

Commit

Permalink
Add freecad icon for files
Browse files Browse the repository at this point in the history
  • Loading branch information
martinRenou committed Nov 29, 2024
1 parent 2e64333 commit 83522e5
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
12 changes: 11 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,13 @@ 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 +92,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 +105,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;
}
33 changes: 33 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.

0 comments on commit 83522e5

Please sign in to comment.