xwin.py (pymol-open-source-2.2.0) | : | xwin.py (pymol-open-source-2.3.0) | ||
---|---|---|---|---|
import os | import os | |||
def machine_get_clipboard(): | def machine_get_clipboard(): | |||
result = [] | result = [] | |||
from popen2 import popen2 | ||||
wish_path = os.environ['PYMOL_PATH']+"/ext/bin/wish8.0" # dubious... | wish_path = os.environ['PYMOL_PATH']+"/ext/bin/wish8.0" # dubious... | |||
if not os.path.exists(wish_path): | if not os.path.exists(wish_path): | |||
wish_path = "/usr/bin/wish" | wish_path = "/usr/bin/wish" | |||
if os.path.exists(wish_path): | if os.path.exists(wish_path): | |||
pipe = popen2(wish_path) | import subprocess | |||
pipe[1].write("puts [ selection get ]\n") | p = subprocess.Popen([wish_path], | |||
pipe[1].write("exit\n") | universal_newlines=True, | |||
pipe[1].close() | stdin=subprocess.PIPE, | |||
while 1: | stdout=subprocess.PIPE) | |||
l=pipe[0].readline() | p.stdin.write("puts [ selection get ]\n") | |||
if not l: break | p.stdin.write("exit\n") | |||
result.append(l) | p.stdin.close() | |||
result = p.stdout.readlines() | ||||
return result | return result | |||
End of changes. 2 change blocks. | ||||
9 lines changed or deleted | 9 lines changed or added |