Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sift
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SIFT
sift
Commits
37933354
Commit
37933354
authored
9 years ago
by
R. Keoni Garcia
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/feature-graph-selection' into develop
parents
2d3f2f76
c2f3723a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
py/cspov/__main__.py
+5
-14
5 additions, 14 deletions
py/cspov/__main__.py
py/cspov/model/document.py
+9
-0
9 additions, 0 deletions
py/cspov/model/document.py
py/cspov/view/ProbeGraphs.py
+25
-0
25 additions, 0 deletions
py/cspov/view/ProbeGraphs.py
with
39 additions
and
14 deletions
py/cspov/__main__.py
+
5
−
14
View file @
37933354
...
...
@@ -419,24 +419,15 @@ class Main(QtGui.QMainWindow):
self
.
scene_manager
.
newProbePoint
.
connect
(
update_probe_point
)
def
update_probe_polygon
(
uuid
,
points
,
layerlist
=
self
.
behaviorLayersList
):
selected_uuids
=
list
(
layerlist
.
current_selected_uuids
())
LOG
.
debug
(
"
selected UUID set is {0!r:s}
"
.
format
(
selected_uuids
))
# if the layer list doesn't have any selected UUIDs, use the one passed in
if
len
(
selected_uuids
)
<=
0
:
selected_uuids
=
[
uuid
]
# if we have more than two uuids, just plot the very first one
elif
len
(
selected_uuids
)
>
2
:
selected_uuids
=
selected_uuids
[
0
:
1
]
# now we must have 1 or 2 UUIDs in our list
top_uuids
=
list
(
self
.
document
.
current_visible_layers
(
2
))
LOG
.
debug
(
"
top visible UUID is {0!r:s}
"
.
format
(
top_uuids
))
# TODO, when the plots manage their own layer selection, change this call
# FUTURE, once the polygon is a layer, this will need to change
# set the selection for the probe plot to the top visible layer
self
.
graphManager
.
set_layer_selections
(
*
top_uuids
)
# update our current plot with the new polygon
polygon_name
=
self
.
graphManager
.
currentPolygonChanged
(
polygonPoints
=
points
)
polygon_name
=
self
.
graphManager
.
currentPolygonChanged
(
polygonPoints
=
points
)
# do whatever other updates the scene manager needs
self
.
scene_manager
.
on_new_polygon
(
polygon_name
,
points
)
...
...
This diff is collapsed.
Click to expand it.
py/cspov/model/document.py
+
9
−
0
View file @
37933354
...
...
@@ -302,6 +302,15 @@ class Document(QObject):
return
x
.
uuid
return
None
def
current_visible_layers
(
self
,
max_layers
=
None
):
count
=
0
for
x
in
self
.
current_layer_set
:
if
x
.
visible
:
count
+=
1
yield
x
.
uuid
if
max_layers
is
not
None
and
count
>=
max_layers
:
break
def
select_layer_set
(
self
,
layer_set_index
):
"""
change the selected layer set, 0..N (typically 0..3), cloning the old set if needed
...
...
This diff is collapsed.
Click to expand it.
py/cspov/view/ProbeGraphs.py
+
25
−
0
View file @
37933354
...
...
@@ -131,6 +131,11 @@ class ProbeGraphManager (QObject) :
return
self
.
graphs
[
self
.
selected_graph_index
].
setPolygon
(
polygonPoints
)
def
set_layer_selections
(
self
,
*
uuids
):
"""
Set the UUIDs for the current graph.
"""
return
self
.
graphs
[
self
.
selected_graph_index
].
set_layer_selections
(
*
uuids
)
def
handle_tab_change
(
self
,
)
:
"""
deal with the fact that the tab changed in the tab widget
"""
...
...
@@ -298,6 +303,26 @@ class ProbeGraphDisplay (object) :
# Rebuild the plot (stale is used to determine if actual rebuild is needed)
self
.
rebuildPlot
()
def
set_layer_selections
(
self
,
*
layer_uuids
):
if
len
(
layer_uuids
)
>
2
:
raise
ValueError
(
"
Probe graphs can handle a maximum of 2 layers (got %d)
"
,
len
(
layer_uuids
))
if
len
(
layer_uuids
)
>=
1
:
xIndex
=
self
.
xDropDown
.
findData
(
str
(
layer_uuids
[
0
]))
if
xIndex
>=
0
:
self
.
xDropDown
.
setCurrentIndex
(
xIndex
)
self
.
xSelectedUUID
=
layer_uuids
[
0
]
else
:
LOG
.
error
(
"
Tried to set probe graph to non-existent layer: %s
"
,
layer_uuids
[
0
])
if
len
(
layer_uuids
)
>=
2
:
yIndex
=
self
.
xDropDown
.
findData
(
str
(
layer_uuids
[
1
]))
if
yIndex
>=
0
:
self
.
yDropDown
.
setCurrentIndex
(
yIndex
)
self
.
ySelectedUUID
=
layer_uuids
[
1
]
else
:
LOG
.
error
(
"
Tried to set probe graph to non-existent layer: %s
"
,
layer_uuids
[
1
])
def
xSelected
(
self
)
:
"""
The user selected something in the X layer list.
"""
...
...
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