Exemplo n.º 1
0
 def preloadResources(self, resType):
     '''
     Pre-loads all discovered resources of the given type.
     For example preloadResources(PanoConstants.RES_TYPE_MODELS) will pre-load all models in all resource
     locations.
     @param resType: A constant that identifies the type of resources to preload.
     '''
     if self.log.isEnabledFor(logging.DEBUG):
         self.log.debug('Preloading resource types %s' %
                        ResourcesTypes.typeToStr(resType))
     locations = self.resLocations.get(resType)
     if locations is not None:
         for loc in locations:
             self.preloadResourceLocation(loc.name, [resType], False)
Exemplo n.º 2
0
    def _storePreloaded(self, res, filename, location):
        '''
        Stores a resource in the special storage allocated for preloaded
        resources.
        @param res: The loaded resource, a pano.resources.Resource instance.
        @param filename: The full path to the file that contains the resource.
        @param location: The name of the resource location containing the resource.
        '''
        if self.log.isEnabledFor(logging.DEBUG):
            self.log.debug('adding pre-loaded resource %s of type %s' %
                           (filename, ResourcesTypes.typeToStr(res.type)))

        perLocation = self.preloadStore.get(location)
        if perLocation is None:
            perLocation = {}
        perLocation[filename] = res
        self.preloadStore[location] = perLocation