only try to switch pages in a notebook if we actually have one. Not a fix for, but somewhat workaround for the crashing aspect of LP #271850

This commit is contained in:
Chris Jones 2008-09-25 22:22:05 +01:00
parent 99893f0b98
commit fc9b50850e
1 changed files with 9 additions and 7 deletions

View File

@ -856,16 +856,18 @@ class Terminator:
def previous_tab(self, term): def previous_tab(self, term):
notebook = self.get_first_parent_notebook(term) notebook = self.get_first_parent_notebook(term)
notebook.prev_page() if notebook:
# This seems to be required in some versions of (py)gtk. notebook.prev_page()
# Without it, the selection changes, but the displayed page doesn't change # This seems to be required in some versions of (py)gtk.
# Seen in gtk-2.12.11 and pygtk-2.12.1 at least. # Without it, the selection changes, but the displayed page doesn't change
notebook.set_current_page(notebook.get_current_page()) # Seen in gtk-2.12.11 and pygtk-2.12.1 at least.
notebook.set_current_page(notebook.get_current_page())
def next_tab(self, term): def next_tab(self, term):
notebook = self.get_first_parent_notebook(term) notebook = self.get_first_parent_notebook(term)
notebook.next_page() if notebook:
notebook.set_current_page(notebook.get_current_page()) notebook.next_page()
notebook.set_current_page(notebook.get_current_page())
def move_tab(self, term, direction): def move_tab(self, term, direction):
dbg("moving to direction %s" % direction) dbg("moving to direction %s" % direction)