Hey John -
The table behaves so much better now!

I of course have found a bug though.. you can still change the size of the non-scaled columns - i.e. I can drag and make the icon columns larger... I figure that's a slightly different problem, but if you're already in that code...

I tried to resize a fixed-width column in Thunderbird and what it does is move the column, resizing the column to the left of the current column as if you had dragged the left side of the column rather than the right. It's a nice effect.

Alec

[email protected] wrote:
[commits] (john) [10342] Update Chandler Makefile for wx 42

Diff

Modified: trunk/chandler/Makefile (10341 => 10342)

--- trunk/chandler/Makefile	2006-04-19 14:24:14 UTC (rev 10341)
+++ trunk/chandler/Makefile	2006-04-19 16:08:23 UTC (rev 10342)
@@ -38,7 +38,7 @@
          $(CHANDLERARCHIVES)/PyLucene-$(SNAP)-2.0rc1-5-$(BP)1.tar.gz \
          $(CHANDLERARCHIVES)/python-$(SNAP)-2.4.2-$(BP)4.tar.gz \
          $(CHANDLERARCHIVES)/twisted-$(SNAP)-r15399-$(BP)1.tar.gz \
-         $(CHANDLERARCHIVES)/wxPython-$(SNAP)-2.6.2.0-$(BP)41.tar.gz \
+         $(CHANDLERARCHIVES)/wxPython-$(SNAP)-2.6.2.0-$(BP)42.tar.gz \
          $(CHANDLERARCHIVES)/zopeinterface-$(SNAP)-3.1.0c1-$(BP)1.tar.gz \
          $(CHANDLERARCHIVES)/dateutil-$(SNAP)-1.1-$(BP)1.tar.gz \
          $(CHANDLERARCHIVES)/vobject-$(SNAP)-0.3.0-r139-$(BP)2.tar.gz \

Modified: trunk/chandler/application/Utility.py (10341 => 10342)

--- trunk/chandler/application/Utility.py	2006-04-19 14:24:14 UTC (rev 10341)
+++ trunk/chandler/application/Utility.py	2006-04-19 16:08:23 UTC (rev 10342)
@@ -22,7 +22,7 @@
 # with your name (and some helpful text). The comment's really there just to
 # cause Subversion to warn you of a conflict when you update, in case someone 
 # else changes it at the same time you do (that's why it's on the same line).
-SCHEMA_VERSION = "182" # alecf: got rid of selectedItemToView
+SCHEMA_VERSION = "183" # john: update Table and Column schema
 
 logger = None # initialized in initLogging()
 

Modified: trunk/chandler/parcels/osaf/framework/blocks/ControlBlocks.py (10341 => 10342)

--- trunk/chandler/parcels/osaf/framework/blocks/ControlBlocks.py	2006-04-19 14:24:14 UTC (rev 10341)
+++ trunk/chandler/parcels/osaf/framework/blocks/ControlBlocks.py	2006-04-19 16:08:23 UTC (rev 10342)
@@ -202,10 +202,11 @@
     kind = schema.One(schema.Kind, doc="The Kind used "
                       "for 'kind' columns")
 
