Changeset 4080
- Timestamp:
- 05/12/08 06:42:49 (2 months ago)
- Files:
-
- trunk/dabo/ui/uiwx/dFormMixin.py (modified) (2 diffs)
- trunk/dabo/ui/uiwx/dPemMixin.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/dabo/ui/uiwx/dFormMixin.py
r4058 r4080 465 465 466 466 def saveSizeAndPosition(self): 467 """ Save the current size and position of this form. 468 """ 467 """ Save the current size and position of this form.""" 469 468 if self.Application: 470 469 if self.SaveRestorePosition and not self.TempForm: … … 473 472 self.Application.setUserSetting("%s.windowstate" % name, state) 474 473 475 if state == 'Normal':474 if state == "Normal": 476 475 # Don't save size and position when the window 477 476 # is minimized, maximized or fullscreen because 478 477 # windows doesn't supply correct value if the window 479 # is in one of these sta es.478 # is in one of these states. 480 479 pos = self.Position 481 480 size = self.Size 482 483 481 self.Application.setUserSetting("%s.left" % name, pos[0]) 484 482 self.Application.setUserSetting("%s.top" % name, pos[1]) trunk/dabo/ui/uiwx/dPemMixin.py
r4072 r4080 1675 1675 1676 1676 1677 def _uniqueNameForParent(self, name, parent=None): 1678 """Takes a given name and ensures that it is unique among the existing child 1679 objects of the specified parent container. If no parent is specified, self.Parent 1680 is assumed. Returns either the original name, if it is unique, or the name with 1681 a numeric suffix that will make it unique. 1682 """ 1683 if parent is None: 1684 parent = self.Parent 1685 i = 0 1686 nameError = True 1687 candidate = name 1688 while nameError: 1689 if i: 1690 candidate = "%s%s" % (name, i) 1691 nameError = hasattr(parent, candidate) \ 1692 and type(getattr(parent, candidate)) != wx._core._wxPyDeadObject \ 1693 and getattr(parent, candidate) != self \ 1694 and [win for win in parent.GetChildren() 1695 if win != self and win.GetName() == candidate] 1696 i += 1 1697 return candidate 1698 1699 1677 1700 # The following 3 flag functions are used in some of the property 1678 1701 # get/set functions. … … 2249 2272 # Dabo is setting the name implicitly, in which case we want to mangle 2250 2273 # the name if necessary to make it unique (we don't want a NameError). 2251 i = 0 2252 while True: 2253 if i == 0: 2254 candidate = name 2255 else: 2256 candidate = "%s%s" % (name, i) 2257 nameError = hasattr(parent, candidate) \ 2258 and type(getattr(parent, candidate)) != wx._core._wxPyDeadObject \ 2259 and getattr(parent, candidate) != self 2260 if not nameError: 2261 badNames = [win for win in parent.GetChildren() 2262 if win != self and win.GetName() == candidate] 2263 if badNames: 2264 nameError = True 2265 if nameError: 2266 i += 1 2267 else: 2268 name = candidate 2269 break 2274 name = self._uniqueNameForParent(name) 2270 2275 else: 2271 2276 # the user is explicitly setting the Name. If another object already
