From ac78af3c67e3a9aac6cfe1342680be99225831fb Mon Sep 17 00:00:00 2001
From: Insoleet <insomniak.fr@gmail.com>
Date: Thu, 18 Feb 2016 08:44:57 +0100
Subject: [PATCH] Fix shortest path in informations window (#378)

---
 src/sakia/core/graph/wot_graph.py |  2 +-
 src/sakia/gui/member.py           | 16 +++++++---------
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/sakia/core/graph/wot_graph.py b/src/sakia/core/graph/wot_graph.py
index c6723977..ea01ac29 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 406ab6ab..fc88680b 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)
 
-- 
GitLab