gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz ./Gzz.py ./Makefile ./bindings.py gzz/clien...


From: Benja Fallenstein
Subject: [Gzz-commits] gzz ./Gzz.py ./Makefile ./bindings.py gzz/clien...
Date: Sun, 27 Oct 2002 19:17:55 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Benja Fallenstein <address@hidden>      02/10/27 19:17:54

Modified files:
        .              : Gzz.py Makefile bindings.py 
        gzz/client     : Fallback.java FallbackBinder.java actions.py 
                         pythonbinder.py 
        gzz/errors     : NotAffineVobCoorderException.java 
        gzz/modules/pp : PPDims.java 
        gzz/util       : SaveImage.java 
        gzz/view       : DefaultBinder.java LastOpDecorator.java 
                         MarkDecorator.java 
        gzz/vob        : Box.java 
        test/gzz/media : pagespan.py 
Added files:
        gzz/client     : __init__.py 

Log message:
        More work towards Python bindings (now -p)

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/Gzz.py.diff?tr1=1.41&tr2=1.42&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/Makefile.diff?tr1=1.198&tr2=1.199&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/bindings.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/client/__init__.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/client/Fallback.java.diff?tr1=1.47&tr2=1.48&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/client/FallbackBinder.java.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/client/actions.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/client/pythonbinder.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/errors/NotAffineVobCoorderException.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/PPDims.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/util/SaveImage.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/DefaultBinder.java.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/LastOpDecorator.java.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/MarkDecorator.java.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/Box.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/media/pagespan.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: gzz/Gzz.py
diff -u gzz/Gzz.py:1.41 gzz/Gzz.py:1.42
--- gzz/Gzz.py:1.41     Sat Oct  5 09:59:47 2002
+++ gzz/Gzz.py  Sun Oct 27 19:17:54 2002
@@ -28,6 +28,7 @@
     """The main Gzz client class."""
 
     transient = 0
+    bindings_type = 'java'
 
     def run(self):
         self.style = self.graphicsAPI.getTextStyle("SansSerif", 
java.awt.Font.PLAIN, 10);
@@ -45,7 +46,7 @@
                 self.cellContentView, gzz.view.pagespanview.ContentView())
             
         gzz.client.Fallback(self.space.getHomeCell(), self.linkSpace, 
-                            self.dimensions, self.views, 
+                            self.binder, self.dimensions, self.views, 
                             self.viewSpecificBinders, self.cellView, 
                             self.cellContentView, self.filers)
         gzz.client.AbstractUpdateManager.chg()
@@ -57,6 +58,8 @@
                 gzz.control.commander.AwtCommander(globals())
             if o in ("-t", "--transient"):
                 self.transient = 1
+            if o in ("-p", "--python-bindings"):
+                self.bindings_type = 'python'
 
         if (not self.transient) and (not self.args):
             print ""
@@ -66,6 +69,14 @@
 
 
     def set_defaults(self):
+        if self.bindings_type == 'java':
+            self.binder = gzz.view.DefaultBinder()
+        else:
+            print "Using Python bindings"
+            import bindings
+            self.binder = \
+                gzz.client.pythonbinder.PythonBinder(bindings.normal_mode)
+        
         self.spanType = java.lang.System.getProperty("gzz.spanType")
         self.spaceType = java.lang.System.getProperty("gzz.spaceType")
         self.obsTrigger = gzz.impl.SimpleObsTrigger()
@@ -148,7 +159,7 @@
         self.set_defaults()
 
 def run():
-    opts, args = getopt.getopt(sys.argv[1:], "Ct"+gzz.util.dbg.short,
+    opts, args = getopt.getopt(sys.argv[1:], "Ctp"+gzz.util.dbg.short,
             ["--commander"]+gzz.util.dbg.long)
 
     for o,a in opts:
Index: gzz/Makefile
diff -u gzz/Makefile:1.198 gzz/Makefile:1.199
--- gzz/Makefile:1.198  Fri Oct 25 04:20:22 2002
+++ gzz/Makefile        Sun Oct 27 19:17:54 2002
@@ -487,7 +487,7 @@
        python2.2 $(GZZ_DEPENDS)/ly.py lava/gzz/impl/
        $(JAVAC) $(DEBUG) -d $(CLASSDIR) $(LAVASRC)
 test-lava:
-       $(JYTHON) lava/test/lavatest.py
+       $(GLLIB) $(JYTHON) test/testutil.py $(DBG) lava/test/
 test-lava-junit:
        $(JAVA) -Dzdir=$(Z_DIR) junit.textui.TestRunner gzz.TestLava
 
Index: gzz/bindings.py
diff -u gzz/bindings.py:1.1 gzz/bindings.py:1.2
--- gzz/bindings.py:1.1 Sun Oct 27 18:55:55 2002
+++ gzz/bindings.py     Sun Oct 27 19:17:54 2002
@@ -21,7 +21,7 @@
     # Mode switching bindings
     
     'Tab':       EditMode(1),
-    'Shift-Tab': EditMode(0)
+    'Shift-Tab': EditMode(0),
     'Ctrl-F':    SearchMode(),
 
 
@@ -29,7 +29,7 @@
     # Bindings to invoke external editor
     
     'Ctrl-E':       CallExternalEditor(1),
-    'Ctrl-Shift-E': CallExternalEditor(0)
+    'Ctrl-Shift-E': CallExternalEditor(0),
 
 
 
Index: gzz/gzz/client/Fallback.java
diff -u gzz/gzz/client/Fallback.java:1.47 gzz/gzz/client/Fallback.java:1.48
--- gzz/gzz/client/Fallback.java:1.47   Fri Oct  4 02:54:11 2002
+++ gzz/gzz/client/Fallback.java        Sun Oct 27 19:17:54 2002
@@ -73,7 +73,7 @@
  * It implements a subset of the 0.6.0 bindings.
  */
 public class Fallback {
-public static final String rcsid = "$Id: Fallback.java,v 1.47 2002/10/04 
06:54:11 tjl Exp $";
+public static final String rcsid = "$Id: Fallback.java,v 1.48 2002/10/28 
00:17:54 benja Exp $";
     public static boolean dbg = false;
     private static void pa(String s) { System.err.println(s); }
 
@@ -114,7 +114,7 @@
 
     public Space space;
     public View[] viewList;
-    public DefaultBinder binder = new DefaultBinder(this);
+    public FallbackBinder binder;
     
     /** FallbackBinder objects only used when a given view is active.
      *  Maps views to binders.
@@ -193,7 +193,7 @@
                 return -1;
         }
        public boolean isMarked(Cell c) {
-           return binder.markedCells.contains(c);
+           return DefaultBinder.markedCells.contains(c);
        }
         public CellView getCellView() {
             return cellView;
@@ -344,9 +344,11 @@
        return w;
     }
 
-    public Fallback(Cell start, Space linkSpace, FallbackDim[] dimList,
+    public Fallback(Cell start, Space linkSpace, FallbackBinder binder,
+                   FallbackDim[] dimList,
                     View[] viewList, Map viewSpecificBinders, CellView 
cellView,
                     CellContentView cellContentView, Filer.Group filers) {
+       this.binder = binder;
        this.dimList = dimList;
         this.viewList = viewList;
         this.viewSpecificBinders = viewSpecificBinders;
@@ -355,6 +357,8 @@
         this.linkSpace = linkSpace;
         this.cellView = cellView;
         this.cellContentView = cellContentView;
+       
+       binder.setFallback(this);
         
         xuIndexer = IndexManager.getXuIndexer(linkSpace);
 
Index: gzz/gzz/client/FallbackBinder.java
diff -u gzz/gzz/client/FallbackBinder.java:1.14 
gzz/gzz/client/FallbackBinder.java:1.15
--- gzz/gzz/client/FallbackBinder.java:1.14     Wed Oct  2 14:42:51 2002
+++ gzz/gzz/client/FallbackBinder.java  Sun Oct 27 19:17:54 2002
@@ -27,6 +27,8 @@
 /** A set of keybindings for the fallback client.
  */
 public interface FallbackBinder {
+    void setFallback(Fallback fallback);
+
     void keystroke(String k, Fallback.Win win);
     void mouse(MouseEvent e, Fallback.Win win);
     void windowClosed(Fallback.Win win);
Index: gzz/gzz/client/actions.py
diff -u gzz/gzz/client/actions.py:1.1 gzz/gzz/client/actions.py:1.2
--- gzz/gzz/client/actions.py:1.1       Sun Oct 27 18:55:55 2002
+++ gzz/gzz/client/actions.py   Sun Oct 27 19:17:54 2002
@@ -74,7 +74,7 @@
         print "Saved."
         return 1
 
-   except java.io.IOException, e:
+    except java.io.IOException, e:
         print "Exception while saving:", e
         e.printStackTrace()
         return 0
@@ -106,7 +106,7 @@
         x.client.windows[self.side].updateDims()
 
 class ResetDims(SidedOp):
-    def call(self, x)
+    def call(self, x):
         ind = x.client.windows[self.side]
         
         for i in range(len(ind)):
Index: gzz/gzz/client/pythonbinder.py
diff -u gzz/gzz/client/pythonbinder.py:1.1 gzz/gzz/client/pythonbinder.py:1.2
--- gzz/gzz/client/pythonbinder.py:1.1  Sun Oct 27 18:55:55 2002
+++ gzz/gzz/client/pythonbinder.py      Sun Oct 27 19:17:54 2002
@@ -2,8 +2,10 @@
 import java, gzz
 
 class PythonBinder(gzz.client.FallbackBinder):    
-    def __init__(self, bindings, client):
+    def __init__(self, bindings):
         self.bindings = bindings
+
+    def setFallback(client):
         self.client = client
 
     pendingOp = None
Index: gzz/gzz/errors/NotAffineVobCoorderException.java
diff -u gzz/gzz/errors/NotAffineVobCoorderException.java:1.1 
gzz/gzz/errors/NotAffineVobCoorderException.java:1.2
--- gzz/gzz/errors/NotAffineVobCoorderException.java:1.1        Tue Oct 15 
09:30:01 2002
+++ gzz/gzz/errors/NotAffineVobCoorderException.java    Sun Oct 27 19:17:54 2002
@@ -1,4 +1,25 @@
-// (c) Tuomas J. Lukka
+/*
+NotAffineVobCoorderException.java
+ *    
+ *    Copyright (c) 2002, Tuomas J. Lukka
+ *    
+ *    You may use and distribute under the terms of either the GNU Lesser
+ *    General Public License, either version 2 of the license or,
+ *    at your choice, any later version. Alternatively, you may use and
+ *    distribute under the terms of the XPL.
+ *    
+ *    See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of
+ *    the licenses.
+ *    
+ *    This software is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the README
+ *    file for more details.
+ *    
+ */
+/*
+ * Written by Tuomas J. Lukka
+ */
 
 package gzz.errors;
 
Index: gzz/gzz/modules/pp/PPDims.java
diff -u gzz/gzz/modules/pp/PPDims.java:1.1 gzz/gzz/modules/pp/PPDims.java:1.2
--- gzz/gzz/modules/pp/PPDims.java:1.1  Sun Oct 20 07:45:58 2002
+++ gzz/gzz/modules/pp/PPDims.java      Sun Oct 27 19:17:54 2002
@@ -1,4 +1,25 @@
-// (c) Tuomas J. Lukka
+/*
+PPDims.java
+ *    
+ *    Copyright (c) 2002, Tuomas J. Lukka
+ *    
+ *    You may use and distribute under the terms of either the GNU Lesser
+ *    General Public License, either version 2 of the license or,
+ *    at your choice, any later version. Alternatively, you may use and
+ *    distribute under the terms of the XPL.
+ *    
+ *    See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of
+ *    the licenses.
+ *    
+ *    This software is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the README
+ *    file for more details.
+ *    
+ */
+/*
+ * Written by Tuomas J. Lukka
+ */
 
 package gzz.modules.pp;
 import gzz.*;
Index: gzz/gzz/util/SaveImage.java
diff -u gzz/gzz/util/SaveImage.java:1.1 gzz/gzz/util/SaveImage.java:1.2
--- gzz/gzz/util/SaveImage.java:1.1     Wed Oct 16 03:50:48 2002
+++ gzz/gzz/util/SaveImage.java Sun Oct 27 19:17:54 2002
@@ -1,4 +1,25 @@
-// (c) Tuomas J. Lukka
+/*
+SaveImage.java
+ *    
+ *    Copyright (c) 2002, Tuomas J. Lukka
+ *    
+ *    You may use and distribute under the terms of either the GNU Lesser
+ *    General Public License, either version 2 of the license or,
+ *    at your choice, any later version. Alternatively, you may use and
+ *    distribute under the terms of the XPL.
+ *    
+ *    See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of
+ *    the licenses.
+ *    
+ *    This software is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the README
+ *    file for more details.
+ *    
+ */
+/*
+ * Written by Tuomas J. Lukka
+ */
 
 package gzz.util;
 import java.io.*;
Index: gzz/gzz/view/DefaultBinder.java
diff -u gzz/gzz/view/DefaultBinder.java:1.9 gzz/gzz/view/DefaultBinder.java:1.10
--- gzz/gzz/view/DefaultBinder.java:1.9 Sun Oct 27 18:55:55 2002
+++ gzz/gzz/view/DefaultBinder.java     Sun Oct 27 19:17:54 2002
@@ -42,7 +42,7 @@
 /** Keybindings for the Fallback client.
  */
 public class DefaultBinder implements FallbackBinder {
-public static final String rcsid = "$Id: DefaultBinder.java,v 1.9 2002/10/27 
23:55:55 benja Exp $";
+public static final String rcsid = "$Id: DefaultBinder.java,v 1.10 2002/10/28 
00:17:54 benja Exp $";
     public static boolean dbg = false;
     private static void pa(String s) { System.err.println(s); }
 
@@ -96,7 +96,7 @@
      */
     public ClientException lastClientException;
 
-    public DefaultBinder(Fallback fallback) {
+    public void setFallback(Fallback fallback) {
         this.fallback = fallback;
     }
 
Index: gzz/gzz/view/LastOpDecorator.java
diff -u gzz/gzz/view/LastOpDecorator.java:1.19 
gzz/gzz/view/LastOpDecorator.java:1.20
--- gzz/gzz/view/LastOpDecorator.java:1.19      Tue Oct 15 09:29:18 2002
+++ gzz/gzz/view/LastOpDecorator.java   Sun Oct 27 19:17:54 2002
@@ -32,7 +32,7 @@
  *  directional op entered.
  */
 public class LastOpDecorator implements FallbackSceneDecorator {
-String rcsid = "$Id: LastOpDecorator.java,v 1.19 2002/10/15 13:29:18 tjl Exp 
$";
+String rcsid = "$Id: LastOpDecorator.java,v 1.20 2002/10/28 00:17:54 benja Exp 
$";
     public static boolean dbg = false;
     private static void pa(String s) { System.err.println(s); }
 
@@ -45,12 +45,15 @@
     int padding = 15;
 
     public void render(VobScene sc, int into, Fallback fallback, Fallback.Win 
win) {
+       if(!(fallback.binder instanceof DefaultBinder)) return;
+       DefaultBinder binder = (DefaultBinder)fallback.binder;
+
         Fallback.Win other;
        if(win == fallback.windows[fallback.LEFT])
            other = fallback.windows[fallback.RIGHT];
        else if(win == fallback.windows[fallback.RIGHT])
            other = fallback.windows[fallback.LEFT];
-       else if(fallback.binder.directOp == DefaultBinder.REASSIGN_ARROWSET)
+       else if(binder.directOp == DefaultBinder.REASSIGN_ARROWSET)
            other = null; // REASSIGN_ARROWSET is shown in all windows
        else
            return; // command doesn't apply to this window...
@@ -61,20 +64,20 @@
        HChain ch = new LinebreakableChain();
        cvf.setCenter(win.cursor);
 
-        if(dbg) pa("fallback.binder.directOp: "+fallback.binder.directOp);
+        if(dbg) pa("fallback.binder.directOp: "+binder.directOp);
 
-        if(fallback.binder.lastClientException != null) {
-            fallback.binder.lastClientException.renderApology(ch, style);
+        if(binder.lastClientException != null) {
+            binder.lastClientException.renderApology(ch, style);
         } else if(fallback.mode == fallback.NORMAL) {
-            switch(fallback.binder.directOp) {
+            switch(binder.directOp) {
                 case DefaultBinder.NONE: return;
                 case DefaultBinder.CONNECT:
                    ch.addBox(text("Connect [where?] to "));
-                   if(fallback.binder.marks.isEmpty())
+                   if(binder.marks.isEmpty())
                        ch.addBox(cell(other.cursor, win));
-                   else if(fallback.binder.marks.size() == 1) {
+                   else if(binder.marks.size() == 1) {
                        ch.addBox(text("the marked cell ("));
-                       Mark m = (Mark)fallback.binder.marks.get(0);
+                       Mark m = (Mark)binder.marks.get(0);
                        ch.addBox(cell(m.cell, win));
                        ch.addBox(text(")"));
                    } else
@@ -101,12 +104,12 @@
                    break;
                 default:
                     throw new IllegalArgumentException("DirOp not known: " +
-                                                       
fallback.binder.directOp);
+                                                       binder.directOp);
             }
         } else if(fallback.mode == fallback.TEXT_1)
             ch.addBox(text("Text edit mode (press Tab to finish editing)."));
         else if(fallback.mode == fallback.SEARCH)
-            ch.addBox(text("Search for: " + fallback.binder.buffer));
+            ch.addBox(text("Search for: " + binder.buffer));
         else return;
         
         // XXX linebreaking! (only breaks *between* boxes...)
Index: gzz/gzz/view/MarkDecorator.java
diff -u gzz/gzz/view/MarkDecorator.java:1.8 gzz/gzz/view/MarkDecorator.java:1.9
--- gzz/gzz/view/MarkDecorator.java:1.8 Tue Oct 15 09:29:18 2002
+++ gzz/gzz/view/MarkDecorator.java     Sun Oct 27 19:17:54 2002
@@ -42,7 +42,7 @@
         java.awt.Dimension boxsize = new java.awt.Dimension();
        cv.getDefaultSize(1, boxsize);
 
-       int n = fallback.binder.marks.size();
+       int n = DefaultBinder.marks.size();
        if(n == 0) return;
 
        float w = boxsize.width, h = n * boxsize.height;
@@ -57,7 +57,7 @@
        Box b = new Box();
 
         for(int i=0; i<n; i++) {
-           Mark m = (Mark)fallback.binder.marks.get(i);
+           Mark m = (Mark)DefaultBinder.marks.get(i);
            if(m.spans != null) return; // for now-- should show span(s)
            Cell c = m.cell;
 
Index: gzz/gzz/vob/Box.java
diff -u gzz/gzz/vob/Box.java:1.2 gzz/gzz/vob/Box.java:1.3
--- gzz/gzz/vob/Box.java:1.2    Tue Oct 15 09:29:19 2002
+++ gzz/gzz/vob/Box.java        Sun Oct 27 19:17:54 2002
@@ -1,4 +1,25 @@
-// (c) Tuomas J. Lukka
+/*
+Box.java
+ *    
+ *    Copyright (c) 2002, Tuomas J. Lukka
+ *    
+ *    You may use and distribute under the terms of either the GNU Lesser
+ *    General Public License, either version 2 of the license or,
+ *    at your choice, any later version. Alternatively, you may use and
+ *    distribute under the terms of the XPL.
+ *    
+ *    See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of
+ *    the licenses.
+ *    
+ *    This software is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the README
+ *    file for more details.
+ *    
+ */
+/*
+ * Written by Tuomas J. Lukka
+ */
 
 package gzz.vob;
 
Index: gzz/test/gzz/media/pagespan.py
diff -u gzz/test/gzz/media/pagespan.py:1.1 gzz/test/gzz/media/pagespan.py:1.2
--- gzz/test/gzz/media/pagespan.py:1.1  Fri Oct 11 09:35:02 2002
+++ gzz/test/gzz/media/pagespan.py      Sun Oct 27 19:17:54 2002
@@ -1,4 +1,20 @@
-#(c): Tuomas Lukka
+# 
+# Copyright (c) 2002, Tuomas Lukka
+# 
+# You may use and distribute under the terms of either the GNU Lesser
+# General Public License, either version 2 of the license or,
+# at your choice, any later version. Alternatively, you may use and
+# distribute under the terms of the XPL.
+# 
+# See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of
+# the licenses.
+# 
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the README
+# file for more details.
+# 
+
 
 # Requires attributes:
 # scrollblock1, scrollblock2: pagespan scrollblocks




reply via email to

[Prev in Thread] Current Thread [Next in Thread]