Repository: bokeh/bokeh

Issue:
GlyphView should not extend RendererView
This is a long term issue with view/model inheritance in bokehjs. `GlyphView` is the prominent case, but there is also `ToolView` and `PlotCanvas`, none of which are renderers.



Discussion:

Resolving patch:
diff --git a/bokeh/core/enums.py b/bokeh/core/enums.py
--- a/bokeh/core/enums.py
+++ b/bokeh/core/enums.py
@@ -153,7 +153,7 @@ def enumeration(*values, **kwargs):
                               "pt-pt", "ru", "ru-UA", "sk", "th", "tr", "uk-UA")
 
 #: Specify a position in the render order for a Bokeh renderer
-RenderLevel = enumeration("image", "underlay", "glyph", "annotation", "overlay", "tool")
+RenderLevel = enumeration("image", "underlay", "glyph", "annotation", "overlay")
 
 #: Specify a render mode for renderers that support both Canvas or CSS rendering
 RenderMode = enumeration("canvas", "css")


Test patch:
diff --git a/bokehjs/test/core/enums.coffee b/bokehjs/test/core/enums.coffee
--- a/bokehjs/test/core/enums.coffee
+++ b/bokehjs/test/core/enums.coffee
@@ -26,7 +26,7 @@ describe "enums module", ->
     expect(enums.RenderMode).to.be.deep.equal ["canvas", "css"]
 
   it "should have RenderLevel", ->
-    expect(enums.RenderLevel).to.be.deep.equal ["image", "underlay", "glyph", "annotation", "overlay", "tool"]
+    expect(enums.RenderLevel).to.be.deep.equal ["image", "underlay", "glyph", "annotation", "overlay"]
 
   it "should have Side", ->
     expect(enums.Side).to.be.deep.equal ["left", "right"]
diff --git a/bokehjs/test/core/layout/side_panel.coffee b/bokehjs/test/core/layout/side_panel.coffee
--- a/bokehjs/test/core/layout/side_panel.coffee
+++ b/bokehjs/test/core/layout/side_panel.coffee
@@ -79,11 +79,11 @@ describe "SidePanel.Model", ->
       @plot_canvas = new PlotCanvas({ 'plot': plot })
       @plot_canvas.attach_document(doc)
       @plot_canvas_view = new @plot_canvas.default_view({ 'model': @plot_canvas })
-      @axis_view = new @axis.default_view({ model: @axis, plot_model: @plot_canvas, plot_view: @plot_canvas_view })
+      @axis_view = new @axis.default_view({ model: @axis, plot_view: @plot_canvas_view })
 
     it "should not fail if visible is not on model", ->
       an = new Annotation()
-      an_view = new an.default_view({model: an, plot_model: @plot_canvas, plot_view: @plot_canvas_view})
+      an_view = new an.default_view({model: an, plot_view: @plot_canvas_view})
       expect(an_view._size_constraint).to.be.undefined
       update_constraints(an_view)
       # Should still be undefined because visible is false
diff --git a/bokehjs/test/models/annotations/color_bar.coffee b/bokehjs/test/models/annotations/color_bar.coffee
--- a/bokehjs/test/models/annotations/color_bar.coffee
+++ b/bokehjs/test/models/annotations/color_bar.coffee
@@ -262,7 +262,6 @@ describe "ColorBar module", ->
 
       @color_bar_view = new @color_bar.default_view({
         model: @color_bar
-        plot_model: @plot.plot_canvas
         plot_view: @plot_canvas_view
       })
 
diff --git a/bokehjs/test/models/axes/axis.coffee b/bokehjs/test/models/axes/axis.coffee
--- a/bokehjs/test/models/axes/axis.coffee
+++ b/bokehjs/test/models/axes/axis.coffee
@@ -81,7 +81,6 @@ describe "Axis.View", ->
     sinon.stub(plot_canvas_view, 'update_constraints')
     @axis_view = new @axis.default_view({
       model: @axis
-      plot_model: plot.plot_canvas
       plot_view: plot_canvas_view
     })
 
diff --git a/bokehjs/test/models/glyphs/glyph_utils.coffee b/bokehjs/test/models/glyphs/glyph_utils.coffee
--- a/bokehjs/test/models/glyphs/glyph_utils.coffee
+++ b/bokehjs/test/models/glyphs/glyph_utils.coffee
@@ -30,7 +30,6 @@ create_glyph_view = (glyph) ->
 
   glyph_renderer_view = new glyph_renderer.default_view({
     model: glyph_renderer
-    plot_model: plot.plot_canvas
     plot_view: plot_view
   })
 
diff --git a/bokehjs/test/models/plots/plot_canvas.coffee b/bokehjs/test/models/plots/plot_canvas.coffee
--- a/bokehjs/test/models/plots/plot_canvas.coffee
+++ b/bokehjs/test/models/plots/plot_canvas.coffee
@@ -321,7 +321,7 @@ describe "PlotCanvas.View update_constraints", ->
   #  axis = new Axis({ ticker: ticker, formatter: formatter })
   #  @test_plot.add_layout(axis, 'below')
   #  test_plot_view = new @test_plot.default_view({ 'model': @test_plot })
-  #  axis_view = new axis.default_view({ model: axis, plot_model: @test_plot, plot_view: test_plot_view })
+  #  axis_view = new axis.default_view({ model: axis, plot_view: test_plot_view })
 
   #  spy = sinon.spy(update_constraints)
   #  test_plot_view.update_constraints()
diff --git a/bokehjs/test/models/tools/gestures/resize_tool.coffee b/bokehjs/test/models/tools/gestures/resize_tool.coffee
--- a/bokehjs/test/models/tools/gestures/resize_tool.coffee
+++ b/bokehjs/test/models/tools/gestures/resize_tool.coffee
@@ -33,7 +33,6 @@ describe "ResizeTool", ->
       @resizetool = new ResizeTool({ plot: plot })
       @resizetool_view = new @resizetool.default_view({
         model: @resizetool
-        plot_model: plot.plot_canvas
         plot_view: @plot_canvas_view
       })
 
diff --git a/bokehjs/test/models/tools/gestures/wheel_pan_tool.coffee b/bokehjs/test/models/tools/gestures/wheel_pan_tool.coffee
--- a/bokehjs/test/models/tools/gestures/wheel_pan_tool.coffee
+++ b/bokehjs/test/models/tools/gestures/wheel_pan_tool.coffee
@@ -48,7 +48,6 @@ describe "WheelPanTool", ->
 
       wheel_pan_tool_view = new x_wheel_pan_tool.default_view({
         model: x_wheel_pan_tool
-        plot_model: @plot.plot_canvas
         plot_view: @plot_canvas_view
       })
 
@@ -68,7 +67,6 @@ describe "WheelPanTool", ->
 
       wheel_pan_tool_view = new x_wheel_pan_tool.default_view({
         model: x_wheel_pan_tool
-        plot_model: @plot.plot_canvas
         plot_view: @plot_canvas_view
       })