Skip to content

Commit

Permalink
bugfix:解密预览的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
cforth committed Sep 13, 2018
1 parent 6adc61c commit 78af385
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Cryptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,11 @@ def run(self):
self.main_window.event_generate("<<DisableCrypto>>", when="tail")
[self.tree.delete(item) for item in self.tree.get_children()]
abspath = os.path.abspath(self.f_path)
root_node = self.tree.insert('', 'end', text=self.name_handle_func(os.path.split(abspath)[1]), open=True)
try:
root_node = self.tree.insert('', 'end', text=self.name_handle_func(os.path.split(abspath)[1]), open=True)
except Exception as e:
logging.warning("Convert error: ", e)
root_node = self.tree.insert('', 'end', text="输入格式或者密码错误!", open=True)
self.process_directory(root_node, abspath, self.name_handle_func)
self.main_window.event_generate("<<AllowCrypto>>", when="tail")

Expand All @@ -470,7 +474,11 @@ def process_directory(self, parent, path, name_handle_func):
abspath = os.path.join(path, p)
# 是否存在子目录
isdir = os.path.isdir(abspath)
name = name_handle_func(p)
try:
name = name_handle_func(p)
except Exception as e:
logging.warning("Convert error: ", e)
name = "输入格式或者密码错误!"
# 将文件地址加入tree的item的values中
oid = self.tree.insert(parent, 'end', text=name, values=[abspath], open=False)
if isdir:
Expand Down

0 comments on commit 78af385

Please sign in to comment.