📄 pythonshell.java
字号:
/*
* Created on Aug 16, 2004
*
* @author Fabio Zadrozny
*/
package org.python.pydev.editor.codecompletion.shell;
import java.io.File;
import java.io.IOException;
import org.eclipse.core.runtime.CoreException;
import org.python.pydev.core.REF;
import org.python.pydev.plugin.PydevPlugin;
import org.python.pydev.runners.SimplePythonRunner;
import org.python.pydev.runners.SimpleRunner;
/**
* @author Fabio Zadrozny
*/
public class PythonShell extends AbstractShell{
/**
* Initialize with the default python server file.
*
* @throws IOException
* @throws CoreException
*/
public PythonShell() throws IOException, CoreException {
super(PydevPlugin.getScriptWithinPySrc("pycompletionserver.py"));
}
@Override
protected synchronized String createServerProcess(int pWrite, int pRead) throws IOException {
String interpreter = PydevPlugin.getPythonInterpreterManager().getDefaultInterpreter();
File file = new File(interpreter);
if(file.exists() == false ){
throw new RuntimeException("The interpreter location found does not exist. "+interpreter);
}
if(file.isDirectory() == true){
throw new RuntimeException("The interpreter location found is a directory. "+interpreter);
}
String execMsg;
if(SimpleRunner.isWindowsPlatform()){ //in windows, we have to put python "path_to_file.py"
execMsg = interpreter+" \""+REF.getFileAbsolutePath(serverFile)+"\" "+pWrite+" "+pRead;
}else{ //however in mac, or linux, this gives an error...
execMsg = interpreter+" "+REF.getFileAbsolutePath(serverFile)+" "+pWrite+" "+pRead;
}
process = new SimplePythonRunner().createProcess(execMsg, serverFile.getParentFile());
return execMsg;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -