jupyterlab_advanced_image_viewer_extension 1.0.9 → 1.0.11
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/README.md +1 -0
- package/lib/index.js +12 -0
- package/package.json +2 -1
- package/src/index.ts +16 -0
package/README.md
CHANGED
|
@@ -22,6 +22,7 @@ The viewer toolbar adds zoom in / out / fit controls and a `help` link that list
|
|
|
22
22
|
- **Toolbar controls** - zoom in, zoom out, and reset-to-fit buttons on the viewer toolbar
|
|
23
23
|
- **Arrow-key navigation** - Left and Right open the previous and next image in the same folder, advancing within one viewer instead of opening new tabs
|
|
24
24
|
- **Copy to clipboard** - right-click a raster image (PNG/JPG/…) and choose "Copy to Clipboard" to copy it as PNG to the system clipboard
|
|
25
|
+
- **Refresh** - a toolbar refresh button reloads the image from disk, the same control the HTML viewer provides
|
|
25
26
|
|
|
26
27
|
## Requirements
|
|
27
28
|
|
package/lib/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { Dialog, showDialog, Toolbar, ToolbarButton } from '@jupyterlab/apputils
|
|
|
2
2
|
import { PathExt } from '@jupyterlab/coreutils';
|
|
3
3
|
import { IImageTracker } from '@jupyterlab/imageviewer';
|
|
4
4
|
import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
|
5
|
+
import { refreshIcon } from '@jupyterlab/ui-components';
|
|
5
6
|
import { Widget } from '@lumino/widgets';
|
|
6
7
|
import { ViewerController } from './controller';
|
|
7
8
|
const PLUGIN_ID = 'jupyterlab_advanced_image_viewer_extension:plugin';
|
|
@@ -90,6 +91,17 @@ const plugin = {
|
|
|
90
91
|
controller.dispose();
|
|
91
92
|
controllers.delete(viewer);
|
|
92
93
|
});
|
|
94
|
+
// Reload from disk, like the HTML viewer's refresh button. That button
|
|
95
|
+
// skips the reload while the model is dirty; an image model is never
|
|
96
|
+
// edited, so there is nothing here to discard.
|
|
97
|
+
widget.toolbar.addItem('advanced-refresh', new ToolbarButton({
|
|
98
|
+
icon: refreshIcon,
|
|
99
|
+
tooltip: 'Reload image from disk',
|
|
100
|
+
onClick: async () => {
|
|
101
|
+
await widget.context.revert();
|
|
102
|
+
widget.update();
|
|
103
|
+
}
|
|
104
|
+
}));
|
|
93
105
|
widget.toolbar.addItem('advanced-zoom-out', new ToolbarButton({
|
|
94
106
|
label: '-',
|
|
95
107
|
tooltip: 'Zoom out',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jupyterlab_advanced_image_viewer_extension",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "JupyterLab extension for advanced image viewing: fit-to-screen, cursor-anchored wheel zoom, drag-to-pan, and Left/Right arrow keys to move to the previous and next image in a folder",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jupyter",
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"@jupyterlab/docregistry": "^4.0.0",
|
|
63
63
|
"@jupyterlab/imageviewer": "^4.0.0",
|
|
64
64
|
"@jupyterlab/settingregistry": "^4.0.0",
|
|
65
|
+
"@jupyterlab/ui-components": "^4.0.0",
|
|
65
66
|
"@lumino/disposable": "^2.0.0",
|
|
66
67
|
"@lumino/widgets": "^2.0.0"
|
|
67
68
|
},
|
package/src/index.ts
CHANGED
|
@@ -18,6 +18,8 @@ import { IImageTracker, ImageViewer } from '@jupyterlab/imageviewer';
|
|
|
18
18
|
|
|
19
19
|
import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
|
20
20
|
|
|
21
|
+
import { refreshIcon } from '@jupyterlab/ui-components';
|
|
22
|
+
|
|
21
23
|
import { IDisposable } from '@lumino/disposable';
|
|
22
24
|
|
|
23
25
|
import { Widget } from '@lumino/widgets';
|
|
@@ -134,6 +136,20 @@ const plugin: JupyterFrontEndPlugin<void> = {
|
|
|
134
136
|
controllers.delete(viewer);
|
|
135
137
|
});
|
|
136
138
|
|
|
139
|
+
// Reload from disk, like the HTML viewer's refresh button. That button
|
|
140
|
+
// skips the reload while the model is dirty; an image model is never
|
|
141
|
+
// edited, so there is nothing here to discard.
|
|
142
|
+
widget.toolbar.addItem(
|
|
143
|
+
'advanced-refresh',
|
|
144
|
+
new ToolbarButton({
|
|
145
|
+
icon: refreshIcon,
|
|
146
|
+
tooltip: 'Reload image from disk',
|
|
147
|
+
onClick: async () => {
|
|
148
|
+
await widget.context.revert();
|
|
149
|
+
widget.update();
|
|
150
|
+
}
|
|
151
|
+
})
|
|
152
|
+
);
|
|
137
153
|
widget.toolbar.addItem(
|
|
138
154
|
'advanced-zoom-out',
|
|
139
155
|
new ToolbarButton({
|