@jupytergis/jupytergis-qgis 0.4.5 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/modelfactory.d.ts +3 -0
- package/lib/modelfactory.js +3 -2
- package/lib/plugins.js +25 -23
- package/package.json +4 -4
package/lib/modelfactory.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IJupyterGISDoc, JupyterGISModel, IAnnotationModel } from '@jupytergis/schema';
|
|
2
2
|
import { DocumentRegistry } from '@jupyterlab/docregistry';
|
|
3
3
|
import { Contents } from '@jupyterlab/services';
|
|
4
|
+
import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
|
4
5
|
/**
|
|
5
6
|
* A Model factory to create new instances of JupyterGISModel.
|
|
6
7
|
*/
|
|
@@ -52,11 +53,13 @@ export declare class JupyterGISModelFactoryBase implements DocumentRegistry.IMod
|
|
|
52
53
|
*/
|
|
53
54
|
createNew(options: DocumentRegistry.IModelOptions<IJupyterGISDoc>): JupyterGISModel;
|
|
54
55
|
private _annotationModel;
|
|
56
|
+
private _settingRegistry;
|
|
55
57
|
private _disposed;
|
|
56
58
|
}
|
|
57
59
|
export declare namespace JupyterGISModelFactoryBase {
|
|
58
60
|
interface IOptions {
|
|
59
61
|
annotationModel: IAnnotationModel;
|
|
62
|
+
settingRegistry: ISettingRegistry;
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
65
|
export declare class QGZModelFactory extends JupyterGISModelFactoryBase {
|
package/lib/modelfactory.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JupyterGISModel } from '@jupytergis/schema';
|
|
1
|
+
import { JupyterGISModel, } from '@jupytergis/schema';
|
|
2
2
|
/**
|
|
3
3
|
* A Model factory to create new instances of JupyterGISModel.
|
|
4
4
|
*/
|
|
@@ -67,7 +67,8 @@ export class JupyterGISModelFactoryBase {
|
|
|
67
67
|
const model = new JupyterGISModel({
|
|
68
68
|
sharedModel: options.sharedModel,
|
|
69
69
|
languagePreference: options.languagePreference,
|
|
70
|
-
annotationModel: this._annotationModel
|
|
70
|
+
annotationModel: this._annotationModel,
|
|
71
|
+
settingRegistry: this._settingRegistry,
|
|
71
72
|
});
|
|
72
73
|
return model;
|
|
73
74
|
}
|
package/lib/plugins.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { ICollaborativeDrive } from '@jupyter/collaborative-drive';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { ICollaborativeDrive, } from '@jupyter/collaborative-drive';
|
|
2
|
+
import { logoMiniIcon, logoMiniIconQGZ, requestAPI, } from '@jupytergis/base';
|
|
3
|
+
import { JupyterGISDocumentWidgetFactory } from '@jupytergis/jupytergis-core';
|
|
4
|
+
import { IJGISExternalCommandRegistryToken, JupyterGISDoc, IJupyterGISDocTracker, IAnnotationToken, } from '@jupytergis/schema';
|
|
5
|
+
import { Dialog, ICommandPalette, IThemeManager, InputDialog, showDialog, showErrorMessage, } from '@jupyterlab/apputils';
|
|
4
6
|
import { IEditorServices } from '@jupyterlab/codeeditor';
|
|
5
7
|
import { ConsolePanel, IConsoleTracker } from '@jupyterlab/console';
|
|
6
8
|
import { PathExt } from '@jupyterlab/coreutils';
|
|
7
9
|
import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
|
|
10
|
+
import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
|
8
11
|
import { Widget } from '@lumino/widgets';
|
|
9
|
-
import { logoMiniIcon, logoMiniIconQGZ, requestAPI } from '@jupytergis/base';
|
|
10
|
-
import { JupyterGISDocumentWidgetFactory } from '@jupytergis/jupytergis-core';
|
|
11
12
|
import { QGSModelFactory, QGZModelFactory } from './modelfactory';
|
|
12
13
|
/**
|
|
13
14
|
* The command IDs used by the qgis plugin.
|
|
@@ -16,10 +17,10 @@ var CommandIDs;
|
|
|
16
17
|
(function (CommandIDs) {
|
|
17
18
|
CommandIDs.exportQgis = 'jupytergis:export';
|
|
18
19
|
})(CommandIDs || (CommandIDs = {}));
|
|
19
|
-
const activate = async (app, tracker, themeManager, drive, externalCommandRegistry, contentFactory, editorServices, rendermime, consoleTracker, annotationModel, commandPalette) => {
|
|
20
|
+
const activate = async (app, tracker, themeManager, drive, externalCommandRegistry, contentFactory, editorServices, rendermime, consoleTracker, annotationModel, settingRegistry, commandPalette) => {
|
|
20
21
|
const fcCheck = await requestAPI('jupytergis_qgis/backend-check', {
|
|
21
22
|
method: 'POST',
|
|
22
|
-
body: JSON.stringify({})
|
|
23
|
+
body: JSON.stringify({}),
|
|
23
24
|
});
|
|
24
25
|
const { installed } = fcCheck;
|
|
25
26
|
const backendCheck = () => {
|
|
@@ -41,7 +42,7 @@ const activate = async (app, tracker, themeManager, drive, externalCommandRegist
|
|
|
41
42
|
contentFactory,
|
|
42
43
|
rendermime,
|
|
43
44
|
mimeTypeService: editorServices.mimeTypeService,
|
|
44
|
-
consoleTracker
|
|
45
|
+
consoleTracker,
|
|
45
46
|
});
|
|
46
47
|
const QGZWidgetFactory = new JupyterGISDocumentWidgetFactory({
|
|
47
48
|
name: 'JupyterGIS QGZ Factory',
|
|
@@ -56,14 +57,14 @@ const activate = async (app, tracker, themeManager, drive, externalCommandRegist
|
|
|
56
57
|
contentFactory,
|
|
57
58
|
rendermime,
|
|
58
59
|
mimeTypeService: editorServices.mimeTypeService,
|
|
59
|
-
consoleTracker
|
|
60
|
+
consoleTracker,
|
|
60
61
|
});
|
|
61
62
|
// Registering the widget factory
|
|
62
63
|
app.docRegistry.addWidgetFactory(QGSWidgetFactory);
|
|
63
64
|
app.docRegistry.addWidgetFactory(QGZWidgetFactory);
|
|
64
65
|
// Creating and registering the model factory for our custom DocumentModel
|
|
65
|
-
app.docRegistry.addModelFactory(new QGSModelFactory({ annotationModel }));
|
|
66
|
-
app.docRegistry.addModelFactory(new QGZModelFactory({ annotationModel }));
|
|
66
|
+
app.docRegistry.addModelFactory(new QGSModelFactory({ annotationModel, settingRegistry }));
|
|
67
|
+
app.docRegistry.addModelFactory(new QGZModelFactory({ annotationModel, settingRegistry }));
|
|
67
68
|
// register the filetype
|
|
68
69
|
app.docRegistry.addFileType({
|
|
69
70
|
name: 'QGS',
|
|
@@ -72,7 +73,7 @@ const activate = async (app, tracker, themeManager, drive, externalCommandRegist
|
|
|
72
73
|
extensions: ['.qgs', '.QGS'],
|
|
73
74
|
fileFormat: 'base64',
|
|
74
75
|
contentType: 'QGS',
|
|
75
|
-
icon: logoMiniIcon
|
|
76
|
+
icon: logoMiniIcon,
|
|
76
77
|
});
|
|
77
78
|
app.docRegistry.addFileType({
|
|
78
79
|
name: 'QGZ',
|
|
@@ -81,7 +82,7 @@ const activate = async (app, tracker, themeManager, drive, externalCommandRegist
|
|
|
81
82
|
extensions: ['.qgz', '.QGZ'],
|
|
82
83
|
fileFormat: 'base64',
|
|
83
84
|
contentType: 'QGZ',
|
|
84
|
-
icon: logoMiniIconQGZ
|
|
85
|
+
icon: logoMiniIconQGZ,
|
|
85
86
|
});
|
|
86
87
|
const QGISSharedModelFactory = () => {
|
|
87
88
|
return new JupyterGISDoc();
|
|
@@ -127,7 +128,7 @@ const activate = async (app, tracker, themeManager, drive, externalCommandRegist
|
|
|
127
128
|
filepath = (await InputDialog.getText({
|
|
128
129
|
label: 'File name',
|
|
129
130
|
placeholder: PathExt.basename(sourcePath, sourceExtension),
|
|
130
|
-
title: 'Export the project to QGZ file'
|
|
131
|
+
title: 'Export the project to QGZ file',
|
|
131
132
|
})).value;
|
|
132
133
|
}
|
|
133
134
|
if (filepath === null) {
|
|
@@ -151,7 +152,7 @@ const activate = async (app, tracker, themeManager, drive, externalCommandRegist
|
|
|
151
152
|
layers: model.layers,
|
|
152
153
|
sources: model.sources,
|
|
153
154
|
layerTree: model.layerTree.slice().reverse(),
|
|
154
|
-
options: model.options
|
|
155
|
+
options: model.options,
|
|
155
156
|
};
|
|
156
157
|
// Check if the file exists
|
|
157
158
|
let fileExist = true;
|
|
@@ -161,7 +162,7 @@ const activate = async (app, tracker, themeManager, drive, externalCommandRegist
|
|
|
161
162
|
if (fileExist) {
|
|
162
163
|
const overwrite = await showDialog({
|
|
163
164
|
title: 'Export the project to QGZ file',
|
|
164
|
-
body: `The file ${filepath} already exists.\nDo you want to overwrite it
|
|
165
|
+
body: `The file ${filepath} already exists.\nDo you want to overwrite it ?`,
|
|
165
166
|
});
|
|
166
167
|
if (!overwrite.button.accept) {
|
|
167
168
|
return;
|
|
@@ -171,8 +172,8 @@ const activate = async (app, tracker, themeManager, drive, externalCommandRegist
|
|
|
171
172
|
method: 'POST',
|
|
172
173
|
body: JSON.stringify({
|
|
173
174
|
path: absolutePath,
|
|
174
|
-
virtual_file: virtualFile
|
|
175
|
-
})
|
|
175
|
+
virtual_file: virtualFile,
|
|
176
|
+
}),
|
|
176
177
|
});
|
|
177
178
|
if (!response.exported) {
|
|
178
179
|
showErrorMessage('Export the project to QGZ file', response.logs.errors.length
|
|
@@ -186,15 +187,15 @@ const activate = async (app, tracker, themeManager, drive, externalCommandRegist
|
|
|
186
187
|
await showDialog({
|
|
187
188
|
title: 'Export the project to QGZ file',
|
|
188
189
|
body,
|
|
189
|
-
buttons: [Dialog.okButton()]
|
|
190
|
+
buttons: [Dialog.okButton()],
|
|
190
191
|
});
|
|
191
192
|
}
|
|
192
|
-
}
|
|
193
|
+
},
|
|
193
194
|
});
|
|
194
195
|
if (commandPalette) {
|
|
195
196
|
commandPalette.addItem({
|
|
196
197
|
command: CommandIDs.exportQgis,
|
|
197
|
-
category: 'JupyterGIS'
|
|
198
|
+
category: 'JupyterGIS',
|
|
198
199
|
});
|
|
199
200
|
}
|
|
200
201
|
}
|
|
@@ -211,9 +212,10 @@ export const qgisplugin = {
|
|
|
211
212
|
IEditorServices,
|
|
212
213
|
IRenderMimeRegistry,
|
|
213
214
|
IConsoleTracker,
|
|
214
|
-
IAnnotationToken
|
|
215
|
+
IAnnotationToken,
|
|
216
|
+
ISettingRegistry,
|
|
215
217
|
],
|
|
216
218
|
optional: [ICommandPalette],
|
|
217
219
|
autoStart: true,
|
|
218
|
-
activate
|
|
220
|
+
activate,
|
|
219
221
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupytergis/jupytergis-qgis",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "JupyterGIS QGIS extension.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jupyter",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@jupyter/collaborative-drive": "^3.0.0",
|
|
57
|
-
"@jupytergis/base": "^0.
|
|
58
|
-
"@jupytergis/jupytergis-core": "^0.
|
|
59
|
-
"@jupytergis/schema": "^0.
|
|
57
|
+
"@jupytergis/base": "^0.6.0",
|
|
58
|
+
"@jupytergis/jupytergis-core": "^0.6.0",
|
|
59
|
+
"@jupytergis/schema": "^0.6.0",
|
|
60
60
|
"@jupyterlab/application": "^4.3.0",
|
|
61
61
|
"@jupyterlab/apputils": "^4.3.0",
|
|
62
62
|
"@jupyterlab/coreutils": "^6.3.0",
|