Fix up drag and drop to work more often, between more widgets

This commit is contained in:
Chris Jones 2010-03-02 12:39:47 +00:00
parent afdbaa3fe6
commit b213e76461
5 changed files with 21 additions and 16 deletions

View File

@ -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:

View File

@ -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)

View File

@ -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:

View File

@ -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)

View File

@ -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: