import java.util.Map;
import jalview.api.AlignmentViewPanel;
+import jalview.bin.Cache;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
import jalview.ext.pymol.PymolCommands;
import jalview.ext.pymol.PymolManager;
import jalview.gui.StructureViewer.ViewerType;
import jalview.structure.AtomSpec;
+import jalview.structure.AtomSpecModel;
import jalview.structure.StructureCommand;
import jalview.structure.StructureCommandI;
import jalview.structure.StructureSelectionManager;
private PymolManager pymolManager;
- private Thread pymolMonitor;
-
/*
* full paths to structure files opened in PyMOL
*/
}
@Override
- public SequenceRenderer getSequenceRenderer(AlignmentViewPanel alignment)
+ public SequenceRenderer getSequenceRenderer(AlignmentViewPanel avp)
{
- // pull up?
- return new SequenceRenderer(alignment.getAlignViewport());
+ return new SequenceRenderer(avp.getAlignViewport());
}
@Override
return ViewerType.PYMOL;
}
- public boolean isPymolRunning()
+ @Override
+ public boolean isViewerRunning()
{
return pymolManager.isPymolLaunched();
}
+ @Override
public void closeViewer(boolean closePymol)
{
- getSsm().removeStructureViewerListener(this, this.getStructureFiles());
- if (closePymol)
- {
- pymolManager.exitPymol();
- }
+ super.closeViewer(closePymol);
pymolManager = null;
-
- if (pymolMonitor != null)
- {
- pymolMonitor.interrupt();
- }
- releaseUIResources();
- }
-
- public boolean openSession(String pymolSessionFile)
- {
- StructureCommandI cmd = getCommandGenerator()
- .loadFile(pymolSessionFile);
- executeCommand(cmd, false);
- return true;
}
public boolean launchPymol()
return true;
}
- boolean launched = pymolManager.launchPymol();
- if (launched)
+ Process pymol = pymolManager.launchPymol();
+ if (pymol != null)
{
// start listening for PyMOL selections - how??
+ startExternalViewerMonitor(pymol);
}
else
{
- System.err.println("Failed to launch PyMOL!");
+ Cache.log.error("Failed to launch PyMOL!");
}
- return launched;
+ return pymol != null;
}
public void openFile(PDBEntry pe)
return ".pse";
}
+ @Override
+ public String getHelpURL()
+ {
+ return "https://pymolwiki.org/";
+ }
+
+ /**
+ * Constructs and sends commands to set atom properties for visible Jalview
+ * features on residues mapped to structure
+ *
+ * @param avp
+ * @return
+ */
+ public int sendFeaturesToViewer(AlignmentViewPanel avp)
+ {
+ // todo pull up this and JalviewChimeraBinding variant
+ Map<String, Map<Object, AtomSpecModel>> featureValues = buildFeaturesMap(
+ avp);
+ List<StructureCommandI> commands = getCommandGenerator()
+ .setAttributes(featureValues);
+ executeCommands(commands, false, null);
+ return commands.size();
+ }
+
}