def runGradint(): gradint.gluedListTracker = [] gradint.waitBeforeStart = 0 gradint.main() gradint.gluedListTracker.sort(byFirstLen) duration = 0 for l, row in zip(gradint.gluedListTracker, xrange(len(gradint.gluedListTracker))): glueStart = 0 if hasattr(l[0], "timesDone"): timesDone = l[0].timesDone else: timesDone = 0 for i in xrange(timesDone): addRepeat(row) for i in l: i.event.draw(i.getEventStart(glueStart), row, False) glueStart = i.getAdjustedEnd(glueStart) duration = max(duration, glueStart) return duration
import Tkinter, gradint gradint.justSynthesize = "en " + Tkinter.Tk().selection_get( selection="CLIPBOARD").encode("utf-8").replace("#", " sharp ") gradint.GUI_translations["Cancel lesson"] = { "en": "Press here to cancel this reading" } gradint.main()
def runGradint(): gradint.gluedListTracker = [] gradint.waitBeforeStart = 0 gradint.main() gradint.gluedListTracker.sort(byFirstLen) duration = 0 for l, row in zip(gradint.gluedListTracker, xrange(len(gradint.gluedListTracker))): def check_for_pictures(): for gluedEvent in l: event = gluedEvent.event try: el = event.eventList except: el = [event] for j in el: try: el2 = j.eventList except: el2 = [j] for i in el2: if hasattr(i, "file") and "_" in i.file: for imgExt in ["gif", "png", "jpeg", "jpg"]: imageFilename = i.file[:i.file.rindex( "_" )] + os.extsep + imgExt # TODO: we're assuming no _en etc in the image filename (projected onto both L1 and L2) if os.path.exists(imageFilename): return EventTracker( row, os.path.abspath(imageFilename)) check_for_pictures() if hasattr(l[0], "timesDone"): timesDone = l[0].timesDone else: timesDone = 0 for i in xrange(timesDone): addRepeat(row) glueStart = 0 for i in l: i.event.draw(i.getEventStart(glueStart), row, False) glueStart = i.getAdjustedEnd(glueStart) duration = max(duration, glueStart) background_screen.sort() i = 0 while i < len(background_screen) - 1: if background_screen[i][-1] == background_screen[i + 1][ -1] and background_screen[i][1] + 5 >= background_screen[i + 1][0]: # turning off for 5 seconds or less, then turning back on again with the SAME image: might as well merge background_screen[i] = (background_screen[i][0], background_screen[i + 1][1], background_screen[i][2]) del background_screen[i + 1] else: i += 1 for i in xrange(len(background_screen)): startTime, endTime, img = background_screen[i] bkgScrFade.fixAt(startTime, 1) fadeOutTime = endTime if i < len(background_screen) - 1: fadeOutTime = max( fadeOutTime, min(background_screen[i + 1][0] - 1, fadeOutTime + 5)) # and don't move the screen while fading out: for ii in xrange(len(bkgScrX.fixed)): if bkgScrX.fixed[ii][0] == endTime: bkgScrX.fixed[ii] = ((fadeOutTime, bkgScrX.fixed[ii][1])) break bkgScrFade.fixAt(fadeOutTime, 1) if endTime >= startTime + 1: bkgScrFade.fixAt(startTime + 0.5, 0.3) bkgScrFade.fixAt(endTime - 0.5, 0.3) else: bkgScrFade.fixAt( (startTime + endTime) / 2.0, 0.5 ) # TODO: do we really want to bother with fade, or even any background image at all, if it's less than 1 second ?? return duration
except: if not destDir in fail: fail[destDir]=1 raw_input("Problem writing to "+destDir) raw_input("from "+srcDir) raw_input("Please do it manually in Explorer") raw_input("or remove Application Lock if on") try: os.rmdir(srcDir) except: pass # follow-through # http://www.mobilejaw.com/articles/2009/09/removing-application-lock-on-windows-mobile-standard-devices/ # -> http://www.mobilejaw.com/content/2009/09/MobileJaw-ClearSecurity-MobiControl.cab if os.path.isdir(os.getcwd()+"\\espeak-data"): print "Installing eSpeak..." moveFiles(os.getcwd()+"\\espeak-data","\\espeak-data") if "Storage Card" in os.getcwd(): moveFiles(os.getcwd()+"\\bin","\\Storage Card\\bin") else: moveFiles(os.getcwd()+"\\bin","\\bin") if os.path.isdir(os.getcwd()+"\\Program Files"): print "Installing TkInter..." if "Storage Card" in os.getcwd(): if os.path.isdir("\\Storage Card\\Windows"): moveFiles("\\Storage Card\\Windows","\\Windows") moveFiles(os.getcwd()+"\\Program Files","\\Storage Card\\Program Files") else: moveFiles(os.getcwd()+"\\Program Files","\\Program Files") raw_input("Setup successful - now run Gradint") raise SystemExit # can now run del moveFiles,l import gradint ; gradint.main()