Make drag and drop of terminals work

This commit is contained in:
Chris Jones 2009-11-16 22:56:55 -06:00
parent ec1c20540a
commit 7d9575df5f
4 changed files with 9 additions and 7 deletions

View File

@ -95,7 +95,7 @@ class Container(object):
"""Split this container vertically""" """Split this container vertically"""
return(self.split_axis(widget, False)) return(self.split_axis(widget, False))
def split_axis(self, widget, vertical=True): def split_axis(self, widget, vertical=True, sibling=None):
"""Default axis splitter. This should be implemented by subclasses""" """Default axis splitter. This should be implemented by subclasses"""
raise NotImplementedError('split_axis') raise NotImplementedError('split_axis')

View File

@ -41,7 +41,7 @@ class Paned(Container):
del(self.cnxids['init']) del(self.cnxids['init'])
# pylint: disable-msg=W0613 # pylint: disable-msg=W0613
def split_axis(self, widget, vertical=True): def split_axis(self, widget, vertical=True, sibling=None):
"""Default axis splitter. This should be implemented by subclasses""" """Default axis splitter. This should be implemented by subclasses"""
self.remove(widget) self.remove(widget)
if vertical: if vertical:
@ -49,7 +49,8 @@ class Paned(Container):
else: else:
container = HPaned() container = HPaned()
sibling = Terminal() if not sibling:
sibling = Terminal()
self.terminator.register_terminal(sibling) self.terminator.register_terminal(sibling)
sibling.spawn_child() sibling.spawn_child()

View File

@ -637,8 +637,8 @@ class Terminal(gtk.VBox):
pos = self.get_location(widget, x, y) pos = self.get_location(widget, x, y)
data.terminator.remove(widgetsrc, True) srcpaned.remove(widgetsrc)
data.terminator.add(self, widgetsrc, pos) dstpaned.split_axis(dsthbox, pos in ['top', 'bottom'], widgetsrc)
def get_location(self, vte, x, y): def get_location(self, vte, x, y):
"""Get our location within the terminal""" """Get our location within the terminal"""

View File

@ -186,7 +186,7 @@ class Window(Container, gtk.Window):
self.disconnect_child(widget) self.disconnect_child(widget)
return(True) return(True)
def split_axis(self, widget, vertical=True): def split_axis(self, widget, vertical=True, sibling=None):
"""Split the window""" """Split the window"""
self.remove(widget) self.remove(widget)
@ -196,7 +196,8 @@ class Window(Container, gtk.Window):
else: else:
container = HPaned() container = HPaned()
sibling = Terminal() if not sibling:
sibling = Terminal()
self.terminator.register_terminal(sibling) self.terminator.register_terminal(sibling)
self.add(container) self.add(container)
container.show_all() container.show_all()