{
if (isChimeraRunning())
{
- List<String> reply = viewer.sendChimeraCommand("save " + filepath,
+ /*
+ * Chimera: https://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/midas/save.html
+ * ChimeraX: https://www.cgl.ucsf.edu/chimerax/docs/user/commands/save.html
+ */
+ String command = isChimeraX() ? "save session " : "save ";
+ List<String> reply = viewer.sendChimeraCommand(command + filepath,
true);
if (reply.contains("Session written"))
{
/**
* Ask Chimera to open a session file. Returns true if successful, else false.
- * The filename must have a .py extension for this command to work.
+ * The filename must have a .py (Chimera) or .cxs (ChimeraX) extension for
+ * this command to work.
*
* @param filepath
* @return
*/
public boolean openSession(String filepath)
{
+ /*
+ * Chimera: https://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/midas/open.html
+ * ChimeraX: https://www.cgl.ucsf.edu/chimerax/docs/user/commands/open.html
+ */
sendChimeraCommand("open " + filepath, true);
// todo: test for failure - how?
return true;
}
return atts;
}
+
+ public boolean isChimeraX()
+ {
+ return viewer.isChimeraX();
+ }
}
{
if (pathUsed == null)
{
- File tempFile = File.createTempFile("chimera", ".py");
+ String suffix = jmb.isChimeraX() ? ".cxs" : ".py";
+ File tempFile = File.createTempFile("chimera", suffix);
tempFile.deleteOnExit();
pathUsed = tempFile.getPath();
}