argh, I pushed before pulling. re-add chantra commits

This commit is contained in:
Chris Jones 2008-05-25 01:32:50 +01:00
commit 594305345d
2 changed files with 29 additions and 39 deletions

View File

@ -1047,11 +1047,12 @@ class Terminator:
pane.show () pane.show ()
pane.set_position (position / 2) pane.set_position (position / 2)
terminal.show () terminal.show ()
terminal.spawn_child ()
# 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 ()
@ -1087,7 +1088,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
@ -1116,9 +1116,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
@ -1177,8 +1177,12 @@ class Terminator:
## Now, we set focus on the new term ## Now, we set focus on the new term
notebook.set_current_page(-1) notebook.set_current_page(-1)
terminal._vte.grab_focus () terminal._vte.grab_focus ()
index = self.term_list.index(widget) #adding a new tab, thus we need to get the
# last term of the previous tab and add
# the new term just after
sibling = self._notebook_last_term(notebook.get_nth_page(notebook.page_num(terminal)-1))
index = self.term_list.index(sibling)
self.term_list.insert (index + 1, terminal) self.term_list.insert (index + 1, terminal)
return (True) return (True)
@ -1234,6 +1238,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,9 +1276,9 @@ class Terminator:
gdparent.remove(parent) gdparent.remove(parent)
gdparent.pack2(sibling) gdparent.pack2(sibling)
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()
@ -1296,20 +1301,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 ()
@ -1324,24 +1318,19 @@ 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):
vertical = False vertical = False

View File

@ -113,6 +113,7 @@ class TerminatorConfValuestore:
'ignore_hosts' : ['localhost','127.0.0.0/8','*.local'], 'ignore_hosts' : ['localhost','127.0.0.0/8','*.local'],
'encoding' : 'UTF-8', 'encoding' : 'UTF-8',
'active_encodings' : ['UTF-8', 'ISO-8859-1'], 'active_encodings' : ['UTF-8', 'ISO-8859-1'],
'background_image' : '',
} }
def __getattr__ (self, keyname): def __getattr__ (self, keyname):