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
c208f45b
Commit
c208f45b
authored
May 30, 2021
by
Valentin Valls
Browse files
Add isAvailableInScan to check item with other scans
parent
d0a82f59
Changes
3
Hide whitespace changes
Inline
Side-by-side
bliss/flint/model/plot_item_model.py
View file @
c208f45b
...
...
@@ -148,6 +148,21 @@ class CurveItem(plot_model.Item, CurveMixIn):
def
isValid
(
self
):
return
self
.
__x
is
not
None
and
self
.
__y
is
not
None
def
isAvailableInScan
(
self
,
scan
:
scan_model
.
Scan
)
->
bool
:
"""Returns true if this item is available in this scan.
This only imply that the data source is available.
"""
if
not
self
.
isValid
():
return
False
channel
=
self
.
xChannel
()
if
channel
.
channel
(
scan
)
is
None
:
return
False
channel
=
self
.
yChannel
()
if
channel
.
channel
(
scan
)
is
None
:
return
False
return
True
def
getScanValidation
(
self
,
scan
:
scan_model
.
Scan
)
->
Optional
[
str
]:
"""
Returns None if everything is fine, else a message to explain the problem.
...
...
@@ -229,6 +244,18 @@ class XIndexCurveItem(CurveItem):
channel
=
self
.
yChannel
()
return
channel
is
not
None
def
isAvailableInScan
(
self
,
scan
:
scan_model
.
Scan
)
->
bool
:
"""Returns true if this item is available in this scan.
This only imply that the data source is available.
"""
if
not
self
.
isValid
():
return
False
channel
=
self
.
yChannel
()
if
channel
.
channel
(
scan
)
is
None
:
return
False
return
True
def
xData
(
self
,
scan
:
scan_model
.
Scan
)
->
Optional
[
scan_model
.
Data
]:
yData
=
self
.
yData
(
scan
)
if
yData
is
None
:
...
...
bliss/flint/model/plot_model.py
View file @
c208f45b
...
...
@@ -381,6 +381,13 @@ class Item(qt.QObject):
"""
return
None
def
isAvailableInScan
(
self
,
scan
:
scan_model
.
Scan
)
->
bool
:
"""Returns true if this item is available in this scan.
This only imply that the data source is available.
"""
return
True
def
isValidInScan
(
self
,
scan
:
scan_model
.
Scan
)
->
bool
:
"""Returns true if this item do not have any messages associated with
the data of this scan."""
...
...
@@ -511,6 +518,19 @@ class ChildItem(Item):
def
source
(
self
)
->
Optional
[
Item
]:
return
self
.
__source
def
isAvailableInScan
(
self
,
scan
:
scan_model
.
Scan
)
->
bool
:
"""Returns true if this item is available in this scan.
This only imply that the data source is available.
"""
if
not
self
.
isValid
():
return
False
source
=
self
.
source
()
if
source
is
not
None
:
if
not
source
.
isAvailableInScan
(
scan
):
return
False
return
True
class
ComputableMixIn
:
"""This item use the scan data to process result before displaying it."""
...
...
bliss/flint/model/plot_state_model.py
View file @
c208f45b
...
...
@@ -595,6 +595,19 @@ class NormalizedCurveItem(plot_model.ChildItem, plot_item_model.CurveMixIn):
if
eventType
==
plot_model
.
ChangeEventType
.
X_CHANNEL
:
self
.
_emitValueChanged
(
plot_model
.
ChangeEventType
.
X_CHANNEL
)
def
isAvailableInScan
(
self
,
scan
:
scan_model
.
Scan
)
->
bool
:
"""Returns true if this item is available in this scan.
This only imply that the data source is available.
"""
if
not
plot_model
.
ChildItem
.
isAvailableInScan
(
self
,
scan
):
return
False
monitor
=
self
.
monitorChannel
()
if
monitor
is
not
None
:
if
monitor
.
channel
(
scan
)
is
None
:
return
False
return
True
def
displayName
(
self
,
axisName
,
scan
:
scan_model
.
Scan
)
->
str
:
"""Helper to reach the axis display name"""
sourceItem
=
self
.
source
()
...
...
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