33 |
|
|
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 |
37 |
head = list[0] |
head = list[0] |
38 |
params = [call(l, gzz.potion.FunctionCall) for l in list[1:]] |
params = [call(l, gzz.potion.FunctionCall) for l in list[1:]] |
39 |
print head, params |
print head, params |
124 |
|
|
125 |
from gzz.potion.potions import NewCell, Connect, PrefixOrOther, \ |
from gzz.potion.potions import NewCell, Connect, PrefixOrOther, \ |
126 |
Hop2, Put, PrefixOrRight, PrefixOrLeft, \ |
Hop2, Put, PrefixOrRight, PrefixOrLeft, \ |
127 |
RightWindow, LeftWindow, Go, Clone,ToggleMark |
RightWindow, LeftWindow, Go, Clone, \ |
128 |
|
ToggleMark, Quit, ChangeView, ChangeDim |
129 |
|
|
130 |
|
def const(i): |
131 |
|
from gzz.potion.potions import ConstantExpression |
132 |
|
return ConstantExpression(i, str(i)) |
133 |
|
|
134 |
bindings = { |
bindings = { |
135 |
'Up': arr(1,1,-1), 'i': arr(1,1,-1), 'e': arr(0,1,-1), |
'Up': arr(1,1,-1), 'i': arr(1,1,-1), 'e': arr(0,1,-1), |
136 |
'Down': arr(1,1,1), ',': arr(1,1,1), 'c': arr(0,1,1), |
'Down': arr(1,1,1), ',': arr(1,1,1), 'c': arr(0,1,1), |
148 |
'T': action([Clone,[PrefixOrLeft], None]), |
'T': action([Clone,[PrefixOrLeft], None]), |
149 |
'm': action([ToggleMark, [RightWindow]]), |
'm': action([ToggleMark, [RightWindow]]), |
150 |
'M': action([ToggleMark, [LeftWindow]]), |
'M': action([ToggleMark, [LeftWindow]]), |
151 |
|
'q': call([Quit]), |
152 |
|
'Q': call([Quit]), |
153 |
|
'x': call([ChangeDim, const(0), const(1)]), |
154 |
|
'Alt-X': call([ChangeDim, const(0), const(-1)]), |
155 |
|
'v': call([ChangeView, const(1)]), |
156 |
|
'Alt-V': call([ChangeView, const(-1)]), |
157 |
} |
} |
158 |
|
|
159 |
self.binder = gzz.client.PotionFallbackBinder(map(bindings)) |
self.binder = gzz.client.PotionFallbackBinder(map(bindings)) |
160 |
self.decorators.append(gzz.view.PendingPotionDecorator()) |
self.decorators.append(gzz.view.PendingPotionDecorator()) |
161 |
else: |
else: |