From 48e6477a68c148b64513309d33c9b1a8a0a08713 Mon Sep 17 00:00:00 2001 From: Emmanuel Bretelle Date: Fri, 23 May 2008 20:39:26 +0100 Subject: [PATCH 1/3] fixing an issue where tab order was broken step to repro: - open terminator - open a new tab - in new tab, split axis - go to first tab - create a new tab - Ctrl-shift-N around and the order is not respected --- terminator | 8 ++++++-- terminatorlib/config.py | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/terminator b/terminator index c88d638a..9cd4a9f7 100755 --- a/terminator +++ b/terminator @@ -1171,8 +1171,12 @@ class Terminator: ## Now, we set focus on the new term notebook.set_current_page(-1) 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) return (True) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 979eae3a..751fef06 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -113,6 +113,7 @@ class TerminatorConfValuestore: 'ignore_hosts' : ['localhost','127.0.0.0/8','*.local'], 'encoding' : 'UTF-8', 'active_encodings' : ['UTF-8', 'ISO-8859-1'], + 'background_image' : '', } def __getattr__ (self, keyname): From 634a680c254a5dcc878fc4f559b46976661dd1d9 Mon Sep 17 00:00:00 2001 From: Emmanuel Bretelle Date: Fri, 23 May 2008 22:31:48 +0100 Subject: [PATCH 2/3] 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 --- terminator | 58 +++++++++++++++++++++--------------------------------- 1 file changed, 22 insertions(+), 36 deletions(-) diff --git a/terminator b/terminator index 9cd4a9f7..32778a1e 100755 --- a/terminator +++ b/terminator @@ -1045,7 +1045,9 @@ class Terminator: # insert the term reference into the list 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 terminal._vte.grab_focus () @@ -1081,7 +1083,6 @@ class Terminator: #other pages, we insert after the last term of previous page previoustab = notebook.get_nth_page(page_num - 1) sibling = self._notebook_last_term(previoustab) - print sibling siblingindex = self.term_list.index(sibling) for term in termslice: siblingindex += 1 @@ -1110,9 +1111,9 @@ class Terminator: if isinstance(child, TerminatorTerm): return child 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): - 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__) return None @@ -1232,6 +1233,7 @@ class Terminator: grandparent.insert_page(sibling, None,page) grandparent.set_tab_label_packing(sibling, True, True, gtk.PACK_START) grandparent.set_tab_reorderable(sibling, True) + grandparent.set_current_page(page) else: @@ -1269,9 +1271,9 @@ class Terminator: gdparent.remove(parent) gdparent.pack2(sibling) parent.destroy() - if index == 0: index = 1 - self.term_list[index - 1]._vte.grab_focus () - + if index == 0: index = 1 + 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: self.term_list[0]._titlebox.hide() @@ -1294,20 +1296,9 @@ class Terminator: nextterm = self.term_list[next] - if isinstance(nextterm.get_parent(), gtk.Notebook): - box = 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 + ##we need to set the current page of each notebook + self._set_current_notebook_page_recursive(nextterm) + nextterm._vte.grab_focus () @@ -1322,24 +1313,19 @@ class Terminator: #self.window.set_title(self.term_list[previous]._vte.get_window_title()) previousterm = self.term_list[previous] - if isinstance(previousterm.get_parent(), gtk.Notebook): - box = 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 + ##we need to set the current page of each notebook + self._set_current_notebook_page_recursive(previousterm) 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): vertical = False From 79095bc52b9e5e2e76369474caf70dcc1584d76c Mon Sep 17 00:00:00 2001 From: Emmanuel Bretelle Date: Sat, 24 May 2008 15:23:30 +0100 Subject: [PATCH 3/3] removed an extra spawn_child in terminator.add which was causing dnd terms to be respawn with the wrong working dir --- terminator | 1 - 1 file changed, 1 deletion(-) diff --git a/terminator b/terminator index 32778a1e..7ba5e91b 100755 --- a/terminator +++ b/terminator @@ -1041,7 +1041,6 @@ class Terminator: pane.show () pane.set_position (position / 2) terminal.show () - terminal.spawn_child () # insert the term reference into the list index = self.term_list.index (widget)