-    width = schema.One(schema.Integer, required=True,
+    width = schema.One(schema.Integer,  defaultValue = 20,
                        doc="The width of the column, "
                        "relative to other columns")
 
+    scaleColumn = schema.One(schema.Boolean, defaultValue = False)
     readOnly = schema.One(schema.Boolean, initialValue=False)
     
     schema.addClouds(

Modified: trunk/chandler/parcels/osaf/framework/blocks/Table.py (10341 => 10342)

--- trunk/chandler/parcels/osaf/framework/blocks/Table.py	2006-04-19 14:24:14 UTC (rev 10341)
+++ trunk/chandler/parcels/osaf/framework/blocks/Table.py	2006-04-19 16:08:23 UTC (rev 10342)
@@ -16,7 +16,7 @@
     IgnoreSynchronizeWidget
     )
 
-from ControlBlocks import Column, columnType
+from ControlBlocks import Column
 
 import Styles
 import DragAndDrop
@@ -102,13 +102,6 @@
         self.EnableDragCell(True)
         self.DisableDragRowSize()
         self.SetDefaultCellBackgroundColour(wx.WHITE)
-        """
-          Big fat hack. Since the grid is a scrolled window we set a border equal to the size
-        of the scrollbar so the scroll bars won't show. Instead we should consider modifying
-        grid adding a new style for not showing scrollbars.  Bug #2375
-        """
-        self.SetMargins(-wx.SystemSettings_GetMetric(wx.SYS_VSCROLL_X),
-                        -wx.SystemSettings_GetMetric(wx.SYS_HSCROLL_Y))
         self.EnableCursor (False)
         background = "" (wx.SYS_COLOUR_HIGHLIGHT)
         self.SetLightSelectionBackground()
@@ -257,33 +250,13 @@
 
     @WithoutSynchronizeWidget
     def OnSize(self, event):
-        size = event.GetSize()
-        widthMinusLastColumn = 0
-
-        assert self.GetNumberCols() > 0, "We're assuming that there is at least one column"
-        lastColumnIndex = self.GetNumberCols() - 1
-        for column in xrange (lastColumnIndex):
-            widthMinusLastColumn += self.GetColSize (column)
-        lastColumnWidth = size.width - widthMinusLastColumn
-        """
-          This is a temporary fix to get around an apparent bug in
-          grids.  We only want to adjust for scrollbars if they
-          are present.  The -2 is a hack, without which the
-          sidebar will grow indefinitely when resizing the window.
-        """
-        if (self.GetSize() == self.GetVirtualSize()):
-            lastColumnWidth = lastColumnWidth - 2
-        else:
-            lastColumnWidth = lastColumnWidth - wx.SystemSettings_GetMetric(wx.SYS_VSCROLL_X) - 1
-        if lastColumnWidth > 0:
-            self.SetColSize (lastColumnIndex, lastColumnWidth)
-            self.ForceRefresh()
+        # Don't call SynchronizeWidget when we're resising the window
         event.Skip()
 
     @WithoutSynchronizeWidget
     def OnColumnDrag(self, event):
-        columnIndex = event.GetRowOrCol()
-        self.blockItem.columns[columnIndex].width = self.GetColSize (columnIndex)
+        for index, column in enumerate(self.blockItem.columns):
+            column.width = self.GetColSize (index)
 
     def OnItemDrag(self, event):
 
@@ -412,7 +385,14 @@
         assert (self.GetNumberCols() == gridTable.GetNumberCols() and
                 self.GetNumberRows() == gridTable.GetNumberRows())
 
-        self.UpdateColumnWidths(newColumns)
+        # Update column widths
+
+        for index, column in enumerate(self.blockItem.columns):
+            self.SetColSize (index, column.width)
+            self.ScaleColumn (index, column.scaleColumn)
+
+        self.ScaleWidthToFit (self.blockItem.scaleWidthsToFit)
+
         self.UpdateSelection(newColumns)
         self.EndBatch()
 
@@ -422,21 +402,6 @@
         self.ProcessTableMessage (message)
         self.ForceRefresh () 
 
-    def UpdateColumnWidths(self, columns):
-        # update all column widths but the last one
-        widthMinusLastColumn = 0
-        for columnIndex in xrange (columns - 1):
-            widthMinusLastColumn += self.blockItem.columns[columnIndex].width
-            self.SetColSize (columnIndex, self.blockItem.columns[columnIndex].width)
-
-        # update the last column to fill the rest of the widget
-        remaining = self.GetSize().width - widthMinusLastColumn
-        # Adjust for scrollbar if it is present
-        if (self.GetSize() != self.GetVirtualSize()):
-            remaining = remaining - wx.SystemSettings_GetMetric(wx.SYS_VSCROLL_X) - 1
-        if remaining > 0:
-            self.SetColSize(columns - 1, remaining)
-    
     def UpdateSelection(self, columns):
         """
         Update the grid's selection based on the collection's selection.
@@ -696,6 +661,7 @@
     characterStyle = schema.One(Styles.CharacterStyle)
     headerCharacterStyle = schema.One(Styles.CharacterStyle)
     hasGridLines = schema.One(schema.Boolean, initialValue = False)
+    scaleWidthsToFit = schema.One(schema.Boolean, defaultValue = False)
 
     schema.addClouds(
         copying = schema.Cloud(

Modified: trunk/chandler/parcels/osaf/views/cpiatest/mainblocks.py (10341 => 10342)

--- trunk/chandler/parcels/osaf/views/cpiatest/mainblocks.py	2006-04-19 14:24:14 UTC (rev 10341)
+++ trunk/chandler/parcels/osaf/views/cpiatest/mainblocks.py	2006-04-19 16:08:23 UTC (rev 10342)
@@ -40,11 +40,11 @@
     Sidebar = SidebarBlock.template(
         'Sidebar',
         characterStyle = globalBlocks.SidebarRowStyle,
-        columns = [
-            Column.update(parcel, 'SidebarColName',
-                          heading = u'',
-                          attributeName = u'displayName')],
-
+        columns = [Column.update(parcel, 'SidebarColName',
+                                 heading = u'',
+                                 scaleColumn = True,
+                                 attributeName = u'displayName')],
+        scaleWidthsToFit = True,
         border = RectType(0, 0, 4, 0),
         editRectOffsets = [17, -17, 0],
         buttons = [IconButton, SharingButton],

Modified: trunk/chandler/parcels/osaf/views/main/mainblocks.py (10341 => 10342)

--- trunk/chandler/parcels/osaf/views/main/mainblocks.py	2006-04-19 14:24:14 UTC (rev 10341)
+++ trunk/chandler/parcels/osaf/views/main/mainblocks.py	2006-04-19 16:08:23 UTC (rev 10342)
@@ -48,11 +48,12 @@
     Sidebar = SidebarBlock.template(
         'Sidebar',
         characterStyle = globalBlocks.SidebarRowStyle,
-        columns = [
-            Column.update(parcel, 'SidebarColName',
-                          heading = u'',
-                          attributeName = u'displayName')],
+        columns = [Column.update(parcel, 'SidebarColName',
+                                 heading = u'',
+                                 scaleColumn = True,
+                                 attributeName = u'displayName')],
                           
+        scaleWidthsToFit = True,
         border = RectType(0, 0, 4, 0),
         editRectOffsets = [17, -17, 0],
         buttons = [IconButton, SharingButton],

Modified: trunk/chandler/parcels/osaf/views/main/summaryblocks.py (10341 => 10342)

--- trunk/chandler/parcels/osaf/views/main/summaryblocks.py	2006-04-19 14:24:14 UTC (rev 10341)
+++ trunk/chandler/parcels/osaf/views/main/summaryblocks.py	2006-04-19 16:08:23 UTC (rev 10342)
@@ -33,6 +33,7 @@
         childrenBlocks = [
             DashboardBlock.template('TableSummaryView',
                 contents = pim_ns.allCollection,
+                scaleWidthsToFit = True,
                 columns = [
                     Column.update(parcel, 'SumColTask',
                                   heading = _(u'T'),
@@ -50,11 +51,13 @@
                                   heading = _(u'Who'),
                                   attributeName = 'who',
                                   width = 130,
+                                  scaleColumn = True,
                                   readOnly = True),
                     Column.update(parcel, 'SumColAbout',
                                   heading = _(u'Title'),
                                   attributeName = 'about',
-                                  width = 130),
+                                  width = 130,
+                                  scaleColumn = True),
                     Column.update(parcel, 'SumColCalendarEvent',
                                   heading = _(u'E'),
                                   valueType = 'kind',
@@ -65,6 +68,7 @@
                                   heading = _(u'Date'),
                                   attributeName = 'date',
                                   width = 130,
+                                  scaleColumn = True,
                                   readOnly = True),
                     Column.update(parcel, 'SumColTriage',
                                   heading = _(u'Triage'),

  

_______________________________________________ Commits mailing list [email protected] http://lists.osafoundation.org/mailman/listinfo/commits



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Open Source Applications Foundation "chandler-dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/chandler-dev

Reply via email to