From 1e68ac74cb516c2688e64cdc6a15480551b2f80d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 27 Apr 2014 22:55:27 +0000 Subject: asymptote 2.25 git-svn-id: svn://tug.org/texlive/trunk@33704 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/asymptote/GUI/xasy2asy.py | 4 ++++ Master/texmf-dist/asymptote/GUI/xasyCodeEditor.py | 19 ++++++++++++------- Master/texmf-dist/asymptote/GUI/xasyMainWin.py | 2 ++ Master/texmf-dist/asymptote/GUI/xasyOptions.py | 2 +- Master/texmf-dist/asymptote/GUI/xasyVersion.py | 2 +- 5 files changed, 20 insertions(+), 9 deletions(-) (limited to 'Master/texmf-dist/asymptote/GUI') diff --git a/Master/texmf-dist/asymptote/GUI/xasy2asy.py b/Master/texmf-dist/asymptote/GUI/xasy2asy.py index 984bd1f5dd9..3a2c1bcbe7b 100755 --- a/Master/texmf-dist/asymptote/GUI/xasy2asy.py +++ b/Master/texmf-dist/asymptote/GUI/xasy2asy.py @@ -65,6 +65,10 @@ def startQuickAsy(): except: quickAsyFailed = True +def stopQuickAsy(): + if quickAsyRunning(): + fout.write("exit;\n"); + def getAsyTempDir(): return AsyTempDir diff --git a/Master/texmf-dist/asymptote/GUI/xasyCodeEditor.py b/Master/texmf-dist/asymptote/GUI/xasyCodeEditor.py index 1f7ad60328f..d09196a41be 100755 --- a/Master/texmf-dist/asymptote/GUI/xasyCodeEditor.py +++ b/Master/texmf-dist/asymptote/GUI/xasyCodeEditor.py @@ -21,21 +21,26 @@ import xasyOptions def getText(text=""): """Launch the external editor""" temp = mkstemp() - tempf = fdopen(temp[0],"r+w") + tempf = fdopen(temp[0],"w") tempf.write(text) - tempf.flush() + tempf.close() try: - cmdpath,cmd = path.split(xasyOptions.options['externalEditor']) + cmdpath,cmd = path.split(path.expandvars(xasyOptions.options['externalEditor'])) split_cmd = split(cmd) cmdpart = [path.join(cmdpath,split_cmd[0])] argpart = split_cmd[1:]+[temp[1]] arglist = cmdpart+argpart call(arglist) - except: + except Exception as e: raise Exception('Error launching external editor.') - tempf.seek(0) - text = tempf.read() - remove(temp[1]) + + try: + tempf = open(temp[1],"r") + text = tempf.read() + tempf.close() + remove(temp[1]) + except Exception as e: + raise Exception('Error reading from external editor.') return text if __name__ == '__main__': diff --git a/Master/texmf-dist/asymptote/GUI/xasyMainWin.py b/Master/texmf-dist/asymptote/GUI/xasyMainWin.py index e3a0044011a..657d24ba81b 100755 --- a/Master/texmf-dist/asymptote/GUI/xasyMainWin.py +++ b/Master/texmf-dist/asymptote/GUI/xasyMainWin.py @@ -566,6 +566,8 @@ class xasyMainWin: os.rmdir(getAsyTempDir()) except: pass + + stopQuickAsy() self.parent.destroy() def openFile(self,name): diff --git a/Master/texmf-dist/asymptote/GUI/xasyOptions.py b/Master/texmf-dist/asymptote/GUI/xasyOptions.py index 4406687cbf4..17d58d760e5 100755 --- a/Master/texmf-dist/asymptote/GUI/xasyOptions.py +++ b/Master/texmf-dist/asymptote/GUI/xasyOptions.py @@ -33,7 +33,7 @@ defaultOptions = { } if sys.platform[:3] == "win": - defaultOptions['externalEditor'] = "notepad.exe" + defaultOptions['externalEditor'] = "%PROGRAMFILES%\Windows NT\Accessories\wordpad.exe" else: defaultOptions['externalEditor'] = "emacs" diff --git a/Master/texmf-dist/asymptote/GUI/xasyVersion.py b/Master/texmf-dist/asymptote/GUI/xasyVersion.py index aefd00148e1..48b2683382f 100755 --- a/Master/texmf-dist/asymptote/GUI/xasyVersion.py +++ b/Master/texmf-dist/asymptote/GUI/xasyVersion.py @@ -1,2 +1,2 @@ #!/usr/bin/env python -xasyVersion = "2.25" +xasyVersion = "2.26" -- cgit v1.2.3