34 |
def call(list, type=gzz.potion.CommandCall): |
def call(list, type=gzz.potion.CommandCall): |
35 |
if list is None: return None |
if list is None: return None |
36 |
if isinstance(list, gzz.potion.Expression): return list |
if isinstance(list, gzz.potion.Expression): return list |
37 |
|
print list |
38 |
head = list[0] |
head = list[0] |
39 |
params = [call(l, gzz.potion.FunctionCall) for l in list[1:]] |
params = [call(l, gzz.potion.FunctionCall) for l in list[1:]] |
|
print head, params |
|
40 |
return type(head(), params) |
return type(head(), params) |
41 |
|
|
42 |
def action(list, win=1): |
def action(list, win=1): |
126 |
Hop2, Put, PrefixOrRight, PrefixOrLeft, \ |
Hop2, Put, PrefixOrRight, PrefixOrLeft, \ |
127 |
RightWindow, LeftWindow, Go, Clone, \ |
RightWindow, LeftWindow, Go, Clone, \ |
128 |
ToggleMark, Quit, ChangeView, ChangeDim, \ |
ToggleMark, Quit, ChangeView, ChangeDim, \ |
129 |
Break |
Break, Delete, GoToOriginal |
130 |
|
|
131 |
def const(i): |
def const(i): |
132 |
from gzz.potion.potions import ConstantExpression |
from gzz.potion.potions import ConstantExpression |
142 |
'n': action([NewCell, None]), |
'n': action([NewCell, None]), |
143 |
'-': action([Connect, [PrefixOrOther], None]), |
'-': action([Connect, [PrefixOrOther], None]), |
144 |
'h': action([Hop2, None]), |
'h': action([Hop2, None]), |
145 |
'p': action([Put,[RightWindow],[PrefixOrLeft]]), |
'p': action([Put,[RightWindow], [PrefixOrLeft]]), |
146 |
|
'P': action([Put,[LeftWindow], [PrefixOrRight]]), |
147 |
'g': action([Go, [PrefixOrOther]], 1), |
'g': action([Go, [PrefixOrOther]], 1), |
148 |
'G': action([Go, [PrefixOrOther]], 0), |
'G': action([Go, [PrefixOrOther]], 0), |
149 |
't': action([Clone,[PrefixOrRight], None]), |
't': action([Clone,[PrefixOrRight], None]), |
158 |
'Alt-V': action(call([ChangeView, const(-1)])), |
'Alt-V': action(call([ChangeView, const(-1)])), |
159 |
'b': action(call([Break, None])), |
'b': action(call([Break, None])), |
160 |
'B': action(call([Break, None])), |
'B': action(call([Break, None])), |
161 |
|
'Delete': action(call([Delete, [PrefixOrRight]])), |
162 |
|
'Alt-Backspace': action(call([Delete, [PrefixOrRight]])), |
163 |
|
'Shift-Delete': action(call([Delete, [PrefixOrLeft]])), |
164 |
|
'Alt-Shift-Delete': action(call([Delete, [PrefixOrLeft]])), |
165 |
|
'o': action(call([GoToOriginal, [RightWindow]]), 1), |
166 |
|
'O': action(call([GoToOriginal, [LeftWindow]]), 0), |
167 |
} |
} |
168 |
|
|
169 |
self.binder = gzz.client.PotionFallbackBinder(map(bindings)) |
self.binder = gzz.client.PotionFallbackBinder(map(bindings)) |