some more tab focus fixes
* added _set_current_notebook_page_recursive given a widget, set all parents notebook page active to be sure that the focus is not broken
This commit is contained in:
parent
48e6477a68
commit
634a680c25
52
terminator
52
terminator
|
@ -1045,7 +1045,9 @@ class Terminator:
|
||||||
|
|
||||||
# insert the term reference into the list
|
# insert the term reference into the list
|
||||||
index = self.term_list.index (widget)
|
index = self.term_list.index (widget)
|
||||||
self.term_list.insert (index + 1, terminal)
|
if pos in ('bottom', 'right'):
|
||||||
|
index = index + 1
|
||||||
|
self.term_list.insert (index, terminal)
|
||||||
|
|
||||||
# make the new terminal grab the focus
|
# make the new terminal grab the focus
|
||||||
terminal._vte.grab_focus ()
|
terminal._vte.grab_focus ()
|
||||||
|
@ -1081,7 +1083,6 @@ class Terminator:
|
||||||
#other pages, we insert after the last term of previous page
|
#other pages, we insert after the last term of previous page
|
||||||
previoustab = notebook.get_nth_page(page_num - 1)
|
previoustab = notebook.get_nth_page(page_num - 1)
|
||||||
sibling = self._notebook_last_term(previoustab)
|
sibling = self._notebook_last_term(previoustab)
|
||||||
print sibling
|
|
||||||
siblingindex = self.term_list.index(sibling)
|
siblingindex = self.term_list.index(sibling)
|
||||||
for term in termslice:
|
for term in termslice:
|
||||||
siblingindex += 1
|
siblingindex += 1
|
||||||
|
@ -1110,9 +1111,9 @@ class Terminator:
|
||||||
if isinstance(child, TerminatorTerm):
|
if isinstance(child, TerminatorTerm):
|
||||||
return child
|
return child
|
||||||
elif isinstance(child, gtk.Paned):
|
elif isinstance(child, gtk.Paned):
|
||||||
return self._notebook_first_term(child.get_child2())
|
return self._notebook_last_term(child.get_child2())
|
||||||
elif isinstance(child, gtk.Notebook):
|
elif isinstance(child, gtk.Notebook):
|
||||||
return self._notebook_first_term(child.get_nth_page(child.get_n_pages()-1))
|
return self._notebook_last_term(child.get_nth_page(child.get_n_pages()-1))
|
||||||
|
|
||||||
dbg("[ERROR] unsupported class %s in _notebook_last_term" % child.__class__.__name__)
|
dbg("[ERROR] unsupported class %s in _notebook_last_term" % child.__class__.__name__)
|
||||||
return None
|
return None
|
||||||
|
@ -1232,6 +1233,7 @@ class Terminator:
|
||||||
grandparent.insert_page(sibling, None,page)
|
grandparent.insert_page(sibling, None,page)
|
||||||
grandparent.set_tab_label_packing(sibling, True, True, gtk.PACK_START)
|
grandparent.set_tab_label_packing(sibling, True, True, gtk.PACK_START)
|
||||||
grandparent.set_tab_reorderable(sibling, True)
|
grandparent.set_tab_reorderable(sibling, True)
|
||||||
|
grandparent.set_current_page(page)
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -1271,7 +1273,7 @@ class Terminator:
|
||||||
parent.destroy()
|
parent.destroy()
|
||||||
if index == 0: index = 1
|
if index == 0: index = 1
|
||||||
self.term_list[index - 1]._vte.grab_focus ()
|
self.term_list[index - 1]._vte.grab_focus ()
|
||||||
|
self._set_current_notebook_page_recursive(self.term_list[index - 1])
|
||||||
if len(self.term_list) == 1:
|
if len(self.term_list) == 1:
|
||||||
self.term_list[0]._titlebox.hide()
|
self.term_list[0]._titlebox.hide()
|
||||||
|
|
||||||
|
@ -1294,20 +1296,9 @@ class Terminator:
|
||||||
|
|
||||||
|
|
||||||
nextterm = self.term_list[next]
|
nextterm = self.term_list[next]
|
||||||
if isinstance(nextterm.get_parent(), gtk.Notebook):
|
##we need to set the current page of each notebook
|
||||||
box = nextterm
|
self._set_current_notebook_page_recursive(nextterm)
|
||||||
parent = box.get_parent()
|
|
||||||
for i in range(0, parent.get_n_pages()):
|
|
||||||
if box == parent.get_nth_page(i):
|
|
||||||
parent.set_current_page(i)
|
|
||||||
break
|
|
||||||
notebookpage = self.get_first_notebook_page(nextterm)
|
|
||||||
if notebookpage:
|
|
||||||
child = None
|
|
||||||
for i in range(0, notebookpage[0].get_n_pages()):
|
|
||||||
if notebookpage[0].get_nth_page(i) == notebookpage[1]:
|
|
||||||
notebookpage[0].set_current_page(i)
|
|
||||||
break
|
|
||||||
nextterm._vte.grab_focus ()
|
nextterm._vte.grab_focus ()
|
||||||
|
|
||||||
|
|
||||||
|
@ -1322,23 +1313,18 @@ class Terminator:
|
||||||
|
|
||||||
#self.window.set_title(self.term_list[previous]._vte.get_window_title())
|
#self.window.set_title(self.term_list[previous]._vte.get_window_title())
|
||||||
previousterm = self.term_list[previous]
|
previousterm = self.term_list[previous]
|
||||||
if isinstance(previousterm.get_parent(), gtk.Notebook):
|
##we need to set the current page of each notebook
|
||||||
box = previousterm
|
self._set_current_notebook_page_recursive(previousterm)
|
||||||
parent = box.get_parent()
|
|
||||||
for i in range(0, parent.get_n_pages()):
|
|
||||||
if box == parent.get_nth_page(i):
|
|
||||||
parent.set_current_page(i)
|
|
||||||
break
|
|
||||||
notebookpage = self.get_first_notebook_page(previousterm)
|
|
||||||
if notebookpage:
|
|
||||||
child = None
|
|
||||||
for i in range(0, notebookpage[0].get_n_pages()):
|
|
||||||
if notebookpage[0].get_nth_page(i) == notebookpage[1]:
|
|
||||||
notebookpage[0].set_current_page(i)
|
|
||||||
break
|
|
||||||
previousterm._vte.grab_focus ()
|
previousterm._vte.grab_focus ()
|
||||||
|
|
||||||
|
|
||||||
|
def _set_current_notebook_page_recursive(self, widget):
|
||||||
|
page = self.get_first_notebook_page(widget)
|
||||||
|
while page:
|
||||||
|
child = None
|
||||||
|
page_num = page[0].page_num(page[1])
|
||||||
|
page[0].set_current_page(page_num)
|
||||||
|
page = self.get_first_notebook_page(page[0])
|
||||||
|
|
||||||
|
|
||||||
def resizeterm (self, widget, keyname):
|
def resizeterm (self, widget, keyname):
|
||||||
|
|
Loading…
Reference in New Issue