From 768df7afff3cb5ecb636cf324f5965f0aeb1b9a4 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Thu, 27 Oct 2022 14:43:59 +0100 Subject: [PATCH] JAL-4083 don't need globalUseScriptWait after all, just a couple of calls to jmolHistory need the flag too --- src/jalview/ext/jmol/JalviewJmolBinding.java | 30 +++++++++----------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index a529fae..9436209 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -83,8 +83,6 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel public Viewer jmolViewer; - private boolean globalUseScriptWait = false; - public JalviewJmolBinding(StructureSelectionManager ssm, PDBEntry[] pdbentry, SequenceI[][] sequenceIs, DataSourceType protocol) @@ -131,7 +129,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel { Console.debug(">>Jmol>> " + script); String s; - if (globalUseScriptWait || useScriptWait) + if (useScriptWait) { s = jmolViewer.scriptWait(script); } @@ -269,12 +267,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel { 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(), useScriptWait); @@ -285,8 +278,6 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel highlightAtom(atom.getAtomIndex(), atom.getPdbResNum(), atom.getChain(), atom.getPdbFile(), useScriptWait); } - if (useScriptWait) - setGlobalUseScriptWait(prevUseScriptWait); } } @@ -300,7 +291,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel return; } - jmolHistory(false); + jmolHistory(false, useScriptWait); StringBuilder selection = new StringBuilder(32); StringBuilder cmd = new StringBuilder(64); @@ -319,14 +310,20 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel .append(" and not hetero; spacefill 0;"); jmolScript(cmd.toString(), useScriptWait); - jmolHistory(true); + jmolHistory(true, useScriptWait); } private boolean debug = true; private void jmolHistory(boolean enable) { - jmolScript("History " + ((debug || enable) ? "on" : "off")); + jmolHistory(enable, false); + } + + private void jmolHistory(boolean enable, boolean useScriptWait) + { + jmolScript("History " + ((debug || enable) ? "on" : "off"), + useScriptWait); } public void loadInline(String string) @@ -1075,11 +1072,4 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel { return "http://wiki.jmol.org"; // BH 2018 } - - private boolean setGlobalUseScriptWait(boolean b) - { - boolean prev = globalUseScriptWait; - globalUseScriptWait = b; - return prev; - } } -- 1.7.10.2