From 40d9c9f294735841777e3a387458f1085987571b Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 11 Mar 2019 14:54:26 +0000 Subject: [PATCH] JAL-3201 restore group colours correctly from project --- src/jalview/project/Jalview2XML.java | 9 +++++---- src/jalview/viewmodel/AlignmentViewport.java | 3 ++- test/jalview/project/Jalview2xmlTests.java | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/jalview/project/Jalview2XML.java b/src/jalview/project/Jalview2XML.java index 53e9a83..1797fb7 100644 --- a/src/jalview/project/Jalview2XML.java +++ b/src/jalview/project/Jalview2XML.java @@ -4977,21 +4977,22 @@ public class Jalview2XML } } + /* + * turn off 'alignment colour applies to all groups' + * while restoring global colour scheme + */ + viewport.setColourAppliesToAllGroups(false); viewport.setGlobalColourScheme(cs); viewport.getResidueShading().setThreshold(pidThreshold, view.isIgnoreGapsinConsensus()); viewport.getResidueShading() .setConsensus(viewport.getSequenceConsensusHash()); - viewport.setColourAppliesToAllGroups(false); - if (safeBoolean(view.isConservationSelected()) && cs != null) { viewport.getResidueShading() .setConservationInc(safeInt(view.getConsThreshold())); } - af.changeColour(cs); - viewport.setColourAppliesToAllGroups(true); viewport diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index 0f56561..0ea31d7 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -662,7 +662,8 @@ public abstract class AlignmentViewport * retain any colour thresholds per group while * changing choice of colour scheme (JAL-2386) */ - sg.setColourScheme(cs.getInstance(sg, hiddenRepSequences)); + sg.setColourScheme( + cs == null ? null : cs.getInstance(sg, hiddenRepSequences)); if (cs != null) { sg.getGroupColourScheme().alignmentChanged(sg, diff --git a/test/jalview/project/Jalview2xmlTests.java b/test/jalview/project/Jalview2xmlTests.java index afc445e..ea3f00b 100644 --- a/test/jalview/project/Jalview2xmlTests.java +++ b/test/jalview/project/Jalview2xmlTests.java @@ -818,6 +818,7 @@ public class Jalview2xmlTests extends Jalview2xmlBase /* * Colour alignment by Buried Index, Above 10% PID, By Conservation 20% */ + av.setColourAppliesToAllGroups(false); af.changeColour_actionPerformed(JalviewColourScheme.Buried.toString()); assertTrue(av.getGlobalColourScheme() instanceof BuriedColourScheme); af.abovePIDThreshold_actionPerformed(true); -- 1.7.10.2