Mercurial > libervia-web
diff browser_side/panels.py @ 88:50b480fd0605
browser side: widgetsPanel is now scrollable when there are too many widgets, and widgets have a minimum size
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 27 Jun 2011 16:46:31 +0200 |
parents | 6c3b3254605f |
children | 8d2c7be09eef |
line wrap: on
line diff
--- a/browser_side/panels.py Mon Jun 27 12:40:40 2011 +0200 +++ b/browser_side/panels.py Mon Jun 27 16:46:31 2011 +0200 @@ -114,11 +114,11 @@ if not isinstance(_new_panel, LiberviaWidget): print ('WARNING: droping an object which is not a class of LiberviaWidget') _flextable = self.getParent() - _widgetpanel = _flextable.getParent() + _widgetspanel = _flextable.getParent().getParent() row_idx, cell_idx = self._getCellAndRow(_flextable, event) if self.host.selected == self: self.host.select(None) - _widgetpanel.changeWidget(row_idx, cell_idx, _new_panel) + _widgetspanel.changeWidget(row_idx, cell_idx, _new_panel) """_unempty_panels = filter(lambda wid:not isinstance(wid,EmptyWidget),list(_flextable)) _width = 90/float(len(_unempty_panels) or 1) #now we resize all the cell of the column @@ -174,8 +174,8 @@ def onClose(self, sender): print "onClose:", sender - _widgetpanel = self.getParent().getParent() - _widgetpanel.removeWidget(self) + _widgetspanel = self.getParent().getParent().getParent() + _widgetspanel.removeWidget(self) def setTitle(self, text): """change the title in the header of the widget @@ -649,14 +649,15 @@ if game_type=="Tarot": return self.tarot_panel -class WidgetsPanel(SimplePanel): +class WidgetsPanel(ScrollPanelWrapper): def __init__(self, host): - SimplePanel.__init__(self) + ScrollPanelWrapper.__init__(self) + self.setSize('100%', '100%') self.host = host self.flextable = FlexTable() self.flextable.setSize('100%','100%') - self.add(self.flextable) + self.setWidget(self.flextable) self.setStyleName('widgetsPanel') _bottom = BottomBorderWidget(self.host) self.flextable.setWidget(0, 0, _bottom) #There will be always an Empty widget on the last row, @@ -672,6 +673,7 @@ except: print "ERROR: Trying to change an unexisting widget !" return + cellFormatter = self.flextable.getFlexCellFormatter()