Changeset 3060
- Timestamp:
- 04/13/2007 05:14:16 PM (2 years ago)
- Files:
-
- trunk/dabo/dApp.py (modified) (1 diff)
- trunk/dabo/ui/uiwx/dFormMixin.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/dabo/dApp.py
r3054 r3060 977 977 978 978 Icon = property(_getIcon, _setIcon, None, 979 _("""Specifies the icon to use on all forms and dialogs by default.""")) 979 _("""Specifies the icon to use on all forms and dialogs by default. 980 981 The value passed can be a binary icon bitmap, a filename, or a 982 sequence of filenames. Providing a sequence of filenames pointing to 983 icons at expected dimensions like 16, 22, and 32 px means that the 984 system will not have to scale the icon, resulting in a much better 985 appearance.""")) 980 986 981 987 MainForm = property(_getMainForm, _setMainForm, None, trunk/dabo/ui/uiwx/dFormMixin.py
r3054 r3060 573 573 def _getIcon(self): 574 574 try: 575 return self._ Icon575 return self._icon 576 576 except AttributeError: 577 577 return None … … 579 579 def _setIcon(self, val): 580 580 if self._constructed(): 581 setIconFunc = self.SetIcon 581 582 if val is None: 582 583 ico = wx.NullIcon … … 584 585 ico = val 585 586 else: 586 iconPath = dabo.icons.getIconFileName(val) 587 if iconPath and os.path.exists(iconPath): 588 ext = os.path.splitext(iconPath)[1].lower() 589 if ext == ".png": 590 bitmapType = wx.BITMAP_TYPE_PNG 591 elif ext == ".ico": 592 bitmapType = wx.BITMAP_TYPE_ICO 587 setIconFunc = self.SetIcons 588 if isinstance(val, basestring): 589 icon_strs = (val,) 590 else: 591 icon_strs = val 592 ico = wx.IconBundle() 593 for icon_str in icon_strs: 594 iconPath = dabo.icons.getIconFileName(icon_str) 595 if iconPath and os.path.exists(iconPath): 596 ext = os.path.splitext(iconPath)[1].lower() 597 if ext == ".png": 598 bitmapType = wx.BITMAP_TYPE_PNG 599 elif ext == ".ico": 600 bitmapType = wx.BITMAP_TYPE_ICO 601 else: 602 # punt: 603 bitmapType = wx.BITMAP_TYPE_ANY 604 single_ico = wx.Icon(iconPath, bitmapType) 593 605 else: 594 # punt, but only ico will work on Windows 595 bitmapType = wx.BITMAP_TYPE_ANY 596 ico = wx.Icon(iconPath, bitmapType) 597 else: 598 val = None 599 ico = wx.NullIcon 600 # raise ValueError, "Invalid icon specified." 601 606 single_ico = wx.NullIcon 607 ico.AddIcon(single_ico) 602 608 # wx doesn't provide GetIcon() 603 self._ Icon = val604 se lf.SetIcon(ico)609 self._icon = val 610 setIconFunc(ico) 605 611 606 612 else: 607 613 self._properties["Icon"] = val 608 614 609 610 def _getIconBundle(self):611 try:612 return self._Icons613 except:614 return None615 616 def _setIconBundle(self, val):617 if self._constructed():618 self.SetIcons(val)619 self._Icons = val # wx doesn't provide GetIcons()620 else:621 self._properties["Icons"] = val622 623 615 624 616 def _getMDI(self): … … 923 915 924 916 Icon = property(_getIcon, _setIcon, None, 925 _("Specifies the icon for the form. (wxIcon)")) 926 927 IconBundle = property(_getIconBundle, _setIconBundle, None, 928 _("Specifies the set of icons for the form. (wxIconBundle)")) 917 _("""Specifies the icon for the form. 918 919 The value passed can be a binary icon bitmap, a filename, or a 920 sequence of filenames. Providing a sequence of filenames pointing to 921 icons at expected dimensions like 16, 22, and 32 px means that the 922 system will not have to scale the icon, resulting in a much better 923 appearance.""")) 929 924 930 925 MDI = property(_getMDI, None, None, … … 1013 1008 DynamicFloatOnParent = makeDynamicProperty(FloatOnParent) 1014 1009 DynamicIcon = makeDynamicProperty(Icon) 1015 DynamicIconBundle = makeDynamicProperty(IconBundle)1016 1010 DynamicMenuBar = makeDynamicProperty(MenuBar) 1017 1011 DynamicShowCaption = makeDynamicProperty(ShowCaption)
