diff --git a/terminatorlib/container.py b/terminatorlib/container.py index a009dee2..f133648f 100755 --- a/terminatorlib/container.py +++ b/terminatorlib/container.py @@ -87,6 +87,10 @@ class Container(object): """Ensure we still have a reason to exist""" raise NotImplementedError('hoover') + def get_children(self): + """Return an ordered list of the children of this Container""" + raise NotImplementedError('get_children') + def closeterm(self, widget): """Handle the closure of a terminal""" try: diff --git a/terminatorlib/notebook.py b/terminatorlib/notebook.py index a4516651..ed5fd38c 100755 --- a/terminatorlib/notebook.py +++ b/terminatorlib/notebook.py @@ -137,6 +137,13 @@ class Notebook(Container, gtk.Notebook): self.disconnect_child(widget) return(True) + def get_children(self): + """Return an ordered list of our children""" + children = [] + for page in xrange(0,self.get_n_pages() - 1): + children.append(self.get_nth_page(page)) + return(children) + def newtab(self, widget=None): """Add a new tab, optionally supplying a child widget""" maker = Factory() diff --git a/terminatorlib/paned.py b/terminatorlib/paned.py index c71084a7..cab3c29b 100755 --- a/terminatorlib/paned.py +++ b/terminatorlib/paned.py @@ -126,6 +126,13 @@ class Paned(Container): self.children.remove(widget) return(True) + def get_children(self): + """Return an ordered list of our children""" + children = [] + children.append(self.get_child1()) + children.append(self.get_child2()) + return(children) + def wrapcloseterm(self, widget): """A child terminal has closed, so this container must die""" dbg('Paned::wrapcloseterm: Called on %s' % widget) diff --git a/terminatorlib/window.py b/terminatorlib/window.py index 8138f0e5..7c36ad16 100755 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -281,6 +281,12 @@ class Window(Container, gtk.Window): self.disconnect_child(widget) return(True) + def get_children(self): + """Return a single list of our child""" + children = [] + children.append(self.get_child()) + return(children) + def hoover(self): """Ensure we still have a reason to exist""" if not self.get_child():