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
=== modified file 'clicompanionlib/tabs.py'
--- clicompanionlib/tabs.py 2011-03-21 18:04:14 +0000
+++ clicompanionlib/tabs.py 2011-03-25 12:03:30 +0000
@@ -34,6 +34,9 @@
34#definition gcp - how many pages is visible34#definition gcp - how many pages is visible
35gcp=0;35gcp=0;
3636
37#definition nop - (no of pages) reflects no of terminal tabs left (some may be closed by the user)
38nop=0;
39
37class Tabs(object):40class Tabs(object):
38 '''41 '''
39 add a new terminal in a tab above the current terminal42 add a new terminal in a tab above the current terminal
@@ -56,10 +59,12 @@
56 #notebook.set_show_border(True)59 #notebook.set_show_border(True)
57 60
58 global gcp61 global gcp
62 global nop
63 nop += 1
59 gcp += 164 gcp += 1
60 pagenum = ('Tab %d') % gcp65 pagenum = ('Tab %d') % gcp
61 if gcp > 1:66 if nop > 1:
62 notebook.set_show_tabs(True)67 notebook.set_show_tabs(True)
63 box = gtk.HBox()68 box = gtk.HBox()
64 label = gtk.Label(pagenum)69 label = gtk.Label(pagenum)
65 box.pack_start(label, True, True)70 box.pack_start(label, True, True)
@@ -93,7 +98,12 @@
93 ## get the page number of the tab we wanted to close98 ## get the page number of the tab we wanted to close
94 pagenum = notebook.page_num(widget)99 pagenum = notebook.page_num(widget)
95 ## and close it100 ## and close it
96 notebook.remove_page(pagenum) 101 notebook.remove_page(pagenum)
102 global nop
103 nop -= 1
104 if nop <= 1:
105 notebook.set_show_tabs(False)
106
97 107
98 def update_term_config(self, _vte):108 def update_term_config(self, _vte):
99 ##read config file109 ##read config file

Subscribers

People subscribed via source and target branches