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;
private PymolManager pymolManager;
- private Thread pymolMonitor;
-
/*
* full paths to structure files opened in PyMOL
*/
public void closeViewer(boolean closePymol)
{
super.closeViewer(closePymol);
- if (closePymol)
- {
- pymolManager.exitPymol();
- }
pymolManager = null;
-
- if (pymolMonitor != null)
- {
- pymolMonitor.interrupt();
- }
- }
-
- 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.error("Failed to launch PyMOL!");
}
- return launched;
+ return pymol != null;
}
public void openFile(PDBEntry pe)
* a second parameter sets the pdbid as the loaded PyMOL object name
*/
String pdbId = pe.getId();
+ try {
+ String safePDBId = java.net.URLEncoder.encode(pdbId,"UTF-8");
+ pdbId = safePDBId.replace('%', '_');
+ pdbId = pdbId.replace("-", "__");
+ char fc = pdbId.charAt(0);
+ // put an 's' before any numerics
+ if (fc>='0' && fc<='9')
+ {
+ pdbId = 's'+pdbId;
+ }
+// pdbId.replace('-', 0)
+ } catch (Exception x)
+ {
+ Cache.error("Unxpected encoding exception for '"+pdbId+"'",x);
+ }
cmd.addParameter(pdbId);
executeCommand(cmd, false);