Skip to content

Settable active state of ToolProxys in gridplot #10107

@chrisbarber

Description

@chrisbarber

Is your feature request related to a problem? Please describe.

No friendly way of setting the state of the (merged) tools in a gridplot. The underlying tool model's .active states can be changed independently, and this "works," but the change is not reflected in the UI. The ToolProxy objects can be navigated to and their .active states set, but one has to look inside them, at their tools list, and the tool_name properties on them, in order to determine which is which.

See original discussion here: #4567

Describe the solution you'd like

Some convenient lookup for the ToolProxy which is associated with a given merged tool type on a gridplot, or maybe some friendlier interface where it would actually sound like the "merged gridplot box select tool" for example.

Describe alternatives you've considered

This is roughly how it looks, manually hunting down the tool proxies and identifying their types:

const gridplot_toolbar = Bokeh.documents[0].get_model_by_name('plots').children[0].children[0].toolbar;
var bokeh_xpan_tool_proxy = null;
var bokeh_box_select_tool_proxy = null;
for (var tool_proxy of gridplot_toolbar.gestures["pan"].tools) {
    switch (tool_proxy.tools[0].tool_name) {
    case "Pan":
        bokeh_xpan_tool_proxy = tool_proxy;
        break;
    case "Box Select":
        bokeh_box_select_tool_proxy = tool_proxy;
        break;
    }
}

I originally just grabbed the DOM button element for things in the toolbar and .click()ed them. Now with hammerjs being used, I can't find a way to just trigger such an event.

Changing the proxied tool states in tandem and just dealing with the fact it is not reflected in the UI, like when you go through the tool proxies.

Additional context

Here is an example that illustrates the need to go through the tool proxies, which are hard to find (and are probably considered internal and should not be relied on)
#4567 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions