From 6e4a036de3446459effdd32d5ae0c5352d913083 Mon Sep 17 00:00:00 2001 From: "Silas S. Brown" <ssb22@cam.ac.uk> Date: Tue, 15 Dec 2009 16:49:55 +0000 Subject: [PATCH] Gradint update git-svn-id: http://svn.code.sf.net/p/e-guidedog/code/ssb22/gradint@479 29193198-4895-4776-b068-10539e920549 --- gradint-build/Makefile | 2 +- gradint-build/advanced.txt | 6 ++-- gradint-build/src/booktime.py | 2 +- gradint-build/src/filescan.py | 49 ++++++++++++++++++++--------- gradint-build/src/frontend.py | 6 ++-- gradint-build/src/lessonplan.py | 2 +- gradint-build/src/loop.py | 2 +- gradint-build/src/makeevent.py | 2 +- gradint-build/src/play.py | 4 +-- gradint-build/src/recording.py | 55 ++++++++++++++++++++------------- gradint-build/src/sequence.py | 2 +- gradint-build/src/synth.py | 4 +-- gradint-build/src/system.py | 4 +-- gradint-build/src/top.py | 2 +- gradint-build/thindown.py | 2 +- 15 files changed, 88 insertions(+), 56 deletions(-) diff --git a/gradint-build/Makefile b/gradint-build/Makefile index 28e5bbf..2c3e469 100644 --- a/gradint-build/Makefile +++ b/gradint-build/Makefile @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9945 (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/advanced.txt b/gradint-build/advanced.txt index 70ece9b..eea037f 100644 --- a/gradint-build/advanced.txt +++ b/gradint-build/advanced.txt @@ -554,11 +554,11 @@ userNameFile="username.txt" # for multiple students, e.g. for a single-user machine in use by a family). # Set it to "" to disable this feature. -import_recordings_from = r"\My Documents" +import_recordings_from = [r"\My Documents", r"\Storage Card\My Documents", r"\Ramdisk\My Documents"] # This is really for Windows Mobile, but can also be adapted # for other platforms. If you leave Recording1.wav, Recording2.wav -# etc in that directory, Gradint will offer to "import" them -# when you make a lesson. Record the second-language words +# etc in any of the above directories, Gradint will offer to "import" +# them when you make a lesson. Record the second-language words # into odd-numbered files, and their first-language meanings # into even numbered files. # This can be useful to catch words with the Notes app on a PocketPC diff --git a/gradint-build/src/booktime.py b/gradint-build/src/booktime.py index 84b3a1d..c375d61 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.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9945 (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 d6866af..40e3e77 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.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9945 (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 @@ -31,30 +31,49 @@ def scanSamples(directory=None): # poetry learning) retVal = [] doLabel("Scanning samples") - if import_recordings_from: - try: l=os.listdir(import_recordings_from) + if import_recordings_from: import_recordings() + scanSamples_inner(directory,retVal,0) + return retVal + +class CannotOverwriteExisting(Exception): pass +def import_recordings(destDir=None): + global import_recordings_from + if not type(import_recordings_from)==type([]): # legacy settings + if import_recordings_from: import_recordings_from=[import_recordings_from] + else: import_recordings_from = [] + numFound=0 + for checkFirst in [1,0]: + if checkFirst: + if destDir: curFiles=list2set(os.listdir(destDir)) + else: continue # no point checking for existing files in a new directory + for importDir in import_recordings_from: + try: l=os.listdir(importDir) except: l=[] - destDir = None for f in l: if (f.lower().endswith(dotwav) or f.lower().endswith(dotmp3)) and f[-5] in "0123456789": + if checkFirst: + for lang in [firstLanguage,secondLanguage]: + for ext in [dotwav,dotmp3]: + if f[:f.rfind(extsep)]+"_"+lang+ext in curFiles: raise CannotOverwriteExisting() + continue if not destDir: - if not getYN("Import the recordings that are in "+import_recordings_from+"?"): break + if not getYN("Import the recordings that are in "+importDir+"?"): break prefix=time.strftime("%Y-%m-%d") ; i=0 while isDirectory(prefix+cond(i,"_"+str(i),"")): i+=1 destDir=directory+os.sep+prefix+cond(i,"_"+str(i),"") try: os.mkdir(directory) # make sure samples directory exists except: pass os.mkdir(destDir) - open(destDir+os.sep+"settings"+dottxt,"w").write("firstLanguage=\""+firstLanguage+"\"\nsecondLanguage=\""+secondLanguage+"\"\n") - try: os.rename(import_recordings_from+os.sep+f,destDir+os.sep+f) + try: os.rename(importDir+os.sep+f,destDir+os.sep+f) except: try: import shutil - shutil.copy2(import_recordings_from+os.sep+f,destDir+os.sep+f) - except: open(destDir+os.sep+f,"wb").write(import_recordings_from+os.sep+f).read() - os.remove(import_recordings_from+os.sep+f) - scanSamples_inner(directory,retVal,0) - return retVal + shutil.copy2(importDir+os.sep+f,destDir+os.sep+f) + except: open(destDir+os.sep+f,"wb").write(importDir+os.sep+f).read() + os.remove(importDir+os.sep+f) + numFound += 1 + if numFound: open(destDir+os.sep+"settings"+dottxt,"w").write("firstLanguage=\""+firstLanguage+"\"\nsecondLanguage=\""+secondLanguage+"\"\n") + return numFound def exec_in_a_func(x): # helper function for below (can't be nested in python 2.3) # Also be careful of http://bugs.python.org/issue4315 (shadowing globals in an exec) - better do this in a dictionary @@ -72,12 +91,12 @@ def getLsDic(directory): # Helper function for samples and prompts scanning # Calls os.listdir, returns dict of filename-without-extension to full filename # Puts variants into variantFiles and normalises them - # Also sorts out import_recordings (pointless for prompts, but settings.txt shouldn't be found in prompts) + # Also sorts out import_recordings output (pointless for prompts, but settings.txt shouldn't be found in prompts) if not (directory.find(exclude_from_scan)==-1): return {} try: ls = os.listdir(directory) - except OSError: return {} # (can run without a 'samples' directory at all if just doing synth) + except: return {} # (can run without a 'samples' directory at all if just doing synth) if "settings"+dottxt in ls: - # Sort out the o/p from import_recordings_from above (and legacy record-with-HDogg.bat if anyone's still using that) + # Sort out the o/p from import_recordings (and legacy record-with-HDogg.bat if anyone's still using that) oddLanguage,evenLanguage = exec_in_a_func(u8strip(open(directory+os.sep+"settings"+dottxt,"rb").read().replace("\r\n","\n")).strip(wsp)) if oddLanguage==evenLanguage: oddLanguage,evenLanguage="_"+oddLanguage,"-meaning_"+evenLanguage # if user sets languages the same, assume they want -meaning prompts else: oddLanguage,evenLanguage="_"+oddLanguage,"_"+evenLanguage diff --git a/gradint-build/src/frontend.py b/gradint-build/src/frontend.py index 0f696f0..55d40fb 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.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9945 (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 @@ -444,7 +444,7 @@ class ExtraButton(object): if not newName: newName="1" ls = [] try: ls = os.listdir(samplesDirectory) - except OSError: os.mkdir(samplesDirectory) + except: os.mkdir(samplesDirectory) name1=newName while newName in ls: newName+="1" name2=newName @@ -473,7 +473,7 @@ def make_extra_buttons_waiting_list(): else: oneUp=os.getcwd() for d in [samplesDirectory,oneUp]: try: ls = os.listdir(d) - except OSError: continue + except: continue ls.sort() for l in ls: if l.endswith(exclude_from_scan) and fileExists(d+os.sep+l+os.sep+shortDescriptionName): extra_buttons_waiting_list.append(ExtraButton(d+os.sep+l)) diff --git a/gradint-build/src/lessonplan.py b/gradint-build/src/lessonplan.py index 5cdaa03..995e347 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.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9945 (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 08ea828..05cfb21 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.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9945 (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 849fb40..1944fde 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.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9945 (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 69e3c54..a24a941 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.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9945 (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 @@ -179,7 +179,7 @@ def system(cmd): # Don't call os.system for commands like sound playing, because if you do then any Control-C interrupt will go to that rather than to gradint as we want, and it will pop up a large blank console window in Windows GUI-only version if riscos_sound or not hasattr(os,"popen"): return os.system(cmd) # no popen try: r=os.popen(cmd) - except OSError: return os.system(cmd) # too many file descriptors open or something + except: return os.system(cmd) # too many file descriptors open or something r.read() ; return r.close() # Event(len) gives a pause of that length diff --git a/gradint-build/src/recording.py b/gradint-build/src/recording.py index b89fa22..14a339c 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.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9945 (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 @@ -350,7 +350,7 @@ class RecorderControls: if intor0(o2): newName=o2+"-"+newName if isDirectory(unicode2filename(self.currentDir+os.sep+origName)): try: os.rename(unicode2filename(self.currentDir+os.sep+origName),unicode2filename(self.currentDir+os.sep+newName)) - except OSError: + except: tkMessageBox.showinfo(app.master.title(),localise("Could not rename %s to %s") % (origName,newName)) return self.addButton(row,col,text=newName,command=(lambda f=self.currentDir+os.sep+newName:self.changeDir(f))) @@ -361,7 +361,7 @@ class RecorderControls: for ext in [dottxt, dotwav, dotmp3]: if fileExists_stat(unicode2filename(self.currentDir+os.sep+origName+"_"+lang+ext)): try: os.rename(unicode2filename(self.currentDir+os.sep+origName+"_"+lang+ext),unicode2filename(self.currentDir+os.sep+newName+"_"+lang+ext)) - except OSError: + except: tkMessageBox.showinfo(app.master.title(),localise("Could not rename %s to %s") % (origName+"_"+lang+ext,newName+"_"+lang+ext)) # TODO undo any that did succeed first! + check for destination-already-exists (OS may not catch it) return self.updateFile(unicode2filename(newName+"_"+lang+ext),row,self.languagesToDraw.index(lang),cond(ext==dottxt,0,2)) # TODO the 2 should be 1 if and only if we didn't just record it @@ -393,21 +393,23 @@ class RecorderControls: else: self.addLabel(row,3+3*languageNo,"") self.need_reRecord_enabler = not (not tkSnack) - else: + else: # does not exist synthFilename = filename[:filename.rfind(extsep)]+dottxt if txtExists=="unknown": txtExists=fileExists(synthFilename) if txtExists: self.addLabel(row,2+3*languageNo,localise("(synth'd)")) elif self.always_enable_synth and get_synth_if_possible(self.languagesToDraw[languageNo],0): self.addButton(row,2+3*languageNo,text=localise("Synthesize"),command=(lambda *args:self.startSynthEdit(None,row+1,1+3*languageNo,synthFilename))) else: self.addLabel(row,2+3*languageNo,localise("(empty)")) self.coords2buttons[(row,2+3*languageNo)].is_synth_label = True - self.addButton(row,3+3*languageNo,text=localise("Record"),command=(lambda f=recFilename,r=row,l=languageNo:self.doRecord(f,r,l))) + if winCEsound and not tkSnack: self.addLabel(row,3+3*languageNo,"") + else: self.addButton(row,3+3*languageNo,text=localise("Record"),command=(lambda f=recFilename,r=row,l=languageNo:self.doRecord(f,r,l))) def add_addMore_button(self): - self.addButton(self.addMoreRow,0,text=localise("Add more words"),command=(lambda *args:self.addMore()),colspan=cond(self.need_reRecord_enabler,2,4)) + if winCEsound and not tkSnack: pass # no 'add more words' button on WinCE; use PocketPC record button instead + else: self.addButton(self.addMoreRow,0,text=localise("Add more words"),command=(lambda *args:self.addMore()),colspan=cond(self.need_reRecord_enabler,2,4)) if self.need_reRecord_enabler: self.addButton(self.addMoreRow,2,text=localise("Re-record"),command=(lambda *args:self.global_rerecord()),colspan=2) self.addButton(self.addMoreRow,4,text=localise("New folder"),command=(lambda *args:self.newFolder()),colspan=3) def del_addMore_button(self): - self.coords2buttons[(self.addMoreRow,0)].grid_forget() # old 'add more' button - if (self.addMoreRow,3) in self.coords2buttons: self.coords2buttons[(self.addMoreRow,1)].grid_forget() # old 're-record' button + if (self.addMoreRow,0) in self.coords2buttons: self.coords2buttons[(self.addMoreRow,0)].grid_forget() # old 'add more' button + if (self.addMoreRow,2) in self.coords2buttons: self.coords2buttons[(self.addMoreRow,2)].grid_forget() # old 're-record' button self.coords2buttons[(self.addMoreRow,4)].grid_forget() # old 'new folder' button def addMore(self): self.del_addMore_button() @@ -421,9 +423,7 @@ class RecorderControls: self.addMoreRow += 2 ; self.maxPrefix += 1 self.add_addMore_button() def doRecord(self,filename,row,languageNo,needToUpdatePlayButton=False): - if not tkSnack: - if winCEsound: return tkMessageBox.showinfo(app.master.title(),localise("Sorry not implemented on PocketPC, but you can use PocketPC's Notes app (record %s to 1st file, %s to 2nd file, %s to 3rd etc) and Gradint can import this.") % (secondLanguage,firstLanguage,secondLanguage)) - else: return tkMessageBox.showinfo(app.master.title(),localise("Sorry, cannot record on this computer because the tkSnack library (python-tksnack) is not installed.")) + if not tkSnack: return tkMessageBox.showinfo(app.master.title(),localise("Sorry, cannot record on this computer because the tkSnack library (python-tksnack) is not installed.")) theISM.startRecording(filename) if needToUpdatePlayButton: self.updateFile(filename,row,languageNo,2) self.coords2buttons[(row,3+3*languageNo)]["text"]=localise("Stop") @@ -482,7 +482,7 @@ class RecorderControls: while True: fname = "folder%d" % count try: os.mkdir(unicode2filename(self.currentDir+os.sep+fname)) - except OSError: + except: count += 1 ; continue break self.del_addMore_button() @@ -519,6 +519,15 @@ class RecorderControls: tkMessageBox.showinfo(app.master.title(),localise("Gradint has opened the current folder for you to work on. When you press OK, Gradint will re-scan the folder for new files.")) self.undraw() self.draw() + def pocketPCrecord(self,*args): + # (apparently get 11.025kHz 16-bit mono. Can set Notes to NOT switch to notes app when holding Recording button, in which case you then need the task manager to actually get into Notes.) + if tkMessageBox.askyesno(app.master.title(),localise("Press and hold the PocketPC's Record button to record; release to stop. Record %s to 1st Note, %s to 2nd, %s to 3rd etc. Import all Notes now?") % (secondLanguage,firstLanguage,secondLanguage)): + try: + if import_recordings(self.currentDir): + getLsDic(self.currentDir) # to rename them + self.undraw() ; self.draw() + else: app.todo.alert="No files found to import. Check this setting: import_recordings_from = "+repr(import_recordings_from) + except CannotOverwriteExisting: app.todo.alert="Filenames conflict with those already in this folder. Clear the folder first, or choose another, then press the button again (your recordings have been left in the Notes app)." def do_recordFromFile(self,*args): if not tkSnack or tkSnack=="MicOnly": return tkMessageBox.showinfo(app.master.title(),localise("Sorry, cannot record from file on this computer because the tkSnack library (python-tksnack) is not installed")) msg1 = localise("You can record from an existing recording (i.e. copy parts from it) if you first put the existing recording into the samples folder and then press its Play button.")+"\n\n" @@ -546,13 +555,15 @@ class RecorderControls: self.need_reRecord_enabler = 0 # no previously-existing words yet (when we get existing words we 'lock' them and have to unlock by pressing a global 'rerecord' button 1st, just in case) - r = Tkinter.Frame(self.frame) - r.grid(row=1,sticky="e",columnspan=2) - Tkinter.Label(r,text=localise("Action of spacebar during recording")).pack() - r=Tkinter.Frame(r) ; r.pack() - Tkinter.Radiobutton(r, text=localise("move down"), variable=app.scanrow, value="0", indicatoron=1).pack({"side":"left"}) - Tkinter.Radiobutton(r, text=localise("move along"), variable=app.scanrow, value="1", indicatoron=1).pack({"side":"left"}) - Tkinter.Radiobutton(r, text=localise("stop"), variable=app.scanrow, value="2", indicatoron=1).pack({"side":"left"}) + if winCEsound and not tkSnack: Tkinter.Button(self.frame,text=localise("PocketPC record..."),command=self.pocketPCrecord).grid(row=1,columnspan=2) + else: + r = Tkinter.Frame(self.frame) + r.grid(row=1,sticky="e",columnspan=2) + Tkinter.Label(r,text=localise("Action of spacebar during recording")).pack() + r=Tkinter.Frame(r) ; r.pack() + Tkinter.Radiobutton(r, text=localise("move down"), variable=app.scanrow, value="0", indicatoron=1).pack({"side":"left"}) + Tkinter.Radiobutton(r, text=localise("move along"), variable=app.scanrow, value="1", indicatoron=1).pack({"side":"left"}) + Tkinter.Radiobutton(r, text=localise("stop"), variable=app.scanrow, value="2", indicatoron=1).pack({"side":"left"}) self.grid,self.ourCanvas = setupScrollbar(self.frame,2) if hasattr(self,"oldCanvasBbox"): del self.oldCanvasBbox # unconditionally reconfigure scrollbar even if bounds are unchanged @@ -613,7 +624,7 @@ class RecorderControls: curRow += 2 if languageOverride in self.languagesToDraw and not flwr.endswith(dottxt): self.updateFile(fname,prefix2row[prefix],self.languagesToDraw.index(languageOverride),state=1) - elif flwr.endswith(dotwav) or flwr.endswith(dotmp3) and tkSnack and not tkSnack=="MicOnly": # no _ in it but we can still play it for splitting + elif (flwr.endswith(dotwav) or flwr.endswith(dotmp3)) and tkSnack and not tkSnack=="MicOnly": # no _ in it but we can still play it for splitting self.addButton(curRow,0,text=(localise("Record from %s") % (filename2unicode(fname),)),command=(lambda r=curRow,f=self.currentDir+os.sep+fname:self.doRecordFrom(f,r))) self.has_recordFrom_buttons = True curRow += 1 @@ -635,7 +646,9 @@ class RecorderControls: if hasattr(self,"CompressButton"): self.CompressButton.pack(side="left") Tkinter.Button(r,text=localise(cond(recorderMode,"Quit","Back to main menu")),command=self.finished).pack(side="left") - Tkinter.Label(self.frame,text="Choose a word and start recording. Then press space to advance (see control at top). You can also browse and manage previous recordings. Click on filenames at left to rename (multi-line pastes are allowed); click synthesized text to edit it.",wraplength=cond(olpc or winCEsound,self.ourCanvas.winfo_screenwidth(),min(int(self.ourCanvas.winfo_screenwidth()*.7),512))).grid(columnspan=2) # (512-pixel max. so the column isn't too wide to read on wide screens, TODO increase if the font is large) + if winCEsound and not tkSnack: msg="Click on filenames at left to rename; click synthesized text to edit it" + else: msg="Choose a word and start recording. Then press space to advance (see control at top). You can also browse and manage previous recordings. Click on filenames at left to rename (multi-line pastes are allowed); click synthesized text to edit it." + Tkinter.Label(self.frame,text=msg,wraplength=cond(olpc or winCEsound,self.ourCanvas.winfo_screenwidth(),min(int(self.ourCanvas.winfo_screenwidth()*.7),512))).grid(columnspan=2) # (512-pixel max. so the column isn't too wide to read on wide screens, TODO increase if the font is large) # (Don't worry about making the text files editable - editable filenames should be enough + easier to browse the result outside Gradint; can include both languages in the filename if you like - hope the users figure this out as we don't want to make the instructions too complex) def doRecWords(): # called from GUI thread diff --git a/gradint-build/src/sequence.py b/gradint-build/src/sequence.py index 76b92d7..ca53c49 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.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9945 (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 123b03d..c017933 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.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9945 (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 @@ -327,7 +327,7 @@ class ESpeakSynth(Synth): try: self.place = tryplace langList = os.listdir(self.place+os.sep+"voices") - except OSError: self.place = None + except: self.place = None if langList: break for l in langList[:]: if l in ["default","!v","mb"]: langList.remove(l) diff --git a/gradint-build/src/system.py b/gradint-build/src/system.py index c5b233c..4f47b73 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.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9945 (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 @@ -185,7 +185,7 @@ if not fileExists(configFiles[0]): if tbObj and hasattr(tbObj,"tb_frame") and hasattr(tbObj.tb_frame,"f_code") and hasattr(tbObj.tb_frame.f_code,"co_filename") and os.sep in tbObj.tb_frame.f_code.co_filename: os.chdir(oldDir) try: os.chdir(tbObj.tb_frame.f_code.co_filename[:tbObj.tb_frame.f_code.co_filename.rfind(os.sep)]) - except OSError: pass + except: pass # directory should be OK by now if sys.platform.find("ymbian")>-1: sys.path.insert(0,os.getcwd()+os.sep+"lib") diff --git a/gradint-build/src/top.py b/gradint-build/src/top.py index 4a92359..1b7b677 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.9944 (c) 2002-2009 Silas S. Brown. GPL v3+." +program_name = "gradint v0.9945 (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 784cf2c..a87cc3b 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.9944 (c) 2002-2009 Silas S. Brown. GPL v3+. +# gradint v0.9945 (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