Can't select multiple object on macOS

Issue #257 resolved
Wilson Tan created an issue

When try to select multiple object on canvas, control + left click not recognised. [DEBUG][MainThread] on_key_down(): control [DEBUG][MainThread] button=3, x=258, y=267, xdata=0.538464, ydata=0.466664 [DEBUG][MainThread] No active tool to respond to click!

Comments (20)

  1. Marius Stanciu

    Wilson, I assume that you are talking about the Geometry Editor because only there you can select something.

    The reported error:

    "No active tool to respond to click!"

    is raised only when either the Select Tools (the left icon in the Draw toolbar) is not active or when you are not using the left mouse button to click.

    Check that you are having those two conditions fulfilled.

    selection.JPG

  2. Wilson Tan reporter

    @Marius Stanciu Yes, I mean Geometry Editor. I did select the select tools and press control+left mouse button click, but seem like the flatcam not recognise control+left click. Screen Shot 2018-06-17 at 12.38.44 AM.png

  3. Marius Stanciu

    Can you tell me what version of FlatCAM are you using? Official master branch or else what? I don't have access to OSX but I can check on Windows if there is an issue. Please describe in detail what are the steps that you are doing so you get that result.

    Also be advised that the latest development version of FlatCAM master is Python3 based now.

  4. Wilson Tan reporter

    @Marius Stanciu I'm using the version in official master branch. Actually I did run in Python 3 as well, but not pyqt5, still using pyqt4. I did test in windows using parallels desktop, but in windows this issue in not present, so seem like it only happen in macOS.

    First, I create new geometry and then draw some shape. After that I click select tool and press control + left mouse click to select multiple object but fail to do so.

  5. Marius Stanciu

    Wilson, don't use the Marius Ciocanel name as I am not that one and he will get emails with your posts. It's better not to disturb other peoples. It's the reason I don't use yours, because there are many choices with your name and I don't know which is the correct one.

    Regarding your issue, can you please check the sources in my branch? May work in your case. Use Python3 and PyQt4. You need to install the following modules: PyQt4, python3-qt-opengl, pyopengl, svg.path, simplejson, shapely, numpy, rtree, ortools, vispy. You need to have a video card capable of OpenGL 2.1 and updated drivers.

    https://bitbucket.org/marius_stanciu/flatcam_vispy_pyqt4/get/4c6e08a941b8.zip

  6. Wilson Tan reporter

    Hi, I did try the reworked selection functions. but I still unable to select multiple parts. but I found that maybe is macOS simulate the control + click as right click, so the flatcam can't recognise it. maybe in macOS need to change the multiple selection control.

  7. Wilson Tan reporter

    Hi, now I'm having issue opening flatcam. File "/Users/wilsontan/Desktop/marius_stanciu-flatcam_vispy_pyqt4-a99af6ca9bff/flatcam", line 11, in <module> from PyQt4 import QtGui ModuleNotFoundError: No module named 'PyQt4.sip' Did I mess up somethings?

  8. Marius Stanciu

    When you install PyQt4 module it should install SIP module also. Uninstall PyQt4 and then install it again. It seems that something related to SIP is missing in PyQt4. Check if you have a separate SIP module installed and try to reinstall it (upgrade).

  9. Wilson Tan reporter

    Hi, finally I able to open the flatcam but I'm having issue again. The plot area is not showing, so unable to test it. The error message as below:

    WARNING: Error drawing visual <vispy.visuals.mesh.MeshVisual object at 0x10d215e10> WARNING: Traceback (most recent call last): File "flatcam.py", line 36, in <module> sys.exit(app.exec_()) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/vispy/app/backends/_qt.py", line 436, in event out = super(QtBaseCanvasBackend, self).event(ev) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/vispy/app/backends/_qt.py", line 708, in paintGL self._vispy_canvas.events.draw(region=None) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/vispy/util/event.py", line 455, in call self._invoke_callback(cb, event) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/vispy/util/event.py", line 475, in _invoke_callback self, cb_event=(cb, event)) << caught exception here: >> File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/vispy/util/event.py", line 471, in _invoke_callback cb(event) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/vispy/scene/canvas.py", line 207, in on_draw self._draw_scene() File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/vispy/scene/canvas.py", line 253, in _draw_scene self.draw_visual(self.scene) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/vispy/scene/canvas.py", line 291, in draw_visual node.draw() File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/vispy/scene/visuals.py", line 98, in draw self._visual_superclass.draw(self) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/vispy/visuals/visual.py", line 588, in draw v.draw() File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/vispy/visuals/mesh.py", line 517, in draw Visual.draw(self, args, kwds) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/vispy/visuals/visual.py", line 440, in draw self._vshare.index_buffer) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/vispy/visuals/shaders/program.py", line 77, in draw Program.draw(self, args, *kwargs) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/vispy/gloo/program.py", line 470, in draw canvas.context.flush_commands() File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/vispy/gloo/context.py", line 171, in flush_commands self.glir.flush(self.shared.parser) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/vispy/gloo/glir.py", line 232, in flush self._shared.flush(parser) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/vispy/gloo/glir.py", line 146, in flush parser.parse(self._filter(self.clear(), parser)) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/vispy/gloo/glir.py", line 477, in parse self._parse(command) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/vispy/gloo/glir.py", line 439, in _parse ob.draw(args) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/vispy/gloo/glir.py", line 918, in draw gl.check_error('Check before draw') File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/vispy/gloo/gl/init.py", line 211, in check_error raise err RuntimeError: OpenGL got errors (Check before draw): GL_INVALID_FRAMEBUFFER_OPERATION ERROR: Invoking <bound method SceneCanvas.on_draw of <VisPyCanvas (PyQt4) at 0x10cfec3c8>> for DrawEvent ERROR: Invoking <bound method SceneCanvas.on_draw of <VisPyCanvas (PyQt4) at 0x10cfec3c8>> repeat 2 Screen Shot 2018-09-05 at 5.59.44 PM.png

  10. Marius Stanciu

    Hi, It seems that some packages are missing. Have you installed pyopengl and python3-opengl? I don't know the exact names for the packages when using MacOS. You may use the setup_ubuntu. sh file content as indications. It's a text file.

  11. Wilson Tan reporter

    Hi, it's possible that which file did you reworked and I paste it on the source of flatcam 8.5? because I search through internet it seem like and graphic card issue. so maybe I unable to solve it. thanks

  12. Marius Stanciu

    You use Python 3.7 which I have not tested yet to see if my FlatCAM fork is working with. The version that I currently use is Python 3.6.5.

    Regarding modifying FlatCAM 8.5 unfortunately I don't have the time now to compare the source code. If you want you could check, the modification is somewhere in FlatCAMDraw.py. But beware, there are other changes there, it's not a simple copy and replace.

    What graphics card do you use?

  13. Wilson Tan reporter

    Hi, I had switched to python36 but not luck, same issue. This time I'm running with intel graphic. So I assume not graphic card issue.

    I compare the FlatCAMDraw.py with FlatCAM8.5 and yours version its really not an easy modification and im still fresh in programming sadly can't do it myself.

  14. Marius Stanciu

    If there is time I will try to make a FlatCAM 8.5 FlatCAMDraw file specifically for you, replacing the CTRL key with SHIFT key for multiple selection. Will that work for you?

  15. Marius Stanciu

    Actually the modification is easy:

    All you have to do is to replace the entire class FCSelect(DrawTool) - should be around line 587 in FlatCAMDraw.py file, and it's easy just to replace the entire class because it's small and you'll not mess the tabs- with the following code:

    class FCSelect(DrawTool):
        def __init__(self, draw_app):
            DrawTool.__init__(self, draw_app)
            self.storage = self.draw_app.storage
            #self.shape_buffer = self.draw_app.shape_buffer
            self.selected = self.draw_app.selected
            self.start_msg = "Click on geometry to select"
    
        def click(self, point):
            try:
                _, closest_shape = self.storage.nearest(point)
            except StopIteration:
                return ""
    
            if self.draw_app.key != 'shift':
                self.draw_app.selected = []
    
            self.draw_app.set_selected(closest_shape)
            self.draw_app.app.log.debug("Selected shape containing: " + str(closest_shape.geo))
    
            return ""
    

    This way, to make multiple selection you'll have to use the "SHIFT" key and mouse left click. I hope this solve your problem.

    LE: remember, selection of rectangles is done clicking near the corners it won't work on the entire perimeter.

  16. Wilson Tan reporter

    Hi, this really help! I didn't see the control keyword inside the code. I keep trying to modified event.button. Thanks a lot for solving this issue for me. Best regards.

  17. Log in to comment