Skip to content

Commit c1e1329

Browse files
Add freecad icon (#21)
* Add freecad icon for files * Selectable icon * Empty 'f' * [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>
1 parent 2e64333 commit c1e1329

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

src/plugins.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
showErrorMessage,
2020
WidgetTracker
2121
} from '@jupyterlab/apputils';
22+
import { LabIcon } from '@jupyterlab/ui-components';
2223

2324
import { JupyterCadWidgetFactory } from '@jupytercad/jupytercad-core';
2425
import {
@@ -28,6 +29,12 @@ import {
2829
} from '@jupytercad/schema';
2930
import { requestAPI } from '@jupytercad/base';
3031
import { JupyterCadFCModelFactory } from './modelfactory';
32+
import freecadIconSvg from '../style/freecad.svg';
33+
34+
const freecadIcon = new LabIcon({
35+
name: 'jupytercad:stp',
36+
svgstr: freecadIconSvg
37+
});
3138

3239
const FACTORY = 'Jupytercad Freecad Factory';
3340

@@ -84,7 +91,8 @@ const activate = async (
8491
mimeTypes: ['application/octet-stream'],
8592
extensions: ['.FCStd', 'fcstd'],
8693
fileFormat: 'base64',
87-
contentType: 'FCStd'
94+
contentType: 'FCStd',
95+
icon: freecadIcon
8896
});
8997

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

98106
widgetFactory.widgetCreated.connect((sender, widget) => {
107+
widget.title.icon = freecadIcon;
99108
// Notify the instance tracker if restore data needs to update.
100109
widget.context.pathChanged.connect(() => {
101110
tracker.save(widget);

src/svg.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module '*.svg' {
2+
const value: string; // @ts-ignore
3+
export default value;
4+
}

style/freecad.svg

Lines changed: 37 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)