From 577e53187c6426c7f720f9f404ac831982d79e88 Mon Sep 17 00:00:00 2001
From: "Silas S. Brown" <ssb22@cam.ac.uk>
Date: Sun, 11 Jul 2010 16:15:22 +0000
Subject: [PATCH] Gradint update

git-svn-id: http://svn.code.sf.net/p/e-guidedog/code/ssb22/gradint@866 29193198-4895-4776-b068-10539e920549
---
 gradint-build/Makefile                        |   2 +-
 .../mac/start-gradint.app/espeak-OSX.zip      | Bin 1406197 -> 1406215 bytes
 gradint-build/src/booktime.py                 |   2 +-
 gradint-build/src/filescan.py                 |   2 +-
 gradint-build/src/frontend.py                 |   4 ++--
 gradint-build/src/lessonplan.py               |   2 +-
 gradint-build/src/loop.py                     |   2 +-
 gradint-build/src/makeevent.py                |   2 +-
 gradint-build/src/play.py                     |   6 ++++--
 gradint-build/src/recording.py                |  16 +++++++++++-----
 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/src/users.py                    |   2 +-
 gradint-build/thindown.py                     |   2 +-
 gradint-build/windows/espeak-windows.7z       | Bin 1137267 -> 1137267 bytes
 17 files changed, 29 insertions(+), 21 deletions(-)

diff --git a/gradint-build/Makefile b/gradint-build/Makefile
index 090a60d..90cc423 100644
--- a/gradint-build/Makefile
+++ b/gradint-build/Makefile
@@ -1,5 +1,5 @@
 # This file is part of the source code of
-# gradint v0.9958 (c) 2002-2010 Silas S. Brown. GPL v3+.
+# gradint v0.9959 (c) 2002-2010 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/mac/start-gradint.app/espeak-OSX.zip b/gradint-build/mac/start-gradint.app/espeak-OSX.zip
index 54ab2461aee862805f30a109292a181acb00daa9..165f255cdf2a63cdf7de58647f235103f2d55a2b 100644
GIT binary patch
delta 179
zcmezRGPM0wXhREQ3sVbo3rh=Y3tJ0&3r7p*7B2M;Mw!Wmdqt+(ba09AmR4{xFtTjO
z4l7|{U}z8P-~wW9Am#yLULfWJVtybN0AfKP76M}7?O`1vY_FN*n5Xl1a7i#qOfN4M
zH9|FN`s!j)9cG;^0${7&6^q(4%1+lS5%pn|nqFNZ>dsg={cwq>2A8=D1H&!@Q3eJE
E0By83x&QzG

delta 170
zcmZpF75epMXhREQ3sVbo3rh=Y3tJ0&3r7p*7B2OU=^@uxM5iw(7UdM=WMFpqrRf90
zp%p9)W-HrcJGg+D8;E&;m=}oofS4bM1%Ox(h=qVyczbMz2-|BWapvj#9b6KOywmH7
zMU9w3E2i%)7S&-^-6AmAaIeU;5>b0bvFQ#aqCSkm(|b!q-5Il{Uo8>U;L>qnVAyOR
I%D}(?0G(wvvj6}9

diff --git a/gradint-build/src/booktime.py b/gradint-build/src/booktime.py
index b247f1b..5021e83 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.9958 (c) 2002-2010 Silas S. Brown. GPL v3+.
+# gradint v0.9959 (c) 2002-2010 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 956e2a3..a1eec82 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.9958 (c) 2002-2010 Silas S. Brown. GPL v3+.
+# gradint v0.9959 (c) 2002-2010 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 5872be3..7595006 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.9958 (c) 2002-2010 Silas S. Brown. GPL v3+.
+# gradint v0.9959 (c) 2002-2010 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
@@ -182,7 +182,7 @@ def selectAll(e):
 def selectAllButNumber(e): # hack for recording.py - select all but any number at the start
     e.widget.event_generate('<Home>')
     for i in list(e.widget.theText.get()):
-        if "0"<=i<="9": e.widget.event_generate('<Right>')
+        if "0"<=i<="9" or i=="_": e.widget.event_generate('<Right>')
         else: return e.widget.event_generate('<Shift-End>')
 def addTextBox(row,wide=0):
     text = Tkinter.StringVar(row)
diff --git a/gradint-build/src/lessonplan.py b/gradint-build/src/lessonplan.py
index 6a3e356..e631d54 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.9958 (c) 2002-2010 Silas S. Brown. GPL v3+.
+# gradint v0.9959 (c) 2002-2010 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 4230a25..2b7a1db 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.9958 (c) 2002-2010 Silas S. Brown. GPL v3+.
+# gradint v0.9959 (c) 2002-2010 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 93b24cb..964a4e6 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.9958 (c) 2002-2010 Silas S. Brown. GPL v3+.
+# gradint v0.9959 (c) 2002-2010 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 dd6c99a..9505fb6 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.9958 (c) 2002-2010 Silas S. Brown. GPL v3+.
+# gradint v0.9959 (c) 2002-2010 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
@@ -109,7 +109,9 @@ if unix:
     gotSox=0
     if got_program("sox"):
       if macsound and sox_formats.find("Rosetta")>-1:
-        show_warning(sox_formats.replace("sox.","sox and espeak.")+" Otherwise expect problems!") # (TODO need to check espeak separately in case they've compiled it x86, see in synth.py)
+        try: u""+sox_formats
+        except: sox_formats="Please install Rosetta (from the Mac OS X optional CD) to run sox." # just in case there are encoding problems with localisation
+        show_warning(sox_formats.replace("sox.","some of the utilities Gradint uses.")+" Otherwise expect problems!") # (TODO need to check espeak separately in case they've compiled it x86, see in synth.py)
         got_qtplay = 0
       else: show_warning("SOX found, but it can't handle WAV files. Ubuntu users please install libsox-fmt-all.")
 else: gotSox = got_program("sox")
diff --git a/gradint-build/src/recording.py b/gradint-build/src/recording.py
index c990f3b..6205c8f 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.9958 (c) 2002-2010 Silas S. Brown. GPL v3+.
+# gradint v0.9959 (c) 2002-2010 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 RecorderControls:
         renameEntry.grid(row=row,column=col,sticky='we')
         number=filename
         if number.startswith("word"): number=number[4:]
-        if number and "0"<=number[0]<="9":
+        if number and ("0"<=number[0]<="9" or (len(number)>=2 and number[0]=="_" and "0"<=number[1]<="9")): # the format of addMore method
             renameText.set(number)
             selectAllFunc = selectAllButNumber
         else:
@@ -434,7 +434,7 @@ class RecorderControls:
         self.del_addMore_button()
         for r in range(5):
             if self.maxPrefix<=99: prefix = "word%02d" % self.maxPrefix
-            else: prefix = "word_%04d" % self.maxPrefix
+            else: prefix = "word_%04d" % self.maxPrefix # if changing this, change startRename and selectAllButNumber also, AND the code that works out maxPrefix (and NB legacy collections).  TODO use of _ may not suit variants if in same dir.
             self.addLabel(self.addMoreRow,0,utext=prefix)
             for lang in self.languagesToDraw:
                 self.updateFile(unicode2filename(prefix+"_"+lang+dotwav),self.addMoreRow,self.languagesToDraw.index(lang),state=0)
@@ -658,11 +658,17 @@ class RecorderControls:
               else:
                   prefix=fname[:fname.rindex("_")]
                   languageOverride = languageof(fname)
+              
               wprefix = prefix
-              if wprefix.startswith("word"): wprefix=wprefix[4:] # ditch any "word" before the integer
-              try: iprefix = int(wprefix)
+              for ww in ["word_","word","_"]:
+                if wprefix.startswith(ww):
+                  wprefix=wprefix[len(ww):] ; break
+              ii=0
+              while ii<len(wprefix) and "0"<=wprefix[ii]<="9": ii += 1
+              try: iprefix = int(wprefix[:ii])
               except: iprefix = -1
               if iprefix>maxPrefix: maxPrefix=iprefix # max existing numerical prefix
+              
               if (flwr.endswith(dotwav) or flwr.endswith(dotmp3) or flwr.endswith(dottxt)): # even if not languageOverride in self.languagesToDraw e.g. for prompts - helps setting up gradint in a language it doesn't have prompts for (creates blank rows for the prefixes that other languages use). TODO do we want to add 'and languageOverride in self.languagesToDraw' if NOT in prompts?
                 if not prefix in prefix2row:
                     self.addLabel(curRow,0,utext=filename2unicode(prefix))
diff --git a/gradint-build/src/sequence.py b/gradint-build/src/sequence.py
index 5a72218..8b2f8b4 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.9958 (c) 2002-2010 Silas S. Brown. GPL v3+.
+# gradint v0.9959 (c) 2002-2010 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 c0362f9..f2c46d7 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.9958 (c) 2002-2010 Silas S. Brown. GPL v3+.
+# gradint v0.9959 (c) 2002-2010 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 4c8be33..5145d27 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.9958 (c) 2002-2010 Silas S. Brown. GPL v3+.
+# gradint v0.9959 (c) 2002-2010 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 e4791c1..b57e4c6 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.9958 (c) 2002-2010 Silas S. Brown. GPL v3+."
+program_name = "gradint v0.9959 (c) 2002-2010 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/src/users.py b/gradint-build/src/users.py
index b50df01..bc6523d 100644
--- a/gradint-build/src/users.py
+++ b/gradint-build/src/users.py
@@ -1,5 +1,5 @@
 # This file is part of the source code of
-# gradint v0.9958 (c) 2002-2010 Silas S. Brown. GPL v3+.
+# gradint v0.9959 (c) 2002-2010 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/thindown.py b/gradint-build/thindown.py
index c60fe4a..7d1e7b1 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.9958 (c) 2002-2010 Silas S. Brown. GPL v3+.
+# gradint v0.9959 (c) 2002-2010 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/windows/espeak-windows.7z b/gradint-build/windows/espeak-windows.7z
index 3f8599348536e684d30a0c652221003aa36e3a55..1942f46d4a33d7b2763c73ddd81265989fc0c95a 100644
GIT binary patch
delta 168
zcmeyo#r5+RR|WH`J?qtF7?{kbq;1lR5@Y}YRWQlG;CJFPOQS-o0%NNJQ>y}Vs{%`_
z0&A-RTdM+ls{%)>0%xlNSE~Yds{&7}0&lAVU#kLttAfB*1;O``wrlwvGCtQ>+?;7F
zq$~ToF2}$!$tAJPP&Jb!_*vigl#?-1r<GDn+!=f#7p!y&ekl-`WB<AT*VNZfj0FGP
Rp6(MRsK|Ei?6XJ)1^|d6IEDZK

delta 168
zcmeyo#r5+RR|WH`J?qtF7?_?PwRh8t5@Y}YRWQlGz^i=gK%+vd0%NNJQ>y}Vs{%`_
z0&A-RTdM+ls{%)>0%xlNSE~Yds{&7}0&lAVU#kLttAfB*1;O``wmiOmcHcvHyGF!a
z_<K0w?-ju{?9X<{wzAZ(Q4gK#ds@j|EJxq?Ktq<GPv*Md%`M0HigN_oPI!tNzgRtM
R`E;KsK}EKY>-j|)7y#Y^H=zIk

-- 
GitLab