From: gmungoc Date: Mon, 29 Jun 2020 10:55:14 +0000 (+0100) Subject: Merge branch 'develop' of https://source.jalview.org/git/jalview.git into develop X-Git-Tag: Develop-2_11_2_0-d20201215~24^2~36 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=3b2dd110a9283ae50db9302c8cc22ab4aec7a199;hp=d53294db69b6bb2fe39415b28abb98092234ce67;p=jalview.git Merge branch 'develop' of https://source.jalview.org/git/jalview.git into develop --- diff --git a/src/jalview/ext/pymol/PymolCommands.java b/src/jalview/ext/pymol/PymolCommands.java index be01533..36957f5 100644 --- a/src/jalview/ext/pymol/PymolCommands.java +++ b/src/jalview/ext/pymol/PymolCommands.java @@ -2,6 +2,7 @@ package jalview.ext.pymol; import java.awt.Color; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Map; @@ -22,25 +23,31 @@ import jalview.structure.StructureCommandsBase; */ public class PymolCommands extends StructureCommandsBase { - private static final StructureCommand CLOSE_PYMOL = new StructureCommand("quit"); + // https://pymol.org/dokuwiki/doku.php?id=command:zoom + // not currently documented on + // https://pymolwiki.org/index.php/Category:Commands + private static final StructureCommand FOCUS_VIEW = new StructureCommand( + "zoom"); - private static final StructureCommand COLOUR_BY_CHAIN = new StructureCommand("spectrum", "chain"); + // https://pymolwiki.org/index.php/Quit + private static final StructureCommand CLOSE_PYMOL = new StructureCommand( + "quit"); - private static final List COLOR_BY_CHARGE = new ArrayList<>(); + // not currently documented on + // https://pymolwiki.org/index.php/Category:Commands + private static final StructureCommand COLOUR_BY_CHAIN = new StructureCommand( + "spectrum", "chain"); - private static final List SHOW_BACKBONE = new ArrayList<>(); + private static final List COLOR_BY_CHARGE = Arrays + .asList(new StructureCommand("color", "white", "*"), + new StructureCommand("color", "red", "resn ASP resn GLU"), + new StructureCommand("color", "blue", + "resn LYS resn ARG"), + new StructureCommand("color", "yellow", "resn CYS")); - static { - COLOR_BY_CHARGE.add(new StructureCommand("color", "white", "*")); - COLOR_BY_CHARGE - .add(new StructureCommand("color", "red", "resn ASP resn GLU")); - COLOR_BY_CHARGE.add( - new StructureCommand("color", "blue", "resn LYS resn ARG")); - COLOR_BY_CHARGE - .add(new StructureCommand("color", "yellow", "resn CYS")); - SHOW_BACKBONE.add(new StructureCommand("hide", "everything")); - SHOW_BACKBONE.add(new StructureCommand("show", "ribbon")); - } + private static final List SHOW_BACKBONE = Arrays + .asList(new StructureCommand("hide", "everything"), + new StructureCommand("show", "ribbon")); @Override public StructureCommandI colourByChain() @@ -77,8 +84,7 @@ public class PymolCommands extends StructureCommandsBase @Override public StructureCommandI focusView() { - // TODO what? - return null; + return FOCUS_VIEW; } @Override @@ -93,7 +99,8 @@ public class PymolCommands extends StructureCommandsBase { chains.append(" chain ").append(chain); } - commands.add(new StructureCommand("show", "cartoon", chains.toString())); + commands.add( + new StructureCommand("show", "cartoon", chains.toString())); return commands; } @@ -231,7 +238,7 @@ public class PymolCommands extends StructureCommandsBase final AtomSpecModel colourData = colourMap.get(colour); commands.add(getColourCommand(colourData, colour)); } - + return commands; } @@ -249,8 +256,7 @@ public class PymolCommands extends StructureCommandsBase * @return */ protected StructureCommandI setAttribute(String attributeName, - String attributeValue, - AtomSpecModel atomSpecModel) + String attributeValue, AtomSpecModel atomSpecModel) { StringBuilder sb = new StringBuilder(128); sb.append("p.").append(attributeName).append("='") @@ -284,13 +290,13 @@ public class PymolCommands extends StructureCommandsBase for (String featureType : featureMap.keySet()) { String attributeName = makeAttributeName(featureType); - + /* * todo: clear down existing attributes for this feature? */ // commands.add(new StructureCommand("iterate", "all", // "p."+attributeName+"='None'"); //? - + Map values = featureMap.get(featureType); for (Object value : values.keySet()) { @@ -307,7 +313,7 @@ public class PymolCommands extends StructureCommandsBase commands.add(cmd); } } - + return commands; } diff --git a/src/jalview/gui/ChimeraViewFrame.java b/src/jalview/gui/ChimeraViewFrame.java index 5fd185d..810f40d 100644 --- a/src/jalview/gui/ChimeraViewFrame.java +++ b/src/jalview/gui/ChimeraViewFrame.java @@ -536,12 +536,6 @@ public class ChimeraViewFrame extends StructureViewerBase } @Override - protected void fitToWindow_actionPerformed() - { - jmb.focusView(); - } - - @Override public ViewerType getViewerType() { return ViewerType.CHIMERA; diff --git a/src/jalview/gui/StructureViewerBase.java b/src/jalview/gui/StructureViewerBase.java index 33a122c..a0b199b 100644 --- a/src/jalview/gui/StructureViewerBase.java +++ b/src/jalview/gui/StructureViewerBase.java @@ -1209,6 +1209,9 @@ public abstract class StructureViewerBase extends GStructureViewer } forceClose = confirm == JvOptionPane.YES_OPTION; } + } + if (binding != null) + { binding.closeViewer(forceClose); } setAlignmentPanel(null); diff --git a/src/jalview/jbgui/GStructureViewer.java b/src/jalview/jbgui/GStructureViewer.java index 73180ee..4e13032 100644 --- a/src/jalview/jbgui/GStructureViewer.java +++ b/src/jalview/jbgui/GStructureViewer.java @@ -214,6 +214,7 @@ public abstract class GStructureViewer extends JInternalFrame protected void fitToWindow_actionPerformed() { + getBinding().focusView(); } protected void highlightSelection_actionPerformed()