34
31
for key, value in DOC_STYLES['Default'].items():
35
32
DOC_FACES[key] = value
37
terminal_client_script = """set my_path to quoted form of POSIX path of "%s"
38
set my_file to quoted form of POSIX path of "%s"
39
set which_python to quoted form of POSIX path of "%s"
40
tell application "System Events"
41
tell application process "Terminal"
46
keystroke "cd " & my_path
49
keystroke %swhich_python & " " & my_file & " &"
53
tell application process "E-Pyo"
58
terminal_client_script_path = os.path.join(TEMP_PATH, "terminal_client_script.scpt")
60
34
# ***************** Catalog starts here *******************
915
888
text = self.doc_panel.getExampleScript()
916
889
with open(DOC_EXAMPLE_PATH, "w") as f:
918
if not DOC_AS_SINGLE_APP and self.osx_app_bundled:
919
f = open(terminal_client_script_path, "w")
891
th = RunningThread(DOC_EXAMPLE_PATH, TEMP_PATH, self.which_python, self.osx_app_bundled, self.caller_need_to_invoke_32_bit, self.set_32_bit_arch)
893
wx.FutureCall(8000, self.status.SetStatusText, "", 0)
895
class RunningThread(threading.Thread):
896
def __init__(self, path, cwd, which_python, osx_app_bundled, caller_need_to_invoke_32_bit, set_32_bit_arch):
897
threading.Thread.__init__(self)
900
self.which_python = which_python
901
self.osx_app_bundled = osx_app_bundled
902
self.caller_need_to_invoke_32_bit = caller_need_to_invoke_32_bit
903
self.set_32_bit_arch = set_32_bit_arch
904
self.terminated = False
907
self.terminated = True
908
self.proc.terminate()
911
if self.osx_app_bundled:
912
vars_to_remove = "PYTHONHOME PYTHONPATH EXECUTABLEPATH RESOURCEPATH ARGVZERO PYTHONOPTIMIZE"
913
prelude = "export -n %s;export PATH=/usr/local/bin:/usr/local/lib:$PATH;env;" % vars_to_remove
920
914
if self.caller_need_to_invoke_32_bit:
921
f.write(terminal_client_script % (TEMP_PATH, DOC_EXAMPLE_PATH, self.which_python, self.set_32_bit_arch))
915
self.proc = subprocess.Popen(["%s%s%s %s" % (prelude, self.set_32_bit_arch, self.which_python, self.path)],
916
shell=True, cwd=self.cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
923
f.write(terminal_client_script % (TEMP_PATH, DOC_EXAMPLE_PATH, self.which_python, ""))
925
pid = subprocess.Popen(["osascript", terminal_client_script_path]).pid
918
self.proc = subprocess.Popen(["%s%s %s" % (prelude, self.which_python, self.path)], cwd=self.cwd,
919
shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
926
920
elif wx.Platform == '__WXMAC__':
927
921
if self.caller_need_to_invoke_32_bit:
928
pid = subprocess.Popen(["%s%s %s" % (self.set_32_bit_arch, self.which_python, DOC_EXAMPLE_PATH)],
929
cwd=TEMP_PATH, shell=True).pid
922
self.proc = subprocess.Popen(["%s%s %s" % (self.set_32_bit_arch, self.which_python, self.path)],
923
shell=True, cwd=self.cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
931
pid = subprocess.Popen([self.which_python, DOC_EXAMPLE_PATH], cwd=TEMP_PATH).pid
925
self.proc = subprocess.Popen(["%s %s" % (self.which_python, self.path)], cwd=self.cwd,
926
shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
933
pid = subprocess.Popen([self.which_python, DOC_EXAMPLE_PATH], cwd=TEMP_PATH).pid
934
wx.FutureCall(8000, self.status.SetStatusText, "", 0)
928
self.proc = subprocess.Popen([self.which_python, self.path], cwd=self.cwd,
929
shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
931
while self.proc.poll() == None and not self.terminated:
936
934
if __name__ == "__main__":
937
935
DOC_AS_SINGLE_APP = True