Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Kaufmann <humitos@gmail.com>2012-10-12 13:01:18 (GMT)
committer Manuel QuiƱones <manuq@laptop.org>2012-10-12 18:41:04 (GMT)
commitf96776a4705e0b131d34c1a519b92615c97cf980 (patch)
tree651211c1d2b7005a092b95f402419683ad461a0d
parentb0c0ba9af7f025cb55d8ece733f843866b85bec2 (diff)
New layout of tabs SL #3560
When Browse starts it shows just one tab sized half of the whole canvas. Every time a new tab is added they are resized and expanded over the full canvas width to make them fit. Once the 9th[1] tab is reached, all of them keep the same size and two buttons are added to be able to scroll over them. [1] this decision was taken here 959f86e0406914267047dc10302f98a059b6ba21 Signed-off-by: Manuel Kaufmann <humitos@gmail.com> Acked-by: Manuel QuiƱones <manuq@laptop.org>
-rw-r--r--browser.py30
1 files changed, 14 insertions, 16 deletions
diff --git a/browser.py b/browser.py
index 8b3463a..472d83b 100644
--- a/browser.py
+++ b/browser.py
@@ -249,29 +249,27 @@ class TabbedView(BrowserNotebook):
tab_page.destroy()
def _update_tab_sizes(self):
- """Update ta widths based in the amount of tabs."""
+ """Update tab widths based in the amount of tabs."""
n_pages = self.get_n_pages()
canvas_size = self.get_allocation()
- # FIXME
- # overlap_size = self.style_get_property('tab-overlap') * n_pages - 1
- overlap_size = 0
- allowed_size = canvas_size.width - overlap_size
-
- tab_new_size = int(allowed_size * 1.0 / (n_pages + 1))
- # Four tabs ensured:
- tab_max_size = int(allowed_size * 1.0 / (5))
- # Eight tabs ensured:
- tab_min_size = int(allowed_size * 1.0 / (9))
-
- if tab_new_size < tab_min_size:
- tab_new_size = tab_min_size
- elif tab_new_size > tab_max_size:
- tab_new_size = tab_max_size
+ allowed_size = canvas_size.width
+ if n_pages == 1:
+ # use half of the whole space
+ tab_expand = False
+ tab_new_size = int(allowed_size / 2)
+ elif n_pages <= 8: # ensure eight tabs
+ tab_expand = True # use all the space available by tabs
+ tab_new_size = -1
+ else:
+ # scroll the tab toolbar if there are more than 8 tabs
+ tab_expand = False
+ tab_new_size = (allowed_size / 8)
for page_idx in range(n_pages):
page = self.get_nth_page(page_idx)
label = self.get_tab_label(page)
+ self.child_set_property(page, 'tab-expand', tab_expand)
label.update_size(tab_new_size)
def _update_closing_buttons(self):