User c586072c01
16-11-2016 10:37:37
I'm trying to customise the Marvin Sketch UI, based on what's described here:
https://docs.chemaxon.com/display/docs/Customizing+Marvin+GUI
It says that the new configuration should be set using the
UserSettings.put(String, String)
method, but this method is no longer present in the API.
Can you advise on how this should be done?
Tim
ChemAxon 775b29fd6e
16-11-2016 15:06:26
Hi Tim,
try out the first method. Eg. Under windows you have to create a customization.xml file and copy it to C:\Documents and Settings\$USERNAME\chemaxon\$VERSION_NUMBER\. We've remove put method a few years ago.
Regards, Zoltan
User c586072c01
16-11-2016 15:14:42
That is no use. This needs to be done through the API as its software that get's installed onto a users computer and we can't poke random files into random place on their computers (and mess up any other applications that use MSketch).
ChemAxon 775b29fd6e
16-11-2016 15:33:34
I see, try this one.
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
try {
final JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final Dimension preferredDimension = new Dimension(800, 600);
final UserSettings userSettings = new UserSettings("test-settings");
userSettings.setLastSketchFrameSize(preferredDimension);
userSettings.save("test-settings saved");
final MSketchPane msketchPane = new MSketchPane(userSettings);
final String menuconfigPath = "/home/zpolgar/Documents/customization.xml";
final String menuconfigParameter = "menuconfig=" + menuconfigPath;
msketchPane.setParams(menuconfigParameter);
frame.setSize(preferredDimension);
frame.add(msketchPane);
frame.setVisible(true);
} catch (IOException e) {
System.err.println(e.getMessage());
}
}
});
customization.xml
<?xml version="1.0" encoding="UTF-8"?>
<customization active="sketch6default">
<scheme id="sketch6default">
<modify path="toolbar/mytemplates" index="0"/>
<modify path="toolbar/tools" index="0"/>
<modify path="toolbar/atoms/atom.N" visible="false"/>
<modify path="toolbar/atoms/atom.S" visible="false"/>
<modify path="toolbar/atoms/atom.F" visible="false"/>
<modify path="toolbar/atoms/atom.P" visible="false"/>
<modify path="toolbar/atoms/atom.Cl" visible="false"/>
<modify path="toolbar/atoms/atom.I" visible="false"/>
</scheme>
</customization>
Zoltan.
User c586072c01
16-11-2016 16:56:18
Thank you. I got it to work.
But one clarification: the customization.xml file I have is a not a file on the filesystem, but a resource inside a jar file of the application e.g. the path is to a resource (file) within within the jar. But that still works.
Thanks