Controlling the GUI programmatically -- can/cannot

The Waveform “settings” user_data chunk included in the JLS file can control the plot settings. See the export code, import code and the available plot settings. You can use this mechanism to set the range_mode to manual, set the range, and disable the voltage plot.

However, it cannot control other Waveform widget settings like fill and statistics, at least in the existing production code. However, adding this feature ended up being trivial! JLS files can now generate arbitrary settings, events, and actions that are posted to the Waveform widget.

You can search waveform_widget.py for on_action_ for all the supported actions. An interesting one is !x_zoom_to implemented by method on_action_x_zoom_to. Note that events and actions need the leading ! that indicates unretained value to PubSub.

You then just need to add JSON-formatted user_data with metadata value 0x400 to the JLS file when you create it. Here is an example python script that generates a suitable JLS file:

EDIT: script removed: see next post

You can run the script like this:

python .\jls_create.py out.jls

I have also attached a JLS file that it created:
EDIT: JLS removed: see next post

Make sure you clone the Joulescope UI repo and use that code (not the official UI release) to open this file. Future official releases will include this feature.

This was a fun diversion to unlock the power of JLS files customizing the Waveform widget. I think the power is now in your hands :wink: