diff --git a/gradint-build/Makefile b/gradint-build/Makefile index 616d49e5dced4636abd55bd5d8d93985a55d9c22..0bbe0239b502d1e784d68bbfcfb0650ec75537b3 100644 --- a/gradint-build/Makefile +++ b/gradint-build/Makefile @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v3.04 (c) 2002-20 Silas S. Brown. GPL v3+. +# gradint v3.05 (c) 2002-20 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/booktime.py b/gradint-build/src/booktime.py index a2457817cd79735c4af975926d62a040d59a61ab..f0907d77fb31e72134d8985a2e0833fee51f14f4 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 v3.04 (c) 2002-20 Silas S. Brown. GPL v3+. +# gradint v3.05 (c) 2002-20 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 87f8a0af8a686a03683f21225ce2efeb2747dc5e..1923d499a09a2f7af45984a78fe4473e7edd70c6 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 v3.04 (c) 2002-20 Silas S. Brown. GPL v3+. +# gradint v3.05 (c) 2002-20 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 db881acedb2b9c33094a1ba69451bb19909c7457..ce7a25a1879eff04c6aec29d28692fb30e85f206 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 v3.04 (c) 2002-20 Silas S. Brown. GPL v3+. +# gradint v3.05 (c) 2002-20 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 @@ -378,6 +378,8 @@ def setupScrollbar(parent,rowNo): onLeft = winCEsound or olpc s = Tkinter.Scrollbar(parent,takefocus=0) s.grid(row=rowNo,column=cond(onLeft,0,1),sticky="ns"+cond(onLeft,"w","e")) + try: parent.rowconfigure(rowNo,weight=1) + except: pass c=Tkinter.Canvas(parent,bd=0,width=200,height=100,yscrollcommand=s.set) c.grid(row=rowNo,column=cond(onLeft,1,0),sticky="nsw") s.config(command=c.yview) @@ -501,7 +503,7 @@ def startTk(): self.extra_button_callables = [] self.pack(fill=Tkinter.BOTH,expand=1) self.leftPanel = Tkinter.Frame(self) - self.leftPanel.pack(side="left",fill=Tkinter.X,expand=1) # "fill" needed so listbox can fill later + self.leftPanel.pack(side="left",fill=Tkinter.BOTH,expand=1) self.rightPanel = None # for now self.cancelling = 0 # guard against multiple presses of Cancel self.Label = Tkinter.Label(self.leftPanel,text="Please wait a moment") @@ -1230,7 +1232,7 @@ if useTK: if sys.version.startswith("2.3.5") and "DISPLAY" in os.environ: explorerCommand = None # 'open' doesn't seem to work when running from within Python in X11 on 10.4 else: explorerCommand="open" elif unix: - if "KDE_FULL_SESSION" is os.environ and got_program("kfmclient"): + if "KDE_FULL_SESSION" in os.environ and got_program("kfmclient"): # looks like we're in a KDE session and can use the kfmclient command textEditorCommand=explorerCommand="kfmclient exec" elif not olpc and got_program("gnome-open"): @@ -1242,7 +1244,7 @@ if useTK: # (TODO if both rox and gnome are available, can we tell which one the user prefers?) explorerCommand="rox" # anyway, see if we can find a nice editor - for editor in ["leafpad","gedit","nedit","kedit","xedit"]: + for editor in ["leafpad","featherpad","gedit","nedit","kedit","xedit"]: if got_program(editor): textEditorName=textEditorCommand=editor textEditorWaits = 1 diff --git a/gradint-build/src/lessonplan.py b/gradint-build/src/lessonplan.py index 188765d0f6b2f45ac0758f1b867c1c011670aabd..45703200b65d19e9f737fbc1b36efbe6b3edf030 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 v3.04 (c) 2002-20 Silas S. Brown. GPL v3+. +# gradint v3.05 (c) 2002-20 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 7205c3bc46b32338f3006b710b8e5a1ef4236a86..8d6d01fa2a3ac131159145313cade4ecd65f4fad 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 v3.04 (c) 2002-20 Silas S. Brown. GPL v3+. +# gradint v3.05 (c) 2002-20 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 b814afeb190f4d3a4700e4e115686be506aefce9..fa9fa207cc0d86f32ca1f111d04796a02500649e 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 v3.04 (c) 2002-20 Silas S. Brown. GPL v3+. +# gradint v3.05 (c) 2002-20 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 6c3e5659e15c93ca1ea157d48757a1cff15cfc07..2d5c4f8412fccd1b5e155144483bfa8440875e85 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 v3.04 (c) 2002-20 Silas S. Brown. GPL v3+. +# gradint v3.05 (c) 2002-20 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 @@ -156,14 +156,18 @@ if winsound or mingw32: # TODO now that we (usually) have tkSnack bundled with the Windows version, can we try that also (with file=) before sndrec32? if not wavPlayer and fileExists(os.environ.get("windir","C:\\Windows")+"\\system32\\sndrec32.exe"): wavPlayer = "start /min sndrec32 /play /close" # TODO could also use ShellExecute or some other utility to make it completely hidden elif unix and not macsound: - sox_type = "-t ossdsp -s "+sox_16bit # (we will check that sox can do ossdsp below) (always specify 16-bit because if we're adjusting the volume of 8-bit wav's then we could lose too many bits in the adjustment unless we first convert to 16-bit) + sox_type = "-t ossdsp "+sox_signed+" "+sox_16bit # (we will check that sox can do ossdsp below) (always specify 16-bit because if we're adjusting the volume of 8-bit wav's then we could lose too many bits in the adjustment unless we first convert to 16-bit) if not soundVolume==1: sox_effect=" vol "+str(soundVolume) if sox_effect and not gotSox: show_warning("Warning: trying to adjust soundVolume when 'sox' is not on the system might not work") # (need a warning here, because if using 'aplay' then sox o/p is 2>/dev/null (see below) so a missing sox won't be obvious) + if sox_formats.find("alsa")>=0 and isDirectory("/dev/snd"): + sox_type=sox_type.replace("ossdsp","alsa") + oss_sound_device = "hw:0,0" if not oss_sound_device: dsps_to_check = [] - if sox_formats.find("ossdsp")>=0: dsps_to_check += ["/dev/sound/dsp","/dev/dsp"] + if sox_formats.find("ossdsp")>=0: + dsps_to_check += ["/dev/sound/dsp","/dev/dsp"] if sox_formats.find("sunau")>=0: dsps_to_check += ["/dev/audio"] for dsp in dsps_to_check: if fileExists_stat(dsp): @@ -421,7 +425,10 @@ def lengthOfSound(file): def pcmlen(file): header = sndhdr.what(file) - if not header: raise IOError("Problem opening file '%s'" % (file,)) + if not header: + # some Python 3 installations seem less able to run sndhdr + if gotSox: return len(readB(os.popen("sox \""+file+"\" -t raw "+sox_8bit+" "+sox_signed+" -c 1 -r 8000 - ",popenRB)))/8000.0 + else: raise IOError("sndhdr can't analyse file '%s'" % (file,)) (wtype,wrate,wchannels,wframes,wbits) = header if android: if wrate==6144: # might be a .3gp from android_recordFile diff --git a/gradint-build/src/recording.py b/gradint-build/src/recording.py index b2f01e15d04e01cda02b220454d7662f5d455196..19f42f67de22150ebbb5659e4888ee0e196bf66a 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 v3.04 (c) 2002-20 Silas S. Brown. GPL v3+. +# gradint v3.05 (c) 2002-20 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 @@ -51,7 +51,7 @@ class PlayerInput(InputSource): # play to speakers while recording to various de global paranoid_file_management if use_unicode_filenames: fileToPlay=ensure_unicode(fileToPlay) else: - assert not type(fileToPlay)==type(u"") + assert type(fileToPlay)==type("") if not paranoid_file_management and filter(lambda x:ord(x)>=128,list(fileToPlay)): paranoid_file_management = True # hack to try to work around a Tkinter fault on Linux with utf-8 filenames if paranoid_file_management: # try to ensure it's ready for reading if filelen(fileToPlay)<1048576: @@ -86,7 +86,8 @@ class PlayerInput(InputSource): # play to speakers while recording to various de elapsedTime = self.elapsedTime() if elapsedTime>=self.length-self.startSample*1.0/self.sampleRate: self.close() else: - import thread + try: import thread + except ImportError: import _thread as thread def stopMe(self,thread_id,elapsedTime): time.sleep(max(0.5,self.length-self.startSample*1.0/self.sampleRate-elapsedTime)) self.autostop(thread_id) @@ -678,7 +679,8 @@ class RecorderControls(ButtonScrollingMixin): app.scanrow.set("0") self.reconfigure_scrollbar() if tkSnack: theISM.setInputSource(MicInput()) - self.frame=Tkinter.Frame(app.leftPanel) ; self.frame.pack() + self.frame=Tkinter.Frame(app.leftPanel) + self.frame.pack(fill=Tkinter.Y,expand=1) 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) diff --git a/gradint-build/src/sequence.py b/gradint-build/src/sequence.py index 3c9f991c718ae0467fe7f2cc5166fdf7d8ea1cd2..e58f5c1ba03329a7137e707556834953dbe6244d 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 v3.04 (c) 2002-20 Silas S. Brown. GPL v3+. +# gradint v3.05 (c) 2002-20 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 a12cc7f8430ef3b58d45d18feb1222c931f3a934..98b065448a0e666fb44fbcdd8e45d7c50515bcca 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 v3.04 (c) 2002-20 Silas S. Brown. GPL v3+. +# gradint v3.05 (c) 2002-20 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 8276d6d8fd88c00e1e81d04b2070193d28a742f7..f9ad43aebb68d75b453ecce968e909a19e570bb6 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 v3.04 (c) 2002-20 Silas S. Brown. GPL v3+. +# gradint v3.05 (c) 2002-20 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 44b70b092d162157a7253d413ab13d1bee213958..5eb5f8c8d43b7e76fc1dea04e7adabb51ab8a344 100644 --- a/gradint-build/src/top.py +++ b/gradint-build/src/top.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # (Python 2 or Python 3, but more fully tested on 2) -program_name = "gradint v3.04 (c) 2002-20 Silas S. Brown. GPL v3+." +program_name = "gradint v3.05 (c) 2002-20 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 44d82ffa06d806560ee6bc6b7c2d911131b25297..15390793dcdfdc24b4357ee36301c1b8d9dad487 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 v3.04 (c) 2002-20 Silas S. Brown. GPL v3+. +# gradint v3.05 (c) 2002-20 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 4872d0d78dfdf45d9f7ee04d678938c70475793a..b12eb56badc627ed916b35809db227f93bfb80a4 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 v3.04 (c) 2002-20 Silas S. Brown. GPL v3+. +# gradint v3.05 (c) 2002-20 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