import jalview.api.FeatureRenderer;
import jalview.api.FeatureSettingsModelI;
import jalview.api.SequenceRenderer;
-import jalview.bin.Cache;
+import jalview.bin.Console;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
import jalview.gui.AppJmol;
public Viewer jmolViewer;
+ private boolean globalUseScriptWait = false;
+
public JalviewJmolBinding(StructureSelectionManager ssm,
PDBEntry[] pdbentry, SequenceI[][] sequenceIs,
DataSourceType protocol)
private String jmolScript(String script)
{
- Cache.log.debug(">>Jmol>> " + script);
- String s = jmolViewer.evalStringQuiet(script); // scriptWait(script); BH
- Cache.log.debug("<<Jmol<< " + s);
+ return jmolScript(script, false);
+ }
+
+ private String jmolScript(String script, boolean useScriptWait)
+ {
+ Console.debug(">>Jmol>> " + script);
+ 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)
{
+ // we set the globalUseScriptWait (and reset to previous value) only if
+ // we're going to use it here
+ boolean useScriptWait = atoms.size() > 1;
+ boolean prevUseScriptWait = false;
+ if (useScriptWait)
+ prevUseScriptWait = setGlobalUseScriptWait(useScriptWait);
if (resetLastRes.length() > 0)
{
- jmolScript(resetLastRes.toString());
+ jmolScript(resetLastRes.toString(), useScriptWait);
resetLastRes.setLength(0);
}
for (AtomSpec atom : atoms)
{
highlightAtom(atom.getAtomIndex(), atom.getPdbResNum(),
- atom.getChain(), atom.getPdbFile());
+ atom.getChain(), atom.getPdbFile(), useScriptWait);
}
+ if (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;
+ }
}