App freezes when plotting.

Issue #63 resolved
Juan Pablo Caram repo owner created an issue

The program randomly freezes/hangs when plotting.

To force the error open a Gerber file and click on the "Re-plot all" toolbar button frequently. If more objects are being plotted, the higher the chance to trigger the problem.

This might be related to Matplotlib and threading, or with the progress bar being called unsafely from another thread (less likely).

The plotting takes considerable time, so it has to be done in a separate thread, otherwise the UI becomes unresponsive for an unacceptable amount of time.

Comments (3)

  1. Juan Pablo Caram reporter

    Changed in App.plot_all():

    app_obj.plotcanvas.auto_adjust_axes()
    self.on_zoom_fit(None)
    

    into

    GLib.idle_add(app_obj.plotcanvas.auto_adjust_axes)
    GLib.idle_add(lambda: self.on_zoom_fit(None))
    

    This seems to reduce the probability of occurrence.

    Also changed at the end of FlatCAMGerber.plot():

    # self.app.plotcanvas.auto_adjust_axes()
    GLib.idle_add(self.app.plotcanvas.auto_adjust_axes)
    

    I did not make this change in the other FlatCAMObj's, but the problem seems much better even when plotting objects of other kinds.

  2. Log in to comment