Skip to content

Commit e976418

Browse files
committed
widgets: remove the previous version entirely, and also k3d. This new approach is clearly greatly superior and will work.
- I'm also really tired of fixing the old code whenever I change the new code, since that is a waste of time.
1 parent c75b561 commit e976418

File tree

15 files changed

+6
-2428
lines changed

15 files changed

+6
-2428
lines changed

src/packages/frontend/jupyter/browser-actions.ts

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ import { fromJS, Map } from "immutable";
1111
import { debounce, isEqual } from "lodash";
1212
import { from_json, to_json, merge_copy, uuid } from "@cocalc/util/misc";
1313
import { JupyterActions as JupyterActions0 } from "@cocalc/jupyter/redux/actions";
14-
import { WidgetManager } from "./widgets/manager";
15-
import { WidgetManager as WidgetManager2 } from "./widgets/manager2";
14+
import { WidgetManager } from "./widgets/manager2";
1615
import { CursorManager } from "./cursor-manager";
1716
import { ConfirmDialogOptions } from "./confirm-dialog";
1817
import { callback2, once } from "@cocalc/util/async-utils";
@@ -39,7 +38,6 @@ import { webapp_client } from "@cocalc/frontend/webapp-client";
3938

4039
export class JupyterActions extends JupyterActions0 {
4140
public widget_manager?: WidgetManager;
42-
public widget_manager2?: WidgetManager2;
4341
public nbgrader_actions: NBGraderActions;
4442
public snippet_actions: any;
4543

@@ -109,17 +107,10 @@ export class JupyterActions extends JupyterActions0 {
109107
if (ipywidgets_state == null) {
110108
throw Error("bug -- ipywidgets_state must be defined");
111109
}
112-
if (false) {
113-
this.widget_manager = new WidgetManager(
114-
ipywidgets_state!,
115-
this.setWidgetModelIdState.bind(this),
116-
);
117-
} else {
118-
this.widget_manager2 = new WidgetManager2({
119-
ipywidgets_state: ipywidgets_state!,
120-
actions: this,
121-
});
122-
}
110+
this.widget_manager = new WidgetManager({
111+
ipywidgets_state: ipywidgets_state!,
112+
actions: this,
113+
});
123114
// Stupid hack for now -- this just causes some activity so
124115
// that the syncdb syncs.
125116
// This should not be necessary, and may indicate a bug in the sync layer?
@@ -323,20 +314,6 @@ export class JupyterActions extends JupyterActions0 {
323314
// this.deprecated("focus_unlock");
324315
};
325316

326-
private setWidgetModelIdState(
327-
model_id: string,
328-
state: string | null, // '' = good; 'nonempty' = bad; null=delete
329-
): void {
330-
let widgetModelIdState: Map<string, string> =
331-
this.store.get("widgetModelIdState");
332-
if (state === null) {
333-
widgetModelIdState = widgetModelIdState.delete(model_id);
334-
} else {
335-
widgetModelIdState = widgetModelIdState.set(model_id, state);
336-
}
337-
this.setState({ widgetModelIdState });
338-
}
339-
340317
protected close_client_only(): void {
341318
const account = this.redux.getStore("account");
342319
if (account != null) {

src/packages/frontend/jupyter/output-messages/ipywidget.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export function IpyWidget({ id: cell_id, value, actions }: WidgetProps) {
4848
loadFontAwesome();
4949
const id = value.get("model_id");
5050

51-
const { widget_manager2: widget_manager } = actions;
51+
const { widget_manager } = actions;
5252
if (widget_manager == null) {
5353
// console.log("IpyWidget: not rendering due to widget_manager=null");
5454
return;

0 commit comments

Comments
 (0)