Merge lp:~simar/clicompanion/fix-625648 into lp:clicompanion

Proposed by Gursimran singh
Status: Merged
Approved by: Duane Hinnen
Approved revision: 74
Merge reported by: Duane Hinnen
Merged at revision: not available
Proposed branch: lp:~simar/clicompanion/fix-625648
Merge into: lp:clicompanion
Diff against target: 47 lines (+18/-3)
1 file modified
clicompanionlib/tabs.py (+18/-3)
To merge this branch: bzr merge lp:~simar/clicompanion/fix-625648
Reviewer Review Type Date Requested Status
Duane Hinnen Approve
Review via email: mp+54954@code.launchpad.net

Description of the change

Under normal conditions if we destroy active tab the focus shifts to left but if the tab destroyed is active and its last tab (which contains a page) then the focus shifts to the left. If the destroyed tab is a tab which not does have focus then focus remains with the same tab that had the focus previously.

To post a comment you must log in.
Revision history for this message
Duane Hinnen (duanedesign) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'clicompanionlib/tabs.py'
2--- clicompanionlib/tabs.py 2011-03-21 18:04:14 +0000
3+++ clicompanionlib/tabs.py 2011-03-26 12:45:50 +0000
4@@ -34,6 +34,9 @@
5 #definition gcp - how many pages is visible
6 gcp=0;
7
8+#definition nop - (no of pages) reflects no of terminal tabs left (some may be closed by the user)
9+nop=0;
10+
11 class Tabs(object):
12 '''
13 add a new terminal in a tab above the current terminal
14@@ -56,10 +59,12 @@
15 #notebook.set_show_border(True)
16
17 global gcp
18+ global nop
19+ nop += 1
20 gcp += 1
21 pagenum = ('Tab %d') % gcp
22- if gcp > 1:
23- notebook.set_show_tabs(True)
24+ if nop > 1:
25+ notebook.set_show_tabs(True)
26 box = gtk.HBox()
27 label = gtk.Label(pagenum)
28 box.pack_start(label, True, True)
29@@ -93,7 +98,17 @@
30 ## get the page number of the tab we wanted to close
31 pagenum = notebook.page_num(widget)
32 ## and close it
33- notebook.remove_page(pagenum)
34+ notebook.remove_page(pagenum)
35+ global nop
36+ nop -= 1
37+ if nop <= 1:
38+ notebook.set_show_tabs(False)
39+
40+ # check if the focus does not go to the last page (ie with only a + sign)
41+ if notebook.get_current_page() == nop:
42+ notebook.prev_page()
43+
44+
45
46 def update_term_config(self, _vte):
47 ##read config file

Subscribers

People subscribed via source and target branches