diff --git a/tests/test_app_bokeh.py b/tests/test_app_bokeh.py index 997a12f52..f9527a735 100644 --- a/tests/test_app_bokeh.py +++ b/tests/test_app_bokeh.py @@ -185,8 +185,8 @@ def test_get_level_by_extent() -> None: def test_roots(doc: Document) -> None: """Test that the document has the correct number of roots.""" - # should be 4 roots: main window, controls, slide_info, popup table - assert len(doc.roots) == 4 + # should be 5 roots: main window, controls, slide_info, popup, extra_layout + assert len(doc.roots) == 5 def test_config_loaded(data_path: pytest.TempPathFactory) -> None: @@ -627,7 +627,7 @@ def test_pt_size_spinner(doc: Document) -> None: pt_size_spinner.value = 10 # check that the point size has been set correctly assert ( - main.UI["p"].renderers[main.UI["vstate"].layer_dict["nodes"]].glyph.size + main.UI["p"].renderers[main.UI["vstate"].layer_dict["nodes"]].glyph.radius == 2 * 10 ) diff --git a/tiatoolbox/visualization/bokeh_app/main.py b/tiatoolbox/visualization/bokeh_app/main.py index 4401295b1..4a36e494e 100644 --- a/tiatoolbox/visualization/bokeh_app/main.py +++ b/tiatoolbox/visualization/bokeh_app/main.py @@ -784,7 +784,7 @@ def overlay_alpha_cb(attr: str, old: float, new: float) -> None: # noqa: ARG001 def pt_size_cb(attr: str, old: float, new: float) -> None: # noqa: ARG001 """Callback to change the size of the points.""" - UI["vstate"].graph_node.size = 2 * new + UI["vstate"].graph_node.radius = 2 * new def edge_size_cb(attr: str, old: float, new: float) -> None: # noqa: ARG001 @@ -1789,7 +1789,14 @@ def make_window(vstate: ViewerState) -> dict: # noqa: PLR0915 box_source = ColumnDataSource({"x": [], "y": [], "width": [], "height": []}) pt_source = ColumnDataSource({"x": [], "y": []}) r = p.rect("x", "y", "width", "height", source=box_source, fill_alpha=0) - c = p.circle("x", "y", source=pt_source, color="red", size=5) + c = p.circle( + "x", + "y", + source=pt_source, + color="red", + radius=3, + radius_units="screen", + ) p.add_tools(BoxEditTool(renderers=[r], num_objects=1)) p.add_tools(PointDrawTool(renderers=[c])) p.add_tools(TapTool()) @@ -1801,7 +1808,13 @@ def make_window(vstate: ViewerState) -> dict: # noqa: PLR0915 # Add graph stuff node_source = ColumnDataSource({"x_": [], "y_": [], "node_color_": []}) edge_source = ColumnDataSource({"x0_": [], "y0_": [], "x1_": [], "y1_": []}) - vstate.graph_node = Circle(x="x_", y="y_", fill_color="node_color_", size=5) + vstate.graph_node = Circle( + x="x_", + y="y_", + fill_color="node_color_", + radius=3, + radius_units="screen", + ) vstate.graph_edge = Segment(x0="x0_", y0="y0_", x1="x1_", y1="y1_") p.add_glyph(node_source, vstate.graph_node) node_source.selected.on_change("indices", node_select_cb) @@ -1871,6 +1884,8 @@ def make_window(vstate: ViewerState) -> dict: # noqa: PLR0915 "hover": hover, "user": user, "color_bar": color_bar, + "ui_layout": ui_layout, + "extra_options": extra_options, }