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
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
a6b0eba5
Commit
a6b0eba5
authored
9 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Fix graph scene arrows
parent
574bc768
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sakia/gui/views/scenes/explorer_scene.py
+24
-18
24 additions, 18 deletions
src/sakia/gui/views/scenes/explorer_scene.py
with
24 additions
and
18 deletions
src/sakia/gui/views/scenes/explorer_scene.py
+
24
−
18
View file @
a6b0eba5
...
@@ -73,7 +73,7 @@ class ExplorerScene(BaseScene):
...
@@ -73,7 +73,7 @@ class ExplorerScene(BaseScene):
while
queue
:
while
queue
:
n
=
queue
.
pop
()
n
=
queue
.
pop
()
nsteps
=
data
[
n
][
'
scenter
'
]
+
1
nsteps
=
data
[
n
][
'
scenter
'
]
+
1
for
edge
in
networkx
.
edges
(
nx_graph
,
n
):
for
edge
in
networkx
.
edges
(
nx_graph
.
to_undirected
()
,
n
):
next_node
=
edge
[
0
]
if
edge
[
0
]
is
not
n
else
edge
[
1
]
next_node
=
edge
[
0
]
if
edge
[
0
]
is
not
n
else
edge
[
1
]
if
data
[
next_node
][
'
sparent
'
]:
if
data
[
next_node
][
'
sparent
'
]:
continue
continue
...
@@ -128,7 +128,7 @@ class ExplorerScene(BaseScene):
...
@@ -128,7 +128,7 @@ class ExplorerScene(BaseScene):
:param str current: the current node which we compute the subtree
:param str current: the current node which we compute the subtree
"""
"""
ratio
=
data
[
current
][
'
span
'
]
/
data
[
current
][
'
stsize
'
]
ratio
=
data
[
current
][
'
span
'
]
/
data
[
current
][
'
stsize
'
]
for
edge
in
nx_graph
.
edges
(
current
):
for
edge
in
nx_graph
.
to_undirected
().
edges
(
current
):
next_node
=
edge
[
0
]
if
edge
[
0
]
!=
current
else
edge
[
1
]
next_node
=
edge
[
0
]
if
edge
[
0
]
!=
current
else
edge
[
1
]
if
data
[
next_node
][
'
sparent
'
]
!=
current
:
if
data
[
next_node
][
'
sparent
'
]
!=
current
:
continue
continue
...
@@ -152,7 +152,7 @@ class ExplorerScene(BaseScene):
...
@@ -152,7 +152,7 @@ class ExplorerScene(BaseScene):
else
:
else
:
theta
=
data
[
current
][
'
theta
'
]
-
data
[
current
][
'
span
'
]
/
2
theta
=
data
[
current
][
'
theta
'
]
-
data
[
current
][
'
span
'
]
/
2
for
edge
in
nx_graph
.
edges
(
current
):
for
edge
in
nx_graph
.
to_undirected
().
edges
(
current
):
next_node
=
edge
[
0
]
if
edge
[
0
]
!=
current
else
edge
[
1
]
next_node
=
edge
[
0
]
if
edge
[
0
]
!=
current
else
edge
[
1
]
if
data
[
next_node
][
'
sparent
'
]
!=
current
:
if
data
[
next_node
][
'
sparent
'
]
!=
current
:
continue
continue
...
@@ -179,7 +179,7 @@ class ExplorerScene(BaseScene):
...
@@ -179,7 +179,7 @@ class ExplorerScene(BaseScene):
if
len
(
nx_graph
.
nodes
())
==
1
:
if
len
(
nx_graph
.
nodes
())
==
1
:
return
{
nx_graph
.
nodes
()[
0
]:
(
0
,
0
)}
return
{
nx_graph
.
nodes
()[
0
]:
(
0
,
0
)}
nx_graph
=
nx_graph
.
to_undirected
()
#
nx_graph = nx_graph.to_undirected()
data
=
ExplorerScene
.
_init_layout
(
nx_graph
)
data
=
ExplorerScene
.
_init_layout
(
nx_graph
)
if
not
center
:
if
not
center
:
...
@@ -191,7 +191,7 @@ class ExplorerScene(BaseScene):
...
@@ -191,7 +191,7 @@ class ExplorerScene(BaseScene):
data
[
center
][
'
theta
'
]
=
0.0
data
[
center
][
'
theta
'
]
=
0.0
ExplorerScene
.
_set_positions
(
nx_graph
,
data
,
center
)
ExplorerScene
.
_set_positions
(
nx_graph
,
data
,
center
)
distances
=
networkx
.
shortest_path_length
(
nx_graph
,
center
)
distances
=
networkx
.
shortest_path_length
(
nx_graph
.
to_undirected
()
,
center
)
nx_pos
=
{}
nx_pos
=
{}
for
node
in
nx_graph
.
nodes
():
for
node
in
nx_graph
.
nodes
():
hyp
=
distances
[
node
]
+
1
hyp
=
distances
[
node
]
+
1
...
@@ -266,7 +266,7 @@ class ExplorerScene(BaseScene):
...
@@ -266,7 +266,7 @@ class ExplorerScene(BaseScene):
for
edge
in
nx_graph
.
edges
(
data
=
True
):
for
edge
in
nx_graph
.
edges
(
data
=
True
):
edge
[
2
][
"
confirmation_text
"
]
=
""
edge
[
2
][
"
confirmation_text
"
]
=
""
if
(
edge
[
0
],
edge
[
1
])
not
in
self
.
edges
and
(
edge
[
1
],
edge
[
0
])
not
in
self
.
edges
:
if
(
edge
[
0
],
edge
[
1
])
not
in
self
.
edges
:
distance
=
max
(
self
.
nodes
[
edge
[
0
]].
steps
,
self
.
nodes
[
edge
[
1
]].
steps
)
distance
=
max
(
self
.
nodes
[
edge
[
0
]].
steps
,
self
.
nodes
[
edge
[
1
]].
steps
)
explorer_edge
=
ExplorerEdge
(
edge
[
0
],
edge
[
1
],
edge
[
2
],
graph_pos
,
distance
,
dist_max
)
explorer_edge
=
ExplorerEdge
(
edge
[
0
],
edge
[
1
],
edge
[
2
],
graph_pos
,
distance
,
dist_max
)
self
.
node_moved
.
connect
(
explorer_edge
.
move_source_point
)
self
.
node_moved
.
connect
(
explorer_edge
.
move_source_point
)
...
@@ -283,8 +283,16 @@ class ExplorerScene(BaseScene):
...
@@ -283,8 +283,16 @@ class ExplorerScene(BaseScene):
for
node
in
self
.
nodes
.
values
():
for
node
in
self
.
nodes
.
values
():
node
.
neutralize
()
node
.
neutralize
()
path
=
[]
try
:
path
=
networkx
.
shortest_path
(
self
.
nx_graph
,
node_id
,
self
.
identity
.
pubkey
)
except
(
networkx
.
exception
.
NetworkXError
,
networkx
.
exception
.
NetworkXNoPath
)
as
e
:
logging
.
debug
(
str
(
e
))
try
:
try
:
path
=
networkx
.
shortest_path
(
self
.
nx_graph
.
to_undirected
(),
self
.
identity
.
pubkey
,
node_id
)
path
=
networkx
.
shortest_path
(
self
.
nx_graph
,
self
.
identity
.
pubkey
,
node_id
)
except
(
networkx
.
exception
.
NetworkXError
,
networkx
.
exception
.
NetworkXNoPath
)
as
e
:
logging
.
debug
(
str
(
e
))
for
node
,
next_node
in
zip
(
path
[:
-
1
],
path
[
1
:]):
for
node
,
next_node
in
zip
(
path
[:
-
1
],
path
[
1
:]):
if
(
node
,
next_node
)
in
self
.
edges
:
if
(
node
,
next_node
)
in
self
.
edges
:
...
@@ -296,5 +304,3 @@ class ExplorerScene(BaseScene):
...
@@ -296,5 +304,3 @@ class ExplorerScene(BaseScene):
self
.
nodes
[
node
].
highlight
()
self
.
nodes
[
node
].
highlight
()
self
.
nodes
[
next_node
].
highlight
()
self
.
nodes
[
next_node
].
highlight
()
logging
.
debug
(
"
Update edge between {0} and {1}
"
.
format
(
node
,
next_node
))
logging
.
debug
(
"
Update edge between {0} and {1}
"
.
format
(
node
,
next_node
))
except
(
networkx
.
exception
.
NetworkXError
,
networkx
.
exception
.
NetworkXNoPath
)
as
e
:
logging
.
debug
(
str
(
e
))
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