From 7083bfae83b00250bdc8d37e4e309a9d04748256 Mon Sep 17 00:00:00 2001
From: "Silas S. Brown" <ssb22@cam.ac.uk>
Date: Fri, 18 Dec 2009 09:40:34 +0000
Subject: [PATCH] Gradint update

git-svn-id: http://svn.code.sf.net/p/e-guidedog/code/ssb22/gradint@483 29193198-4895-4776-b068-10539e920549
---
 gradint-build/Makefile          |  2 +-
 gradint-build/p                 | 29 -----------------------------
 gradint-build/src/booktime.py   |  2 +-
 gradint-build/src/filescan.py   |  7 ++++---
 gradint-build/src/frontend.py   |  2 +-
 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  |  2 +-
 gradint-build/src/sequence.py   |  2 +-
 gradint-build/src/synth.py      |  4 ++--
 gradint-build/src/system.py     |  2 +-
 gradint-build/src/top.py        |  2 +-
 gradint-build/thindown.py       |  2 +-
 15 files changed, 18 insertions(+), 46 deletions(-)
 delete mode 100644 gradint-build/p

diff --git a/gradint-build/Makefile b/gradint-build/Makefile
index 2c3e469..e25a006 100644
--- a/gradint-build/Makefile
+++ b/gradint-build/Makefile
@@ -1,5 +1,5 @@
 # This file is part of the source code of
-# gradint v0.9945 (c) 2002-2009 Silas S. Brown. GPL v3+.
+# gradint v0.9946 (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/p b/gradint-build/p
deleted file mode 100644
index 424669f..0000000
--- a/gradint-build/p
+++ /dev/null
@@ -1,29 +0,0 @@
---- gradint.py	2009-12-17 17:38:29.000000000 +0000
-+++ /tmp/Gradint.app/gradint.py	2009-12-17 17:52:45.000000000 +0000
-@@ -4320,7 +4320,7 @@
-             try: os.remove(filename)
-             except: pass
-         self.cancelEdit(editEntry,row,col,filename)
--        if row+1 < self.addMoreRow and (row+1,col+1) in self.coords2buttons: self.scrollIntoView(self.coords2buttons[(row+1,col+1)]) # focus the next "synth" button if it exists (TODO do we want to press it as well, like file renaming?)
-+        if row+1 < self.addMoreRow and (row+1,col+1) in self.coords2buttons: self.scrollIntoView(self.coords2buttons[(row+1,col+1)]) # focus the next "synth" button if it exists (don't press it as well like file renaming because it might be a variant etc, TODO can we skip variants?)
-     def cancelEdit(self,editEntry,row,col,filename):
-         editEntry.grid_forget()
-         labelAdded = self.addSynthLabel(filename,row,col)
-@@ -5175,9 +5175,14 @@
- 
- def focusButton(button):
-     button.focus()
--    if macsound: # focus() should display the fact on Windows and Linux, but doesn't on OS X - need to make it default as well
--        try: button.config(state="active")
--        except: pass # maybe not a button
-+    if macsound: # focus() should display the fact on Windows and Linux, but doesn't on OS X so:
-+        def flashButton(button,state):
-+            try: button.config(state=state)
-+            except: pass # maybe not a button
-+        for t in range(250,1000,250): # (NB avoid epilepsy's 5-30Hz!)
-+          app.after(t,lambda *args:flashButton(button,"active"))
-+          app.after(t+150,lambda *args:flashButton(button,"normal"))
-+        # (Don't like flashing, but can't make it permanently active as it won't change when the focus does)
- 
- def startTk():
-     class Application(Tkinter.Frame):
diff --git a/gradint-build/src/booktime.py b/gradint-build/src/booktime.py
index c375d61..b01cd41 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.9945 (c) 2002-2009 Silas S. Brown. GPL v3+.
+# gradint v0.9946 (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 40e3e77..b6629d6 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.9945 (c) 2002-2009 Silas S. Brown. GPL v3+.
+# gradint v0.9946 (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
@@ -127,7 +127,7 @@ def getLsDic(directory):
                 continue
         lsDic[(file+extsep)[:file.find(extsep)]] = val # (this means if there's both mp3 and wav, wav will overwrite as comes later)
     if has_variants:
