Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bliss
bliss
Commits
b747c434
Commit
b747c434
authored
May 28, 2021
by
Valentin Valls
Browse files
Add an action to enable/disable scan storing
parent
0fe68852
Changes
4
Hide whitespace changes
Inline
Side-by-side
bliss/flint/resources/icons/scan-many.png
0 → 100644
View file @
b747c434
1.15 KB
bliss/flint/resources/icons/scan-many.svg
0 → 100644
View file @
b747c434
<?xml version="1.0" encoding="UTF-8"?>
<svg
id=
"svg12"
enable-background=
"new 0 0 32 32"
version=
"1.1"
viewBox=
"0 0 32 32"
xml:space=
"preserve"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:cc=
"http://creativecommons.org/ns#"
xmlns:dc=
"http://purl.org/dc/elements/1.1/"
xmlns:rdf=
"http://www.w3.org/1999/02/22-rdf-syntax-ns#"
><metadata
id=
"metadata2"
><rdf:RDF><cc:Work
rdf:about=
""
><dc:format>
image/svg+xml
</dc:format><dc:type
rdf:resource=
"http://purl.org/dc/dcmitype/StillImage"
/><dc:title/></cc:Work></rdf:RDF></metadata><path
id=
"path16-3"
d=
"m30.24 26.443c-0.2099-0.02224-13.302-0.01495-14.181-0.24464-1.4684-0.38394-1.4525-0.21784-2.0548-1.3356-1.084-2.0116 0.06041-19.343-4.7282-19.387-4.7886-0.044-3.6546 18.21-5.6019 19.861-1.9473 1.6509-1.9292 1.1062-1.9292 1.1062"
fill=
"none"
stroke=
"#00a14b"
stroke-linecap=
"round"
stroke-width=
"2.109"
/><path
id=
"path16-3-5-5"
d=
"m28.024 23.52c-1.084-2.0116-0.05811-18-4.8468-18.044-0.84925-0.00778-1.5122 0.55994-2.0391 1.5085"
fill=
"none"
stroke=
"#758c80"
stroke-linecap=
"round"
stroke-width=
"2.109"
/><path
id=
"path16-3-5-5-1"
d=
"m21.111 23.52c-1.084-2.0116-0.05811-18-4.8468-18.044-0.84925-0.00778-1.5122 0.55994-2.0391 1.5085"
fill=
"none"
stroke=
"#758c80"
stroke-linecap=
"round"
stroke-width=
"2.109"
/></svg>
bliss/flint/widgets/curve_plot.py
View file @
b747c434
...
...
@@ -125,7 +125,8 @@ class CurvePlotWidget(plot_helper.PlotWidget):
def
__init__
(
self
,
parent
=
None
):
super
(
CurvePlotWidget
,
self
).
__init__
(
parent
=
parent
)
self
.
__scans
:
List
[
scan_model
.
Scan
]
=
[]
self
.
__maxScans
=
3
self
.
__maxStoredScans
=
3
self
.
__storePreviousScans
=
False
self
.
__flintModel
:
Optional
[
flint_model
.
FlintState
]
=
None
self
.
__plotModel
:
plot_model
.
Plot
=
None
...
...
@@ -554,6 +555,20 @@ class CurvePlotWidget(plot_helper.PlotWidget):
self
.
scanListUpdated
.
emit
(
self
.
__scans
)
self
.
__redrawAllScans
()
def
setMaxStoredScans
(
self
,
maxScans
:
int
):
# FIXME: Must emit event
self
.
__maxStoredScans
=
maxScans
def
maxStoredScans
(
self
)
->
int
:
return
self
.
__maxStoredScans
def
setPreviousScanStored
(
self
,
storeScans
:
bool
):
# FIXME: Must emit event
self
.
__storePreviousScans
=
storeScans
def
isPreviousScanStored
(
self
)
->
bool
:
return
self
.
__storePreviousScans
@
property
def
__scan
(
self
):
if
len
(
self
.
__scans
)
==
0
:
...
...
@@ -577,10 +592,15 @@ class CurvePlotWidget(plot_helper.PlotWidget):
self
.
__scan
.
scanFinished
.
disconnect
(
self
.
__aggregator
.
callbackTo
(
self
.
__scanFinished
)
)
if
scan
is
not
None
:
self
.
__scans
.
insert
(
0
,
scan
)
while
len
(
self
.
__scans
)
>
self
.
__maxScans
:
del
self
.
__scans
[
-
1
]
if
self
.
__storePreviousScans
:
if
scan
is
not
None
:
self
.
__scans
.
insert
(
0
,
scan
)
while
len
(
self
.
__scans
)
>
self
.
__maxStoredScans
:
del
self
.
__scans
[
-
1
]
else
:
if
scan
is
not
None
:
self
.
__scans
.
clear
()
self
.
__scans
.
append
(
scan
)
self
.
__syncStyleStrategy
()
self
.
scanListUpdated
.
emit
(
self
.
__scans
)
if
self
.
__scan
is
not
None
:
...
...
bliss/flint/widgets/curve_plot_property.py
View file @
b747c434
...
...
@@ -789,6 +789,15 @@ class CurvePlotPropertyWidget(qt.QWidget):
toolBar
.
addSeparator
()
action
=
qt
.
QAction
(
self
)
icon
=
icons
.
getQIcon
(
"flint:icons/scan-many"
)
action
.
setCheckable
(
True
)
action
.
setIcon
(
icon
)
action
.
setToolTip
(
"Enable displaying many scans and show the list"
)
action
.
toggled
.
connect
(
self
.
__toggeledShowScans
)
toolBar
.
addAction
(
action
)
self
.
__storeScanAction
=
action
action
=
qt
.
QAction
(
self
)
icon
=
icons
.
getQIcon
(
"flint:icons/scan-history"
)
action
.
setIcon
(
icon
)
...
...
@@ -800,6 +809,11 @@ class CurvePlotPropertyWidget(qt.QWidget):
return
toolBar
def
__toggeledShowScans
(
self
,
checked
):
self
.
__scanListView
.
setVisible
(
checked
)
if
self
.
__focusWidget
is
not
None
:
self
.
__focusWidget
.
setPreviousScanStored
(
checked
)
def
__resetPlotWithOriginalPlot
(
self
):
widget
=
self
.
__focusWidget
scan
=
widget
.
scan
()
...
...
@@ -966,6 +980,12 @@ class CurvePlotPropertyWidget(qt.QWidget):
else
:
plotModel
=
None
scanModel
=
None
if
widget
is
not
None
:
scansVisible
=
widget
.
isPreviousScanStored
()
self
.
__scanListView
.
setVisible
(
scansVisible
)
self
.
__storeScanAction
.
setChecked
(
scansVisible
)
self
.
__currentScanChanged
(
scanModel
)
self
.
__currentScanListChanged
(
widget
.
scanList
())
self
.
__plotModelUpdated
(
plotModel
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment