Changeset 3748

Show
Ignore:
Timestamp:
11/24/07 07:33:33 (1 year ago)
Author:
ed
Message:

Added some code to better resolve pathing issues. Improved the dialog shown when opening a class file fails to distinguish between bad XML and bad pathing.

Files:

Legend:

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

    r3670 r3748  
    378378            self._classMethods[cls] = mthdsForClass(cls) 
    379379 
    380  
    381     def getFormClass(self): 
     380    def getFormClass(self, filepath=None): 
    382381        """If the selected class is a form/dialog, return a mixed-in 
    383382        subclass of it. Otherwise, return the base ClassDesignerForm. 
     
    399398            _superBase = base 
    400399            _superMixin = dfm 
     400            _classFile = filepath 
    401401            def __init__(self, parent=None, *args, **kwargs): 
    402402                self._isMain = formIsMain 
     
    528528        """ 
    529529        try: 
     530            if not os.path.exists(pth): 
     531                if os.path.exists(os.path.abspath(pth)): 
     532                    pth = os.path.abspath(pth) 
    530533            dct = xtd.xmltodict(pth, addCodeFile=True) 
    531         except: 
    532             raise IOError, _("This does not appear to be a valid class file.") 
     534        except StandardError, e: 
     535            if pth.strip().startswith("<?xml") or os.path.exists(pth): 
     536                raise IOError, _("This does not appear to be a valid class file.") 
     537            else: 
     538                raise IOError, _("The class file '%s' was not found.") % pth 
     539             
    533540 
    534541        # Traverse the dct, looking for superclass information 
     
    630637            # For now, just create a standard dForm mixed-in ClassDesigner 
    631638            # form as the base. 
    632             frmClass = self.getFormClass(
     639            frmClass = self.getFormClass(filepath=pth
    633640            if isWiz: 
    634641                self._extractKey(atts, "PageCount")