My understanding of QgsFormAnnotation
class is there is no way to set form (Qt Designer UI) other than by using function setDesignerForm
which sets it from file path given.
So to do adjustments to the form used for annotation you have to either create new ui file or edit existing, and set the path to it via setDesignerForm
function.
As the ui file is standard xml file you can read/write these files from your plugin using python xml library.
If you need dynamic interactive form, it should be part of your plugin UI - as dialog or dock widget, which can be responsive (connected) to signals coming from all parts of QGIS. E.g. use QgsMapCanvas.selectionChanged
to update your dock widget UI (form) with any selection change in any layer in map canvas.