Problem exporting Trackscheme as XML/PNG using Jython

Hello!

I am currently working on a project which has helped me explore the world of scripting for trackmate. I have managed to save all the statistics obtained from tracking and felt it would be useful to also export track scheme. And while trying out the following code snippet I encountered some problems.

from fiji.plugin.trackmate.visualization.trackscheme import TrackScheme, TrackSchemeFrame
from fiji.plugin.trackmate.visualization.trackscheme import SaveAction
from java.awt import Color
import os
from os.path import join

# set up trackmate
# ...

# get model
model = trackmate.getModel()
selectionModel = SelectionModel(model)

# get trackscheme
trackscheme = TrackScheme(model, selectionModel)
trackscheme.render()
trackscheme.refresh() # trackscheme shows up
trackschemeFrame = trackscheme.getGUI()
saveaction = SaveAction(trackscheme)
savepath = "/User/savedir"

# this step throws an Attribute Error 
# the function= saveXmlPng(TrackSchemeFrame frame, String filename, Color bg)
saveaction.saveXmlPng(trackschemeFrame, os.path.join(savepath, "tracks.xml"), Color.black)

The error:

AttributeError: 'fiji.plugin.trackmate.visualization.trackscheme.Sa' object has no attribute 'saveXmlPng'

I find this very strange that the class itself shows up as fiji.plugin.trackmate.visualization.trackscheme.Sa instead of fiji.plugin.trackmate.visualization.trackscheme.SaveAction, I checked the API and I do not think I have made any typos anywhere. I am able to get the track-scheme on the screen though, without issues.

Also, I am not sure now to provide the filename here, should I specify .xml or .png or just a string?

Currently, I am just saving the whole XML file using TmXmlWriter but this would be really cool if it worked.

Any ideas on this would be appreciated!