Pcbnew: total refresh of UI, or switching canvas type, from Python?

I have been experimenting with Invert Selection in Pcbnew using Python script? - and there I’ve noticed that after changing a selection status of a footprint module, it does not get indicated on OpenGL canvas, regardless of calls to pcbnew.UpdateUserInterface() and pcbnew.Refresh() - but it does get indicated on Cairo canvas.

Now I started deleting footprint modules from Python script based on the selection status, using board.RemoveNative(mod) - and realized that neither the Cairo canvas, nor the OpenGL canvas, handle that correctly, regardless of calls to pcbnew.UpdateUserInterface() and pcbnew.Refresh(): some parts will be shown as deleted, but not all. What I need to do in this case is switch from one (OpenGL or Cairo) canvas to the other, after I run the Python function - and only then do all footprints, expected to be deleted, indeed disappear.

So, obviously, pcbnew.Refresh() either does not fully refresh the window - or maybe it was not meant to do so to begin with. (EDIT: Just checked, deleting elements is properly indicated on Legacy Canvas, however)

So I would like to ask:

  • Is there a Python API call I can issue to have a total redraw/refresh of the UI window in Pcbnew - also in OpenGL and Cairo canvas - , so that script actions like changing the selection status, or deleting, of a footprint, will be properly visualised/shown/rendered?
  • If not, is there a Python API call that will: let me know what Canvas I’m currently using; and allow me to switch to a different Canvas (which will hopefully trigger the right call for updating the UI window) - in Pcbnew?
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.