During the sprint, we were looking at widgets, and I noticed that the MultiCursor constructor takes a FigureCanvasBase as first parameter. This probably exists to say where to connect signals, but this does not match how any of the other widgets work, which infer this from the supplied Axes. Theoretically, I don't see any reason why the Axes need to be on a single Figure for MultiCursor to work, but that's implied by it only using a single canvas.
Proposed fix
The canvas should be found from the Axes, and the constructor should assert that all supplied Axes are on the same Figure (if that is indeed required.)
However, I don't know how to deprecate this. If we use _api.delete_parameter, then the remaining parameters become keyword-only, but we don't want to do that to the Axes parameter, which should have been the first positional parameter.
The text was updated successfully, but these errors were encountered:
I guess you need to do it more or less by hand, taking *args, **kwargs as parameters and then emit a warning if "canvas" in kwargs or isinstance(args[0], FigureCanvasBase)? Then actually bind the args accordingly. (Something along these lines, untested.)
If we are going to mess up with the signature, perhaps we can also consider changing, at the same time, the somewhat unsightly horizOn/vertOn kwargs to both MultiCursor and Cursor? Currently some widgets use "orientation" and others use "direction", but I think standardizing on "orientation" is better ("direction" is also used for "in"/"out" for ticks, whereas colorbar uses "orientation" for horizontal/vertical).
In the specific case of (Multi)Cursor, I'd suggest going for orientation="vertical"|"horizontal"|"both"?
Summary
During the sprint, we were looking at widgets, and I noticed that the
MultiCursor
constructor takes aFigureCanvasBase
as first parameter. This probably exists to say where to connect signals, but this does not match how any of the other widgets work, which infer this from the suppliedAxes
. Theoretically, I don't see any reason why theAxes
need to be on a singleFigure
forMultiCursor
to work, but that's implied by it only using a single canvas.Proposed fix
The canvas should be found from the
Axes
, and the constructor should assert that all suppliedAxes
are on the sameFigure
(if that is indeed required.)However, I don't know how to deprecate this. If we use
_api.delete_parameter
, then the remaining parameters become keyword-only, but we don't want to do that to theAxes
parameter, which should have been the first positional parameter.The text was updated successfully, but these errors were encountered: