From 0fd30873eb4250bc11d0f54ae4df689c3a5f74d1 Mon Sep 17 00:00:00 2001
From: "Silas S. Brown" <ssb22@cam.ac.uk>
Date: Sun, 10 Feb 2013 12:04:41 +0000
Subject: [PATCH] Gradint update

git-svn-id: http://svn.code.sf.net/p/e-guidedog/code/ssb22/gradint@1583 29193198-4895-4776-b068-10539e920549
---
 gradint-build/src/frontend.py  |  2 +-
 gradint-build/src/recording.py |  4 ++++
 gradint-build/src/system.py    | 11 ++++++-----
 gradint-build/thindown.py      |  1 +
 4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/gradint-build/src/frontend.py b/gradint-build/src/frontend.py
index aa25902..fc5f48e 100644
--- a/gradint-build/src/frontend.py
+++ b/gradint-build/src/frontend.py
@@ -372,7 +372,7 @@ def asUnicode(x): # for handling the return value of Tkinter entry.get()
         except: return x.decode("iso-8859-1") # TODO can we get what it actually IS? (on German WinXP, sys.getdefaultencoding==ascii and locale==C but Tkinter still returns Latin1)
 
 def setupScrollbar(parent,rowNo):
-    onLeft = winCEsound or olpc or (winsound and hasattr(app,"isBigPrint")) # window placement on Vista can sometimes end up too far to the right in big print recordings manager
+    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"))
     c=Tkinter.Canvas(parent,bd=0,width=200,height=100,yscrollcommand=s.set)
diff --git a/gradint-build/src/recording.py b/gradint-build/src/recording.py
index 8765527..7ec07aa 100644
--- a/gradint-build/src/recording.py
+++ b/gradint-build/src/recording.py
@@ -682,6 +682,10 @@ class RecorderControls(ButtonScrollingMixin):
         else: self.languagesToDraw = [secondLanguage,firstLanguage] # each lang cn take 3 columns, starting at column 1 (DO need to regenerate this every draw - languages may have changed!)
         if self.currentDir==samplesDirectory: app.master.title(localise("Recordings manager"))
         else: app.master.title(localise("Recordings manager: ")+filename2unicode((os.sep+self.currentDir)[(os.sep+self.currentDir).rindex(os.sep)+1:]))
+        if hasattr(app,"isBigPrint") and winsound:
+            # Vista sometimes has window placement problems
+            try: app.master.geometry("%dx%d+0+0" % (app.winfo_screenwidth(),app.winfo_screenheight()))
+            except: pass
         if not self.snack_initialized:
             if tkSnack and not tkSnack=="MicOnly":
                 tkSnack.initializeSnack(app)
diff --git a/gradint-build/src/system.py b/gradint-build/src/system.py
index 8bb4f62..fd7336a 100644
--- a/gradint-build/src/system.py
+++ b/gradint-build/src/system.py
@@ -439,11 +439,10 @@ if once_per_day&2 and not hasattr(sys,"_gradint_innerImport"): # run every day
       currentDay = time.localtime()[:3]
       if __name__=="__main__": # can do it by importing gradint
         sys._gradint_innerImport = 1
-        try:
-            try: reload(gradint)
-            except NameError: import gradint
-            gradint.orig_onceperday = once_per_day
-            gradint.main()
+        try: reload(gradint)
+        except NameError: import gradint
+        gradint.orig_onceperday = once_per_day
+        try: gradint.main()
         except SystemExit: pass
       elif winsound and fileExists("gradint-wrapper.exe"): # in this setup we can do it by recursively calling gradint-wrapper.exe
         s=" ".join(sys.argv[1:])
@@ -456,6 +455,8 @@ if once_per_day&2 and not hasattr(sys,"_gradint_innerImport"): # run every day
         show_warning("Not doing once_per_day&2 logic because not running as main program")
         # (DO need to be able to re-init the module - they might change advanced.txt etc)
         break
+      if len(sys.argv)>1: sys.argv.append(";")
+      sys.argv.append("disable_once_per_day=0") # don't let a disable_once_per_day=2 in argv result in repeated questioning
      time.sleep(3600) # delay 1 hour at a time (in case hibernated)
 if once_per_day&1 and fileExists(progressFile) and time.localtime(os.stat(progressFile).st_mtime)[:3]==time.localtime()[:3]: sys.exit() # already run today
 try: orig_onceperday
diff --git a/gradint-build/thindown.py b/gradint-build/thindown.py
index 51d743e..04d8503 100644
--- a/gradint-build/thindown.py
+++ b/gradint-build/thindown.py
@@ -62,6 +62,7 @@ desktop_only = [ # Don't want these on either WinCE or S60:
 'if not extsep==".":', # RISC OS
 "if macsound:","elif macsound:",
 'if hasattr(app,"isBigPrint") and macsound:',
+'if hasattr(app,"isBigPrint") and winsound:',
 "if unix:","elif unix:",
 "if paranoid_file_management:",
 "elif unix and not macsound:",
-- 
GitLab