Changeset 4337

Show
Ignore:
Timestamp:
08/02/08 16:56:05 (4 months ago)
Author:
ed
Message:

Fixed a problem when copying/saving labels. The AutoResize? was changing the Width, causing it to be saved, which prevents AutoResize? from working properly after that. With this change, the Width and Height are not copied or saved if AutoResize? is True and it matches the fontMetric.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ide/ClassDesignerComponents.py

    r4198 r4337  
    146146                    "Height") and self.ControllingSizer.getItemProp(self, "Expand"): 
    147147                continue 
     148            if isinstance(self, dabo.ui.dLabel) and prop in ("Width", "Height"): 
     149                # Don't copy the size if AutoSize=True and the width is close to the default size. 
     150                if self.AutoResize: 
     151                    defWd, defHt = dabo.ui.fontMetric(wind=self) 
     152                    isDefaultSize = False 
     153                    if prop == "Width": 
     154                        isDefaultSize = (abs(self.Width - defWd) <= 1) 
     155                    elif prop == "Height": 
     156                        isDefaultSize = (abs(self.Height - defHt) <= 1) 
     157                    if isDefaultSize: 
     158                        # ignore it. 
     159                        continue 
    148160            if prop == "BackColor" and isinstance(self, (LayoutPanel, LayoutSpacerPanel)): 
    149161                continue