X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fext%2Fpymol%2FPymolCommands.java;h=e4f9f5f8d27911efec4a26791c70e98e05898071;hb=27f24d1f14b8e8704d72797286f7a6e5f60b2119;hp=910aae1d69eef0428c7299519946eb95f432ff8b;hpb=8c29d4d93761896bb75c6c3b24c3fdd0612c7bb3;p=jalview.git diff --git a/src/jalview/ext/pymol/PymolCommands.java b/src/jalview/ext/pymol/PymolCommands.java index 910aae1..e4f9f5f 100644 --- a/src/jalview/ext/pymol/PymolCommands.java +++ b/src/jalview/ext/pymol/PymolCommands.java @@ -1,14 +1,15 @@ package jalview.ext.pymol; +import java.awt.Color; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + import jalview.structure.AtomSpecModel; import jalview.structure.StructureCommand; import jalview.structure.StructureCommandI; import jalview.structure.StructureCommandsBase; -import java.awt.Color; -import java.util.ArrayList; -import java.util.List; - /** * A class that generates commands to send to PyMol over its XML-RPC interface. *

@@ -119,9 +120,8 @@ public class PymolCommands extends StructureCommandsBase @Override public StructureCommandI openCommandFile(String path) { - // where is this documented by PyMol? - // todo : xml-rpc answers 'method "@" is not supported' - return new StructureCommand("@" + path); // should be .pml + // https://pymolwiki.org/index.php/Run + return new StructureCommand("run", path); // should be .pml } @Override @@ -210,4 +210,27 @@ public class PymolCommands extends StructureCommandsBase return new StructureCommand("load", file); } + /** + * Overrides the default implementation (which generates concatenated + * commands) to generate one per colour (because the XML-RPC interface to + * PyMOL only accepts one command at a time) + * + * @param colourMap + * @return + */ + @Override + public List colourBySequence( + Map colourMap) + { + List commands = new ArrayList<>(); + for (Object key : colourMap.keySet()) + { + Color colour = (Color) key; + final AtomSpecModel colourData = colourMap.get(colour); + commands.add(getColourCommand(colourData, colour)); + } + + return commands; + } + }