dabo Commit
Revision 2411
Date: 2006-10-31 08:25:15 -0800 (Tue, 31 Oct 2006)
Author: ed

Changed:
U   trunk/dabo/ui/uiwx/dEditor.py
U   trunk/dabo/ui/uiwx/dListControl.py
U   trunk/dabo/ui/uiwx/dPemMixin.py
U   trunk/dabo/ui/uiwx/dRadioList.py

Log:
Added the method 'showContainingPage()' to dPemMixin. Calling this on any 
object will cause any pageframe-type controls inside of which the object is 
contained to switch their selected page to the one containing the object. This 
is recursive, so that even in pageframe-within-pageframe scenarios, the object 
will end up being visible.

Added auto-sizing of columns to dListControl. Added get/setItemForeColor() 
methods; it already had the get/setItemBackColor() methods.

Added the method 'showCurrentLine()' to dEditor. This will scroll the editor so 
that the specified line is visible.

Fixed a minor bug in dRadioList that happened if you instantiated it with 
ShowBox=False passed to the constructor.


Diff:
Modified: trunk/dabo/ui/uiwx/dEditor.py
===================================================================
--- trunk/dabo/ui/uiwx/dEditor.py       2006-10-31 15:48:38 UTC (rev 2410)
+++ trunk/dabo/ui/uiwx/dEditor.py       2006-10-31 16:25:15 UTC (rev 2411)
@@ -424,6 +424,11 @@
                return ret
                
 
+       def showCurrentLine(self):
+               """Scrolls the editor so that the current position is 
visible."""
+               self.EnsureCaretVisible()
+               
+               
        def OnNeedShown(self, evt):
                """ Called when the user deletes a hidden header line."""
                # We expand the previously folded text, but it may be better
@@ -1618,6 +1623,7 @@
 
        def _setLineNumber(self, val):
                self.GotoLine(val)
+               self.EnsureCaretVisible()
 
 
        def _getLineCount(self):

Modified: trunk/dabo/ui/uiwx/dListControl.py
===================================================================
--- trunk/dabo/ui/uiwx/dListControl.py  2006-10-31 15:48:38 UTC (rev 2410)
+++ trunk/dabo/ui/uiwx/dListControl.py  2006-10-31 16:25:15 UTC (rev 2411)
@@ -116,9 +116,31 @@
        
        def setColumnWidth(self, col, wd):
                """Sets the width of the specified column."""
-               self.SetColumnWidth(col, wd)
+               if isinstance(wd, basestring):
+                       self.autoSizeColumn(col)
+               else:
+                       self.SetColumnWidth(col, wd)
+       
+       
+       def autoSizeColumn(self, col):
+               """Auto-sizes the specified column."""
+               self.lockDisplay()
+               self.SetColumnWidth(col, wx.LIST_AUTOSIZE)
+               wd = self.GetColumnWidth(col)
+               self.SetColumnWidth(col, wx.LIST_AUTOSIZE_USEHEADER)
+               if self.GetColumnWidth(col) < wd:
+                       self.SetColumnWidth(col, wd)
+               self.unlockDisplay()
+               
 
+       def autoSizeColumns(self, colList=None):
+               """Auto-sizes all the columns."""
+               if colList is None:
+                       colList = range(self.ColumnCount)
+               for col in colList:
+                       self.autoSizeColumn(col)
 
+
        def append(self, tx, col=0, row=None):
                """ Appends a row with the associated text in the specified 
column.
                If the value for tx is a list/tuple, the values will be set in 
the columns
@@ -208,10 +230,12 @@
        def setItemData(self, item, data):
                """ Associate some data with the item. """
                return self.SetItemData(item, data)
-
+               
+               
        def getItemData(self, item):
                """ Retrieve the data associated with the item. """
                return self.GetItemData(item)
+               
 
        # Image-handling function
        def addImage(self, img, key=None):
@@ -263,6 +287,18 @@
                self.SetItemBackgroundColour(itm, color)
                
        
+       def getItemForeColor(self, itm):
+               return self.GetItemTextColour(itm)
+
+
+       def setItemForeColor(self, itm, val):
+               if isinstance(val, basestring):
+                       color = dabo.dColors.colorTupleFromName(val)
+               else:
+                       color = val
+               self.SetItemTextColour(itm, color)
+               
+       
        def __onActivation(self, evt):
                self._hitIndex = evt.GetIndex()
                # Call the default Hit code
@@ -418,13 +454,10 @@
                        _("Number of columns in the control (read-only).  
(int)") )
 
        Count = property(_getRowCount, None, None, 
-                       _("""Number of rows in the control (read-only).  (int)
+                       _("Number of rows in the control (read-only). Alias for 
RowCount  (int)"))
 
-                               This is an alias for RowCount."""))
-
        HeaderVisible = property(_getHeaderVisible, _setHeaderVisible, None, 
                        _("Specifies whether the header is shown or not."))
-       DynamicHeaderVisible = makeDynamicProperty(HeaderVisible)
 
        HitIndex = property(_getHitIndex, None, None,
                        _("Returns the index of the last hit item."))
@@ -457,7 +490,7 @@
                        _("Specifies whether light rules are drawn between 
rows."))
 
 
-
+       DynamicHeaderVisible = makeDynamicProperty(HeaderVisible)
        DynamicHorizontalRules = makeDynamicProperty(HorizontalRules)
        DynamicMultipleSelect = makeDynamicProperty(MultipleSelect)
        DynamicValue = makeDynamicProperty(Value)

Modified: trunk/dabo/ui/uiwx/dPemMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dPemMixin.py     2006-10-31 15:48:38 UTC (rev 2410)
+++ trunk/dabo/ui/uiwx/dPemMixin.py     2006-10-31 16:25:15 UTC (rev 2411)
@@ -730,6 +730,17 @@
                self.Lower()
        
        
+       def showContainingPage(self):
+               """If this object is inside of any paged control, it will force 
all containing
+               paged controls to switch to the page that contains this object.
+               """
+               cntnr = self
+               while cntnr and not isinstance(cntnr, dabo.ui.dForm):
+                       if isinstance(cntnr, dabo.ui.dPage):
+                               cntnr.Parent.SelectedPage = cntnr
+                       cntnr = cntnr.Parent
+       
+       
        def addObject(self, classRef, Name=None, *args, **kwargs):
                """ Instantiate object as a child of self.
                

Modified: trunk/dabo/ui/uiwx/dRadioList.py
===================================================================
--- trunk/dabo/ui/uiwx/dRadioList.py    2006-10-31 15:48:38 UTC (rev 2410)
+++ trunk/dabo/ui/uiwx/dRadioList.py    2006-10-31 16:25:15 UTC (rev 2411)
@@ -404,6 +404,9 @@
                        if val != self._showBox:
                                self._showBox = val
                                fromSz = self.Sizer
+                               if fromSz is None:
+                                       # Control hasn't been constructed yet
+                                       return
                                parent = fromSz.Parent
                                isInSizer = fromSz.ControllingSizer is not None
                                if isInSizer:




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Reply via email to