dabo Commit
Revision 6230
Date: 2010-11-30 15:38:37 -0800 (Tue, 30 Nov 2010)
Author: Paul
Trac: http://trac.dabodev.com/changeset/6230
Changed:
U trunk/dabo/ui/uiwx/dGrid.py
Log:
Added dColumn.CellFontBold and DynamicCellFontBold. However, it isn't
displaying
on Linux. Left comments in place to tackle later.
Diff:
Modified: trunk/dabo/ui/uiwx/dGrid.py
===================================================================
--- trunk/dabo/ui/uiwx/dGrid.py 2010-11-30 23:23:25 UTC (rev 6229)
+++ trunk/dabo/ui/uiwx/dGrid.py 2010-11-30 23:38:37 UTC (rev 6230)
@@ -772,8 +772,20 @@
"""Called from all of the Cell property setters."""
## dynamic prop uses cellDynamicRow; reg prop uses
self.CurrentRow
row = getattr(self, "_cellDynamicRow", self.Parent.CurrentRow)
- cellAttr = self._gridCellAttrs.get(row,
self._gridColAttr.Clone())
- getattr(cellAttr, wxPropName)(*args, **kwargs)
+ cellAttr = obj = self._gridCellAttrs.get(row,
self._gridColAttr.Clone())
+ if "." in wxPropName:
+ # For instance, Font.SetWeight
+ subObject, wxPropName = wxPropName.split(".")
+ obj = getattr(cellAttr, subObject)
+ getattr(obj, wxPropName)(*args, **kwargs)
+
+ ## pkm 2010-11-30 : Tried to add CellFontBold, but it doesn't
show visually in the
+ ## grid no matter what I try. Commented code
below shows what I
+ ## attempted:
+ #cellAttr.Font = wx.Font(cellAttr.Font.PointSize,
cellAttr.Font.Family,
+ # cellAttr.Font.Style, cellAttr.Font.Weight,
cellAttr.Font.Underlined,
+ # cellAttr.Font.FaceName)
+ #cellAttr = cellAttr.Clone()
self._gridCellAttrs[row] = cellAttr
@@ -821,6 +833,24 @@
self._properties["CellBackColor"] = val
+ def _getCellFontBold(self):
+ row = self.Parent.CurrentRow
+ cellAttr = self._gridCellAttrs.get(row, False)
+ if cellAttr:
+ return cellAttr.GetFont().GetWeight() == wx.BOLD
+ return self.FontBold
+
+ def _setCellFontBold(self, val):
+ if self._constructed():
+ if val:
+ val = wx.FONTWEIGHT_BOLD
+ else:
+ val = wx.FONTWEIGHT_NORMAL
+ self._setCellProp("Font.SetWeight", val)
+ else:
+ self._properties["CellFontBold"] = val
+
+
def _getCellForeColor(self):
row = self.Parent.CurrentRow
cellAttr = self._gridCellAttrs.get(row, False)
@@ -1455,6 +1485,9 @@
CellBackColor = property(_getCellBackColor, _setCellBackColor, None,
_("Color for the background of the current cell in the
column."))
+ CellFontBold = property(_getCellFontBold, _setCellFontBold, None,
+ _("Specifies whether the current cell's font is
bold-faced."))
+
CellForeColor = property(_getCellForeColor, _setCellForeColor, None,
_("Color for the foreground (text) of the current cell
in the column."))
@@ -1520,7 +1553,7 @@
_("The font properties of the column's cells. (dFont)")
)
FontBold = property(_getFontBold, _setFontBold, None,
- _("Specifies if the cell font is bold-faced. (bool)") )
+ _("Specifies if the cell font (for all cells in the
column) is bold-faced. (bool)") )
FontDescription = property(_getFontDescription, None, None,
_("Human-readable description of the column's cell font
settings. (str)") )
@@ -1649,6 +1682,7 @@
DynamicBackColor = makeDynamicProperty(BackColor)
DynamicCaption = makeDynamicProperty(Caption)
DynamicCellBackColor = makeDynamicProperty(CellBackColor)
+ DynamicCellFontBold = makeDynamicProperty(CellFontBold)
DynamicCellForeColor = makeDynamicProperty(CellForeColor)
DynamicCustomEditorClass = makeDynamicProperty(CustomEditorClass)
DynamicCustomEditors = makeDynamicProperty(CustomEditors)
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]