Skip to content

Commit

Permalink
Create worker registry
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc committed Nov 15, 2023
1 parent c1c22d2 commit 7364969
Show file tree
Hide file tree
Showing 20 changed files with 621 additions and 624 deletions.
180 changes: 90 additions & 90 deletions packages/base/src/fcplugin/modelfactory.ts
Original file line number Diff line number Diff line change
@@ -1,101 +1,101 @@
import {
IAnnotationModel,
IJupyterCadDoc,
JupyterCadModel
} from '@jupytercad/schema';
import { DocumentRegistry } from '@jupyterlab/docregistry';
import { Contents } from '@jupyterlab/services';
// import {
// IAnnotationModel,
// IJupyterCadDoc,
// JupyterCadModel
// } from '@jupytercad/schema';
// import { DocumentRegistry } from '@jupyterlab/docregistry';
// import { Contents } from '@jupyterlab/services';

/**
* A Model factory to create new instances of JupyterCadModel.
*/
export class JupyterCadFCModelFactory
implements DocumentRegistry.IModelFactory<JupyterCadModel>
{
constructor(options: JupyterCadFCModelFactory.IOptions) {
this._annotationModel = options.annotationModel;
}
// /**
// * A Model factory to create new instances of JupyterCadModel.
// */
// export class JupyterCadFCModelFactory
// implements DocumentRegistry.IModelFactory<JupyterCadModel>
// {
// constructor(options: JupyterCadFCModelFactory.IOptions) {
// this._annotationModel = options.annotationModel;
// }

/**
* Whether the model is collaborative or not.
*/
readonly collaborative = true;
// /**
// * Whether the model is collaborative or not.
// */
// readonly collaborative = true;

/**
* The name of the model.
*
* @returns The name
*/
get name(): string {
return 'jupytercad-fcmodel';
}
// /**
// * The name of the model.
// *
// * @returns The name
// */
// get name(): string {
// return 'jupytercad-fcmodel';
// }

/**
* The content type of the file.
*
* @returns The content type
*/
get contentType(): Contents.ContentType {
return 'FCStd';
}
// /**
// * The content type of the file.
// *
// * @returns The content type
// */
// get contentType(): Contents.ContentType {
// return 'FCStd';
// }

/**
* The format of the file.
*
* @returns the file format
*/
get fileFormat(): Contents.FileFormat {
return 'base64';
}
// /**
// * The format of the file.
// *
// * @returns the file format
// */
// get fileFormat(): Contents.FileFormat {
// return 'base64';
// }

/**
* Get whether the model factory has been disposed.
*
* @returns disposed status
*/
get isDisposed(): boolean {
return this._disposed;
}
// /**
// * Get whether the model factory has been disposed.
// *
// * @returns disposed status
// */
// get isDisposed(): boolean {
// return this._disposed;
// }

/**
* Dispose the model factory.
*/
dispose(): void {
this._disposed = true;
}
// /**
// * Dispose the model factory.
// */
// dispose(): void {
// this._disposed = true;
// }

/**
* Get the preferred language given the path on the file.
*
* @param path path of the file represented by this document model
* @returns The preferred language
*/
preferredLanguage(path: string): string {
return '';
}
// /**
// * Get the preferred language given the path on the file.
// *
// * @param path path of the file represented by this document model
// * @returns The preferred language
// */
// preferredLanguage(path: string): string {
// return '';
// }

/**
* Create a new instance of JupyterCadModel.
*
* @returns The model
*/
createNew(
options: DocumentRegistry.IModelOptions<IJupyterCadDoc>
): JupyterCadModel {
const model = new JupyterCadModel({
sharedModel: options.sharedModel,
languagePreference: options.languagePreference,
annotationModel: this._annotationModel
});
return model;
}
// /**
// * Create a new instance of JupyterCadModel.
// *
// * @returns The model
// */
// createNew(
// options: DocumentRegistry.IModelOptions<IJupyterCadDoc>
// ): JupyterCadModel {
// const model = new JupyterCadModel({
// sharedModel: options.sharedModel,
// languagePreference: options.languagePreference,
// annotationModel: this._annotationModel
// });
// return model;
// }

private _annotationModel: IAnnotationModel;
private _disposed = false;
}
// private _annotationModel: IAnnotationModel;
// private _disposed = false;
// }

export namespace JupyterCadFCModelFactory {
export interface IOptions {
annotationModel: IAnnotationModel;
}
}
// export namespace JupyterCadFCModelFactory {
// export interface IOptions {
// annotationModel: IAnnotationModel;
// }
// }
Loading

0 comments on commit 7364969

Please sign in to comment.