From: Jim Procter Date: Fri, 17 Mar 2023 16:02:53 +0000 (+0000) Subject: JAL-3921 allow Jmol saveState to be executed as evalScriptWait so state is written... X-Git-Tag: Release_2_11_3_0~3^2~7^2~1 X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=862dbed4080eb694f8c09fbfd81a5cf37eef2928 JAL-3921 allow Jmol saveState to be executed as evalScriptWait so state is written before script eval returns --- diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index 21a19ae..dde7643 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -154,7 +154,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel jmolHistory(false); if (lastCommand == null || !lastCommand.equals(cmd)) { - jmolScript(cmd + "\n"); + jmolScript(cmd + "\n",command.isWaitNeeded()); } jmolHistory(true); lastCommand = cmd; diff --git a/src/jalview/ext/jmol/JmolCommands.java b/src/jalview/ext/jmol/JmolCommands.java index 19d64f0..7fa47a1 100644 --- a/src/jalview/ext/jmol/JmolCommands.java +++ b/src/jalview/ext/jmol/JmolCommands.java @@ -241,7 +241,9 @@ public class JmolCommands extends StructureCommandsBase /* * https://chemapps.stolaf.edu/jmol/docs/#writemodel */ - return new StructureCommand("write STATE \"" + filepath + "\""); + StructureCommand sc = new StructureCommand("write STATE \"" + filepath + "\""); + sc.setWaitNeeded(true); + return sc; } @Override diff --git a/src/jalview/structure/StructureCommand.java b/src/jalview/structure/StructureCommand.java index 5dab059..6e4c4e1 100644 --- a/src/jalview/structure/StructureCommand.java +++ b/src/jalview/structure/StructureCommand.java @@ -29,6 +29,7 @@ public class StructureCommand implements StructureCommandI private List parameters; + private boolean waitNeeded=false; public StructureCommand(String cmd, String... params) { command = cmd; @@ -40,7 +41,18 @@ public class StructureCommand implements StructureCommandI } } } - + + public void setWaitNeeded(boolean wait) + { + waitNeeded=wait; + } + + @Override + public boolean isWaitNeeded() + { + return waitNeeded; + } + @Override public void addParameter(String param) { diff --git a/src/jalview/structure/StructureCommandI.java b/src/jalview/structure/StructureCommandI.java index ba557a8..03b15fb 100644 --- a/src/jalview/structure/StructureCommandI.java +++ b/src/jalview/structure/StructureCommandI.java @@ -31,4 +31,6 @@ public interface StructureCommandI void addParameter(String param); boolean hasParameters(); + + default boolean isWaitNeeded() { return false; }; }