Skip to content

Commit

Permalink
Revert "Add arrow renderer, fix some problems from finos#1290"
Browse files Browse the repository at this point in the history
This reverts commit 5032199.
  • Loading branch information
zepaz committed Jan 22, 2021
1 parent bce83df commit 6414edc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 55 deletions.
4 changes: 0 additions & 4 deletions cpp/perspective/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -634,10 +634,6 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)

# .dll not importable
set_property(TARGET binding PROPERTY SUFFIX .pyd)
elseif (MACOS OR NOT MANYLINUX)
target_compile_options(binding PRIVATE -Wdeprecated-declarations)
set_property(TARGET psp PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${module_origin_path})
set_property(TARGET binding PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${module_origin_path})
else()
target_compile_options(binding PRIVATE -Wdeprecated-declarations)
endif()
Expand Down
53 changes: 2 additions & 51 deletions packages/perspective-jupyterlab/src/ts/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ import {PerspectiveWidget} from "./psp_widget";
*/
const FACTORY_CSV = "CSVPerspective";
const FACTORY_JSON = "JSONPerspective";
const FACTORY_ARROW = "ArrowPerspective";

const RENDER_TIMEOUT = 1000;

type IPerspectiveDocumentType = "csv" | "json" | "arrow";
type IPerspectiveDocumentType = "csv" | "json";

// create here to reuse for exception handling
const baddialog = (): void => {
Expand Down Expand Up @@ -54,7 +53,7 @@ export class PerspectiveDocumentWidget extends DocumentWidget<PerspectiveWidget>

private _update(): void {
try {
if (this._type === "csv" || this._type === "arrow") {
if (this._type === "csv") {
// load csv directly
const data: string = this._context.model.toString();
this._psp._update(data);
Expand Down Expand Up @@ -118,15 +117,6 @@ export class PerspectiveJSONFactory extends ABCWidgetFactory<IDocumentWidget<Per
}
}

/**
* A widget factory for arrow widgets.
*/
export class PerspectiveArrowFactory extends ABCWidgetFactory<IDocumentWidget<PerspectiveWidget>> {
protected createNewWidget(context: DocumentRegistry.Context): IDocumentWidget<PerspectiveWidget> {
return new PerspectiveDocumentWidget({context}, "arrow");
}
}

/**
* Activate cssviewer extension for CSV files
*/
Expand All @@ -145,13 +135,6 @@ function activate(app: JupyterFrontEnd, restorer: ILayoutRestorer | null, themeM
readOnly: true
});

const factoryarrow = new PerspectiveArrowFactory({
name: FACTORY_ARROW,
fileTypes: ["arrow"],
defaultFor: ["arrow"],
readOnly: true
});

const trackercsv = new WidgetTracker<IDocumentWidget<PerspectiveWidget>>({
namespace: "csvperspective"
});
Expand All @@ -160,10 +143,6 @@ function activate(app: JupyterFrontEnd, restorer: ILayoutRestorer | null, themeM
namespace: "jsonperspective"
});

const trackerarrow = new WidgetTracker<IDocumentWidget<PerspectiveWidget>>({
namespace: "arrowperspective"
});

if (restorer) {
// Handle state restoration.
void restorer.restore(trackercsv, {
Expand All @@ -177,26 +156,17 @@ function activate(app: JupyterFrontEnd, restorer: ILayoutRestorer | null, themeM
args: widget => ({path: widget.context.path, factory: FACTORY_JSON}),
name: widget => widget.context.path
});

void restorer.restore(trackerarrow, {
command: "docmanager:open",
args: widget => ({path: widget.context.path, factory: FACTORY_ARROW}),
name: widget => widget.context.path
});
}

app.docRegistry.addWidgetFactory(factorycsv);
app.docRegistry.addWidgetFactory(factoryjson);
app.docRegistry.addWidgetFactory(factoryarrow);

const ftcsv = app.docRegistry.getFileType("csv");
const ftjson = app.docRegistry.getFileType("json");
const ftarrow = app.docRegistry.getFileType("arrow");

factorycsv.widgetCreated.connect((sender, widget) => {
// Track the widget.
void trackercsv.add(widget);

// Notify the widget tracker if restore data needs to update.
widget.context.pathChanged.connect(() => {
void trackercsv.save(widget);
Expand All @@ -211,7 +181,6 @@ function activate(app: JupyterFrontEnd, restorer: ILayoutRestorer | null, themeM
factoryjson.widgetCreated.connect((sender, widget) => {
// Track the widget.
void trackerjson.add(widget);

// Notify the widget tracker if restore data needs to update.
widget.context.pathChanged.connect(() => {
void trackerjson.save(widget);
Expand All @@ -223,21 +192,6 @@ function activate(app: JupyterFrontEnd, restorer: ILayoutRestorer | null, themeM
}
});

factoryarrow.widgetCreated.connect((sender, widget) => {
// Track the widget.
void trackerarrow.add(widget);

// Notify the widget tracker if restore data needs to update.
widget.context.pathChanged.connect(() => {
void trackerarrow.save(widget);
});

if (ftarrow) {
widget.title.iconClass = ftarrow.iconClass || "";
widget.title.iconLabel = ftarrow.iconLabel || "";
}
});

// Keep the themes up-to-date.
const updateThemes = (): void => {
const isLight = themeManager && themeManager.theme ? themeManager.isLight(themeManager.theme) : true;
Expand All @@ -247,9 +201,6 @@ function activate(app: JupyterFrontEnd, restorer: ILayoutRestorer | null, themeM
trackerjson.forEach((pspDocWidget: PerspectiveDocumentWidget) => {
pspDocWidget.psp.dark = !isLight;
});
trackerarrow.forEach((pspDocWidget: PerspectiveDocumentWidget) => {
pspDocWidget.psp.dark = !isLight;
});
};

if (themeManager) {
Expand Down

0 comments on commit 6414edc

Please sign in to comment.