def importKeyStoreCb(self, path, filename):
if not filename or len(filename) < 1:
return
try:
full = os.path.join(path, filename[0])
if full.endswith(".json"):
with open(full) as f:
jsonKS = utils.readJsonStream(f)
App.get_running_app().keyStore = \
key_store.KeyStore.readStoreFromJson(jsonKS)
else:
config = configparser.RawConfigParser()
config.optionxform = str
with open(full) as f:
config.readfp(f)
App.get_running_app().keyStore = \
key_store.KeyStore.readStore(config)
App.get_running_app().curSearchPath = path
except (IOError, UnicodeDecodeError, ValueError,
configparser.Error) as e:
displayError(e)
except KeyError:
displayError(_("Malformed crypto container"))
self.dismissPopup()
self.buildKSTree()
评论列表
文章目录