Skip to content

Provide public access to the toolbar state for widget interaction #2694

Closed

Description

@jlaura

Currently the state of the MPL toolbar is not publicly available and must be accessed via fig.canvas.manager.toolbar._active. Accessing via _active is dangerous as it is private and could potentially be altered without notice [link].(http://stackoverflow.com/questions/20711148/ignore-matplotlib-cursor-widget-when-toolbar-widget-selected/20712813#20712813.)

Is it possible to provide public access to the toolbar state so that widgets can 'fire' only when a toolbar item is not selected. As an example, if a cursor widget is used to generate subplots, it currently generates a subplot based on the point of an initial pan or zoom request (toolbar item).

@tacaswell

Activity

  1. tacaswell commented on Dec 26, 2013

    @tacaswell
    Member

    @fariza Can you take a look at this?

  2. fariza commented on Dec 27, 2013

    @fariza
    Member

    This raises a very important point in the split of navigation and toolbar.

    On the side of navigation there should be a public state. the api should allow to add/remove/disable/enable states.

    On the toolbar side the buttons that respond to changes in the states should be converted to radio buttons. And again a new api to add/remove/etc... buttons.

    Right after #2624 I will restart the discussion on this split, I will make sure this state handling is included.

  3. fariza commented on Dec 27, 2013

    @fariza
    Member

    @tacaswell Do you recommend doing the split based on a MEP? Or straight with a PR?

    I am just asking to know what option have more chances of speedier review and approval.

  4. tacaswell commented on Dec 27, 2013

    @tacaswell
    Member

    I am not sure the best way to do it. You can see how well my major re-factor is going with a straight PR.

    Given that you are blocked by #2624, I think writing out a MEP with all the api details would be good because the discussion on that can happen in parallel.

  5. fariza commented on Jan 7, 2014

    @fariza
    Member

    @tacaswell I am working on the MEP for the split, please checkit out

    https://github.com/matplotlib/matplotlib/wiki/Mep22

  6. fariza commented on Jan 22, 2014

    @fariza
    Member

    @tacaswell please add MEP22 label

  7. fariza commented on Jan 24, 2014

    @fariza
    Member

    In MEP22 #2759 NavigationBase class, there is a new method get_active that returns a dictionnary with the currently toggled tool, and a list of the registered tool instances

  8. fariza commented on Aug 7, 2015

    @fariza
    Member

    MEP22 solved this problem. fig.canvas.manager.toolmanager.active_toggle returns the currently toggled tools
    I'm closing this issue, please reopen if necessary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions