Limitations during GUI creation for processor with Python

Hello,

I am at the moment developing a new processor for SNAP with Python.

As there are some parameters that need to be entered by the user I am evaluating how I can shape the GUI to enter these parameters.
I found some limitations that seem not to be possible with python:

  • File selection dialog, so the user does not have to type a path to a file but can select the file directly. There is something like this used in “AATSR Ungridding”
  • If - then - parameter: e.g. if alorithm1 is chosen, coefficents 1 to 4 need to be entered. If algorithm 2 is chosen, only coefficients 1 and 2 need to be entered. The other coefficients should not be visible / greyed out. There is something in this way implemented for “Orthorectification”

Is it correct that it is not possible to create something like this using Python, or did I overlook something?
As this seems to be possible via Java GUI, is it possible to combine the Java GUI with a Python processor?
Is there some plan to add functionality like this to the Python API?

Thanks for any answers!

Hi,

If you define in the info.xml file your parameter with a datatype “java.io.File”, the default GUI should be the file selection dialog.

On the other hand, enabling/disabling parameters, as far as I know, is not possible with the default GUI, in this case you should create an specific dialog via Java (yes, it is possible to combine it with a Python processor).

Regards

1 Like

Hi,

The limitations you observer also apply to Java. At least as long as you use the Default (auto-generated) GUI for Operators.
I’ve never tried to use a python operator along with a Java GUI, but I see no reason why it should not work.

In the layer.xml file the org.esa.snap.core.gpf.ui.DefaultOperatorAction is defined, which creates the default GUI.
If you replace this action with your own implementation it should work. Probably you need to override DefaultOperatorAction.

For examples you can look at:
org.esa.s3tbx.processor.flh_mci.visat.FlhMciAction
org.esa.s2tbx.processor.mci.ui.S2MciAction
org.esa.snap.core.gpf.ui.reproject.OrthorectificationAction