Cannot use any tools

Issue #332 resolved
Michael Ambrose created an issue

On arch linux with commit r604.dae9cbb-1 and python-matplotlib 3.1.1-1 I cannot use any tools. In the console there is a log entry stating "No active tool to respond to click!".

After some poking around I noticed that https://bitbucket.org/jpcgt/flatcam/src/dae9cbb0471e693b95fd809ddd8bf11ff026ac67/FlatCAMDraw.py#lines-1019 is trying to match event.button to 1 but the object in the event is of type MouseButton.LEFT

I’m not a python expert so I’m surprised that as an enum it still wouldn’t match an int of 1. Does this need to be explicitly type cast now?

I can get everything to work as expected by changing the 1 on line 1019 to MouseButton.LEFT and importing MouseButton with from matplotlib.backend_bases import MouseButton

Comments (2)

  1. Marius Stanciu

    I’m not sure but it may be related to the fact that in Python 3.x all the numbers are assumed to be of Float type. Instead of keyword ‘is’ use the keyword ‘==’.

    Like this:

    if self.active_tool is not None and event.button == 1:
    

  2. Log in to comment