gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz ./Gzz.py ./bindings.py gzz/view/LinebrokenC...


From: Benja Fallenstein
Subject: [Gzz-commits] gzz ./Gzz.py ./bindings.py gzz/view/LinebrokenC...
Date: Sat, 01 Feb 2003 18:50:46 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Benja Fallenstein <address@hidden>      03/02/01 18:50:45

Modified files:
        .              : Gzz.py bindings.py 
        gzz/view       : LinebrokenCellContentView.java 
                         TextCellContentView.java 
        lava/gzz/modules/gispmap: GispP2PMap.java 
Added files:
        lava/gzz/potion/potions: DeleteChar.java 
Removed files:
        gzz/client     : actions.py pythonbinder.py 

Log message:
        Move potion bindings from Gzz.py to bindings.py

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/Gzz.py.diff?tr1=1.73&tr2=1.74&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/bindings.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/LinebrokenCellContentView.java.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/TextCellContentView.java.diff?tr1=1.35&tr2=1.36&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/modules/gispmap/GispP2PMap.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/potion/potions/DeleteChar.java?rev=1.1

Patches:
Index: gzz/Gzz.py
diff -u gzz/Gzz.py:1.73 gzz/Gzz.py:1.74
--- gzz/Gzz.py:1.73     Tue Jan 28 10:53:03 2003
+++ gzz/Gzz.py  Sat Feb  1 18:50:44 2003
@@ -48,7 +48,7 @@
         else:
             ccv = gzz.view.LinebrokenCellContentView(self.style)
             self.cellContentViews = [
-                gzz.view.LinebrokenCellContentView(self.style, 
"XXXXXXXXXXXXXXXX")
+                gzz.view.LinebrokenCellContentView(self.style)
             ]
 
         self.cellContentViews.append(gzz.view.CellMagnifier(ccv, 2))
@@ -120,7 +120,8 @@
                                           TextCursorRight, SwitchToTextMode, \
                                           SwitchToNormalMode, MarkHalfRank, \
                                            ExtEdit, ViewContainedText, 
AndFilterFn, \
-                                           OrFilterFn, RootClone, Step, 
ChangeCellView
+                                           OrFilterFn, RootClone, Step, 
ChangeCellView, \
+                                           DeleteChar
 
             from gzz.modules.email import AllEmailsThat, SubjectFilterFn, 
FromFilterFn, \
                                           ToFilterFn, OlderFilterFn, 
NewerFilterFn
@@ -200,6 +201,7 @@
                'Right': action(call([TextCursorRight])),
                'Tab': action(call([SwitchToNormalMode])),
                'Tabulator': action(call([SwitchToNormalMode])),
+                'Backspace': action(call([DeleteChar])),
            }
 
            bindings = map(bindings)
Index: gzz/bindings.py
diff -u gzz/bindings.py:1.4 gzz/bindings.py:1.5
--- gzz/bindings.py:1.4 Tue Oct 29 16:21:25 2002
+++ gzz/bindings.py     Sat Feb  1 18:50:44 2003
@@ -19,147 +19,115 @@
 """
 Default bindings for the Gzz client.
 
-Note: These bindings are only used with the PythonBinder,
+Note: These bindings are only used with the PotionFallbackBinder,
 not with gzz.view.DefaultBinder.
 """
 
-from gzz.client.actions import *
+import gzz, java
 
-edit_mode = {}
-search_mode = {}
-
-normal_mode = {
-
-    # "Meta-binding:"
-    # Clearing the pending directional operation
-    
-    'Backspace': ClearPendingOp(),
+from gzz.potion.potions import *
+from gzz.modules.email import *
 
+def call(list, type=None):
+    if type is None: type = gzz.potion.CommandCall
+    if list is None: return None
+    if isinstance(list, gzz.potion.Expression): return list
+    #print list
+    head = list[0]
+    params = [call(l, gzz.potion.FunctionCall) for l in list[1:]]
+    return type(head(), params)
+
+def action(list, win=1):
+    return gzz.client.PotionFallbackBinder.Action(call(list), win)
+
+arr = gzz.client.PotionFallbackBinder.Arrow
+def map(dict):
+    m = java.util.HashMap()
+    for k,v in dict.items(): m.put(k, v)
+    return m
 
+def fn(fn):
+    return call(fn, gzz.potion.FunctionCall)
 
-    # Mode switching bindings
-    
-    'Tab':       EditMode(1),
-    'Shift-Tab': EditMode(0),
-    'Ctrl-F':    SearchMode(),
-
-
-
-    # Bindings to invoke external editor
-    
-    'Ctrl-E':       CallExternalEditor(1),
-    'Ctrl-Shift-E': CallExternalEditor(0),
+def const(i):
+    return ConstantExpression(i, str(i))
 
 
+search_mode = {}
 
-    # Left arrowset
+normal_mode = {
+    'Up': arr(1,1,-1), 'i': arr(1,1,-1), 'e': arr(0,1,-1),
+    'Down': arr(1,1,1), ',': arr(1,1,1), 'c': arr(0,1,1),
+    'Left': arr(1,0,-1), 'j': arr(1,0,-1), 's': arr(0,1,-1),
+    'Right': arr(1,0,1), 'l': arr(1,0,1), 'f': arr(0,0,1),
+    'k': arr(1,2,1), 'K': arr(1,2,-1),
+    'd': arr(0,2,1), 'D': arr(0,2,-1),
+    'n': action([NewCell, None]),
+    '-': action([Connect, [PrefixOrOther], None]),
+    'h': action([Hop2, None]),
+    'p': action([Put,[ThisWindow], [PrefixOrOther]], 1),
+    'P': action([Put,[ThisWindow], [PrefixOrOther]], 0),
+    'g': action([Go, [PrefixOrOther]], 1),
+    'G': action([Go, [PrefixOrOther]], 0),
+    't': action([Clone,[PrefixOrRight], None]),
+    'T': action([Clone,[PrefixOrLeft], None]),
+    'm': action([ToggleMark, [ThisWindow]], 1),
+    'M': action([ToggleMark, [ThisWindow]], 0),
+    'Alt-M': action([MarkHalfRank, [PrefixOrThis], None]),
+    'q': action(call([Quit])),
+    'Q': action(call([Quit])),
+    'x': action(call([ChangeDim, const(0), const(1)]), 1),
+    'y': action(call([ChangeDim, const(1), const(1)]), 1),
+    'z': action(call([ChangeDim, const(2), const(1)]), 1),
+    'X': action(call([ChangeDim, const(0), const(1)]), 0),
+    'Y': action(call([ChangeDim, const(1), const(1)]), 0),
+    'Z': action(call([ChangeDim, const(2), const(1)]), 0),
+    'Alt-X': action(call([ChangeDim, const(0), const(-1)]), 1),
+    'Alt-Y': action(call([ChangeDim, const(1), const(-1)]), 1),
+    'Alt-Z': action(call([ChangeDim, const(2), const(-1)]), 1),
+    'Alt-Shift-X': action(call([ChangeDim, const(0), const(-1)]), 0),
+    'Alt-Shift-Y': action(call([ChangeDim, const(1), const(-1)]), 0),
+    'Alt-Shift-Z': action(call([ChangeDim, const(2), const(-1)]), 0),
+    'v': action(call([ChangeView, const(1)])),
+    'Alt-V': action(call([ChangeView, const(-1)])),
+    'b': action(call([Break, None])),
+    'B': action(call([Break, None])),
+    'Delete': action(call([Delete, [PrefixOrThis]])),
+    'Alt-Backspace': action(call([Delete, [PrefixOrThis]])),
+    'Shift-Delete': action(call([Delete, [PrefixOrThis]])),
+    'Alt-Shift-Backspace': action(call([Delete, [PrefixOrThis]])),
+    'o': action(call([Go, [RootClone, [ThisWindow]]]), 1),
+    'O': action(call([Go, [RootClone, [ThisWindow]]]), 0),
+    'Tab': action(call([SwitchToTextMode])),
+    'Tabulator': action(call([SwitchToTextMode])),
+    'Ctrl-E': action(call([ExtEdit, [PrefixOrThis]]), 1),
+    'Ctrl-Shift-E': action(call([ExtEdit, [PrefixOrThis]]), 0),
+    'Ctrl-V': action(call([ViewContainedText, [PrefixOrThis]]), 1),
+    'Ctrl-Shift-V': action(call([ViewContainedText, [PrefixOrThis]]), 0),
+    'Ctrl-9': action(call([ChangeCellView, const(1)])),
     
-    's': Arrow(0, 0, -1),
-    'S': Arrow(0, 0, -1),
-    'f': Arrow(0, 0, 1),
-    'F': Arrow(0, 0, 1),
-    'e': Arrow(0, 1, -1),
-    'E': Arrow(0, 1, -1),
-    'c': Arrow(0, 1, 1),
-    'C': Arrow(0, 1, 1),
-    'd': Arrow(0, 2, -1),
-    'D': Arrow(0, 2, 1),
-
-
-
-    # Right arrowset
-
-    'j': Arrow(1, 0, -1),
-    'J': Arrow(1, 0, -1),
-    'l': Arrow(1, 0, 1),
-    'L': Arrow(1, 0, 1),
-    'i': Arrow(1, 1, -1),
-    'I': Arrow(1, 1, -1),
-    ',': Arrow(1, 1, 1),
-    'k': Arrow(1, 2, -1),
-    'K': Arrow(1, 2, 1),
-
-    'Left':  Arrow(1, 0, -1),
-    'Right': Arrow(1, 0, 1),
-    'Up':    Arrow(1, 1, -1),
-    'Down':  Arrow(1, 1, 1),
-
-
-
-    # Directional operations (DirOps)
-
-    'n': NewAndEdit(),
-    'N': New(),
-    '-': Connect(),
-    'b': Break(),
-    'B': Break(),
-    'h': Hop(),
-    'H': Hop(),
-    't': Clone(1),
-    'T': Clone(0),
+    'Ctrl-A': fn([AllEmailsThat, None]),
+    'Ctrl-F': fn([FromFilterFn, None]),
+    'Ctrl-T': fn([ToFilterFn, None]),
+    'Ctrl-O': fn([OlderFilterFn, None]),
+    'Ctrl-Alt-O': fn([NewerFilterFn, None]),
+    'Alt-S': fn([SubjectFilterFn, None]),
+    '&': fn([AndFilterFn, None, None]),
+    '|': fn([OrFilterFn, None, None]),
+}
 
+edit_mode = {
+    gzz.client.PotionFallbackBinder.CHAR_KEY:
+        action(call([InsertChar, [EventKey]])),
     
-
-    # Non-directional operations
-
-    'm': ToggleMark(1),
-    'M': ToggleMark(0),
-    'v': ChangeView(1, 1),
-    'V': ChangeView(0, 1),
-    'o': Rootclone(1),
-    'O': Rootclone(0),
-    'g': GoTo(1),
-    'G': GoTo(0),
-
-    'Delete': Delete(1),
-    'Ctrl-Backspace': Delete(1),    # Macs have no "Delete" key
-
-
-
-    # Saving and quitting
-
-    'Ctrl-S': Save(),
-    'q': Quit(),
-    'Q': Quit(),
-
-
-
-    # Rotating dimensions
-
-    'x': Rotate(1, 0, 1),
-    'y': Rotate(1, 1, 1),
-    'z': Rotate(1, 2, 1),
-
-    'X': Rotate(0, 0, 1),
-    'Y': Rotate(0, 1, 1),
-    'Z': Rotate(0, 2, 1),
-
-    'Alt-X': Rotate(1, 0, -1),
-    'Alt-Y': Rotate(1, 1, -1),
-    'Alt-Z': Rotate(1, 2, -1),
-
-    'Alt-Shift-X': Rotate(0, 0, -1),
-    'Alt-Shift-Y': Rotate(0, 1, -1),
-    'Alt-Shift-Z': Rotate(0, 2, -1),
-
-    'r': ResetDims(1),
-    'R': ResetDims(0),
-
-
-
-    # Window and arrowset operations
-
-    'Alt-A': ReassignArrowset(),
-    'Alt-F': Fork(),
-    'Alt-N': NewWindow(),
-
-
-
-    # Misc
-
-    'Ctrl-L': MakeLink(1),
-    'Alt-L':  MakeLink(-1),
-
-    # totally temporary!
-    'Ctrl-0': CreatePageSpan(),
+    'Left': action(call([TextCursorLeft])),
+    'Right': action(call([TextCursorRight])),
+    'Tab': action(call([SwitchToNormalMode])),
+    'Tabulator': action(call([SwitchToNormalMode])),
+    'Backspace': action(call([DeleteChar])),
 }
+
+bindingsByMode = java.util.HashMap()
+bindingsByMode.put(gzz.client.PotionFallbackBinder.NORMAL_MODE,
+                   map(normal_mode))
+bindingsByMode.put("text mode", map(text_mode))
Index: gzz/gzz/view/LinebrokenCellContentView.java
diff -u gzz/gzz/view/LinebrokenCellContentView.java:1.24 
gzz/gzz/view/LinebrokenCellContentView.java:1.25
--- gzz/gzz/view/LinebrokenCellContentView.java:1.24    Tue Jan 14 08:36:06 2003
+++ gzz/gzz/view/LinebrokenCellContentView.java Sat Feb  1 18:50:45 2003
@@ -40,7 +40,7 @@
  *  Doesn't scroll, currently.
  */
 public class LinebrokenCellContentView extends CellView {
-public static final String rcsid = "$Id: LinebrokenCellContentView.java,v 1.24 
2003/01/14 13:36:06 tjl Exp $";
+public static final String rcsid = "$Id: LinebrokenCellContentView.java,v 1.25 
2003/02/01 23:50:45 benja Exp $";
     public static boolean dbg = false;
     private static void p(String s) { if(dbg) pa(s); }
     private static void pa(String s) { System.err.println(s); }
@@ -58,7 +58,7 @@
     protected boolean baselined = true;
 
     public LinebrokenCellContentView(TextStyle style) {
-       this(style, "XXXXXXXXXX");
+       this(style, "XXXXXXXXXXX");
     }
 
     public LinebrokenCellContentView(TextStyle style, String widthString) {
Index: gzz/gzz/view/TextCellContentView.java
diff -u gzz/gzz/view/TextCellContentView.java:1.35 
gzz/gzz/view/TextCellContentView.java:1.36
--- gzz/gzz/view/TextCellContentView.java:1.35  Wed Jan  8 20:59:44 2003
+++ gzz/gzz/view/TextCellContentView.java       Sat Feb  1 18:50:45 2003
@@ -39,7 +39,7 @@
 /** A cell content view showing a cell's text.
  */
 public class TextCellContentView extends CellView {
-public static final String rcsid = "$Id: TextCellContentView.java,v 1.35 
2003/01/09 01:59:44 benja Exp $";
+public static final String rcsid = "$Id: TextCellContentView.java,v 1.36 
2003/02/01 23:50:45 benja Exp $";
     public static boolean dbg = false;
     private static void pa(String s) { System.err.println(s); }
 
@@ -51,7 +51,7 @@
     String widthString;
 
     public TextCellContentView(TextStyle style) {
-       this(style, "XXXXXXXXXXXXXXXXXX");
+       this(style, "XXXXXXXXXXX");
     }
 
     public TextCellContentView(TextStyle style, String widthString) {
Index: gzz/lava/gzz/modules/gispmap/GispP2PMap.java
diff -u gzz/lava/gzz/modules/gispmap/GispP2PMap.java:1.1 
gzz/lava/gzz/modules/gispmap/GispP2PMap.java:1.2
--- gzz/lava/gzz/modules/gispmap/GispP2PMap.java:1.1    Fri Jan 31 01:59:34 2003
+++ gzz/lava/gzz/modules/gispmap/GispP2PMap.java        Sat Feb  1 18:50:45 2003
@@ -53,7 +53,7 @@
 
     GISPUDP gisp;
 
-    public GispP2PMap() throws net.jxta.exception.PeerGroupException {
+    public GispP2PMap() {
        int offs = (int)(2000 * new java.util.Random().nextDouble());
        gisp = new GISPUDP(12415 + offs);
        gisp.start(new String[0]);




reply via email to

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