From c3fd0ba6eb48997dd1831a02e5fb48fcd234da2a4fe441bdc7260837515eea38 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Tue, 20 Jul 2021 11:39:19 +0000 Subject: [PATCH 1/4] Accepting request 907197 from home:bnavigator:branches:devel:languages:python:numeric:patched-bokeh - Revert to version 2.3.3 * stay on a stable version. 2.4.0.dev1 broke distributed - Add bokeh-pr11218-figure-toolbar-active-properties.patch * fix for gh#spotify/chartify/issues/128 * is a rebased version of gh#bokeh/bokeh#11218 * tested with all packages with an active %check from `osc whatdependson openSUSE:Factory python-bokeh standard x86_64` OBS-URL: https://build.opensuse.org/request/show/907197 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-bokeh?expand=0&rev=48 --- bokeh-2.3.3.tar.gz | 3 + bokeh-2.4.0.dev1.tar.gz | 3 - ...218-figure-toolbar-active-properties.patch | 386 ++++++++++++++++++ python-bokeh.changes | 11 + python-bokeh.spec | 12 +- 5 files changed, 407 insertions(+), 8 deletions(-) create mode 100644 bokeh-2.3.3.tar.gz delete mode 100644 bokeh-2.4.0.dev1.tar.gz create mode 100644 bokeh-pr11218-figure-toolbar-active-properties.patch diff --git a/bokeh-2.3.3.tar.gz b/bokeh-2.3.3.tar.gz new file mode 100644 index 0000000..5645e12 --- /dev/null +++ b/bokeh-2.3.3.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a5fdcc181835561447fcc5a371300973fce4114692d5853addec284d1cdeb677 +size 10670403 diff --git a/bokeh-2.4.0.dev1.tar.gz b/bokeh-2.4.0.dev1.tar.gz deleted file mode 100644 index c886dec..0000000 --- a/bokeh-2.4.0.dev1.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e295f90b274fb644020a45fa42442a420207c62f69a07184f077e0317df3fd60 -size 11602575 diff --git a/bokeh-pr11218-figure-toolbar-active-properties.patch b/bokeh-pr11218-figure-toolbar-active-properties.patch new file mode 100644 index 0000000..04d3597 --- /dev/null +++ b/bokeh-pr11218-figure-toolbar-active-properties.patch @@ -0,0 +1,386 @@ +From 61026198bbfd7bc056b6b255ce0dd3d0dd0dc4f2 Mon Sep 17 00:00:00 2001 +From: Mateusz Paprocki +Date: Wed, 28 Apr 2021 12:02:01 +0200 +Subject: [PATCH 1/2] Unify {Figure,Toolbar}.active_* properties + +--- + bokeh/models/tools.py | 2 +- + bokeh/plotting/_tools.py | 35 ++++++++++++++++--------- + bokeh/plotting/figure.py | 16 +++++++---- + bokeh/plotting/gmap.py | 4 +-- + bokehjs/src/lib/models/tools/toolbar.ts | 18 ++++++------- + 5 files changed, 46 insertions(+), 29 deletions(-) + +Index: bokeh-2.3.3/bokeh/models/tools.py +=================================================================== +--- bokeh-2.3.3.orig/bokeh/models/tools.py ++++ bokeh-2.3.3/bokeh/models/tools.py +@@ -305,7 +305,7 @@ class Toolbar(ToolbarBase): + Specify a tap/click tool to be active when the plot is displayed. + """) + +- active_multi: tp.Union[Literal["auto"], GestureTool, None] = Nullable(Instance(GestureTool), help=""" ++ active_multi: tp.Union[Literal["auto"], GestureTool, None] = Either(Null, Auto, Instance(GestureTool), default="auto", help=""" + Specify an active multi-gesture tool, for instance an edit tool or a range + tool. + +Index: bokeh-2.3.3/bokeh/plotting/_tools.py +=================================================================== +--- bokeh-2.3.3.orig/bokeh/plotting/_tools.py ++++ bokeh-2.3.3/bokeh/plotting/_tools.py +@@ -37,7 +37,7 @@ from typing_extensions import Literal + + # Bokeh imports + from ..models import HoverTool, Plot, Tool, Toolbar +-from ..models.tools import Drag, InspectTool, Scroll, Tap ++from ..models.tools import Drag, GestureTool, InspectTool, Scroll, Tap + + #----------------------------------------------------------------------------- + # Globals and constants +@@ -62,18 +62,21 @@ ActiveDrag = Union[Drag, Auto, str, None + ActiveInspect = Union[List[InspectTool], InspectTool, Auto, str, None] + ActiveScroll = Union[Scroll, Auto, str, None] + ActiveTap = Union[Tap, Auto, str, None] ++ActiveMulti = Union[GestureTool, Auto, str, None] + + def process_active_tools(toolbar: Toolbar, tool_map: Dict[str, Tool], +- active_drag: ActiveDrag, active_inspect: ActiveInspect, active_scroll: ActiveScroll, active_tap: ActiveTap) -> None: ++ active_drag: ActiveDrag, active_inspect: ActiveInspect, active_scroll: ActiveScroll, ++ active_tap: ActiveTap, active_multi: ActiveMulti) -> None: + """ Adds tools to the plot object + + Args: + toolbar (Toolbar): instance of a Toolbar object + tools_map (dict[str]): tool_map from _process_tools_arg +- active_drag (str or Tool): the tool to set active for drag +- active_inspect (str or Tool): the tool to set active for inspect +- active_scroll (str or Tool): the tool to set active for scroll +- active_tap (str or Tool): the tool to set active for tap ++ active_drag (str, None, "auto" or Tool): the tool to set active for drag ++ active_inspect (str, None, "auto", Tool or Tool[]): the tool to set active for inspect ++ active_scroll (str, None, "auto" or Tool): the tool to set active for scroll ++ active_tap (str, None, "auto" or Tool): the tool to set active for tap ++ active_multi (str, None, "auto" or Tool): the tool to set active for tap + + Returns: + None +@@ -81,12 +84,12 @@ def process_active_tools(toolbar: Toolba + Note: + This function sets properties on Toolbar + """ +- if active_drag in ['auto', None] or isinstance(active_drag, Tool): ++ if active_drag in ["auto", None] or isinstance(active_drag, Tool): + toolbar.active_drag = cast(Any, active_drag) + elif active_drag in tool_map: + toolbar.active_drag = cast(Any, tool_map[active_drag]) + else: +- raise ValueError("Got unknown %r for 'active_drag', which was not a string supplied in 'tools' argument" % active_drag) ++ raise ValueError(f"Got unknown {active_drag!r} for 'active_drag', which was not a string supplied in 'tools' argument") + + if active_inspect in ["auto", None] or isinstance(active_inspect, Tool) or \ + (isinstance(active_inspect, list) and all(isinstance(t, Tool) for t in active_inspect)): +@@ -94,21 +97,28 @@ def process_active_tools(toolbar: Toolba + elif isinstance(active_inspect, str) and active_inspect in tool_map: + toolbar.active_inspect = cast(Any, tool_map[active_inspect]) + else: +- raise ValueError("Got unknown %r for 'active_inspect', which was not a string supplied in 'tools' argument" % active_scroll) ++ raise ValueError(f"Got unknown {active_inspect!r} for 'active_inspect', which was not a string supplied in 'tools' argument") + +- if active_scroll in ['auto', None] or isinstance(active_scroll, Tool): ++ if active_scroll in ["auto", None] or isinstance(active_scroll, Tool): + toolbar.active_scroll = cast(Any, active_scroll) + elif active_scroll in tool_map: + toolbar.active_scroll = cast(Any, tool_map[active_scroll]) + else: +- raise ValueError("Got unknown %r for 'active_scroll', which was not a string supplied in 'tools' argument" % active_scroll) ++ raise ValueError(f"Got unknown {active_scroll!r} for 'active_scroll', which was not a string supplied in 'tools' argument") + +- if active_tap in ['auto', None] or isinstance(active_tap, Tool): ++ if active_tap in ["auto", None] or isinstance(active_tap, Tool): + toolbar.active_tap = cast(Any, active_tap) + elif active_tap in tool_map: + toolbar.active_tap = cast(Any, tool_map[active_tap]) + else: +- raise ValueError("Got unknown %r for 'active_tap', which was not a string supplied in 'tools' argument" % active_tap) ++ raise ValueError(f"Got unknown {active_tap!r} for 'active_tap', which was not a string supplied in 'tools' argument") ++ ++ if active_multi in ["auto", None] or isinstance(active_multi, Tool): ++ toolbar.active_multi = cast(Any, active_multi) ++ elif active_multi in tool_map: ++ toolbar.active_multi = cast(Any, tool_map[active_multi]) ++ else: ++ raise ValueError(f"Got unknown {active_multi!r} for 'active_multi', which was not a string supplied in 'tools' argument") + + def process_tools_arg(plot: Plot, tools: Union[str, Sequence[Union[Tool, str]]], + tooltips: Optional[Union[str, Tuple[str, str]]] = None) -> Tuple[List[Tool], Dict[str, Tool]]: +Index: bokeh-2.3.3/bokeh/plotting/figure.py +=================================================================== +--- bokeh-2.3.3.orig/bokeh/plotting/figure.py ++++ bokeh-2.3.3/bokeh/plotting/figure.py +@@ -32,7 +32,7 @@ from ..core.properties import ( + Tuple, + ) + from ..models import ColumnDataSource, GraphRenderer, Plot, Title, Tool, glyphs +-from ..models.tools import Drag, InspectTool, Scroll, Tap ++from ..models.tools import Drag, GestureTool, InspectTool, Scroll, Tap + from ..transform import linear_cmap + from ..util.options import Options + from ._decorators import glyph_method, marker_method +@@ -175,7 +175,15 @@ class Figure(Plot): + + tool_objs, tool_map = process_tools_arg(self, opts.tools, opts.tooltips) + self.add_tools(*tool_objs) +- process_active_tools(self.toolbar, tool_map, opts.active_drag, opts.active_inspect, opts.active_scroll, opts.active_tap) ++ process_active_tools( ++ self.toolbar, ++ tool_map, ++ opts.active_drag, ++ opts.active_inspect, ++ opts.active_scroll, ++ opts.active_tap, ++ opts.active_multi, ++ ) + + @glyph_method(glyphs.AnnularWedge) + def annular_wedge(self, **kwargs): +@@ -1599,20 +1607,12 @@ def markers(): + + # This class itself is intentionally undocumented (it is used to generate + # documentation elsewhere) +-class FigureOptions(Options): ++class BaseFigureOptions(Options): + + tools = Either(String, Seq(Either(String, Instance(Tool))), default=DEFAULT_TOOLS, help=""" + Tools the plot should start with. + """) + +- x_range = Any(help=""" +- Customize the x-range of the plot. +- """) +- +- y_range = Any(help=""" +- Customize the y-range of the plot. +- """) +- + x_minor_ticks = Either(Auto, Int, default="auto", help=""" + Number of minor ticks between adjacent x-axis major ticks. + """) +@@ -1637,28 +1637,24 @@ class FigureOptions(Options): + A label for the y-axis. + """) + +- active_drag = Either(Auto, String, Instance(Drag), default="auto", help=""" ++ active_drag = Either(Null, Auto, String, Instance(Drag), default="auto", help=""" + Which drag tool should initially be active. + """) + +- active_inspect = Either(Auto, String, Instance(InspectTool), Seq(Instance(InspectTool)), default="auto", help=""" ++ active_inspect = Either(Null, Auto, String, Instance(InspectTool), Seq(Instance(InspectTool)), default="auto", help=""" + Which drag tool should initially be active. + """) + +- active_scroll = Either(Auto, String, Instance(Scroll), default="auto", help=""" ++ active_scroll = Either(Null, Auto, String, Instance(Scroll), default="auto", help=""" + Which scroll tool should initially be active. + """) + +- active_tap = Either(Auto, String, Instance(Tap), default="auto", help=""" ++ active_tap = Either(Null, Auto, String, Instance(Tap), default="auto", help=""" + Which tap tool should initially be active. + """) + +- x_axis_type = Either(Null, Auto, Enum("linear", "log", "datetime", "mercator"), default="auto", help=""" +- The type of the x-axis. +- """) +- +- y_axis_type = Either(Null, Auto, Enum("linear", "log", "datetime", "mercator"), default="auto", help=""" +- The type of the y-axis. ++ active_multi = Either(Null, Auto, String, Instance(GestureTool), default="auto", help=""" ++ Specify an active multi-gesture tool, for instance an edit tool or a range tool. + """) + + tooltips = Either(Null, String, List(Tuple(String, String)), help=""" +@@ -1670,6 +1666,24 @@ class FigureOptions(Options): + and added. + """) + ++class FigureOptions(BaseFigureOptions): ++ ++ x_range = Any(help=""" ++ Customize the x-range of the plot. ++ """) ++ ++ y_range = Any(help=""" ++ Customize the y-range of the plot. ++ """) ++ ++ x_axis_type = Either(Null, Auto, Enum("linear", "log", "datetime", "mercator"), default="auto", help=""" ++ The type of the x-axis. ++ """) ++ ++ y_axis_type = Either(Null, Auto, Enum("linear", "log", "datetime", "mercator"), default="auto", help=""" ++ The type of the y-axis. ++ """) ++ + #----------------------------------------------------------------------------- + # Private API + #----------------------------------------------------------------------------- +Index: bokeh-2.3.3/bokeh/plotting/gmap.py +=================================================================== +--- bokeh-2.3.3.orig/bokeh/plotting/gmap.py ++++ bokeh-2.3.3/bokeh/plotting/gmap.py +@@ -16,8 +16,6 @@ log = logging.getLogger(__name__) + #----------------------------------------------------------------------------- + + # Bokeh imports +-from ..core.enums import HorizontalLocation, VerticalLocation +-from ..core.properties import Auto, Either, Enum, Instance, Int, Seq, String + from ..models import ( + GMapPlot, + LinearAxis, +@@ -25,12 +23,10 @@ from ..models import ( + MercatorTickFormatter, + Range1d, + Title, +- Tool, + ) +-from ..models.tools import Drag, InspectTool, Scroll, Tap +-from ..util.options import Options ++from ._plot import _get_num_minor_ticks + from ._tools import process_active_tools, process_tools_arg +-from .figure import Figure ++from .figure import BaseFigureOptions, Figure + + #----------------------------------------------------------------------------- + # Globals and constants +@@ -92,18 +88,29 @@ class GMap(GMapPlot): + + super().__init__(x_range=Range1d(), y_range=Range1d(), **kw) + +- xf = MercatorTickFormatter(dimension="lon") +- xt = MercatorTicker(dimension="lon") +- self.add_layout(LinearAxis(formatter=xf, ticker=xt), 'below') +- +- yf = MercatorTickFormatter(dimension="lat") +- yt = MercatorTicker(dimension="lat") +- self.add_layout(LinearAxis(formatter=yf, ticker=yt), 'left') ++ if opts.x_axis_location is not None: ++ xf = MercatorTickFormatter(dimension="lon") ++ xt = MercatorTicker(dimension="lon") ++ xt.num_minor_ticks = _get_num_minor_ticks(LinearAxis, opts.x_minor_ticks) ++ self.add_layout(LinearAxis(formatter=xf, ticker=xt, axis_label=opts.x_axis_label), opts.x_axis_location) ++ ++ if opts.y_axis_location is not None: ++ yf = MercatorTickFormatter(dimension="lat") ++ yt = MercatorTicker(dimension="lat") ++ yt.num_minor_ticks = _get_num_minor_ticks(LinearAxis, opts.y_minor_ticks) ++ self.add_layout(LinearAxis(formatter=yf, ticker=yt, axis_label=opts.y_axis_label), opts.y_axis_location) + +- tool_objs, tool_map = process_tools_arg(self, opts.tools) ++ tool_objs, tool_map = process_tools_arg(self, opts.tools, opts.tooltips) + self.add_tools(*tool_objs) +- process_active_tools(self.toolbar, tool_map, opts.active_drag, opts.active_inspect, opts.active_scroll, opts.active_tap) +- ++ process_active_tools( ++ self.toolbar, ++ tool_map, ++ opts.active_drag, ++ opts.active_inspect, ++ opts.active_scroll, ++ opts.active_tap, ++ opts.active_multi, ++ ) + + annular_wedge = Figure.annular_wedge + +@@ -242,51 +249,8 @@ def gmap(google_api_key, map_options, ** + # Dev API + #----------------------------------------------------------------------------- + +-class GMapFigureOptions(Options): +- +- tools = Either(String, Seq(Either(String, Instance(Tool))), default=DEFAULT_TOOLS, help=""" +- Tools the plot should start with. +- """) +- +- x_minor_ticks = Either(Auto, Int, default="auto", help=""" +- Number of minor ticks between adjacent x-axis major ticks. +- """) +- +- y_minor_ticks = Either(Auto, Int, default="auto", help=""" +- Number of minor ticks between adjacent y-axis major ticks. +- """) +- +- x_axis_location = Enum(VerticalLocation, default="below", help=""" +- Where the x-axis should be located. +- """) +- +- y_axis_location = Enum(HorizontalLocation, default="left", help=""" +- Where the y-axis should be located. +- """) +- +- x_axis_label = String(default="", help=""" +- A label for the x-axis. +- """) +- +- y_axis_label = String(default="", help=""" +- A label for the y-axis. +- """) +- +- active_drag = Either(Auto, String, Instance(Drag), default="auto", help=""" +- Which drag tool should initially be active. +- """) +- +- active_inspect = Either(Auto, String, Instance(InspectTool), Seq(Instance(InspectTool)), default="auto", help=""" +- Which drag tool should initially be active. +- """) +- +- active_scroll = Either(Auto, String, Instance(Scroll), default="auto", help=""" +- Which scroll tool should initially be active. +- """) +- +- active_tap = Either(Auto, String, Instance(Tap), default="auto", help=""" +- Which tap tool should initially be active. +- """) ++class GMapFigureOptions(BaseFigureOptions): ++ pass + + #----------------------------------------------------------------------------- + # Private API +Index: bokeh-2.3.3/bokeh/server/static/js/lib/models/tools/toolbar.js +=================================================================== +--- bokeh-2.3.3.orig/bokeh/server/static/js/lib/models/tools/toolbar.js ++++ bokeh-2.3.3/bokeh/server/static/js/lib/models/tools/toolbar.js +@@ -9,7 +9,7 @@ export const Drag = Tool; + export const Inspection = Tool; + export const Scroll = Tool; + export const Tap = Tool; +-const _get_active_attr = (et) => { ++function _get_active_attr(et) { + switch (et) { + case 'tap': return 'active_tap'; + case 'pan': return 'active_drag'; +@@ -19,7 +19,7 @@ const _get_active_attr = (et) => { + } + return null; + }; +-const _supports_auto = (et) => { ++function _supports_auto(et): boolean { + return et == 'tap' || et == 'pan'; + }; + export class Toolbar extends ToolbarBase { +@@ -28,12 +28,12 @@ export class Toolbar extends ToolbarBase + } + static init_Toolbar() { + this.prototype.default_view = ToolbarBaseView; +- this.define(({ Or, Ref, Auto, Null, Nullable }) => ({ ++ this.define(({ Or, Ref, Auto, Null }) => ({ + active_drag: [Or(Ref(Drag), Auto, Null), "auto"], + active_inspect: [Or(Ref(Inspection), Auto, Null), "auto"], + active_scroll: [Or(Ref(Scroll), Auto, Null), "auto"], + active_tap: [Or(Ref(Tap), Auto, Null), "auto"], +- active_multi: [Nullable(Ref(GestureTool)), null], ++ active_multi: [Or(Ref(GestureTool), Auto, Null), "auto"], + })); + } + connect_signals() { diff --git a/python-bokeh.changes b/python-bokeh.changes index a9ca736..a6dbcb9 100644 --- a/python-bokeh.changes +++ b/python-bokeh.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Mon Jul 19 08:35:07 UTC 2021 - Ben Greiner + +- Revert to version 2.3.3 + * stay on a stable version. 2.4.0.dev1 broke distributed +- Add bokeh-pr11218-figure-toolbar-active-properties.patch + * fix for gh#spotify/chartify/issues/128 + * is a rebased version of gh#bokeh/bokeh#11218 + * tested with all packages with an active %check from + `osc whatdependson openSUSE:Factory python-bokeh standard x86_64` + ------------------------------------------------------------------- Mon Jul 12 13:17:06 UTC 2021 - Markéta Machová diff --git a/python-bokeh.spec b/python-bokeh.spec index 1e6180e..3bd545f 100644 --- a/python-bokeh.spec +++ b/python-bokeh.spec @@ -21,21 +21,23 @@ # tests suite disabled by default. See below. %bcond_with tests Name: python-bokeh -Version: 2.4.0.dev1 +Version: 2.3.3 Release: 0 Summary: Statistical interactive HTML plots for Python License: BSD-3-Clause URL: https://github.com/bokeh/bokeh/ Source: https://files.pythonhosted.org/packages/source/b/bokeh/bokeh-%{version}.tar.gz +Patch0: https://github.com/bokeh/bokeh/pull/11218.patch#/bokeh-pr11218-figure-toolbar-active-properties.patch BuildRequires: %{python_module Jinja2 >= 2.9} BuildRequires: %{python_module Pillow >= 7.1.0} BuildRequires: %{python_module PyYAML >= 3.10} BuildRequires: %{python_module devel} BuildRequires: %{python_module numpy >= 1.11.3} BuildRequires: %{python_module packaging >= 16.8} +BuildRequires: %{python_module python-dateutil >= 2.1} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module tornado >= 5.1} -BuildRequires: %{python_module typing_extensions >= 3.10.0} +BuildRequires: %{python_module typing_extensions >= 3.7.4} BuildRequires: fdupes BuildRequires: python-rpm-macros BuildConflicts: python-buildservice-tweak @@ -44,8 +46,9 @@ Requires: python-Pillow >= 7.1.0 Requires: python-PyYAML >= 3.10 Requires: python-numpy >= 1.11.3 Requires: python-packaging >= 16.8 +Requires: python-python-dateutil >= 2.1 Requires: python-tornado >= 5.1 -Requires: python-typing_extensions >= 3.10.0 +Requires: python-typing_extensions >= 3.7.4 Requires(post): update-alternatives Requires(postun):update-alternatives Recommends: python-python-dateutil @@ -59,7 +62,6 @@ BuildRequires: %{python_module mock} BuildRequires: %{python_module nbconvert} BuildRequires: %{python_module networkx} BuildRequires: %{python_module pytest} -BuildRequires: %{python_module python-dateutil} BuildRequires: %{python_module requests} BuildRequires: %{python_module selenium} %endif @@ -73,7 +75,7 @@ graphics in the style of D3.js, and favors delivering this capability with interactivity over large or streaming datasets. %prep -%setup -q -n bokeh-%{version} +%autosetup -p1 -n bokeh-%{version} %build %python_build From e99a08c5130911813ba511dd621b0c802518a7fe7e51e6e94c5c93abf3e7059c Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Tue, 20 Jul 2021 11:51:00 +0000 Subject: [PATCH 2/4] Update patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-bokeh?expand=0&rev=49 --- ...218-figure-toolbar-active-properties.patch | 325 +++++++++++------- 1 file changed, 200 insertions(+), 125 deletions(-) diff --git a/bokeh-pr11218-figure-toolbar-active-properties.patch b/bokeh-pr11218-figure-toolbar-active-properties.patch index 04d3597..b0e496d 100644 --- a/bokeh-pr11218-figure-toolbar-active-properties.patch +++ b/bokeh-pr11218-figure-toolbar-active-properties.patch @@ -11,11 +11,11 @@ Subject: [PATCH 1/2] Unify {Figure,Toolbar}.active_* properties bokehjs/src/lib/models/tools/toolbar.ts | 18 ++++++------- 5 files changed, 46 insertions(+), 29 deletions(-) -Index: bokeh-2.3.3/bokeh/models/tools.py -=================================================================== ---- bokeh-2.3.3.orig/bokeh/models/tools.py -+++ bokeh-2.3.3/bokeh/models/tools.py -@@ -305,7 +305,7 @@ class Toolbar(ToolbarBase): +diff --git a/bokeh/models/tools.py b/bokeh/models/tools.py +index 937f7852ce8..96d6c2798ee 100644 +--- a/bokeh/models/tools.py ++++ b/bokeh/models/tools.py +@@ -314,7 +314,7 @@ class Toolbar(ToolbarBase): Specify a tap/click tool to be active when the plot is displayed. """) @@ -24,20 +24,19 @@ Index: bokeh-2.3.3/bokeh/models/tools.py Specify an active multi-gesture tool, for instance an edit tool or a range tool. -Index: bokeh-2.3.3/bokeh/plotting/_tools.py -=================================================================== ---- bokeh-2.3.3.orig/bokeh/plotting/_tools.py -+++ bokeh-2.3.3/bokeh/plotting/_tools.py -@@ -37,7 +37,7 @@ from typing_extensions import Literal - - # Bokeh imports - from ..models import HoverTool, Plot, Tool, Toolbar --from ..models.tools import Drag, InspectTool, Scroll, Tap -+from ..models.tools import Drag, GestureTool, InspectTool, Scroll, Tap - - #----------------------------------------------------------------------------- - # Globals and constants -@@ -62,18 +62,21 @@ ActiveDrag = Union[Drag, Auto, str, None +diff --git a/bokeh/plotting/_tools.py b/bokeh/plotting/_tools.py +index 53c8b035753..1fa243776b1 100644 +--- a/bokeh/plotting/_tools.py ++++ b/bokeh/plotting/_tools.py +@@ -44,6 +44,7 @@ + ) + from ..models.tools import ( + Drag, ++ GestureTool, + InspectTool, + Scroll, + Tap, +@@ -72,18 +73,21 @@ ActiveInspect = Union[List[InspectTool], InspectTool, Auto, str, None] ActiveScroll = Union[Scroll, Auto, str, None] ActiveTap = Union[Tap, Auto, str, None] @@ -64,7 +63,7 @@ Index: bokeh-2.3.3/bokeh/plotting/_tools.py Returns: None -@@ -81,12 +84,12 @@ def process_active_tools(toolbar: Toolba +@@ -91,12 +95,12 @@ def process_active_tools(toolbar: Toolbar, tool_map: Dict[str, Tool], Note: This function sets properties on Toolbar """ @@ -79,7 +78,7 @@ Index: bokeh-2.3.3/bokeh/plotting/_tools.py if active_inspect in ["auto", None] or isinstance(active_inspect, Tool) or \ (isinstance(active_inspect, list) and all(isinstance(t, Tool) for t in active_inspect)): -@@ -94,21 +97,28 @@ def process_active_tools(toolbar: Toolba +@@ -104,21 +108,28 @@ def process_active_tools(toolbar: Toolbar, tool_map: Dict[str, Tool], elif isinstance(active_inspect, str) and active_inspect in tool_map: toolbar.active_inspect = cast(Any, tool_map[active_inspect]) else: @@ -113,59 +112,29 @@ Index: bokeh-2.3.3/bokeh/plotting/_tools.py def process_tools_arg(plot: Plot, tools: Union[str, Sequence[Union[Tool, str]]], tooltips: Optional[Union[str, Tuple[str, str]]] = None) -> Tuple[List[Tool], Dict[str, Tool]]: -Index: bokeh-2.3.3/bokeh/plotting/figure.py -=================================================================== ---- bokeh-2.3.3.orig/bokeh/plotting/figure.py -+++ bokeh-2.3.3/bokeh/plotting/figure.py -@@ -32,7 +32,7 @@ from ..core.properties import ( - Tuple, +diff --git a/bokeh/plotting/figure.py b/bokeh/plotting/figure.py +index 6e3764a18e1..cf3804507d3 100644 +--- a/bokeh/plotting/figure.py ++++ b/bokeh/plotting/figure.py +@@ -41,6 +41,7 @@ ) - from ..models import ColumnDataSource, GraphRenderer, Plot, Title, Tool, glyphs --from ..models.tools import Drag, InspectTool, Scroll, Tap -+from ..models.tools import Drag, GestureTool, InspectTool, Scroll, Tap - from ..transform import linear_cmap - from ..util.options import Options - from ._decorators import glyph_method, marker_method -@@ -175,7 +175,15 @@ class Figure(Plot): + from ..models.tools import ( + Drag, ++ GestureTool, + InspectTool, + Scroll, + Tap, +@@ -181,7 +182,8 @@ def __init__(self, *arg, **kw): tool_objs, tool_map = process_tools_arg(self, opts.tools, opts.tooltips) self.add_tools(*tool_objs) - process_active_tools(self.toolbar, tool_map, opts.active_drag, opts.active_inspect, opts.active_scroll, opts.active_tap) -+ process_active_tools( -+ self.toolbar, -+ tool_map, -+ opts.active_drag, -+ opts.active_inspect, -+ opts.active_scroll, -+ opts.active_tap, -+ opts.active_multi, -+ ) ++ process_active_tools(self.toolbar, tool_map, ++ opts.active_drag, opts.active_inspect, opts.active_scroll, opts.active_tap, opts.active_multi) @glyph_method(glyphs.AnnularWedge) def annular_wedge(self, **kwargs): -@@ -1599,20 +1607,12 @@ def markers(): - - # This class itself is intentionally undocumented (it is used to generate - # documentation elsewhere) --class FigureOptions(Options): -+class BaseFigureOptions(Options): - - tools = Either(String, Seq(Either(String, Instance(Tool))), default=DEFAULT_TOOLS, help=""" - Tools the plot should start with. - """) - -- x_range = Any(help=""" -- Customize the x-range of the plot. -- """) -- -- y_range = Any(help=""" -- Customize the y-range of the plot. -- """) -- - x_minor_ticks = Either(Auto, Int, default="auto", help=""" - Number of minor ticks between adjacent x-axis major ticks. - """) -@@ -1637,28 +1637,24 @@ class FigureOptions(Options): +@@ -1643,22 +1645,26 @@ class FigureOptions(Options): A label for the y-axis. """) @@ -189,18 +158,149 @@ Index: bokeh-2.3.3/bokeh/plotting/figure.py Which tap tool should initially be active. """) ++ active_multi = Either(Null, Auto, String, Instance(GestureTool), default="auto", help=""" ++ Specify an active multi-gesture tool, for instance an edit tool or a range tool. ++ """) ++ + x_axis_type = Either(Null, Auto, Enum("linear", "log", "datetime", "mercator"), default="auto", help=""" + The type of the x-axis. + """) +diff --git a/bokeh/plotting/gmap.py b/bokeh/plotting/gmap.py +index 90dde0c8206..283d018ae97 100644 +--- a/bokeh/plotting/gmap.py ++++ b/bokeh/plotting/gmap.py +@@ -105,8 +105,8 @@ def __init__(self, **kw): + + tool_objs, tool_map = process_tools_arg(self, opts.tools) + self.add_tools(*tool_objs) +- process_active_tools(self.toolbar, tool_map, opts.active_drag, opts.active_inspect, opts.active_scroll, opts.active_tap) +- ++ process_active_tools(self.toolbar, tool_map, ++ opts.active_drag, opts.active_inspect, opts.active_scroll, opts.active_tap, opts.active_multi) + + annular_wedge = Figure.annular_wedge + +diff --git a/bokehjs/src/lib/models/tools/toolbar.ts b/bokehjs/src/lib/models/tools/toolbar.ts +index 45463b0e14b..e22cb9b3ad0 100644 +--- a/bokehjs/src/lib/models/tools/toolbar.ts ++++ b/bokehjs/src/lib/models/tools/toolbar.ts +@@ -23,7 +23,7 @@ type ActiveGestureToolsProps = { + active_drag: p.Property + active_scroll: p.Property + active_tap: p.Property +- active_multi: p.Property ++ active_multi: p.Property + } + + type ActiveToolsProps = ActiveGestureToolsProps & { +@@ -38,7 +38,7 @@ export namespace Toolbar { + + export interface Toolbar extends Toolbar.Attrs {} + +-const _get_active_attr = (et: string): keyof ActiveGestureToolsProps | null => { ++function _get_active_attr(et: string): keyof ActiveGestureToolsProps | null { + switch (et) { + case 'tap': return 'active_tap' + case 'pan': return 'active_drag' +@@ -49,7 +49,7 @@ const _get_active_attr = (et: string): keyof ActiveGestureToolsProps | null => { + return null + } + +-const _supports_auto = (et: string) => { ++function _supports_auto(et: string): boolean { + return et == 'tap' || et == 'pan' + } + +@@ -63,12 +63,12 @@ export class Toolbar extends ToolbarBase { + static init_Toolbar(): void { + this.prototype.default_view = ToolbarBaseView + +- this.define(({Or, Ref, Auto, Null, Nullable}) => ({ +- active_drag: [ Or(Ref(Drag), Auto, Null), "auto" ], +- active_inspect: [ Or(Ref(Inspection), Auto, Null), "auto" ], +- active_scroll: [ Or(Ref(Scroll), Auto, Null), "auto" ], +- active_tap: [ Or(Ref(Tap), Auto, Null), "auto" ], +- active_multi: [ Nullable(Ref(GestureTool)), null ], ++ this.define(({Or, Ref, Auto, Null}) => ({ ++ active_drag: [ Or(Ref(Drag), Auto, Null), "auto" ], ++ active_inspect: [ Or(Ref(Inspection), Auto, Null), "auto" ], ++ active_scroll: [ Or(Ref(Scroll), Auto, Null), "auto" ], ++ active_tap: [ Or(Ref(Tap), Auto, Null), "auto" ], ++ active_multi: [ Or(Ref(GestureTool), Auto, Null), "auto" ], + })) + } + + +From 0f30e87af87a282fc7ba7fce56cf2987165b3947 Mon Sep 17 00:00:00 2001 +From: Mateusz Paprocki +Date: Wed, 28 Apr 2021 21:50:04 +0200 +Subject: [PATCH 2/2] Unify FigureOptions and GMapFigureOptions + +--- + bokeh/plotting/figure.py | 47 +++++++++++-------- + bokeh/plotting/gmap.py | 97 ++++++++++------------------------------ + 2 files changed, 52 insertions(+), 92 deletions(-) + +diff --git a/bokeh/plotting/figure.py b/bokeh/plotting/figure.py +index cf3804507d3..8201fa8deb6 100644 +--- a/bokeh/plotting/figure.py ++++ b/bokeh/plotting/figure.py +@@ -182,8 +182,15 @@ def __init__(self, *arg, **kw): + + tool_objs, tool_map = process_tools_arg(self, opts.tools, opts.tooltips) + self.add_tools(*tool_objs) +- process_active_tools(self.toolbar, tool_map, +- opts.active_drag, opts.active_inspect, opts.active_scroll, opts.active_tap, opts.active_multi) ++ process_active_tools( ++ self.toolbar, ++ tool_map, ++ opts.active_drag, ++ opts.active_inspect, ++ opts.active_scroll, ++ opts.active_tap, ++ opts.active_multi, ++ ) + + @glyph_method(glyphs.AnnularWedge) + def annular_wedge(self, **kwargs): +@@ -1607,20 +1614,12 @@ def markers(): + + # This class itself is intentionally undocumented (it is used to generate + # documentation elsewhere) +-class FigureOptions(Options): ++class BaseFigureOptions(Options): + + tools = Either(String, Seq(Either(String, Instance(Tool))), default=DEFAULT_TOOLS, help=""" + Tools the plot should start with. + """) + +- x_range = Any(help=""" +- Customize the x-range of the plot. +- """) +- +- y_range = Any(help=""" +- Customize the y-range of the plot. +- """) +- + x_minor_ticks = Either(Auto, Int, default="auto", help=""" + Number of minor ticks between adjacent x-axis major ticks. + """) +@@ -1665,14 +1664,6 @@ class FigureOptions(Options): + Specify an active multi-gesture tool, for instance an edit tool or a range tool. + """) + - x_axis_type = Either(Null, Auto, Enum("linear", "log", "datetime", "mercator"), default="auto", help=""" - The type of the x-axis. - """) - - y_axis_type = Either(Null, Auto, Enum("linear", "log", "datetime", "mercator"), default="auto", help=""" - The type of the y-axis. -+ active_multi = Either(Null, Auto, String, Instance(GestureTool), default="auto", help=""" -+ Specify an active multi-gesture tool, for instance an edit tool or a range tool. - """) - +- """) +- tooltips = Either(Null, String, List(Tuple(String, String)), help=""" -@@ -1670,6 +1666,24 @@ class FigureOptions(Options): + An optional argument to configure tooltips for the Figure. This argument + accepts the same values as the ``HoverTool.tooltips`` property. If a hover +@@ -1682,6 +1673,24 @@ class FigureOptions(Options): and added. """) @@ -225,26 +325,39 @@ Index: bokeh-2.3.3/bokeh/plotting/figure.py #----------------------------------------------------------------------------- # Private API #----------------------------------------------------------------------------- -Index: bokeh-2.3.3/bokeh/plotting/gmap.py -=================================================================== ---- bokeh-2.3.3.orig/bokeh/plotting/gmap.py -+++ bokeh-2.3.3/bokeh/plotting/gmap.py -@@ -16,8 +16,6 @@ log = logging.getLogger(__name__) +diff --git a/bokeh/plotting/gmap.py b/bokeh/plotting/gmap.py +index 283d018ae97..2073a456a86 100644 +--- a/bokeh/plotting/gmap.py ++++ b/bokeh/plotting/gmap.py +@@ -16,16 +16,6 @@ #----------------------------------------------------------------------------- # Bokeh imports -from ..core.enums import HorizontalLocation, VerticalLocation --from ..core.properties import Auto, Either, Enum, Instance, Int, Seq, String +-from ..core.properties import ( +- Auto, +- Either, +- Enum, +- Instance, +- Int, +- Seq, +- String, +-) from ..models import ( GMapPlot, LinearAxis, -@@ -25,12 +23,10 @@ from ..models import ( +@@ -33,17 +23,10 @@ MercatorTickFormatter, Range1d, Title, - Tool, +-) +-from ..models.tools import ( +- Drag, +- InspectTool, +- Scroll, +- Tap, ) --from ..models.tools import Drag, InspectTool, Scroll, Tap -from ..util.options import Options +from ._plot import _get_num_minor_ticks from ._tools import process_active_tools, process_tools_arg @@ -253,23 +366,22 @@ Index: bokeh-2.3.3/bokeh/plotting/gmap.py #----------------------------------------------------------------------------- # Globals and constants -@@ -92,18 +88,29 @@ class GMap(GMapPlot): +@@ -95,18 +78,29 @@ def __init__(self, **kw): super().__init__(x_range=Range1d(), y_range=Range1d(), **kw) - xf = MercatorTickFormatter(dimension="lon") - xt = MercatorTicker(dimension="lon") - self.add_layout(LinearAxis(formatter=xf, ticker=xt), 'below') -- -- yf = MercatorTickFormatter(dimension="lat") -- yt = MercatorTicker(dimension="lat") -- self.add_layout(LinearAxis(formatter=yf, ticker=yt), 'left') + if opts.x_axis_location is not None: + xf = MercatorTickFormatter(dimension="lon") + xt = MercatorTicker(dimension="lon") + xt.num_minor_ticks = _get_num_minor_ticks(LinearAxis, opts.x_minor_ticks) + self.add_layout(LinearAxis(formatter=xf, ticker=xt, axis_label=opts.x_axis_label), opts.x_axis_location) -+ + +- yf = MercatorTickFormatter(dimension="lat") +- yt = MercatorTicker(dimension="lat") +- self.add_layout(LinearAxis(formatter=yf, ticker=yt), 'left') + if opts.y_axis_location is not None: + yf = MercatorTickFormatter(dimension="lat") + yt = MercatorTicker(dimension="lat") @@ -279,8 +391,8 @@ Index: bokeh-2.3.3/bokeh/plotting/gmap.py - tool_objs, tool_map = process_tools_arg(self, opts.tools) + tool_objs, tool_map = process_tools_arg(self, opts.tools, opts.tooltips) self.add_tools(*tool_objs) -- process_active_tools(self.toolbar, tool_map, opts.active_drag, opts.active_inspect, opts.active_scroll, opts.active_tap) -- +- process_active_tools(self.toolbar, tool_map, +- opts.active_drag, opts.active_inspect, opts.active_scroll, opts.active_tap, opts.active_multi) + process_active_tools( + self.toolbar, + tool_map, @@ -293,7 +405,7 @@ Index: bokeh-2.3.3/bokeh/plotting/gmap.py annular_wedge = Figure.annular_wedge -@@ -242,51 +249,8 @@ def gmap(google_api_key, map_options, ** +@@ -245,51 +239,8 @@ def gmap(google_api_key, map_options, **kwargs): # Dev API #----------------------------------------------------------------------------- @@ -347,40 +459,3 @@ Index: bokeh-2.3.3/bokeh/plotting/gmap.py #----------------------------------------------------------------------------- # Private API -Index: bokeh-2.3.3/bokeh/server/static/js/lib/models/tools/toolbar.js -=================================================================== ---- bokeh-2.3.3.orig/bokeh/server/static/js/lib/models/tools/toolbar.js -+++ bokeh-2.3.3/bokeh/server/static/js/lib/models/tools/toolbar.js -@@ -9,7 +9,7 @@ export const Drag = Tool; - export const Inspection = Tool; - export const Scroll = Tool; - export const Tap = Tool; --const _get_active_attr = (et) => { -+function _get_active_attr(et) { - switch (et) { - case 'tap': return 'active_tap'; - case 'pan': return 'active_drag'; -@@ -19,7 +19,7 @@ const _get_active_attr = (et) => { - } - return null; - }; --const _supports_auto = (et) => { -+function _supports_auto(et): boolean { - return et == 'tap' || et == 'pan'; - }; - export class Toolbar extends ToolbarBase { -@@ -28,12 +28,12 @@ export class Toolbar extends ToolbarBase - } - static init_Toolbar() { - this.prototype.default_view = ToolbarBaseView; -- this.define(({ Or, Ref, Auto, Null, Nullable }) => ({ -+ this.define(({ Or, Ref, Auto, Null }) => ({ - active_drag: [Or(Ref(Drag), Auto, Null), "auto"], - active_inspect: [Or(Ref(Inspection), Auto, Null), "auto"], - active_scroll: [Or(Ref(Scroll), Auto, Null), "auto"], - active_tap: [Or(Ref(Tap), Auto, Null), "auto"], -- active_multi: [Nullable(Ref(GestureTool)), null], -+ active_multi: [Or(Ref(GestureTool), Auto, Null), "auto"], - })); - } - connect_signals() { From 29b40fad856927c3a6aaebcd911c1c9be7d321d95fd28d0efcd4b569d074e4ec Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Tue, 20 Jul 2021 15:40:42 +0000 Subject: [PATCH 3/4] Accepting request 907320 from home:bnavigator:branches:devel:languages:python:numeric Ok I should have removed the URL after rebasing the patch OBS-URL: https://build.opensuse.org/request/show/907320 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-bokeh?expand=0&rev=50 --- ...218-figure-toolbar-active-properties.patch | 325 +++++++----------- python-bokeh.changes | 6 + 2 files changed, 131 insertions(+), 200 deletions(-) diff --git a/bokeh-pr11218-figure-toolbar-active-properties.patch b/bokeh-pr11218-figure-toolbar-active-properties.patch index b0e496d..04d3597 100644 --- a/bokeh-pr11218-figure-toolbar-active-properties.patch +++ b/bokeh-pr11218-figure-toolbar-active-properties.patch @@ -11,11 +11,11 @@ Subject: [PATCH 1/2] Unify {Figure,Toolbar}.active_* properties bokehjs/src/lib/models/tools/toolbar.ts | 18 ++++++------- 5 files changed, 46 insertions(+), 29 deletions(-) -diff --git a/bokeh/models/tools.py b/bokeh/models/tools.py -index 937f7852ce8..96d6c2798ee 100644 ---- a/bokeh/models/tools.py -+++ b/bokeh/models/tools.py -@@ -314,7 +314,7 @@ class Toolbar(ToolbarBase): +Index: bokeh-2.3.3/bokeh/models/tools.py +=================================================================== +--- bokeh-2.3.3.orig/bokeh/models/tools.py ++++ bokeh-2.3.3/bokeh/models/tools.py +@@ -305,7 +305,7 @@ class Toolbar(ToolbarBase): Specify a tap/click tool to be active when the plot is displayed. """) @@ -24,19 +24,20 @@ index 937f7852ce8..96d6c2798ee 100644 Specify an active multi-gesture tool, for instance an edit tool or a range tool. -diff --git a/bokeh/plotting/_tools.py b/bokeh/plotting/_tools.py -index 53c8b035753..1fa243776b1 100644 ---- a/bokeh/plotting/_tools.py -+++ b/bokeh/plotting/_tools.py -@@ -44,6 +44,7 @@ - ) - from ..models.tools import ( - Drag, -+ GestureTool, - InspectTool, - Scroll, - Tap, -@@ -72,18 +73,21 @@ +Index: bokeh-2.3.3/bokeh/plotting/_tools.py +=================================================================== +--- bokeh-2.3.3.orig/bokeh/plotting/_tools.py ++++ bokeh-2.3.3/bokeh/plotting/_tools.py +@@ -37,7 +37,7 @@ from typing_extensions import Literal + + # Bokeh imports + from ..models import HoverTool, Plot, Tool, Toolbar +-from ..models.tools import Drag, InspectTool, Scroll, Tap ++from ..models.tools import Drag, GestureTool, InspectTool, Scroll, Tap + + #----------------------------------------------------------------------------- + # Globals and constants +@@ -62,18 +62,21 @@ ActiveDrag = Union[Drag, Auto, str, None ActiveInspect = Union[List[InspectTool], InspectTool, Auto, str, None] ActiveScroll = Union[Scroll, Auto, str, None] ActiveTap = Union[Tap, Auto, str, None] @@ -63,7 +64,7 @@ index 53c8b035753..1fa243776b1 100644 Returns: None -@@ -91,12 +95,12 @@ def process_active_tools(toolbar: Toolbar, tool_map: Dict[str, Tool], +@@ -81,12 +84,12 @@ def process_active_tools(toolbar: Toolba Note: This function sets properties on Toolbar """ @@ -78,7 +79,7 @@ index 53c8b035753..1fa243776b1 100644 if active_inspect in ["auto", None] or isinstance(active_inspect, Tool) or \ (isinstance(active_inspect, list) and all(isinstance(t, Tool) for t in active_inspect)): -@@ -104,21 +108,28 @@ def process_active_tools(toolbar: Toolbar, tool_map: Dict[str, Tool], +@@ -94,21 +97,28 @@ def process_active_tools(toolbar: Toolba elif isinstance(active_inspect, str) and active_inspect in tool_map: toolbar.active_inspect = cast(Any, tool_map[active_inspect]) else: @@ -112,29 +113,59 @@ index 53c8b035753..1fa243776b1 100644 def process_tools_arg(plot: Plot, tools: Union[str, Sequence[Union[Tool, str]]], tooltips: Optional[Union[str, Tuple[str, str]]] = None) -> Tuple[List[Tool], Dict[str, Tool]]: -diff --git a/bokeh/plotting/figure.py b/bokeh/plotting/figure.py -index 6e3764a18e1..cf3804507d3 100644 ---- a/bokeh/plotting/figure.py -+++ b/bokeh/plotting/figure.py -@@ -41,6 +41,7 @@ +Index: bokeh-2.3.3/bokeh/plotting/figure.py +=================================================================== +--- bokeh-2.3.3.orig/bokeh/plotting/figure.py ++++ bokeh-2.3.3/bokeh/plotting/figure.py +@@ -32,7 +32,7 @@ from ..core.properties import ( + Tuple, ) - from ..models.tools import ( - Drag, -+ GestureTool, - InspectTool, - Scroll, - Tap, -@@ -181,7 +182,8 @@ def __init__(self, *arg, **kw): + from ..models import ColumnDataSource, GraphRenderer, Plot, Title, Tool, glyphs +-from ..models.tools import Drag, InspectTool, Scroll, Tap ++from ..models.tools import Drag, GestureTool, InspectTool, Scroll, Tap + from ..transform import linear_cmap + from ..util.options import Options + from ._decorators import glyph_method, marker_method +@@ -175,7 +175,15 @@ class Figure(Plot): tool_objs, tool_map = process_tools_arg(self, opts.tools, opts.tooltips) self.add_tools(*tool_objs) - process_active_tools(self.toolbar, tool_map, opts.active_drag, opts.active_inspect, opts.active_scroll, opts.active_tap) -+ process_active_tools(self.toolbar, tool_map, -+ opts.active_drag, opts.active_inspect, opts.active_scroll, opts.active_tap, opts.active_multi) ++ process_active_tools( ++ self.toolbar, ++ tool_map, ++ opts.active_drag, ++ opts.active_inspect, ++ opts.active_scroll, ++ opts.active_tap, ++ opts.active_multi, ++ ) @glyph_method(glyphs.AnnularWedge) def annular_wedge(self, **kwargs): -@@ -1643,22 +1645,26 @@ class FigureOptions(Options): +@@ -1599,20 +1607,12 @@ def markers(): + + # This class itself is intentionally undocumented (it is used to generate + # documentation elsewhere) +-class FigureOptions(Options): ++class BaseFigureOptions(Options): + + tools = Either(String, Seq(Either(String, Instance(Tool))), default=DEFAULT_TOOLS, help=""" + Tools the plot should start with. + """) + +- x_range = Any(help=""" +- Customize the x-range of the plot. +- """) +- +- y_range = Any(help=""" +- Customize the y-range of the plot. +- """) +- + x_minor_ticks = Either(Auto, Int, default="auto", help=""" + Number of minor ticks between adjacent x-axis major ticks. + """) +@@ -1637,28 +1637,24 @@ class FigureOptions(Options): A label for the y-axis. """) @@ -158,149 +189,18 @@ index 6e3764a18e1..cf3804507d3 100644 Which tap tool should initially be active. """) -+ active_multi = Either(Null, Auto, String, Instance(GestureTool), default="auto", help=""" -+ Specify an active multi-gesture tool, for instance an edit tool or a range tool. -+ """) -+ - x_axis_type = Either(Null, Auto, Enum("linear", "log", "datetime", "mercator"), default="auto", help=""" - The type of the x-axis. - """) -diff --git a/bokeh/plotting/gmap.py b/bokeh/plotting/gmap.py -index 90dde0c8206..283d018ae97 100644 ---- a/bokeh/plotting/gmap.py -+++ b/bokeh/plotting/gmap.py -@@ -105,8 +105,8 @@ def __init__(self, **kw): - - tool_objs, tool_map = process_tools_arg(self, opts.tools) - self.add_tools(*tool_objs) -- process_active_tools(self.toolbar, tool_map, opts.active_drag, opts.active_inspect, opts.active_scroll, opts.active_tap) -- -+ process_active_tools(self.toolbar, tool_map, -+ opts.active_drag, opts.active_inspect, opts.active_scroll, opts.active_tap, opts.active_multi) - - annular_wedge = Figure.annular_wedge - -diff --git a/bokehjs/src/lib/models/tools/toolbar.ts b/bokehjs/src/lib/models/tools/toolbar.ts -index 45463b0e14b..e22cb9b3ad0 100644 ---- a/bokehjs/src/lib/models/tools/toolbar.ts -+++ b/bokehjs/src/lib/models/tools/toolbar.ts -@@ -23,7 +23,7 @@ type ActiveGestureToolsProps = { - active_drag: p.Property - active_scroll: p.Property - active_tap: p.Property -- active_multi: p.Property -+ active_multi: p.Property - } - - type ActiveToolsProps = ActiveGestureToolsProps & { -@@ -38,7 +38,7 @@ export namespace Toolbar { - - export interface Toolbar extends Toolbar.Attrs {} - --const _get_active_attr = (et: string): keyof ActiveGestureToolsProps | null => { -+function _get_active_attr(et: string): keyof ActiveGestureToolsProps | null { - switch (et) { - case 'tap': return 'active_tap' - case 'pan': return 'active_drag' -@@ -49,7 +49,7 @@ const _get_active_attr = (et: string): keyof ActiveGestureToolsProps | null => { - return null - } - --const _supports_auto = (et: string) => { -+function _supports_auto(et: string): boolean { - return et == 'tap' || et == 'pan' - } - -@@ -63,12 +63,12 @@ export class Toolbar extends ToolbarBase { - static init_Toolbar(): void { - this.prototype.default_view = ToolbarBaseView - -- this.define(({Or, Ref, Auto, Null, Nullable}) => ({ -- active_drag: [ Or(Ref(Drag), Auto, Null), "auto" ], -- active_inspect: [ Or(Ref(Inspection), Auto, Null), "auto" ], -- active_scroll: [ Or(Ref(Scroll), Auto, Null), "auto" ], -- active_tap: [ Or(Ref(Tap), Auto, Null), "auto" ], -- active_multi: [ Nullable(Ref(GestureTool)), null ], -+ this.define(({Or, Ref, Auto, Null}) => ({ -+ active_drag: [ Or(Ref(Drag), Auto, Null), "auto" ], -+ active_inspect: [ Or(Ref(Inspection), Auto, Null), "auto" ], -+ active_scroll: [ Or(Ref(Scroll), Auto, Null), "auto" ], -+ active_tap: [ Or(Ref(Tap), Auto, Null), "auto" ], -+ active_multi: [ Or(Ref(GestureTool), Auto, Null), "auto" ], - })) - } - - -From 0f30e87af87a282fc7ba7fce56cf2987165b3947 Mon Sep 17 00:00:00 2001 -From: Mateusz Paprocki -Date: Wed, 28 Apr 2021 21:50:04 +0200 -Subject: [PATCH 2/2] Unify FigureOptions and GMapFigureOptions - ---- - bokeh/plotting/figure.py | 47 +++++++++++-------- - bokeh/plotting/gmap.py | 97 ++++++++++------------------------------ - 2 files changed, 52 insertions(+), 92 deletions(-) - -diff --git a/bokeh/plotting/figure.py b/bokeh/plotting/figure.py -index cf3804507d3..8201fa8deb6 100644 ---- a/bokeh/plotting/figure.py -+++ b/bokeh/plotting/figure.py -@@ -182,8 +182,15 @@ def __init__(self, *arg, **kw): - - tool_objs, tool_map = process_tools_arg(self, opts.tools, opts.tooltips) - self.add_tools(*tool_objs) -- process_active_tools(self.toolbar, tool_map, -- opts.active_drag, opts.active_inspect, opts.active_scroll, opts.active_tap, opts.active_multi) -+ process_active_tools( -+ self.toolbar, -+ tool_map, -+ opts.active_drag, -+ opts.active_inspect, -+ opts.active_scroll, -+ opts.active_tap, -+ opts.active_multi, -+ ) - - @glyph_method(glyphs.AnnularWedge) - def annular_wedge(self, **kwargs): -@@ -1607,20 +1614,12 @@ def markers(): - - # This class itself is intentionally undocumented (it is used to generate - # documentation elsewhere) --class FigureOptions(Options): -+class BaseFigureOptions(Options): - - tools = Either(String, Seq(Either(String, Instance(Tool))), default=DEFAULT_TOOLS, help=""" - Tools the plot should start with. - """) - -- x_range = Any(help=""" -- Customize the x-range of the plot. -- """) -- -- y_range = Any(help=""" -- Customize the y-range of the plot. -- """) -- - x_minor_ticks = Either(Auto, Int, default="auto", help=""" - Number of minor ticks between adjacent x-axis major ticks. - """) -@@ -1665,14 +1664,6 @@ class FigureOptions(Options): - Specify an active multi-gesture tool, for instance an edit tool or a range tool. - """) - - x_axis_type = Either(Null, Auto, Enum("linear", "log", "datetime", "mercator"), default="auto", help=""" - The type of the x-axis. - """) - - y_axis_type = Either(Null, Auto, Enum("linear", "log", "datetime", "mercator"), default="auto", help=""" - The type of the y-axis. -- """) -- ++ active_multi = Either(Null, Auto, String, Instance(GestureTool), default="auto", help=""" ++ Specify an active multi-gesture tool, for instance an edit tool or a range tool. + """) + tooltips = Either(Null, String, List(Tuple(String, String)), help=""" - An optional argument to configure tooltips for the Figure. This argument - accepts the same values as the ``HoverTool.tooltips`` property. If a hover -@@ -1682,6 +1673,24 @@ class FigureOptions(Options): +@@ -1670,6 +1666,24 @@ class FigureOptions(Options): and added. """) @@ -325,39 +225,26 @@ index cf3804507d3..8201fa8deb6 100644 #----------------------------------------------------------------------------- # Private API #----------------------------------------------------------------------------- -diff --git a/bokeh/plotting/gmap.py b/bokeh/plotting/gmap.py -index 283d018ae97..2073a456a86 100644 ---- a/bokeh/plotting/gmap.py -+++ b/bokeh/plotting/gmap.py -@@ -16,16 +16,6 @@ +Index: bokeh-2.3.3/bokeh/plotting/gmap.py +=================================================================== +--- bokeh-2.3.3.orig/bokeh/plotting/gmap.py ++++ bokeh-2.3.3/bokeh/plotting/gmap.py +@@ -16,8 +16,6 @@ log = logging.getLogger(__name__) #----------------------------------------------------------------------------- # Bokeh imports -from ..core.enums import HorizontalLocation, VerticalLocation --from ..core.properties import ( -- Auto, -- Either, -- Enum, -- Instance, -- Int, -- Seq, -- String, --) +-from ..core.properties import Auto, Either, Enum, Instance, Int, Seq, String from ..models import ( GMapPlot, LinearAxis, -@@ -33,17 +23,10 @@ +@@ -25,12 +23,10 @@ from ..models import ( MercatorTickFormatter, Range1d, Title, - Tool, --) --from ..models.tools import ( -- Drag, -- InspectTool, -- Scroll, -- Tap, ) +-from ..models.tools import Drag, InspectTool, Scroll, Tap -from ..util.options import Options +from ._plot import _get_num_minor_ticks from ._tools import process_active_tools, process_tools_arg @@ -366,22 +253,23 @@ index 283d018ae97..2073a456a86 100644 #----------------------------------------------------------------------------- # Globals and constants -@@ -95,18 +78,29 @@ def __init__(self, **kw): +@@ -92,18 +88,29 @@ class GMap(GMapPlot): super().__init__(x_range=Range1d(), y_range=Range1d(), **kw) - xf = MercatorTickFormatter(dimension="lon") - xt = MercatorTicker(dimension="lon") - self.add_layout(LinearAxis(formatter=xf, ticker=xt), 'below') +- +- yf = MercatorTickFormatter(dimension="lat") +- yt = MercatorTicker(dimension="lat") +- self.add_layout(LinearAxis(formatter=yf, ticker=yt), 'left') + if opts.x_axis_location is not None: + xf = MercatorTickFormatter(dimension="lon") + xt = MercatorTicker(dimension="lon") + xt.num_minor_ticks = _get_num_minor_ticks(LinearAxis, opts.x_minor_ticks) + self.add_layout(LinearAxis(formatter=xf, ticker=xt, axis_label=opts.x_axis_label), opts.x_axis_location) - -- yf = MercatorTickFormatter(dimension="lat") -- yt = MercatorTicker(dimension="lat") -- self.add_layout(LinearAxis(formatter=yf, ticker=yt), 'left') ++ + if opts.y_axis_location is not None: + yf = MercatorTickFormatter(dimension="lat") + yt = MercatorTicker(dimension="lat") @@ -391,8 +279,8 @@ index 283d018ae97..2073a456a86 100644 - tool_objs, tool_map = process_tools_arg(self, opts.tools) + tool_objs, tool_map = process_tools_arg(self, opts.tools, opts.tooltips) self.add_tools(*tool_objs) -- process_active_tools(self.toolbar, tool_map, -- opts.active_drag, opts.active_inspect, opts.active_scroll, opts.active_tap, opts.active_multi) +- process_active_tools(self.toolbar, tool_map, opts.active_drag, opts.active_inspect, opts.active_scroll, opts.active_tap) +- + process_active_tools( + self.toolbar, + tool_map, @@ -405,7 +293,7 @@ index 283d018ae97..2073a456a86 100644 annular_wedge = Figure.annular_wedge -@@ -245,51 +239,8 @@ def gmap(google_api_key, map_options, **kwargs): +@@ -242,51 +249,8 @@ def gmap(google_api_key, map_options, ** # Dev API #----------------------------------------------------------------------------- @@ -459,3 +347,40 @@ index 283d018ae97..2073a456a86 100644 #----------------------------------------------------------------------------- # Private API +Index: bokeh-2.3.3/bokeh/server/static/js/lib/models/tools/toolbar.js +=================================================================== +--- bokeh-2.3.3.orig/bokeh/server/static/js/lib/models/tools/toolbar.js ++++ bokeh-2.3.3/bokeh/server/static/js/lib/models/tools/toolbar.js +@@ -9,7 +9,7 @@ export const Drag = Tool; + export const Inspection = Tool; + export const Scroll = Tool; + export const Tap = Tool; +-const _get_active_attr = (et) => { ++function _get_active_attr(et) { + switch (et) { + case 'tap': return 'active_tap'; + case 'pan': return 'active_drag'; +@@ -19,7 +19,7 @@ const _get_active_attr = (et) => { + } + return null; + }; +-const _supports_auto = (et) => { ++function _supports_auto(et): boolean { + return et == 'tap' || et == 'pan'; + }; + export class Toolbar extends ToolbarBase { +@@ -28,12 +28,12 @@ export class Toolbar extends ToolbarBase + } + static init_Toolbar() { + this.prototype.default_view = ToolbarBaseView; +- this.define(({ Or, Ref, Auto, Null, Nullable }) => ({ ++ this.define(({ Or, Ref, Auto, Null }) => ({ + active_drag: [Or(Ref(Drag), Auto, Null), "auto"], + active_inspect: [Or(Ref(Inspection), Auto, Null), "auto"], + active_scroll: [Or(Ref(Scroll), Auto, Null), "auto"], + active_tap: [Or(Ref(Tap), Auto, Null), "auto"], +- active_multi: [Nullable(Ref(GestureTool)), null], ++ active_multi: [Or(Ref(GestureTool), Auto, Null), "auto"], + })); + } + connect_signals() { diff --git a/python-bokeh.changes b/python-bokeh.changes index a6dbcb9..014dda4 100644 --- a/python-bokeh.changes +++ b/python-bokeh.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Jul 20 13:56:14 UTC 2021 - Ben Greiner + +- Remove URL for rebased patch + bokeh-pr11218-figure-toolbar-active-properties.patch + ------------------------------------------------------------------- Mon Jul 19 08:35:07 UTC 2021 - Ben Greiner From 1ff2133eba7d63def6da37578710b61f179642bb3e63ce9008160c6ad9baf283 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Tue, 20 Jul 2021 20:48:02 +0000 Subject: [PATCH 4/4] Accepting request 907355 from home:bnavigator:branches:devel:languages:python:numeric 3 times a charm OBS-URL: https://build.opensuse.org/request/show/907355 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-bokeh?expand=0&rev=51 --- python-bokeh.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-bokeh.spec b/python-bokeh.spec index 3bd545f..67afc4a 100644 --- a/python-bokeh.spec +++ b/python-bokeh.spec @@ -27,7 +27,7 @@ Summary: Statistical interactive HTML plots for Python License: BSD-3-Clause URL: https://github.com/bokeh/bokeh/ Source: https://files.pythonhosted.org/packages/source/b/bokeh/bokeh-%{version}.tar.gz -Patch0: https://github.com/bokeh/bokeh/pull/11218.patch#/bokeh-pr11218-figure-toolbar-active-properties.patch +Patch0: bokeh-pr11218-figure-toolbar-active-properties.patch BuildRequires: %{python_module Jinja2 >= 2.9} BuildRequires: %{python_module Pillow >= 7.1.0} BuildRequires: %{python_module PyYAML >= 3.10}