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
b9cb25e7
Commit
b9cb25e7
authored
May 20, 2021
by
Valentin Valls
Browse files
Add an action to reset the plot with a default selection
parent
f4b1a0c7
Changes
3
Hide whitespace changes
Inline
Side-by-side
bliss/flint/resources/icons/reset-to-plotselect.png
0 → 100644
View file @
b9cb25e7
1.08 KB
bliss/flint/resources/icons/reset-to-plotselect.svg
0 → 100644
View file @
b9cb25e7
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
id=
"svg6"
version=
"1.1"
viewBox=
"0 0 32 32"
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=
"path4-8"
d=
"m4.1449 9.8851c1.9122-0.53218 4.28 2.1371 5.5521 0.041934 1.3009-0.93743 2.5392-4.2848 3.8138-3.8579 1.6262 2.0665 3.2525 4.133 4.8787 6.1995 1.347-1.638 2.6939-3.2761 4.0409-4.9141 1.8521 0.73957 3.5266 2.429 5.6325 2.2647"
fill=
"none"
stroke=
"#00a14b"
stroke-width=
"2.1827"
/>
<path
id=
"path4-8-6-9"
d=
"m27.88 18.32c-1.6049 0.29995-2.7259-1.1887-4.1732-1.5487-1.4779 0.50128-2.8292 1.3141-4.2328 1.973-0.64569 0.23632-1.0281-0.41623-1.5099-0.70518-0.99097-0.72583-1.9819-1.4517-2.9729-2.1775-1.735 0.9667-3.4701 1.9334-5.2051 2.9001-1.9416-0.23125-3.854-0.78498-5.8242-0.70756"
fill=
"none"
stroke=
"#00a14b"
stroke-width=
"2.1827"
/>
<g
id=
"text830"
transform=
"matrix(1.3821 0 0 1.3821 -6.113 -8.9317)"
stroke-width=
".14018"
aria-label=
"RESET"
>
<path
id=
"path815"
d=
"m7.8468 24.699q0.33127 0 0.47364-0.1232 0.1451-0.1232 0.1451-0.40519 0-0.27926-0.1451-0.39972-0.14237-0.12046-0.47364-0.12046h-0.44352v1.0486zm-0.44352 0.72826v1.5469h-1.0541v-4.0875h1.6098q0.80765 0 1.1827 0.27104 0.37782 0.27104 0.37782 0.85693 0 0.4052-0.19712 0.66529-0.19438 0.26009-0.58863 0.38329 0.21629 0.04928 0.38603 0.2245 0.17248 0.17248 0.3477 0.52566l0.5722 1.1608h-1.1225l-0.49828-1.0157q-0.15058-0.30663-0.30663-0.41888-0.15332-0.11225-0.41067-0.11225z"
/>
<path
id=
"path817"
d=
"m10.664 22.886h2.8446v0.7967h-1.7905v0.76111h1.6837v0.7967h-1.6837v0.93633h1.8508v0.7967h-2.9048z"
/>
<path
id=
"path819"
d=
"m17.342 23.015v0.86514q-0.33675-0.15058-0.65707-0.22724t-0.60505-0.07666q-0.37782 0-0.55851 0.10404-0.1807 0.10404-0.1807 0.32306 0 0.16427 0.12046 0.25735 0.1232 0.09035 0.44352 0.15606l0.449 0.09035q0.68171 0.13689 0.96918 0.41615t0.28747 0.79396q0 0.67624-0.40246 1.0075-0.39972 0.32854-1.2238 0.32854-0.38877 0-0.78027-0.07392t-0.78301-0.21902v-0.88979q0.3915 0.20807 0.75563 0.31485 0.36686 0.10404 0.70635 0.10404 0.34496 0 0.5284-0.11499 0.18343-0.11499 0.18343-0.32854 0-0.19165-0.12594-0.29568-0.1232-0.10404-0.49554-0.18617l-0.40793-0.09035q-0.61327-0.13142-0.898-0.41888-0.28199-0.28747-0.28199-0.7748 0-0.61053 0.39424-0.93906t1.1334-0.32854q0.33675 0 0.69266 0.05202 0.35591 0.04928 0.73647 0.15058z"
/>
<path
id=
"path821"
d=
"m18.538 22.886h2.8446v0.7967h-1.7905v0.76111h1.6837v0.7967h-1.6837v0.93633h1.8508v0.7967h-2.9048z"
/>
<path
id=
"path823"
d=
"m21.884 22.886h3.7672v0.7967h-1.3552v3.2908h-1.0541v-3.2908h-1.358z"
/>
</g>
</svg>
bliss/flint/widgets/curve_plot_property.py
View file @
b9cb25e7
...
...
@@ -708,6 +708,16 @@ class CurvePlotPropertyWidget(qt.QWidget):
action
=
_AddItemAction
(
self
)
toolBar
.
addAction
(
action
)
toolBar
.
addSeparator
()
action
=
qt
.
QAction
(
self
)
icon
=
icons
.
getQIcon
(
"flint:icons/reset-to-plotselect"
)
action
.
setIcon
(
icon
)
action
.
setText
(
"Reset with plotselect"
)
action
.
setToolTip
(
"Reset the plot to the original plotselect used"
)
action
.
triggered
.
connect
(
self
.
__resetPlotWithOriginalPlot
)
toolBar
.
addAction
(
action
)
action
=
qt
.
QAction
(
self
)
icon
=
icons
.
getQIcon
(
"flint:icons/remove-all-items"
)
action
.
setIcon
(
icon
)
...
...
@@ -715,6 +725,8 @@ class CurvePlotPropertyWidget(qt.QWidget):
action
.
triggered
.
connect
(
self
.
__removeAllItems
)
toolBar
.
addAction
(
action
)
toolBar
.
addSeparator
()
action
=
qt
.
QAction
(
self
)
icon
=
icons
.
getQIcon
(
"flint:icons/scan-history"
)
action
.
setIcon
(
icon
)
...
...
@@ -726,6 +738,30 @@ class CurvePlotPropertyWidget(qt.QWidget):
return
toolBar
def
__resetPlotWithOriginalPlot
(
self
):
widget
=
self
.
__focusWidget
scan
=
widget
.
scan
()
plots
=
scan_info_helper
.
create_plot_model
(
scan
.
scanInfo
(),
scan
)
plots
=
[
p
for
p
in
plots
if
isinstance
(
p
,
plot_item_model
.
CurvePlot
)]
if
len
(
plots
)
==
0
:
_logger
.
warning
(
"No curve plot to display"
)
qt
.
QMessageBox
.
warning
(
None
,
"Warning"
,
"There was no curve plot in this scan"
)
return
plotModel
=
plots
[
0
]
previousPlotModel
=
self
.
__plotModel
# Reuse only available values
if
isinstance
(
previousPlotModel
,
plot_item_model
.
CurvePlot
):
model_helper
.
removeNotAvailableChannels
(
previousPlotModel
,
plotModel
,
scan
)
model_helper
.
copyItemsFromChannelNames
(
previousPlotModel
,
plotModel
,
scan
=
None
)
if
plotModel
.
styleStrategy
()
is
None
:
plotModel
.
setStyleStrategy
(
DefaultStyleStrategy
(
self
.
__flintModel
))
widget
.
setPlotModel
(
plotModel
)
def
__requestLoadScanFromHistory
(
self
):
from
bliss.flint.widgets.scan_history_dialog
import
ScanHistoryDialog
...
...
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