From dcc72636e652f15443c298a9fcfa26bde6d58e3d Mon Sep 17 00:00:00 2001 From: "Silas S. Brown" <ssb22@cam.ac.uk> Date: Fri, 27 Jan 2012 17:38:36 +0000 Subject: [PATCH] Gradint update git-svn-id: http://svn.code.sf.net/p/e-guidedog/code/ssb22/gradint@1275 29193198-4895-4776-b068-10539e920549 --- gradint-build/src/frontend.py | 8 ++++++-- gradint-build/src/system.py | 6 ++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gradint-build/src/frontend.py b/gradint-build/src/frontend.py index 8be56ba..e9e62e5 100644 --- a/gradint-build/src/frontend.py +++ b/gradint-build/src/frontend.py @@ -1750,11 +1750,15 @@ def gui_outputTo_end(openDir=True): except: pass def main(): - global useTK,justSynthesize,waitBeforeStart,traceback,appTitle + global useTK,justSynthesize,waitBeforeStart,traceback,appTitle,app,warnings_toprint if useTK: if justSynthesize and not justSynthesize[-1]=='*': appTitle=cond('#' in justSynthesize,"Gradint","Reader") # not "language lesson" startTk() - else: rest_of_main() + else: + app = None # not False anymore + if not appuifw and not android: # REALLY output them to stderr + for w in warnings_toprint: show_warning(w) + warnings_toprint = [] ; rest_of_main() def rest_of_main(): global useTK,justSynthesize,waitBeforeStart,traceback,appTitle,saveProgress,RM_running exitStatus = 0 ; RM_running = 1 diff --git a/gradint-build/src/system.py b/gradint-build/src/system.py index b945c31..3c5efdf 100644 --- a/gradint-build/src/system.py +++ b/gradint-build/src/system.py @@ -75,12 +75,14 @@ if android: wsp = '\t\n\x0b\x0c\r ' # whitespace characters - ALWAYS use .strip(wsp) not .strip(), because someone added \xa0 (iso8859-1 no-break space) to string.whitespace on WinCE Python, and that can break processing of un-decoded UTF8 strings, e.g. a Chinese phrase ending "\xe5\x86\xa0"! (and assign to string.whitespace does not work around this.) # As .split() can't take alternative characters (and re-writing in Python is probably slow), just be careful with using it on un-decoded utf-8 stuff. (split(None,1) is ok if 1st word won't end in an affected character) -warnings_printed = [] ; app = None +warnings_printed = [] ; app = False # False is a hack for "maybe later" +warnings_toprint = [] def show_warning(w): - if not app and not appuifw and not android: + if not app and not app==False and not appuifw and not android: if winCEsound and len(w)>100: w=w[:100]+"..." # otherwise can hang winCEsound's console (e.g. a long "assuming that" message from justSynthesize) sys.stderr.write(w+"\n") warnings_printed.append(w+"\n") + if app==False: warnings_toprint.append(w) # may need to output them if app/appuifw/android turns out not to be created def show_info(i,always_stderr=False): # == sys.stderr.write(i) with no \n and no error if closed (+ redirect to app or appuifw if exists) -- GitLab