def loadUIFiles(self):
        self._sheetPrototypes = {}

        prefs = []

        import wallaby.frontends as frontends
        from twisted.plugin import getCache

        for p in FX.packagePath(FX.appModule + ".prefs"): prefs.append(p)
        for frontend in getCache(frontends):
            for p in FX.packagePath("wallaby.frontends." + frontend + ".prefs"): prefs.append(p)

        import os
        for path in prefs:
            root = re.sub(r'[/\\]','.', path).replace('..', '')
            root = re.sub(r'^.*wallaby\.', 'wallaby.', root)
            files = os.listdir(path)
 
            for file in files:
                if '.py' in file and '.pyc' not in file and 'UI_' in file:
                    basename, ext = os.path.splitext(file)
                    if ext == '.py':
                        mod = FX.imp(root + '.' + basename)
                        print "Loading prefs sheet", root + '.' + basename, mod
                        if mod == None: continue
   
                        import string 
                        cls = basename[0] + string.lower(basename[1]) + basename[2] + string.upper(basename[3]) + basename[4:]
    
                        sheetName = unicode(basename.replace('UI_', ''))
    
                        if not cls in mod.__dict__: continue
                        self._sheetPrototypes[sheetName] = mod.__dict__[cls]
    def loadUIFiles(self):
        # Do not reload widgets if not changed
        if self.sheets is None or self.sheets == self._lastSheets: return
        self._lastSheets = self.sheets

        self.clear()

        isheets = []

        self._sheetPrototypes = {}

        import wallaby.frontends as frontends
        from twisted.plugin import getCache

        for p in FX.packagePath(FX.appModule + ".isheet"): isheets.append(p)
        for frontend in getCache(frontends):
            for p in FX.packagePath("wallaby.frontends." + frontend + ".isheet"): isheets.append(p)

        import os
        for path in isheets:
            root = re.sub(r'[/\\]','.', path).replace('..', '')
            root = re.sub(r'^.*wallaby\.', 'wallaby.', root)
            files = os.listdir(path)
            for file in files:
                if '.py' in file and '.pyc' not in file and 'UI_' in file:
                    basename, ext = os.path.splitext(file)

                    if ext != '.py': continue

                    mod = FX.imp(root + '.' + basename)
                    if mod == None: continue

                    cls = basename[0] + string.lower(basename[1]) + basename[2] + string.upper(basename[3]) + basename[4:]
    
                    sheetName = unicode(basename.replace('UI_', ''))

                    sheetCache = None

                    if sheetName in self._sheetPrototypes: 
                        continue

                    if re.match(self.sheets, sheetName) is None: 
                        continue

                    if not self.isMultiPage():
                        p = self.parent()
                        while p != None and (not isinstance(p, Container) or not p.isMultiPage()):
                            p = p.parent()

                        if p is not None:
                            sheetCache = p.sheetCache

                            if sheetName in sheetCache:
                                self._sheet = sheetCache[sheetName]
                                return

                    if not cls in mod.__dict__:
                        for key, val in mod.__dict__.items():
                            if key.startswith("Ui_"):
                                cls = key
                                break

                    if not cls in mod.__dict__: continue

                    self._sheetPrototypes[sheetName] = mod.__dict__[cls]

                    sheet = QtGui.QWidget(self)
                    sheet.ui = self._sheetPrototypes[sheetName]()
                    sheet.ui.setupUi(sheet)
                    sheet.setObjectName(sheetName + "Sheet") 

                    if sheetCache is not None:
                        self._sheet = sheet
                        sheetCache[sheetName] = sheet
                        # also add the cached sheet to the current widget
                        # to allow nested widgets to also be loaded

                    self.addChildWidget(sheet)