support removing notebooks from within notebooks and stop the resize handler from spewing tracebacks for non-paned widgets

This commit is contained in:
Chris Jones 2009-12-02 23:20:26 +00:00
parent 9b8394b701
commit d0e680d473
1 changed files with 19 additions and 3 deletions

View File

@ -941,6 +941,18 @@ class Terminator:
else: else:
gdparent.remove(parent) gdparent.remove(parent)
gdparent.pack2(sibling) gdparent.pack2(sibling)
elif isinstance(gdparent, gtk.Notebook):
# extreme_tabs is on :(
label = gdparent.get_tab_label(parent)
gdparent.remove(parent)
gdparent.insert_page(sibling, None, 0)
gdparent.set_tab_label(sibling, label)
gdparent.set_tab_label_packing(sibling, not self.conf.scroll_tabbar, not self.conf.scroll_tabbar, gtk.PACK_START)
if self._tab_reorderable:
gdparent.set_tab_reorderable(sibling, True)
gdparent.set_current_page(0)
else:
err('Unknown grandparent of %s (parent is a notebook)' % widget)
if isinstance(sibling, TerminatorTerm) and sibling.conf.titlebars and sibling.conf.extreme_tabs: if isinstance(sibling, TerminatorTerm) and sibling.conf.titlebars and sibling.conf.extreme_tabs:
sibling._titlebox.show() sibling._titlebox.show()
else: else:
@ -1017,9 +1029,13 @@ class Terminator:
#print "I saw %d" % (i) #print "I saw %d" % (i)
#pprint.pprint(possible_geo) #pprint.pprint(possible_geo)
if matcher (current_geo, possible_geo, best_geo): try:
if matcher (current_geo, possible_geo, best_geo):
best_index = i best_index = i
best_geo = possible_geo best_geo = possible_geo
except TypeError, KeyError:
# Not being called on a Paned widget
pass
#if best_index is None: #if best_index is None:
# print "nothing best" # print "nothing best"
#else: #else:
@ -1162,9 +1178,9 @@ class Terminator:
horizontalBar = self.term_list[0].get_parent().style_get_property('handle-size') + self.term_list[0]._titlebox.get_allocation().height horizontalBar = self.term_list[0].get_parent().style_get_property('handle-size') + self.term_list[0]._titlebox.get_allocation().height
# Width of the vertical bar that splits terminals # Width of the vertical bar that splits terminals
if self.term_list[0].is_scrollbar_present(): if self.term_list[0].is_scrollbar_present():
verticalBar = self.term_list[0].get_parent().style_get_property('handle-size') + self.term_list[0].get_parent().style_get_property('scroll-arrow-vlength') verticalBar = self.term_list[0].get_parent().style_get_property('handle-size') + self.term_list[0].get_parent().style_get_property('scroll-arrow-vlength')
else: else:
verticalBar = self.term_list[0].get_parent().style_get_property('handle-size') verticalBar = self.term_list[0].get_parent().style_get_property('handle-size')
# Horizontal distance between two terminals # Horizontal distance between two terminals
distance = possible_geo['offset_x'] - (current_geo['offset_x'] + current_geo['span_x']) distance = possible_geo['offset_x'] - (current_geo['offset_x'] + current_geo['span_x'])
if new_edge >= edge: if new_edge >= edge: