changeset 194:6198be95a39c

browser side: new tab is automatically selected, if a tab is removed, the last one is automatically selected bug 6 (additionnal comment)
author Goffi <goffi@goffi.org>
date Mon, 04 Mar 2013 00:19:03 +0100
parents f2ae8e170c49
children dd27072d8ae0
files browser_side/panels.py libervia.py
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/browser_side/panels.py	Mon Mar 04 00:01:23 2013 +0100
+++ b/browser_side/panels.py	Mon Mar 04 00:19:03 2013 +0100
@@ -1060,10 +1060,13 @@
     def onWidgetPanelRemove(self, panel):
         """ Called when a child WidgetsPanel is empty and need to be removed """
         self.remove(panel)
-        if self.getWidgetCount() == 1:
+        widgets_count = self.getWidgetCount()
+        if widgets_count == 1:
             self.tabBar.setVisible(False)
             self.host.resize()
             self.selectTab(0)
+        else:
+            self.selectTab(widgets_count - 1)
         
 class MainPanel(AbsolutePanel):
 
--- a/libervia.py	Mon Mar 04 00:01:23 2013 +0100
+++ b/libervia.py	Mon Mar 04 00:19:03 2013 +0100
@@ -229,6 +229,7 @@
         _widgets_panel = WidgetsPanel(self)
         _widgets_panel.addWidget(wid)
         self.tab_panel.add(_widgets_panel, label)
+        self.tab_panel.selectTab(self.tab_panel.getWidgetCount() - 1)
 
     def _isRegisteredCB(self, registered):
         if not registered: