27 |
def call(self, x): |
def call(self, x): |
28 |
op = x.getPendingOp() |
op = x.getPendingOp() |
29 |
if not op: op = Move() |
if not op: op = Move() |
30 |
|
x.setPendingOp(None) |
31 |
|
|
32 |
x = x.setDir(self.side, self.axis, self.dir) |
x.setDir(self.side, self.axis, self.dir) |
33 |
op.dir(self, x) |
op.dir(x) |
34 |
|
|
35 |
gzz.client.AbstractUpdateManager.prioritize(self.win.getScreen()) |
gzz.client.AbstractUpdateManager.prioritize(x.win.getScreen()) |
36 |
|
|
37 |
class New(DirOp): |
class New(DirOp): |
38 |
def dir(self, x): |
def dir(self, x): |
48 |
x.checkNew() |
x.checkNew() |
49 |
x.win.cursor = x.new |
x.win.cursor = x.new |
50 |
|
|
51 |
|
class Connect(DirOp): |
52 |
|
def dir(self, x): |
53 |
|
if not x.getMarks(): |
54 |
|
x.cell.connect(x.dim, x.dir, |
55 |
|
x.client.windows[1-x.side].cursor) |
56 |
|
else: |
57 |
|
raise gzz.client.ClientException( |
58 |
|
"Sorry, connecting to marked cells is not implemented yet.") |
59 |
|
|
60 |
class Break(DirOp): |
class Break(DirOp): |
61 |
def dir(self, x): |
def dir(self, x): |
62 |
x.checkNew() |
x.checkNew() |
80 |
try: |
try: |
81 |
c = x.client |
c = x.client |
82 |
c.filers.saveAll(c.space.getSlicer().exportAll()) |
c.filers.saveAll(c.space.getSlicer().exportAll()) |
83 |
c.filers.saveAll(c.space.linkSpace.getSlicer().exportAll()) |
c.filers.saveAll(c.linkSpace.getSlicer().exportAll()) |
84 |
print "Saved." |
print "Saved." |
85 |
return 1 |
return 1 |
86 |
|
|
89 |
e.printStackTrace() |
e.printStackTrace() |
90 |
return 0 |
return 0 |
91 |
|
|
92 |
|
class Delete(SidedOp): |
93 |
|
def call(self, x): |
94 |
|
w = self.client.windows[self.side] |
95 |
|
w.cursor.delete() # XXX move cursor |
96 |
|
|
97 |
class Save(Op): |
class Save(Op): |
98 |
def call(self, x): |
def call(self, x): |
99 |
save(x) |
save(x) |
147 |
c = x.client.windows[self.side].cursor |
c = x.client.windows[self.side].cursor |
148 |
|
|
149 |
if c not in x.getMarkedCells(): |
if c not in x.getMarkedCells(): |
150 |
x.setMarks = x.getMarks() + [gzz.view.Mark(c)] |
x.setMarks(x.getMarks() + [gzz.view.Mark(c)]) |
151 |
else: |
else: |
152 |
x.setMarks([m for m in x.getMarks() if m.cell != c]) |
x.setMarks([m for m in x.getMarks() if m.cell != c]) |
153 |
|
|
162 |
|
|
163 |
else: |
else: |
164 |
for i in range(len(marks) - 1): |
for i in range(len(marks) - 1): |
165 |
if marks[i].cell == x.cell: |
if marks[i].cell == w.cursor: |
166 |
w.cursor = marks[i+1].cell |
w.cursor = marks[i+1].cell |
167 |
break |
break |
168 |
else: |
else: |
169 |
w.cursor = marks[0] |
w.cursor = marks[0].cell |
170 |
|
|
171 |
|
class NormalMode(Op): |
172 |
|
def call(self, x): |
173 |
|
x.setMode('normal') |
174 |
|
|
175 |
|
class EditMode(SidedOp): |
176 |
|
def call(self, x): |
177 |
|
if self.side == 0: |
178 |
|
x.setMode('edit 0') |
179 |
|
elif self.side == 1: |
180 |
|
x.setMode('edit 1') |
181 |
|
else: |
182 |
|
assert 0 |
183 |
|
|
184 |
|
class SearchMode(Op): |
185 |
|
def call(self, x): |
186 |
|
x.setMode('search') |
187 |
|
|
188 |
class MakeLink(Op): |
class MakeLink(Op): |
189 |
def __init__(self, dir): self.dir = dir |
def __init__(self, dir): self.dir = dir |