diff --git a/src/sakia/core/graph/wot_graph.py b/src/sakia/core/graph/wot_graph.py index c67239775bad757887e0b8f832701655ae9c1ea0..ea01ac29c1a2f379addb1389f278af8e744ce7d1 100644 --- a/src/sakia/core/graph/wot_graph.py +++ b/src/sakia/core/graph/wot_graph.py @@ -55,7 +55,7 @@ class WoTGraph(BaseGraph): # calculate path of nodes between identity and to_identity try: - path = networkx.shortest_path(self.nx_graph, account_identity.pubkey, to_identity.pubkey) + path = networkx.shortest_path(self.nx_graph.to_undirected(), account_identity.pubkey, to_identity.pubkey) except networkx.NetworkXNoPath as e: logging.debug(str(e)) diff --git a/src/sakia/gui/member.py b/src/sakia/gui/member.py index 406ab6abafa8d40ae376d72c01da008cfee83f0d..fc88680bf24f580def7eaf11a608d9b0b50704fc 100644 --- a/src/sakia/gui/member.py +++ b/src/sakia/gui/member.py @@ -106,6 +106,7 @@ class MemberDialog(QObject): account_identity = await self.account.identity(self.community) path = await graph.get_shortest_path_to_identity(self.identity, account_identity) + nodes = graph.nx_graph.nodes(data=True) if path: distance = len(path) - 1 @@ -114,20 +115,17 @@ class MemberDialog(QObject): .format(self.tr('Distance'), distance)) if distance > 1: index = 0 - for node in path: + for node_id in path: + node = [n for n in nodes if n[0] == node_id][0] if index == 0: text += self.tr("""<tr><td align="right"><b>{:}</b></div></td><td>{:}</td></tr>""")\ - .format( - self.tr('Path'), node['text']) + .format(self.tr('Path'), node[1]['text']) else: text += self.tr("""<tr><td align="right"><b>{:}</b></div></td><td>{:}</td></tr>""")\ - .format('', - node[ - 'text']) - if index == distance and node['id'] != self.account.pubkey: + .format('', node[1]['text'] ) + if index == distance and node_id != self.account.pubkey: text += self.tr("""<tr><td align="right"><b>{:}</b></div></td><td>{:}</td></tr>""")\ - .format('', - self.account.name) + .format('', self.account.name) index += 1 self.ui.label_path.setText(text)