-        ls=list2set(ls)
+        ls=list2set(ls) ; newVs = []
         for k,v in lsDic.items():
             # check for _lang_variant.ext and take out the _variant,
             # but keep them in variant_files dict for fileToEvent to put back
@@ -145,7 +145,8 @@ def getLsDic(directory):
                 variantFiles[dir_newV] = []
                 if newV in ls: variantFiles[dir_newV].append(newV) # the no-variants name is also a valid option
             variantFiles[dir_newV].append(v)
-        random.shuffle(variantFiles[dir_newV])
+            newVs.append(dir_newV)
+        for v in newVs: random.shuffle(variantFiles[v])
     return lsDic
 
 def scanSamples_inner(directory,retVal,doLimit):
diff --git a/gradint-build/src/frontend.py b/gradint-build/src/frontend.py
index b0e738a..d3f9f14 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.9945 (c) 2002-2009 Silas S. Brown. GPL v3+.
+# gradint v0.9946 (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/lessonplan.py b/gradint-build/src/lessonplan.py
index 995e347..0d443c4 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.9945 (c) 2002-2009 Silas S. Brown. GPL v3+.
+# gradint v0.9946 (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 05cfb21..0396bae 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.9945 (c) 2002-2009 Silas S. Brown. GPL v3+.
+# gradint v0.9946 (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 1944fde..4d72540 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.9945 (c) 2002-2009 Silas S. Brown. GPL v3+.
+# gradint v0.9946 (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 a24a941..b2ec38c 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.9945 (c) 2002-2009 Silas S. Brown. GPL v3+.
+# gradint v0.9946 (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 55abbd9..6e14e3b 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.9945 (c) 2002-2009 Silas S. Brown. GPL v3+.
+# gradint v0.9946 (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/sequence.py b/gradint-build/src/sequence.py
index ca53c49..5c8a61a 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.9945 (c) 2002-2009 Silas S. Brown. GPL v3+.
+# gradint v0.9946 (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 c017933..2339f6b 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.9945 (c) 2002-2009 Silas S. Brown. GPL v3+.
+# gradint v0.9946 (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
@@ -340,7 +340,7 @@ class ESpeakSynth(Synth):
         if pickle and fileExists(espeakTranslitCacheFile):
             try: placeStat,tc = pickle.Unpickler(open(espeakTranslitCacheFile,"rb")).load()
             except: placeStat,tc = (),{}
-            if placeStat==tuple(os.stat(self.place)): self.translitCache = tc # otherwise regenerate it because eSpeak installation has changed
+            if placeStat==tuple(os.stat(self.place)): self.translitCache = tc # otherwise regenerate it because eSpeak installation has changed (TODO if you overwrite an existing _dict file in-place, it might not update the stat() of espeak-data and the cache might not be re-generated when it should; espeak's --compile seems ok though)
         if self.place: self.place=self.place[:self.place.rindex(os.sep)] # drop the \espeak-data, so can be used in --path=
     def _add_lang(self,lang,fname):
         if ("-" in lang and not lang=="zh-yue") or "~" in lang: return # variants and emacs backup files
diff --git a/gradint-build/src/system.py b/gradint-build/src/system.py
index 4f47b73..ea873ce 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.9945 (c) 2002-2009 Silas S. Brown. GPL v3+.
+# gradint v0.9946 (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 1b7b677..2c76e16 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.9945 (c) 2002-2009 Silas S. Brown. GPL v3+."
+program_name = "gradint v0.9946 (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 3a34f77..5263386 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.9945 (c) 2002-2009 Silas S. Brown. GPL v3+.
+# gradint v0.9946 (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