JAL-3551 fit to window (zoom) command for PyMOL
[jalview.git] / src / jalview / ext / pymol / PymolCommands.java
index 53b1ec5..f382173 100644 (file)
@@ -22,6 +22,8 @@ import jalview.structure.StructureCommandsBase;
  */
 public class PymolCommands extends StructureCommandsBase
 {
+  private static final StructureCommand CLOSE_PYMOL = new StructureCommand("quit");
+
   private static final StructureCommand COLOUR_BY_CHAIN = new StructureCommand("spectrum", "chain");
 
   private static final List<StructureCommandI> COLOR_BY_CHARGE = new ArrayList<>();
@@ -75,8 +77,9 @@ public class PymolCommands extends StructureCommandsBase
   @Override
   public StructureCommandI focusView()
   {
-    // TODO what?
-    return null;
+    // https://pymol.org/dokuwiki/doku.php?id=command:zoom
+    // not currently documented on https://pymolwiki.org/index.php/Category:Commands
+    return new StructureCommand("zoom");
   }
 
   @Override
@@ -309,4 +312,19 @@ public class PymolCommands extends StructureCommandsBase
     return commands;
   }
 
+  @Override
+  public StructureCommandI openSession(String filepath)
+  {
+    // https://pymolwiki.org/index.php/Load
+    // this version of the command has no dependency on file extension
+    return new StructureCommand("load", filepath, "", "0", "pse");
+  }
+
+  @Override
+  public StructureCommandI closeViewer()
+  {
+    // https://pymolwiki.org/index.php/Quit
+    return CLOSE_PYMOL;
+  }
+
 }