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

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

Description of the change

Fixes the bug https://bugs.launchpad.net/clicompanion/+bug/742394.
All the details of the bug is given in the launchpad bug.

How I fixed:
Added a new global variable nop (no of pages), which will keep track of how many tabs are there in the open state. Used logic to hide the tabs when it is <=1 and show when it is >1..

All changes in tabs.py..

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

bdfhjk included these changes in his merge:

lp:~bdfhjk/clicompanion/fix-739402

So I merged that branch.

Great work simar!

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-25 12:03:30 +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,12 @@
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
41 def update_term_config(self, _vte):
42 ##read config file

Subscribers

People subscribed via source and target branches