Changeset 4122
- Timestamp:
- 06/08/08 09:45:28 (6 months ago)
- Files:
-
- trunk/ide/ClassDesigner.py (modified) (5 diffs)
- trunk/ide/ClassDesignerComponents.py (modified) (1 diff)
- trunk/ide/ClassDesignerControlMixin.py (modified) (5 diffs)
- trunk/ide/ClassDesignerFormMixin.py (modified) (3 diffs)
- trunk/ide/ClassDesignerPropSheet.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ide/ClassDesigner.py
r4085 r4122 354 354 355 355 def evtsForClass(cls): 356 ret = [] 357 for kk, vv in dEvents.__dict__.items(): 358 if kk in baseEvents: 359 # These are superclasses of individual events. 360 continue 356 def safeApplies(itm, cls): 361 357 try: 362 if vv.appliesToClass(cls): 363 ret.append("on%s" % kk) 364 except: 365 pass 358 return itm.appliesToClass(cls) 359 except (AttributeError, NameError): 360 return False 361 ret = ["on%s" % k for k,v in dEvents.__dict__.items() 362 if safeApplies(v,cls)] 366 363 ret.sort() 367 364 return ret … … 808 805 slots = int(self._extractKey(atts, "SlotCount", "1")) 809 806 useBox, boxCaption = None, None 807 # defSpacing = int(self._extractKey(atts, "DefaultSpacing", "0")) 810 808 if clsname == "LayoutBorderSizer": 811 809 useBox = True … … 815 813 szCont = sz.ControllingSizer 816 814 itm = sz.ControllingSizerItem 817 815 # if defSpacing: 816 # # Need to set this *after* the design has been created, or else 817 # # it will create non-Designer spacers that will confuse things. 818 # def setLater(sz, spc): 819 # sz.DefaultSpacing = spc 820 # dabo.ui.callAfter(setLater, sz, defSpacing) 818 821 is2D = isinstance(szCont, dabo.ui.dGridSizer) 819 822 defaults = {True: szItemDefaults[2], … … 2048 2051 if adding: 2049 2052 prop = data["propName"] 2050 if not self._classPropDict.has_key(obj): 2053 try: 2054 self._classPropDict.["obj"] 2055 except KeyError: 2051 2056 self._classPropDict[obj] = {} 2052 2057 # Make sure that there are no single quotes in the comment … … 2533 2538 props["ColumnClass"] = self.getControlClass(dui.dColumn) 2534 2539 newCols = None 2535 if not props.has_key("ColumnCount"): 2540 try: 2541 props["ColumnCount"] 2542 except KeyError: 2536 2543 try: 2537 2544 newCols = int(dui.getString(_("How many columns?"), 2538 2545 _("New Grid Control"), "3")) 2539 except :2546 except ValueError: 2540 2547 newCols = 3 2541 2548 trunk/ide/ClassDesignerComponents.py
r4106 r4122 178 178 # If it hasn't changed from the default, skip it 179 179 if not allProps: 180 if defVals.has_key(prop): 181 if prop not in propsToInclude: 182 dv = defVals[prop] 183 if not isinstance(val, basestring) and isinstance(dv, basestring): 184 # Try to convert 185 if isinstance(val, bool): 186 dv = (dv.lower() == "true") 187 elif isinstance(val, int): 188 dv = int(dv) 189 elif isinstance(val, long): 190 dv = long(dv) 191 elif isinstance(val, float): 192 dv = float(dv) 193 elif isinstance(val, (list, tuple, dict)): 194 dv = eval(dv) 195 elif dv == "None": 196 dv = None 197 if dv == val: 198 continue 180 try: 181 defVals[prop] 182 except KeyError: 183 continue 184 if prop not in propsToInclude: 185 dv = defVals[prop] 186 if not isinstance(val, basestring) and isinstance(dv, basestring): 187 # Try to convert 188 if isinstance(val, bool): 189 dv = (dv.lower() == "true") 190 elif isinstance(val, int): 191 dv = int(dv) 192 elif isinstance(val, long): 193 dv = long(dv) 194 elif isinstance(val, float): 195 dv = float(dv) 196 elif isinstance(val, (list, tuple, dict)): 197 dv = eval(dv) 198 elif dv == "None": 199 dv = None 200 if dv == val: 201 continue 199 202 200 203 if isinstance(val, basestring): trunk/ide/ClassDesignerControlMixin.py
r4085 r4122 746 746 imageProps = {"ScaleMode" : {"type" : list, "readonly" : False, 747 747 "values" : ["Clip", "Proportional", "Stretch"]}} 748 labelProps = {"AutoResize": {"type" : bool, "readonly" : False}} 748 749 multiSelectProps = {"MultipleSelect": {"type" : bool, "readonly" : False}} 749 750 nodeProps = {"Image": {"type" : "path", "readonly" : False, 750 751 "customEditor": "editStdPicture"}} 751 panelProps = {"Buffered" : {"type" : bool, "readonly" : False}, 752 "AlwaysResetSizer": {"type" : bool, "readonly" : False}} 752 panelProps = {"AlwaysResetSizer": {"type" : bool, "readonly" : False}, 753 "Buffered" : {"type" : bool, "readonly" : False}, 754 "MinSizerHeight": {"type" : int, "readonly" : False}, 755 "MinSizerWidth": {"type" : int, "readonly" : False}} 753 756 pictureProps = {"Picture": {"type" : "path", "readonly" : False, 754 757 "customEditor": "editStdPicture"}} … … 792 795 "values" : ["Upper", "Lower", "Title", "None"]}, 793 796 "ReadOnly" : {"type" : bool, "readonly" : False}} 794 htmlTextProps = {"HorizontalScroll": {"type" : bool, "readonly" : False}, 795 "Page": {"type" : unicode, "readonly" : False}, 797 htmlTextProps = {"Page": {"type" : unicode, "readonly" : False}, 796 798 "RespondToLinks": {"type" : bool, "readonly" : False}, 797 799 "ShowScrollBars": {"type" : bool, "readonly" : False}, 800 "Source": {"type" : unicode, "readonly" : False}} 801 scrollProps = {"HorizontalScroll": {"type" : bool, "readonly" : False}, 798 802 "VerticalScroll": {"type" : bool, "readonly" : False}} 799 803 treeProps = {"Editable" : {"type" : bool, "readonly" : False}, … … 883 887 ret.update(imageProps) 884 888 elif isinstance(self, dabo.ui.dLabel): 889 ret.update(labelProps) 885 890 ret.update(colorProps) 886 891 ret.update(captionProps) … … 942 947 elif isinstance(self, dabo.ui.dScrollPanel): 943 948 ret.update(panelProps) 949 ret.update(scrollProps) 944 950 ret.update(colorProps) 945 951 elif isinstance(self, dabo.ui.dPanel): … … 967 973 elif isinstance(self, dabo.ui.dHtmlBox): 968 974 ret.update(htmlTextProps) 975 ret.update(scrollProps) 969 976 elif isinstance(self, dabo.ui.dTimer): 970 977 pass trunk/ide/ClassDesignerFormMixin.py
r3800 r4122 449 449 return 450 450 else: 451 if not os.path.splitext(self._classFile)[1] == ".cdxml": 451 self._classFile = self._classFile.rstrip(".") 452 if not self._classFile.endswith(".cdxml"): 452 453 self._classFile += ".cdxml" 453 454 fname = self._classFile … … 484 485 # IOErrorrror that the calling method can catch. 485 486 open(fname, "wb").write(xml) 486 if not singleFile: 487 # Now write out the code file 488 cfName = "%s-code.py" % os.path.splitext(fname)[0] 487 cfName = "%s-code.py" % os.path.splitext(fname)[0] 488 if singleFile: 489 # Delete the code file if present. 490 if os.path.exists(cfName): 491 os.remove(cfName) 492 else: 493 # Write out the code file 489 494 open(cfName, "wb").write(self._createDesignerCode(codeDict)) 490 495 if currForm: … … 1002 1007 if ctl is None: 1003 1008 return 1004 if self.handles.has_key(ctl):1009 try: 1005 1010 hnd = self.handles[ctl] 1006 for nm,h in hnd.items():1007 h.Visible = False1008 if release:1009 h.release()1011 except KeyError: 1012 return 1013 for nm,h in hnd.items(): 1014 h.Visible = False 1010 1015 if release: 1011 del self.handles[ctl] 1016 h.release() 1017 if release: 1018 del self.handles[ctl] 1012 1019 1013 1020 trunk/ide/ClassDesignerPropSheet.py
r3851 r4122 319 319 dabo.ui.stop(_("Could not set property '%s' to value '%s'\nReason: '%s'") 320 320 % (prop, val, e)) 321 self.updateGridValues() 321 self.updateGridValues() 322 322 323 323
