Changeset 2648

Show
Ignore:
Timestamp:
01/10/07 18:49:33 (2 years ago)
Author:
ed
Message:

Changed the shortcut to remove the font zoom to Ctrl-/, as per Paul.

Fixed a bug in the decreaseFontSize() method in dGrid.

Fixed dTreeView so that the font zoom function work with the nodes. Also created the 'refreshDisplay()' method that causes the tree to resize its nodes properly; sort of like layout() does with sizers.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dabo/ui/uiwx/dGrid.py

    r2633 r2648  
    543543        if val is None: 
    544544            val = -1 
     545        else: 
     546            val = -1 * val 
    545547        self._changeFontSize(val) 
    546548    def _changeFontSize(self, val): 
  • trunk/dabo/ui/uiwx/dTreeView.py

    r2646 r2648  
    116116        self.tree.SetItemFont(self.itemID, val._nativeFont) 
    117117        val.bindEvent(dabo.dEvents.FontPropertiesChanged, self._onFontPropsChanged) 
     118        dabo.ui.callAfterInterval(100, self.tree.refreshDisplay) 
    118119 
    119120     
     
    126127    def _setFontBold(self, val): 
    127128        self.Font.Bold = val 
     129        dabo.ui.callAfterInterval(100, self.tree.refreshDisplay) 
    128130 
    129131 
     
    150152    def _setFontItalic(self, val): 
    151153        self.Font.Italic = val 
     154        dabo.ui.callAfterInterval(100, self.tree.refreshDisplay) 
    152155 
    153156     
     
    160163    def _setFontFace(self, val): 
    161164        self.Font.Face = val 
     165        dabo.ui.callAfterInterval(100, self.tree.refreshDisplay) 
    162166 
    163167     
     
    170174    def _setFontSize(self, val): 
    171175        self.Font.Size = val 
     176        dabo.ui.callAfterInterval(100, self.tree.refreshDisplay) 
    172177     
    173178     
     
    180185    def _setFontUnderline(self, val): 
    181186        self.Font.Underline = val 
     187        dabo.ui.callAfterInterval(100, self.tree.refreshDisplay) 
    182188 
    183189 
     
    198204    def _setImg(self, key): 
    199205        return self.tree.setNodeImg(self, key) 
     206        dabo.ui.callAfterInterval(100, self.tree.refreshDisplay) 
    200207         
    201208         
     
    322329        self._nodeClass = dNode 
    323330         
    324         style = self._extractKey((properties, kwargs), "style", 0) 
     331        style = self._extractKey((properties, kwargs), "style", 0) | wx.TR_HAS_VARIABLE_ROW_HEIGHT 
    325332        # Default to showing buttons 
    326333        val = self._extractKey((properties, kwargs), "ShowButtons", True) 
     
    396403        self.DeleteAllItems() 
    397404        self.nodes = [] 
     405     
     406     
     407    def refreshDisplay(self): 
     408        """Changing some node appearance properties requires that the tree be  
     409        collapsed and re-opened in order to update any sizing issues. 
     410        """ 
     411        self.lockDisplay() 
     412        ndExp = [(nd, nd.Expanded) for nd in self.nodes] 
     413        self.collapseAll() 
     414        for nd, exp in ndExp: 
     415            nd.Expanded = exp 
     416        self.unlockDisplay() 
    398417 
    399418     
     
    749768 
    750769 
     770    def increaseFontSize(self, val=None): 
     771        """Increase the font size by the specified amount for all nodes.""" 
     772        if val is None: 
     773            val = 1 
     774        self._changeFontSize(val) 
     775    def decreaseFontSize(self, val=None): 
     776        if val is None: 
     777            val = -1 
     778        else: 
     779            val = -1 * val 
     780        self._changeFontSize(val) 
     781    def _changeFontSize(self, val): 
     782        for nd in self.nodes: 
     783            try: 
     784                nd.FontSize += val 
     785            except PyAssertionError: 
     786                # This catches invalid point sizes 
     787                pass 
     788        if self.Form is not None: 
     789            dabo.ui.callAfterInterval(200, self.Form.layout) 
     790 
     791 
    751792    def treeFromStructure(self, stru, topNode=None): 
    752793        """Given a sequence of items with a standard format,  
  • trunk/dabo/ui/uiwx/uiApp.py

    r2647 r2648  
    185185        plus = (char == "=") or (char == "+") or (kcd == wx.WXK_NUMPAD_ADD) 
    186186        minus = (char == "-") or (kcd == wx.WXK_NUMPAD_SUBTRACT) 
    187         zero = (char == "0") or (kcd == wx.WXK_NUMPAD0
    188         if not (plus or minus or zero): 
     187        slash = (char == "/") or (kcd == wx.WXK_NUMPAD_DIVIDE
     188        if not (plus or minus or slash): 
    189189            evt.Skip() 
    190190            return