git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b122ba1
)
JAL-4312 call AlignFrame.setAnnotationsVisibility on AWT thread from Commands
author
James Procter
<j.procter@dundee.ac.uk>
Wed, 25 Oct 2023 10:16:01 +0000
(11:16 +0100)
committer
James Procter
<j.procter@dundee.ac.uk>
Wed, 25 Oct 2023 10:16:01 +0000
(11:16 +0100)
src/jalview/bin/Commands.java
patch
|
blob
|
history
diff --git
a/src/jalview/bin/Commands.java
b/src/jalview/bin/Commands.java
index
e02d132
..
a092cd6
100644
(file)
--- a/
src/jalview/bin/Commands.java
+++ b/
src/jalview/bin/Commands.java
@@
-13,6
+13,8
@@
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Locale;
import java.util.Map;
+import javax.swing.SwingUtilities;
+
import jalview.analysis.AlignmentUtils;
import jalview.api.structures.JalviewStructureDisplayI;
import jalview.bin.Jalview.ExitCode;
import jalview.analysis.AlignmentUtils;
import jalview.api.structures.JalviewStructureDisplayI;
import jalview.bin.Jalview.ExitCode;
@@
-361,28
+363,51
@@
public class Commands
}
}
}
}
+
// Show secondary structure annotations?
boolean showSSAnnotations = avm.getFromSubValArgOrPref(
Arg.SHOWSSANNOTATIONS, av.getSubVals(), null,
"STRUCT_FROM_PDB", true);
// Show secondary structure annotations?
boolean showSSAnnotations = avm.getFromSubValArgOrPref(
Arg.SHOWSSANNOTATIONS, av.getSubVals(), null,
"STRUCT_FROM_PDB", true);
- af.setAnnotationsVisibility(showSSAnnotations, true, false);
-
+
// Show sequence annotations?
boolean showAnnotations = avm.getFromSubValArgOrPref(
Arg.SHOWANNOTATIONS, av.getSubVals(), null,
"SHOW_ANNOTATIONS", true);
// Show sequence annotations?
boolean showAnnotations = avm.getFromSubValArgOrPref(
Arg.SHOWANNOTATIONS, av.getSubVals(), null,
"SHOW_ANNOTATIONS", true);
- af.setAnnotationsVisibility(showAnnotations, false, true);
+
+ boolean hideTFrows = (avm.getBoolean(Arg.NOTEMPFAC));
+ final AlignFrame _af = af;
+ // many of jalview's format/layout methods are only thread safe on the swingworker thread.
+ // all these methods should be on the alignViewController so it can coordinate such details
+ try
+ {
+ SwingUtilities.invokeAndWait(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ _af.setAnnotationsVisibility(showSSAnnotations, true,
+ false);
- // show temperature factor annotations?
- if (avm.getBoolean(Arg.NOTEMPFAC))
+ _af.setAnnotationsVisibility(showAnnotations, false, true);
+
+ // show temperature factor annotations?
+ if (hideTFrows)
+ {
+ // do this better (annotation types?)
+ List<String> hideThese = new ArrayList<>();
+ hideThese.add("Temperature Factor");
+ hideThese.add(AlphaFoldAnnotationRowBuilder.LABEL);
+ AlignmentUtils.showOrHideSequenceAnnotations(
+ _af.getCurrentView().getAlignment(), hideThese,
+ null, false, false);
+ }
+ }
+ });
+ } catch (Exception x)
{
{
- // do this better (annotation types?)
- List<String> hideThese = new ArrayList<>();
- hideThese.add("Temperature Factor");
- hideThese.add(AlphaFoldAnnotationRowBuilder.LABEL);
- AlignmentUtils.showOrHideSequenceAnnotations(
- af.getCurrentView().getAlignment(), hideThese, null,
- false, false);
+ Console.warn(
+ "Unexpected exception adjusting annotation row visibility.",
+ x);
}
// wrap alignment? do this last for formatting reasons
}
// wrap alignment? do this last for formatting reasons