Пример #1
0
 def loadConfs(self):
     configs = ParseConfig.ParseConfig(self.USER_CONFIG_FILE)
     if not configs.parse() or configs.isEmpty() or not configs.isValid():
         return False
     configs = configs.getContent()
     logger.log(
         logging.INFO,
         "Config file for user '{}' found and valid".format(self.USER_NAME))
     for name in configs:
         if configs[name]["enable"]:
             currentContainerPath = self.USER_ROOT_FOLDER + name
             self.containers.append(
                 Container(name, configs[name],
                           LUKSDevice.LUKSDevice(currentContainerPath)))
     return True
Пример #2
0
    def _parseModel(self):
        fp = open(self.conf, 'r')
        data = fp.readlines()
        fp.close()

        p = ParseConfig(data)
        p.showDict()
        config = p.getDict()

        self.proj_str = config['proj_str']
        tokens = config['proj_origin'].split(',')
        self.origin = [float(tokens[0]), float(tokens[1])]
        self.rot = float(config['proj_rot'])
        tokens = config['proj_size'].split(',')
        self.size = [float(tokens[0]), float(tokens[1])]
        self.spacing = float(config['spacing'])
        return (0)