Hi everyone,
I needed to modify the ResetTool so that it resets the plot view but not the data selection. I did that using the custom tool mechanism to create a new ResetView tool. Things work well in a minimal example that I launch as >python custom_tool.py , but it doesn’t work if I include the new class in my larger application that I launch with >bokeh serve -app.py, in which case I get the following error:
Traceback (most recent call last):
File “src/bokeh_apps/example_1.py”, line 289, in
SESSION = push_session(DOC, session_id=sys.argv[1])
File “/Users/…/bokeh/client/session.py”, line 63, in push_session
session.push(document)
File “/Users/…/bokeh/client/session.py”, line 270, in push
self._connection.push_doc(doc)
File “/Users/…/bokeh/client/_connection.py”, line 231, in push_doc
raise RuntimeError("Failed to push document: " + reply.content['text'])
RuntimeError: Failed to push document: KeyError(“View model name ‘ResetView’ not found”,)
The new class is simply the original ResetTool class stripped of a few lines:
class ResetView(Tool):
__implementation__ = """
ActionTool = require "models/tools/actions/action_tool"
class ResetViewView extends ActionTool.View
do: () ->
@plot_view.clear_state()
@plot_view.reset_range()
class ResetView extends ActionTool.Model
default_view: ResetViewView
type: "ResetTool"
tool_name: "Reset view"
icon: "bk-tool-icon-reset"
module.exports = {
Model: ResetView
View: ResetViewView
}
"""
I did look at the models/custom.py example but that didn’t help me to understand what I am missing.
Thanks a lot for any help!
Gerardo