Mercurial > libervia-web
comparison src/browser/sat_browser/libervia_widget.py @ 654:40c72f3b7638 frontends_multi_profiles
browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
author | souliane <souliane@mailoo.org> |
---|---|
date | Fri, 27 Feb 2015 02:39:43 +0100 |
parents | 0262fee86375 |
children | 4dbd99de3aaa |
comparison
equal
deleted
inserted
replaced
653:e1d067378ad3 | 654:40c72f3b7638 |
---|---|
744 | 744 |
745 class MainTabPanel(TabPanel, ClickHandler): | 745 class MainTabPanel(TabPanel, ClickHandler): |
746 """The panel managing the tabs""" | 746 """The panel managing the tabs""" |
747 | 747 |
748 def __init__(self, host): | 748 def __init__(self, host): |
749 TabPanel.__init__(self) | 749 TabPanel.__init__(self, FloatingTab=True) |
750 ClickHandler.__init__(self) | 750 ClickHandler.__init__(self) |
751 self.host = host | 751 self.host = host |
752 self.setStyleName('liberviaTabPanel') | 752 self.setStyleName('liberviaTabPanel') |
753 self.addStyleName('mainTabPanel') | |
754 Window.addWindowResizeListener(self) | |
755 | 753 |
756 self.tabBar.addTab(u'✚', True) | 754 self.tabBar.addTab(u'✚', True) |
757 | 755 |
758 def onTabSelected(self, sender, tabIndex): | 756 def onTabSelected(self, sender, tabIndex): |
759 if tabIndex < self.getWidgetCount(): | 757 if tabIndex < self.getWidgetCount(): |
774 | 772 |
775 @return: WidgetsPanel | 773 @return: WidgetsPanel |
776 """ | 774 """ |
777 return self.deck.visibleWidget | 775 return self.deck.visibleWidget |
778 | 776 |
779 def onWindowResized(self, width, height): | |
780 tab_panel_elt = self.getElement() | |
781 _elts = doc().getElementsByClassName('gwt-TabBar') | |
782 if not _elts.length: | |
783 log.error("no TabBar found, it should exist !") | |
784 tab_bar_h = 0 | |
785 else: | |
786 tab_bar_h = _elts.item(0).offsetHeight | |
787 ideal_height = height - DOM.getAbsoluteTop(tab_panel_elt) - tab_bar_h - 5 | |
788 ideal_width = width - DOM.getAbsoluteLeft(tab_panel_elt) - 5 | |
789 self.setWidth("%s%s" % (ideal_width, "px")) | |
790 self.setHeight("%s%s" % (ideal_height, "px")) | |
791 | |
792 def addTab(self, widget, label, select=False): | 777 def addTab(self, widget, label, select=False): |
793 """Create a new tab for the given widget. | 778 """Create a new tab for the given widget. |
794 | 779 |
795 @param widget (Widget): widget to associate to the tab | 780 @param widget (Widget): widget to associate to the tab |
796 @param label (unicode): label of the tab | 781 @param label (unicode): label of the tab |