changeset 656:4dbd99de3aaa frontends_multi_profiles

browser_side: only display "+" button when the tab bar contains only 1 tab, and display it over the contact list to not use vertical space
author souliane <souliane@mailoo.org>
date Fri, 27 Feb 2015 13:00:04 +0100
parents 048401e5c506
children 0b7e4226378d
files src/browser/public/libervia.css src/browser/sat_browser/libervia_widget.py
diffstat 2 files changed, 22 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/public/libervia.css	Fri Feb 27 02:41:11 2015 +0100
+++ b/src/browser/public/libervia.css	Fri Feb 27 13:00:04 2015 +0100
@@ -1155,6 +1155,21 @@
     z-index: 10;
 }
 
+.mainPanel .gwt-TabBar-oneTab {
+    position: fixed;
+    left: 0px;
+    bottom: 0px;
+    border: none;
+}
+
+.mainPanel .gwt-TabBar-oneTab .gwt-TabBarItem-wrapper {
+    display: none;
+}
+
+.mainPanel .gwt-TabBar-oneTab .gwt-TabBarItem-wrapper:nth-child(3) {
+    display: block;
+}
+
 .liberviaTabPanel {
     width: 100%;
     height: 100%;
--- a/src/browser/sat_browser/libervia_widget.py	Fri Feb 27 02:41:11 2015 +0100
+++ b/src/browser/sat_browser/libervia_widget.py	Fri Feb 27 13:00:04 2015 +0100
@@ -750,8 +750,8 @@
         ClickHandler.__init__(self)
         self.host = host
         self.setStyleName('liberviaTabPanel')
-
-        self.tabBar.addTab(u'✚', True)
+        self.tabBar.addTab(u'✚', asHTML=True)
+        self.tabBar.addStyleDependentName('oneTab')
 
     def onTabSelected(self, sender, tabIndex):
         if tabIndex < self.getWidgetCount():
@@ -762,7 +762,7 @@
         try:
             label = Window.prompt(_(u'Name of the new tab'), default_label)
             if not label:
-                label = default_label
+                return  # empty label or user pressed "cancel"
         except:  # this happens when the user prevents the page to open the prompt dialog
             label = default_label
         self.addWidgetsTab(label, select=True)
@@ -782,6 +782,8 @@
         @param select (bool): True to select the added tab
         """
         TabPanel.add(self, widget, DropTab(self, label), False)
+        if self.getWidgetCount() > 1:
+            self.tabBar.removeStyleDependentName('oneTab')
         if select:
             self.selectTab(self.getWidgetCount() - 1)
 
@@ -804,6 +806,6 @@
         widget_index = self.getWidgetIndex(panel)
         self.remove(panel)
         widgets_count = self.getWidgetCount()
+        if widgets_count == 1:
+            self.tabBar.addStyleDependentName('oneTab')
         self.selectTab(widget_index if widget_index < widgets_count else widgets_count - 1)
-
-