public Viewer jmolViewer;
+ private boolean globalUseScriptWait = false;
+
public JalviewJmolBinding(StructureSelectionManager ssm,
PDBEntry[] pdbentry, SequenceI[][] sequenceIs,
DataSourceType protocol)
private String jmolScript(String script)
{
+ return jmolScript(script, false);
+ }
+
+ private String jmolScript(String script, boolean useScriptWait)
+ {
Console.debug(">>Jmol>> " + script);
- String s = jmolViewer.evalStringQuiet(script); // scriptWait(script); BH
+ String s;
+ if (globalUseScriptWait || useScriptWait)
+ {
+ s = jmolViewer.scriptWait(script);
+ }
+ else
+ {
+ s = jmolViewer.evalStringQuiet(script); // scriptWait(script); BH
+ }
Console.debug("<<Jmol<< " + s);
return s;
{
if (atoms != null)
{
+ boolean useScriptWait = atoms.size() > 1;
+ boolean prevUseScriptWait = setGlobalUseScriptWait(useScriptWait);
if (resetLastRes.length() > 0)
{
jmolScript(resetLastRes.toString());
for (AtomSpec atom : atoms)
{
highlightAtom(atom.getAtomIndex(), atom.getPdbResNum(),
- atom.getChain(), atom.getPdbFile());
+ atom.getChain(), atom.getPdbFile(), useScriptWait);
}
+ setGlobalUseScriptWait(prevUseScriptWait);
}
}
// jmol/ssm only
public void highlightAtom(int atomIndex, int pdbResNum, String chain,
- String pdbfile)
+ String pdbfile, boolean useScriptWait)
{
String modelId = getModelIdForFile(pdbfile);
if (modelId.isEmpty())
resetLastRes.append(selection).append(";wireframe 0;").append(selection)
.append(" and not hetero; spacefill 0;");
- jmolScript(cmd.toString());
+ jmolScript(cmd.toString(), useScriptWait);
jmolHistory(true);
}
{
return "http://wiki.jmol.org"; // BH 2018
}
+
+ private boolean setGlobalUseScriptWait(boolean b)
+ {
+ boolean prev = globalUseScriptWait;
+ globalUseScriptWait = b;
+ return prev;
+ }
}