From 07cf4b7d9b6fce93cce2ee111c57b9581577f0e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <1173718158@qq.com> Date: Thu, 26 Dec 2024 23:41:51 +0800 Subject: [PATCH] . --- py/LunaTranslator/gui/showword.py | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/py/LunaTranslator/gui/showword.py b/py/LunaTranslator/gui/showword.py index 3737e1d3..c22aa331 100644 --- a/py/LunaTranslator/gui/showword.py +++ b/py/LunaTranslator/gui/showword.py @@ -970,21 +970,32 @@ class showdiction(QWidget): self.model.clear() root = self.model.invisibleRootItem() rows = [] + cishus = [] for k in globalconfig["cishuvisrank"]: cishu = gobject.baseobject.cishus[k] - if not hasattr(cishu, "tree"): continue + cishus.append(cishu) + if len(cishus) == 1: try: - tree = cishu.tree() + for node in cishus[0].tree().childrens(): + item = QStandardItem(node.text()) + item.setData(node, DictNodeRole) + rows.append(item) except: - continue - if not tree: - continue + print_exc() + else: + for cishu in cishus: + try: + tree = cishu.tree() + except: + continue + if not tree: + continue - item = QStandardItem(globalconfig["cishu"][k]["name"]) - item.setData(tree, DictNodeRole) - rows.append(item) + item = QStandardItem(globalconfig["cishu"][k]["name"]) + item.setData(tree, DictNodeRole) + rows.append(item) root.appendRows(rows) root.setData(len(rows) > 0, DeterminedhasChildren)