Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sakia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
clients
python
sakia
Commits
ac78af3c
Commit
ac78af3c
authored
9 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Fix shortest path in informations window (
#378
)
parent
359edf9e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/sakia/core/graph/wot_graph.py
+1
-1
1 addition, 1 deletion
src/sakia/core/graph/wot_graph.py
src/sakia/gui/member.py
+7
-9
7 additions, 9 deletions
src/sakia/gui/member.py
with
8 additions
and
10 deletions
src/sakia/core/graph/wot_graph.py
+
1
−
1
View file @
ac78af3c
...
@@ -55,7 +55,7 @@ class WoTGraph(BaseGraph):
...
@@ -55,7 +55,7 @@ class WoTGraph(BaseGraph):
# calculate path of nodes between identity and to_identity
# calculate path of nodes between identity and to_identity
try
:
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
:
except
networkx
.
NetworkXNoPath
as
e
:
logging
.
debug
(
str
(
e
))
logging
.
debug
(
str
(
e
))
...
...
This diff is collapsed.
Click to expand it.
src/sakia/gui/member.py
+
7
−
9
View file @
ac78af3c
...
@@ -106,6 +106,7 @@ class MemberDialog(QObject):
...
@@ -106,6 +106,7 @@ class MemberDialog(QObject):
account_identity
=
await
self
.
account
.
identity
(
self
.
community
)
account_identity
=
await
self
.
account
.
identity
(
self
.
community
)
path
=
await
graph
.
get_shortest_path_to_identity
(
self
.
identity
,
path
=
await
graph
.
get_shortest_path_to_identity
(
self
.
identity
,
account_identity
)
account_identity
)
nodes
=
graph
.
nx_graph
.
nodes
(
data
=
True
)
if
path
:
if
path
:
distance
=
len
(
path
)
-
1
distance
=
len
(
path
)
-
1
...
@@ -114,20 +115,17 @@ class MemberDialog(QObject):
...
@@ -114,20 +115,17 @@ class MemberDialog(QObject):
.
format
(
self
.
tr
(
'
Distance
'
),
distance
))
.
format
(
self
.
tr
(
'
Distance
'
),
distance
))
if
distance
>
1
:
if
distance
>
1
:
index
=
0
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
:
if
index
==
0
:
text
+=
self
.
tr
(
"""
<tr><td align=
"
right
"
><b>{:}</b></div></td><td>{:}</td></tr>
"""
)
\
text
+=
self
.
tr
(
"""
<tr><td align=
"
right
"
><b>{:}</b></div></td><td>{:}</td></tr>
"""
)
\
.
format
(
.
format
(
self
.
tr
(
'
Path
'
),
node
[
1
][
'
text
'
])
self
.
tr
(
'
Path
'
),
node
[
'
text
'
])
else
:
else
:
text
+=
self
.
tr
(
"""
<tr><td align=
"
right
"
><b>{:}</b></div></td><td>{:}</td></tr>
"""
)
\
text
+=
self
.
tr
(
"""
<tr><td align=
"
right
"
><b>{:}</b></div></td><td>{:}</td></tr>
"""
)
\
.
format
(
''
,
.
format
(
''
,
node
[
1
][
'
text
'
]
)
node
[
if
index
==
distance
and
node_id
!=
self
.
account
.
pubkey
:
'
text
'
])
if
index
==
distance
and
node
[
'
id
'
]
!=
self
.
account
.
pubkey
:
text
+=
self
.
tr
(
"""
<tr><td align=
"
right
"
><b>{:}</b></div></td><td>{:}</td></tr>
"""
)
\
text
+=
self
.
tr
(
"""
<tr><td align=
"
right
"
><b>{:}</b></div></td><td>{:}</td></tr>
"""
)
\
.
format
(
''
,
.
format
(
''
,
self
.
account
.
name
)
self
.
account
.
name
)
index
+=
1
index
+=
1
self
.
ui
.
label_path
.
setText
(
text
)
self
.
ui
.
label_path
.
setText
(
text
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment