changeset 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 3029e3fdbd40
children 8d2c7be09eef
files browser_side/panels.py public/libervia.css
diffstat 2 files changed, 11 insertions(+), 8 deletions(-) [+]
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()
 
--- a/public/libervia.css	Mon Jun 27 12:40:40 2011 +0200
+++ b/public/libervia.css	Mon Jun 27 16:46:31 2011 +0200
@@ -539,7 +539,7 @@
     vertical-align: top;
 }
 
-.widgetsPanel > table {
+.widgetsPanel > div > table {
     border-collapse: separate !important;
     border-spacing: 7px;
 }
@@ -629,6 +629,7 @@
 	background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ccc)); 
 	background: -moz-linear-gradient(top, #fff, #ccc); 
 	background-image: -o-linear-gradient(#fff,#ccc); 	
+	min-height: 100px;
 }
 
 /* BorderWidgets */