Exemplo n.º 1
0
    def load(self, z, subpath):
        """load data from a zipped project file

        z -- zipped project file
        subpath -- path to its own storage within project file

        returns a tree of internal hierachy
        """
        # subpath = projName/myName/
        from diffpy.pdfgui.utils import unquote_plain
        subs = subpath.split('/')
        rootDict = z.fileTree[subs[0]][subs[1]]
        if rootDict.has_key('structure'):
            for strucName in rootDict['structure'].keys():
                struc = FitStructure(unquote_plain(strucName))
                struc.load(z, subpath + 'structure/' + strucName + '/')
                self.add(struc)

        if rootDict.has_key('dataset'):
            for datasetName in rootDict['dataset'].keys():
                dataset = FitDataSet(unquote_plain(datasetName))
                dataset.load(z, subpath + 'dataset/' + datasetName + '/')
                self.add(dataset)

        if rootDict.has_key('calculation'):
            for calcName in rootDict['calculation'].keys():
                calc = Calculation(unquote_plain(calcName))
                calc.load(z, subpath + 'calculation/' + calcName + '/')
                self.add(calc)

        self.__forward_spdiameter()

        return self.organization()
Exemplo n.º 2
0
    def load(self, z, subpath):
        """load data from a zipped project file

        z -- zipped project file
        subpath -- path to its own storage within project file

        returns a tree of internal hierachy
        """
        # subpath = projName/myName/
        from diffpy.pdfgui.utils import unquote_plain
        subs = subpath.split('/')
        rootDict = z.fileTree[subs[0]][subs[1]]
        if rootDict.has_key('structure'):
            for strucName in rootDict['structure'].keys():
                struc = FitStructure(unquote_plain(strucName))
                struc.load(z, subpath + 'structure/' + strucName + '/')
                self.add(struc)

        if rootDict.has_key('dataset'):
            for datasetName in rootDict['dataset'].keys():
                dataset = FitDataSet(unquote_plain(datasetName))
                dataset.load(z, subpath + 'dataset/' + datasetName + '/')
                self.add(dataset)

        if rootDict.has_key('calculation'):
            for calcName in rootDict['calculation'].keys():
                calc = Calculation(unquote_plain(calcName))
                calc.load(z, subpath + 'calculation/' + calcName + '/')
                self.add(calc)

        self.__forward_spdiameter()

        return self.organization()