diff --git a/terminatorlib/container.py b/terminatorlib/container.py index 37b6ef6f..e45b07fa 100755 --- a/terminatorlib/container.py +++ b/terminatorlib/container.py @@ -83,6 +83,10 @@ class Container(object): """Remove a widget from the container""" raise NotImplementedError('remove') + def hoover(self, widget): + """Ensure we still have a reason to exist""" + raise NotImplementedError('hoover') + def closeterm(self, widget): """Handle the closure of a terminal""" try: diff --git a/terminatorlib/notebook.py b/terminatorlib/notebook.py index b9893cfc..051c559e 100755 --- a/terminatorlib/notebook.py +++ b/terminatorlib/notebook.py @@ -87,7 +87,7 @@ class Notebook(Container, gtk.Notebook): page.create_layout(children[child_key]) num = num + 1 - def split_axis(self, widget, vertical=True, sibling=None, siblinglast=False): + def split_axis(self, widget, vertical=True, sibling=None, widgetlast=False): """Split the axis of a terminal inside us""" order = None page_num = self.page_num(widget) @@ -112,9 +112,9 @@ class Notebook(Container, gtk.Notebook): self.set_tab_label(container, label) self.show_all() - order = [widget, sibling] - if siblinglast is True: - order.reverse + order = [sibling, widget] + if widgetlast is True: + order.reverse() for terminal in order: container.add(terminal) diff --git a/terminatorlib/paned.py b/terminatorlib/paned.py index ea431b6c..6c59cce1 100755 --- a/terminatorlib/paned.py +++ b/terminatorlib/paned.py @@ -41,7 +41,7 @@ class Paned(Container): # pylint: disable-msg=W0613 def split_axis(self, widget, vertical=True, sibling=None, - siblinglast=False): + widgetlast=False): """Default axis splitter. This should be implemented by subclasses""" order = None @@ -61,7 +61,7 @@ class Paned(Container): self.show_all() order = [widget, sibling] - if siblinglast is True: + if widgetlast is False: order.reverse() for terminal in order: diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 5bdbae6c..c461d7c6 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -870,6 +870,7 @@ for %s (%s)' % (name, urlplugin.__class__.__name__)) widget = widget.get_parent() if not widget: # We've run out of widgets. Something is wrong. + err('Failed to find Terminal from vte') return if maker.isinstance(widget, 'Terminal'): break @@ -878,9 +879,6 @@ for %s (%s)' % (name, urlplugin.__class__.__name__)) dstpaned = dsthbox.get_parent() srcpaned = srchbox.get_parent() - if isinstance(dstpaned, gtk.Window) and \ - isinstance(srcpaned, gtk.Window): - return pos = self.get_location(widget, x, y) diff --git a/terminatorlib/window.py b/terminatorlib/window.py index 1cd8c98a..102a250d 100755 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -281,14 +281,17 @@ class Window(Container, gtk.Window): self.disconnect_child(widget) return(True) - def closeterm(self, widget): - """Handle a terminal closing""" - Container.closeterm(self, widget) - + def hoover(self): + """Ensure we still have a reason to exist""" if len(self.get_children()) == 0: self.emit('destroy') - def split_axis(self, widget, vertical=True, sibling=None, siblinglast=False): + def closeterm(self, widget): + """Handle a terminal closing""" + Container.closeterm(self, widget) + self.hoover() + + def split_axis(self, widget, vertical=True, sibling=None, widgetlast=False): """Split the window""" order = None maker = Factory() @@ -305,8 +308,8 @@ class Window(Container, gtk.Window): self.add(container) container.show_all() - order = [widget, sibling] - if siblinglast is True: + order = [sibling, widget] + if widgetlast is True: order.reverse() for term in order: