Makes the Insert terminal number order more sane in complex layouts

This commit is contained in:
Stephen Boddy 2011-02-23 22:02:09 +01:00
parent 9e13bb6aae
commit 966c6ca104
2 changed files with 7 additions and 2 deletions

View File

@ -322,8 +322,13 @@ class Terminator(Borg):
else: else:
numstr = '%d' numstr = '%d'
terminals = []
for window in self.windows:
containers, win_terminals = enumerate_descendants(window)
terminals.extend(win_terminals)
for term in self.get_target_terms(widget): for term in self.get_target_terms(widget):
idx = self.terminals.index(term) idx = terminals.index(term)
term.feed(numstr % (idx + 1)) term.feed(numstr % (idx + 1))
def get_target_terms(self, widget): def get_target_terms(self, widget):

View File

@ -268,7 +268,7 @@ def enumerate_descendants(parent):
terminals.append(descendant) terminals.append(descendant)
while len(containerstmp) > 0: while len(containerstmp) > 0:
child = containerstmp.pop() child = containerstmp.pop(0)
for descendant in child.get_children(): for descendant in child.get_children():
if maker.isinstance(descendant, 'Container'): if maker.isinstance(descendant, 'Container'):
containerstmp.append(descendant) containerstmp.append(descendant)