Make drag and drop of terminals work
This commit is contained in:
parent
ec1c20540a
commit
7d9575df5f
@ -95,7 +95,7 @@ class Container(object):
|
||||
"""Split this container vertically"""
|
||||
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"""
|
||||
raise NotImplementedError('split_axis')
|
||||
|
||||
|
@ -41,7 +41,7 @@ class Paned(Container):
|
||||
del(self.cnxids['init'])
|
||||
|
||||
# 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"""
|
||||
self.remove(widget)
|
||||
if vertical:
|
||||
@ -49,6 +49,7 @@ class Paned(Container):
|
||||
else:
|
||||
container = HPaned()
|
||||
|
||||
if not sibling:
|
||||
sibling = Terminal()
|
||||
self.terminator.register_terminal(sibling)
|
||||
sibling.spawn_child()
|
||||
|
@ -637,8 +637,8 @@ class Terminal(gtk.VBox):
|
||||
|
||||
pos = self.get_location(widget, x, y)
|
||||
|
||||
data.terminator.remove(widgetsrc, True)
|
||||
data.terminator.add(self, widgetsrc, pos)
|
||||
srcpaned.remove(widgetsrc)
|
||||
dstpaned.split_axis(dsthbox, pos in ['top', 'bottom'], widgetsrc)
|
||||
|
||||
def get_location(self, vte, x, y):
|
||||
"""Get our location within the terminal"""
|
||||
|
@ -186,7 +186,7 @@ class Window(Container, gtk.Window):
|
||||
self.disconnect_child(widget)
|
||||
return(True)
|
||||
|
||||
def split_axis(self, widget, vertical=True):
|
||||
def split_axis(self, widget, vertical=True, sibling=None):
|
||||
"""Split the window"""
|
||||
self.remove(widget)
|
||||
|
||||
@ -196,6 +196,7 @@ class Window(Container, gtk.Window):
|
||||
else:
|
||||
container = HPaned()
|
||||
|
||||
if not sibling:
|
||||
sibling = Terminal()
|
||||
self.terminator.register_terminal(sibling)
|
||||
self.add(container)
|
||||
|
Loading…
Reference in New Issue
Block a user