From 9aa590fed5bcb3d915ef4b20e47e01fa1fc4b74d Mon Sep 17 00:00:00 2001 From: "Silas S. Brown" <ssb22@cam.ac.uk> Date: Sun, 13 Dec 2009 18:18:16 +0000 Subject: [PATCH] Gradint update git-svn-id: http://svn.code.sf.net/p/e-guidedog/code/ssb22/gradint@476 29193198-4895-4776-b068-10539e920549 --- gradint-build/Makefile | 18 +++++++++++++----- gradint-build/src/booktime.py | 2 +- gradint-build/src/filescan.py | 2 +- gradint-build/src/frontend.py | 7 +++++-- gradint-build/src/lessonplan.py | 2 +- gradint-build/src/loop.py | 2 +- gradint-build/src/makeevent.py | 2 +- gradint-build/src/play.py | 2 +- gradint-build/src/recording.py | 8 ++++---- gradint-build/src/sequence.py | 2 +- gradint-build/src/synth.py | 2 +- gradint-build/src/system.py | 2 +- gradint-build/src/top.py | 2 +- gradint-build/thindown.py | 2 +- 14 files changed, 33 insertions(+), 22 deletions(-) diff --git a/gradint-build/Makefile b/gradint-build/Makefile index 3c3e943..28e5bbf 100644 --- a/gradint-build/Makefile +++ b/gradint-build/Makefile @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9943 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or @@ -71,6 +71,10 @@ gradint.exe: $(Common_Files) gradint.py cat windows0/7zS.sfx windows0/7zip.conf windows0/data.7z > gradint.exe rm -rf windows0 +# recorder.exe utility for sending to native friends to ask them to record words +# e.g. make recorder.exe RecorderL1=ja if their language is different from zh +RecorderL1=zh +RecorderL2=en recorder.exe: $(Common_Files) gradint.py rm -rf windows0 ; cp -r windows windows0 cd windows0 ; tar -jxf gradint.bgz ; rm gradint.bgz ; cd .. @@ -81,10 +85,14 @@ recorder.exe: $(Common_Files) gradint.py rm -f windows0/gradint/madplay.exe windows0/gradint/sox.exe windows0/gradint/ptts.exe zip -0 windows0/gradint/library.zip gradint.py cp extras/lame.exe extras/zip.exe windows0/gradint/ - echo $$'@echo off\ncd gradint\ngradint-wrapper.exe recorderMode=1' > windows0/gradint/runme.bat - echo 'firstLanguage="zh";secondLanguage="en"' > windows0/gradint/settings.txt - cd windows0; zip -9r recorder.zip gradint/ ; cd .. - echo '$$AUTORUN$$>gradint\runme.bat' | zip -z windows0/recorder.zip + mv windows0/gradint windows0/recorder + echo $$'@echo off\ncd recorder\ngradint-wrapper.exe recorderMode=1\nif not exist ..\\recorder.bat copy runme.bat ..\\recorder.bat\nif exist ..\\recorder.exe del ..\\recorder.exe\nexit' > windows0/recorder/runme.bat + # (replace the .exe with a .bat in case they try to open it again from desktop and get confused by unzip's "overwrite" prompt) + # (NB must say 'start' below for the above del to work) + echo 'firstLanguage="$(RecorderL1)";secondLanguage="$(RecorderL2)"' > windows0/recorder/settings.txt + $(Unix_To_Dos) windows0/recorder/*.bat windows0/recorder/*.txt + cd windows0; zip -9r recorder.zip recorder/ ; cd .. + echo '$$AUTORUN$$>start /min recorder\runme.bat' | zip -z windows0/recorder.zip cat yali-voice/unzipsfx.exe windows0/recorder.zip > recorder.exe zip -A recorder.exe rm -rf windows0 diff --git a/gradint-build/src/booktime.py b/gradint-build/src/booktime.py index c4be276..84b3a1d 100644 --- a/gradint-build/src/booktime.py +++ b/gradint-build/src/booktime.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9943 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or diff --git a/gradint-build/src/filescan.py b/gradint-build/src/filescan.py index 0b004bd..d6866af 100644 --- a/gradint-build/src/filescan.py +++ b/gradint-build/src/filescan.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9943 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or diff --git a/gradint-build/src/frontend.py b/gradint-build/src/frontend.py index 346716e..0f696f0 100644 --- a/gradint-build/src/frontend.py +++ b/gradint-build/src/frontend.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9943 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or @@ -646,6 +646,9 @@ def startTk(): if hasattr(self.todo,"clear_text_boxes"): self.Text1.set("") ; self.Text2.set("") ; self.Entry1.focus() del self.todo.clear_text_boxes + if hasattr(self.todo,"undoRecordFrom"): + theRecorderControls.undoRecordFrom() + del self.todo.undoRecordFrom if hasattr(self.todo,"exit_ASAP"): self.master.destroy() self.pollInterval = 0 @@ -1552,7 +1555,7 @@ def rest_of_main(): except: tracebackFile=None if tracebackFile: try: - tracebackFile.write(w+"\n") + tracebackFile.write(time.asctime()+":\n"+w+"\n") if traceback: traceback.print_exc(None,tracebackFile) tracebackFile.close() if traceback: w += "Details have been written to "+os.getcwd()+os.sep+"last-gradint-error"+extsep+"txt" # do this only if there's a traceback, otherwise little point diff --git a/gradint-build/src/lessonplan.py b/gradint-build/src/lessonplan.py index acd56a1..5cdaa03 100644 --- a/gradint-build/src/lessonplan.py +++ b/gradint-build/src/lessonplan.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9943 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or diff --git a/gradint-build/src/loop.py b/gradint-build/src/loop.py index 6e2ce7e..08ea828 100644 --- a/gradint-build/src/loop.py +++ b/gradint-build/src/loop.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9943 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or diff --git a/gradint-build/src/makeevent.py b/gradint-build/src/makeevent.py index 1640bf2..849fb40 100644 --- a/gradint-build/src/makeevent.py +++ b/gradint-build/src/makeevent.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9943 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or diff --git a/gradint-build/src/play.py b/gradint-build/src/play.py index 5996bb2..69e3c54 100644 --- a/gradint-build/src/play.py +++ b/gradint-build/src/play.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9943 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or diff --git a/gradint-build/src/recording.py b/gradint-build/src/recording.py index 9fbc079..b89fa22 100644 --- a/gradint-build/src/recording.py +++ b/gradint-build/src/recording.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9943 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or @@ -62,7 +62,7 @@ class PlayerInput(InputSource): # play to speakers while recording to various de theISM.nowPlaying = self tkSnack.audio.stop() # as we might be still in c'tor and just about to be assigned to replace the previously-playing sound (i.e. it might not have stopped yet), and we don't want to confuse elapsedTime self.sound.play(start=curSample) - self.startSample = curSample + self.startSample = curSample ; self.startTime = time.time() self.autostop() def autostop(self): if not theISM or not theISM.nowPlaying==self or not tkSnack or not tkSnack.audio: return @@ -77,7 +77,7 @@ class PlayerInput(InputSource): # play to speakers while recording to various de def elapsedTime(self): try: t=tkSnack.audio.elapsedTime() except: t=0.0 - if t==0.0: t=self.length # if elapsedTime raises exception or returns an exact float 0.0, probably finished + if t==0.0: t=time.time()-self.startTime return t def currentSample(self): return int(self.elapsedTime()*self.sampleRate)+self.startSample def currentTime(self): return self.currentSample()*1.0/self.sampleRate @@ -113,7 +113,7 @@ class PlayerInput(InputSource): # play to speakers while recording to various de if theRecorderControls: if self.inCtor: # tried to skip off end - DO ensure the GUI resets its controls when that happens, even if it has "protected" itself due to restarting the sample at different position theRecorderControls.current_recordFrom_button = theRecorderControls.old_recordFrom_button - theRecorderControls.undoRecordFrom() + app.todo.undoRecordFrom=True # we might not be the GUI thread if not tkSnack: if macsound: # might still be able to use Audio Recorder diff --git a/gradint-build/src/sequence.py b/gradint-build/src/sequence.py index 00d3acd..76b92d7 100644 --- a/gradint-build/src/sequence.py +++ b/gradint-build/src/sequence.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9943 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or diff --git a/gradint-build/src/synth.py b/gradint-build/src/synth.py index 3dbdcf5..123b03d 100644 --- a/gradint-build/src/synth.py +++ b/gradint-build/src/synth.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9943 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or diff --git a/gradint-build/src/system.py b/gradint-build/src/system.py index 8f3c885..c5b233c 100644 --- a/gradint-build/src/system.py +++ b/gradint-build/src/system.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9943 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or diff --git a/gradint-build/src/top.py b/gradint-build/src/top.py index 239f654..4a92359 100644 --- a/gradint-build/src/top.py +++ b/gradint-build/src/top.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -program_name = "gradint v0.9943 (c) 2002-2009 Silas S. Brown. GPL v3+." +program_name = "gradint v0.9944 (c) 2002-2009 Silas S. Brown. GPL v3+." # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/gradint-build/thindown.py b/gradint-build/thindown.py index 50bf3e9..784cf2c 100644 --- a/gradint-build/thindown.py +++ b/gradint-build/thindown.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9943 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or -- GitLab