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""" """Remove a widget from the container"""
raise NotImplementedError('remove') raise NotImplementedError('remove')
def hoover(self, widget):
"""Ensure we still have a reason to exist"""
raise NotImplementedError('hoover')
def closeterm(self, widget): def closeterm(self, widget):
"""Handle the closure of a terminal""" """Handle the closure of a terminal"""
try: try:

View File

@ -87,7 +87,7 @@ class Notebook(Container, gtk.Notebook):
page.create_layout(children[child_key]) page.create_layout(children[child_key])
num = num + 1 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""" """Split the axis of a terminal inside us"""
order = None order = None
page_num = self.page_num(widget) page_num = self.page_num(widget)
@ -112,9 +112,9 @@ class Notebook(Container, gtk.Notebook):
self.set_tab_label(container, label) self.set_tab_label(container, label)
self.show_all() self.show_all()
order = [widget, sibling] order = [sibling, widget]
if siblinglast is True: if widgetlast is True:
order.reverse order.reverse()
for terminal in order: for terminal in order:
container.add(terminal) container.add(terminal)

View File

@ -41,7 +41,7 @@ class Paned(Container):
# pylint: disable-msg=W0613 # pylint: disable-msg=W0613
def split_axis(self, widget, vertical=True, sibling=None, def split_axis(self, widget, vertical=True, sibling=None,
siblinglast=False): widgetlast=False):
"""Default axis splitter. This should be implemented by subclasses""" """Default axis splitter. This should be implemented by subclasses"""
order = None order = None
@ -61,7 +61,7 @@ class Paned(Container):
self.show_all() self.show_all()
order = [widget, sibling] order = [widget, sibling]
if siblinglast is True: if widgetlast is False:
order.reverse() order.reverse()
for terminal in order: for terminal in order:

View File

@ -870,6 +870,7 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
widget = widget.get_parent() widget = widget.get_parent()
if not widget: if not widget:
# We've run out of widgets. Something is wrong. # We've run out of widgets. Something is wrong.
err('Failed to find Terminal from vte')
return return
if maker.isinstance(widget, 'Terminal'): if maker.isinstance(widget, 'Terminal'):
break break
@ -878,9 +879,6 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
dstpaned = dsthbox.get_parent() dstpaned = dsthbox.get_parent()
srcpaned = srchbox.get_parent() srcpaned = srchbox.get_parent()
if isinstance(dstpaned, gtk.Window) and \
isinstance(srcpaned, gtk.Window):
return
pos = self.get_location(widget, x, y) pos = self.get_location(widget, x, y)

View File

@ -281,14 +281,17 @@ class Window(Container, gtk.Window):
self.disconnect_child(widget) self.disconnect_child(widget)
return(True) return(True)
def closeterm(self, widget): def hoover(self):
"""Handle a terminal closing""" """Ensure we still have a reason to exist"""
Container.closeterm(self, widget)
if len(self.get_children()) == 0: if len(self.get_children()) == 0:
self.emit('destroy') 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""" """Split the window"""
order = None order = None
maker = Factory() maker = Factory()
@ -305,8 +308,8 @@ class Window(Container, gtk.Window):
self.add(container) self.add(container)
container.show_all() container.show_all()
order = [widget, sibling] order = [sibling, widget]
if siblinglast is True: if widgetlast is True:
order.reverse() order.reverse()
for term in order: for term in order: