From e047e6790e22b8f7cddbe2308f4834adca5038eb Mon Sep 17 00:00:00 2001
From: "Silas S. Brown" <ssb22@cam.ac.uk>
Date: Sun, 10 Feb 2013 08:32:51 +0000
Subject: [PATCH] Gradint update

git-svn-id: http://svn.code.sf.net/p/e-guidedog/code/ssb22/gradint@1579 29193198-4895-4776-b068-10539e920549
---
 gradint-build/Makefile          |  2 +-
 gradint-build/src/booktime.py   |  2 +-
 gradint-build/src/filescan.py   |  2 +-
 gradint-build/src/frontend.py   | 24 +++++++++++++++---------
 gradint-build/src/lessonplan.py |  2 +-
 gradint-build/src/loop.py       |  2 +-
 gradint-build/src/makeevent.py  |  2 +-
 gradint-build/src/play.py       |  2 +-
 gradint-build/src/recording.py  | 11 ++++++++++-
 gradint-build/src/sequence.py   |  2 +-
 gradint-build/src/synth.py      |  2 +-
 gradint-build/src/system.py     |  2 +-
 gradint-build/src/top.py        |  2 +-
 gradint-build/src/users.py      |  2 +-
 gradint-build/thindown.py       |  3 ++-
 15 files changed, 39 insertions(+), 23 deletions(-)

diff --git a/gradint-build/Makefile b/gradint-build/Makefile
index b2dba22..cb64cbd 100644
--- a/gradint-build/Makefile
+++ b/gradint-build/Makefile
@@ -1,5 +1,5 @@
 # This file is part of the source code of
-# gradint v0.9984 (c) 2002-2012 Silas S. Brown. GPL v3+.
+# gradint v0.9985 (c) 2002-2013 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 9b00805..2cfce1f 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.9984 (c) 2002-2012 Silas S. Brown. GPL v3+.
+# gradint v0.9985 (c) 2002-2013 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 30b16ed..949d30a 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.9984 (c) 2002-2012 Silas S. Brown. GPL v3+.
+# gradint v0.9985 (c) 2002-2013 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 354076a..6b49aca 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.9984 (c) 2002-2012 Silas S. Brown. GPL v3+.
+# gradint v0.9985 (c) 2002-2013 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
@@ -379,8 +379,10 @@ def setupScrollbar(parent,rowNo):
     s.config(command=c.yview)
     scrolledFrame=Tkinter.Frame(c) ; c.create_window(0,0,window=scrolledFrame,anchor="nw")
     # Mousewheel binding.  TODO the following bind_all assumes only one scrolledFrame on screen at once (redirect all mousewheel events to the frame; necessary as otherwise they'll go to buttons etc)
-    scrolledFrame.bind_all('<Button-4>',lambda *args:c.yview("scroll","-1","units"))
-    scrolledFrame.bind_all('<Button-5>',lambda *args:c.yview("scroll","1","units"))
+    app.ScrollUpHandler = lambda *args:c.yview("scroll","-1","units")
+    app.ScrollDownHandler = lambda *args:c.yview("scroll","1","units")
+    scrolledFrame.bind_all('<Button-4>',app.ScrollUpHandler)
+    scrolledFrame.bind_all('<Button-5>',app.ScrollDownHandler)
     # DON'T bind <MouseWheel> on Windows - our version of Tk will segfault when it occurs. See http://mail.python.org/pipermail/python-bugs-list/2005-May/028768.html but we can't patch our library.zip's Tkinter anymore (TODO can we use newer Tk DLLs and ensure setup.bat updates them?)
     return scrolledFrame, c
 
@@ -472,6 +474,7 @@ def startTk():
             Tkinter.Frame.__init__(self, master)
             class EmptyClass: pass
             self.todo = EmptyClass() ; self.toRestore = []
+            self.ScrollUpHandler = self.ScrollDownHandler = lambda *args:True
             global app ; app = self
             make_extra_buttons_waiting_list()
             if olpc: self.master.option_add('*font',cond(extra_buttons_waiting_list,'Helvetica 9','Helvetica 14'))
@@ -516,10 +519,9 @@ def startTk():
                 largeNominalSize = int(nominalSize*self.Label.winfo_screenheight()/approx_lines_per_screen_when_large/pixelSize)
                 if largeNominalSize >= nominalSize+3:
                     self.bigPrintFont = f % largeNominalSize
+                    self.bigPrintMult = largeNominalSize*1.0/nominalSize
                     if GUI_always_big_print:
-                        self.master.option_add('*font',self.bigPrintFont)
-                        self.Label["font"]=self.bigPrintFont
-                        del self.bigPrintFont ; self.isBigPrint=1
+                        self.bigPrint0()
                 else: self.after(100,self.check_window_position) # (needs to happen when window is already drawn if you want it to preserve the X co-ordinate)
             except: pass # wrong font format or something - can't do it
             if winCEsound and ask_teacherMode: self.Label["font"]="Helvetica 16" # might make it slightly easier
@@ -820,12 +822,16 @@ def startTk():
             self.Label.pack() ; self.CancelRow.pack()
             self.Label["text"] = "Working..." # (to be replaced by time indication on real-time, not on output-to-file)
             self.Cancel["text"] = localise("Quit")
-        def bigPrint(self,*args):
-            self.thin_down_for_lesson()
+        def bigPrint0(self):
             self.master.option_add('*font',self.bigPrintFont)
-            self.Version["font"]=self.Label["font"]=self.bigPrintFont
+            self.master.option_add('*Scrollbar*width',int(16*self.bigPrintMult)) # (works on some systems; usually ineffective on Mac)
+            self.Label["font"]=self.bigPrintFont
             del self.bigPrintFont # (TODO do we want an option to undo it?  or would that take too much of the big print real-estate.)
             self.isBigPrint=1
+        def bigPrint(self,*args):
+            self.thin_down_for_lesson()
+            self.Version["font"]=self.bigPrintFont
+            self.bigPrint0()
             if self.rightPanel: # oops, need to re-construct it
                 global extra_buttons_waiting_list
                 extra_buttons_waiting_list = []
diff --git a/gradint-build/src/lessonplan.py b/gradint-build/src/lessonplan.py
index cef3334..0ea8d2d 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.9984 (c) 2002-2012 Silas S. Brown. GPL v3+.
+# gradint v0.9985 (c) 2002-2013 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 476383d..34ade33 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.9984 (c) 2002-2012 Silas S. Brown. GPL v3+.
+# gradint v0.9985 (c) 2002-2013 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 1d07565..491ac92 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.9984 (c) 2002-2012 Silas S. Brown. GPL v3+.
+# gradint v0.9985 (c) 2002-2013 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 bbba6dc..14b60d3 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.9984 (c) 2002-2012 Silas S. Brown. GPL v3+.
+# gradint v0.9985 (c) 2002-2013 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/recording.py b/gradint-build/src/recording.py
index 6fe6476..18df1ec 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.9984 (c) 2002-2012 Silas S. Brown. GPL v3+.
+# gradint v0.9985 (c) 2002-2013 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
@@ -701,6 +701,15 @@ class RecorderControls(ButtonScrollingMixin):
         else:
           r = Tkinter.Frame(self.frame)
           r.grid(row=1,sticky="e",columnspan=2)
+          if app.isBigPrint and macsound:
+              # Try to make up for the fact that we can't always increase the width of the scrollbar (and the keyboard often loses focus).  Add extra up/down buttons. (TODO: does any other platform need this?)
+              r2 = Tkinter.Frame(r)
+              r2.pack({"side":"right"})
+              addButton(r2,unichr(8593),lambda *args:app.ScrollUpHandler(),"left")
+              addButton(r2,unichr(8595),lambda *args:app.ScrollDownHandler(),"left")
+              Tkinter.Label(r,text="    ").pack({"side":"right"}) # TODO: more flexible spacer
+              r = Tkinter.Frame(r)
+              r.pack({"side":"right"})
           Tkinter.Label(r,text=localise("Action of spacebar during recording")).pack()
           r=Tkinter.Frame(r) ; r.pack()
           for button in [
diff --git a/gradint-build/src/sequence.py b/gradint-build/src/sequence.py
index 00a1e55..96f5641 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.9984 (c) 2002-2012 Silas S. Brown. GPL v3+.
+# gradint v0.9985 (c) 2002-2013 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 caebbaa..287e8f8 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.9984 (c) 2002-2012 Silas S. Brown. GPL v3+.
+# gradint v0.9985 (c) 2002-2013 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 fe24dcc..2f98281 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.9984 (c) 2002-2012 Silas S. Brown. GPL v3+.
+# gradint v0.9985 (c) 2002-2013 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 a7093d0..b9041e4 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.9984 (c) 2002-2012 Silas S. Brown. GPL v3+."
+program_name = "gradint v0.9985 (c) 2002-2013 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 c9e5535..0f39ef0 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 v0.9984 (c) 2002-2012 Silas S. Brown. GPL v3+.
+# gradint v0.9985 (c) 2002-2013 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 deaad74..7f73f06 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.9984 (c) 2002-2012 Silas S. Brown. GPL v3+.
+# gradint v0.9985 (c) 2002-2013 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
@@ -61,6 +61,7 @@ not_S60 = [ # but may still need on winCE
 desktop_only = [ # Don't want these on either WinCE or S60:
 'if not extsep==".":', # RISC OS
 "if macsound:","elif macsound:",
+"if app.isBigPrint and macsound:",
 "if unix:","elif unix:",
 "if paranoid_file_management:",
 "elif unix and not macsound:",
-- 
GitLab