Skip to content

Commit

Permalink
Update perspective-python for new theme API
Browse files Browse the repository at this point in the history
  • Loading branch information
texodus committed Jan 29, 2022
1 parent 6ddb7d5 commit 69188d8
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
1 change: 0 additions & 1 deletion packages/perspective-jupyterlab/src/js/psp_widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ export class PerspectiveWidget extends Widget {
this._server = server;
}


get editable() {
return this._editable;
}
Expand Down
1 change: 0 additions & 1 deletion packages/perspective-jupyterlab/src/js/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,6 @@ export class PerspectiveView extends DOMWidgetView {
theme: this.model.get("theme"),
});
}
}

editable_changed() {
this.pWidget.editable = this.model.get("editable");
Expand Down
4 changes: 2 additions & 2 deletions python/perspective/perspective/tests/viewer/test_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ def test_viewer_load_data_with_options(self):

def test_viewer_load_clears_state(self):
table = Table({"a": [1, 2, 3]})
viewer = PerspectiveViewer(dark=True, row_pivots=["a"])
viewer = PerspectiveViewer(theme="Material Dark", row_pivots=["a"])
viewer.load(table)
assert viewer.row_pivots == ["a"]
viewer.load({"b": [1, 2, 3]})
assert viewer.row_pivots == []
assert viewer.dark is True # should not break UI
assert viewer.theme == "Material Dark" # should not break UI

def test_viewer_load_np(self):
table = Table({"a": np.arange(1, 100)})
Expand Down
6 changes: 3 additions & 3 deletions python/perspective/perspective/viewer/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __init__(
filter=None,
expressions=None,
plugin_config=None,
dark=None,
theme=None,
editable=False,
):
"""Initialize an instance of `PerspectiveViewer` with the given viewer
Expand Down Expand Up @@ -96,7 +96,7 @@ def __init__(
select by default.
plugin_config (:obj:`dict`): A configuration for the plugin, i.e.
the datagrid plugin or a chart plugin.
dark (:obj:`bool`): Whether to invert the color theme.
theme (:obj:`str`): The color theme to use.
editable (:obj:`bool`): Whether to allow editability using the grid.
Examples:
Expand Down Expand Up @@ -128,7 +128,7 @@ def __init__(
self.filter = validate_filter(filter) or []
self.expressions = validate_expressions(expressions) or []
self.plugin_config = validate_plugin_config(plugin_config) or {}
self.dark = dark
self.theme = theme
self.editable = editable

@property
Expand Down
2 changes: 1 addition & 1 deletion python/perspective/perspective/viewer/viewer_traitlets.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class PerspectiveTraitlets(HasTraits):
filter = List(default_value=[]).tag(sync=True)
expressions = List(default_value=[]).tag(sync=True)
plugin_config = Dict(default_value={}).tag(sync=True)
dark = Bool(None, allow_none=True).tag(sync=True)
theme = Unicode("Material Light", allow_none=True).tag(sync=True)
editable = Bool(False).tag(sync=True)
server = Bool(False).tag(sync=True)
client = Bool(False).tag(sync=True)
Expand Down

0 comments on commit 69188d8

Please sign in to comment.