Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
close() {
if (this._on_close) {
this._on_close();
}
return 'dummy';
}
send() {
return 'dummy';
}
open() {
return 'dummy';
}
}
export class DummyManager extends widgets.ManagerBase {
constructor() {
super();
this.el = window.document.createElement('div');
}
display_view(msg, view, options) {
// TODO: make this a spy
// TODO: return an html element
return Promise.resolve(view).then(v => {
this.el.appendChild(v.el);
v.on('remove', () => console.log('view removed', v)); //eslint-disable-line
return v.el;
});
}
loadClass(className, moduleName, moduleVersion) {
return 'dummy';
}
send(): string {
return 'dummy';
}
open(): string {
return 'dummy';
}
comm_id: string;
_on_msg: Function | null = null;
_on_close: Function | null = null;
}
export
class DummyManager extends widgets.ManagerBase {
constructor() {
super();
this.el = window.document.createElement('div');
}
display_view(msg: services.KernelMessage.IMessage, view: Backbone.View, options: any) {
// TODO: make this a spy
// TODO: return an html element
return Promise.resolve(view).then(view => {
this.el.appendChild(view.el);
view.on('remove', () => console.log('view removed', view));
return view.el;
});
}
protected loadClass(className: string, moduleName: string, moduleVersion: string): Promise {
return 'dummy';
}
send(): string {
return 'dummy';
}
open(): string {
return 'dummy';
}
comm_id: string;
_on_msg: Function | null = null;
_on_close: Function | null = null;
}
export
class DummyManager extends widgets.ManagerBase {
constructor() {
super();
this.el = window.document.createElement('div');
}
display_view(msg: services.KernelMessage.IMessage, view: Backbone.View, options: any) {
// TODO: make this a spy
// TODO: return an html element
return Promise.resolve(view).then(view => {
this.el.appendChild(view.el);
view.on('remove', () => console.log('view removed', view));
return view.el;
});
}
protected loadClass(className: string, moduleName: string, moduleVersion: string): Promise {
}
}
for (let key in this.widget_views) {
if(this.widget_views.hasOwnProperty(key)) {
// Ugly, this should be properly done
let [row, col] = String(key).split(',').map(x => parseInt(x));
let widget_view = this.widget_views[key];
if(data[row][col] && data[row][col].value && data[row][col].value.cid == widget_view.model.cid) {
// good, the previous widget_view should be reused
} else {
// we have a leftover view from the previous run
widget_view.remove();
}
}
}
this.widget_views = await widgets.resolvePromisesDict(widget_view_promises)
},
async _build_table() {
var widgets = require('@jupyter-widgets/base');
var PhosphorWidget = require('@phosphor/widgets').Widget;
var ManagerBase = widgets.ManagerBase;
var WidgetManager = exports.WidgetManager = function(el) {
// Call the base class.
ManagerBase.call(this);
this.el = el;
};
WidgetManager.prototype = Object.create(ManagerBase.prototype);
WidgetManager.prototype.display_view = function(msg, view, options) {
var that = this;
return Promise.resolve(view).then(function(view) {
PhosphorWidget.attach(view.pWidget, that.el);
view.on('remove', function() {
console.log('View removed', view);
});
return view;
// for model attributes, including
//
// - `_view_name`
// - `_view_module`
// - `_view_module_version`
//
// - `_model_name`
// - `_model_module`
// - `_model_module_version`
//
// when different from the base class.
// When serialiazing the entire widget state for embedding, only values that
// differ from the defaults will be specified.
var ScatterplotModel = widgets.DOMWidgetModel.extend({
defaults: _.extend(widgets.DOMWidgetModel.prototype.defaults(), {
_model_name : 'ScatterplotModel',
_view_name : 'ScatterplotView',
_model_module : 'progressivis-nb-widgets',
_view_module : 'progressivis-nb-widgets',
_model_module_version : '0.1.0',
_view_module_version : '0.1.0',
data : 'Hello Scatterplot!',
value: '{0}'
})
});
// Custom View. Renders the widget model.
var ScatterplotView = widgets.DOMWidgetView.extend({
// Defines how the widget gets rendered into the DOM
render: function() {
// for model attributes, including
//
// - `_view_name`
// - `_view_module`
// - `_view_module_version`
//
// - `_model_name`
// - `_model_module`
// - `_model_module_version`
//
// when different from the base class.
// When serialiazing the entire widget state for embedding, only values that
// differ from the defaults will be specified.
var JSProxyModel = widgets.DOMWidgetModel.extend({
defaults: _.extend(widgets.DOMWidgetModel.prototype.defaults(), {
_model_name : 'JSProxyModel',
_view_name : 'JSProxyView',
_model_module : 'jp_proxy_widget',
_view_module : 'jp_proxy_widget',
_model_module_version : '1.0.0',
_view_module_version : '1.0.0',
})
});
//var loader_defined = false;
var JSProxyLoad = "JSProxyLoad";
// Custom View. Renders the widget model.
var JSProxyView = widgets.DOMWidgetView.extend({
render: function() {
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
// ----------------------------------------------------------------------------
var widgets = require("@jupyter-widgets/base");
var _ = require("lodash");
var THREE = require("three");
var OrbitControls = require("three-orbit-controls")(THREE);
// Webpack automatically resolves path for assets
import disc_path from "./assets/disc.png";
var JVisualizerModel = widgets.DOMWidgetModel.extend({
defaults: _.extend(widgets.DOMWidgetModel.prototype.defaults(), {
_model_name: "JVisualizerModel",
_model_module: "open3d",
_model_module_version: "@PROJECT_VERSION_THREE_NUMBER@",
_view_name: "JVisualizerView",
_view_module: "open3d",
_view_module_version: "@PROJECT_VERSION_THREE_NUMBER@",
geometry_jsons: []
})
});
var JVisualizerView = widgets.DOMWidgetView.extend({
camera: null,
control: null,
scene: null,
renderer: null,
geometry: null,
var widgets = require('@jupyter-widgets/base');
var _ = require('lodash');
var cs = require('cornerstone-core');
var cm = require('cornerstone-math');
var ctools = require('cornerstone-tools');
var $ = require('jquery');
ctools.external.cornerstone = cs;
ctools.external.cornerstoneMath = cm;
// When serialiazing the entire widget state for embedding, only values that
// differ from the defaults will be specified.
var CornerstoneModel = widgets.DOMWidgetModel.extend({
defaults: _.extend(widgets.DOMWidgetModel.prototype.defaults(), {
_model_name: 'CornerstoneModel',
_view_name: 'CornerstoneView',
_model_module: 'cornerstone_widget',
_view_module: 'cornerstone_widget',
_model_module_version: '0.1.0',
_view_module_version: '0.1.0',
img_bytes: '',
img_scale: 1,
img_width: 0,
img_height: 0,
img_min: 0,
img_max: 1,
img_color: false,
_selected_tool: '',
_tool_state_in: '',
// //
// The full license is in the file LICENSE, distributed with this software. //
///////////////////////////////////////////////////////////////////////////////
window.ws = window.WebSocket;
var widgets = require('@jupyter-widgets/base');
var _ = require('lodash');
var ROSLIB = require('roslib');
var ROS3D = require('ros3d');
var THREE = require('three');
var defaults = require('./defaults.js')
var widget_defaults = widgets.WidgetModel.prototype.defaults;
var domwidget_defaults = widgets.DOMWidgetModel.prototype.defaults;
var default_serializers = function(names) {
names = names || ['ros', 'tf_client']
var named_serializers = {}
for (let idx in names)
{
named_serializers[names[idx]] = { deserialize: widgets.unpack_models }
}
return {serializers: _.extend(named_serializers, widgets.WidgetModel.serializers)};
}
var fixup_url = function(url) {
url = url
.replace("{hostname}", window.location.hostname)
.replace("{port}", window.location.port);