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
2c0d486c
Commit
2c0d486c
authored
May 30, 2021
by
Valentin Valls
Browse files
Show a specific style for item not part of a scan
parent
c208f45b
Changes
1
Hide whitespace changes
Inline
Side-by-side
bliss/flint/widgets/delegates.py
View file @
2c0d486c
...
...
@@ -227,6 +227,7 @@ class ScanStyleDelegate(qt.QStyledItemDelegate):
editor
=
StylePropertyWidget
(
parent
)
editor
.
setEditable
(
self
.
__editable
)
editor
.
setMinimumSize
(
editor
.
sizeHint
())
editor
.
setCheckItemValidity
(
True
)
self
.
__updateEditor
(
editor
,
index
)
return
editor
...
...
@@ -402,6 +403,11 @@ class StylePropertyWidget(qt.QWidget):
self
.
__plotModel
:
Optional
[
plot_model
.
Plot
]
=
None
"""Holder the item plot to avoid earlier release of the plot"""
self
.
__scan
:
Union
[
None
,
scan_model
.
Scan
]
=
None
self
.
__checkItem
=
False
def
setCheckItemValidity
(
self
,
check
:
bool
):
self
.
__checkItem
=
check
self
.
__update
()
def
setEditable
(
self
,
isEditable
):
"""Set the widget editable.
...
...
@@ -574,6 +580,13 @@ class StylePropertyWidget(qt.QWidget):
else
:
self
.
__legend
.
setSymbol
(
" "
)
def
__isItemAvailable
(
self
,
item
:
plot_model
.
Item
,
scan
:
scan_model
.
Scan
):
if
not
self
.
__checkItem
:
return
True
if
scan
is
None
:
return
False
return
item
.
isAvailableInScan
(
scan
)
def
__update
(
self
):
plotItem
=
self
.
__plotItem
if
plotItem
is
None
:
...
...
@@ -583,10 +596,17 @@ class StylePropertyWidget(qt.QWidget):
else
:
scan
=
self
.
__scan
try
:
style
=
plotItem
.
getStyle
(
scan
)
if
isinstance
(
plotItem
,
plot_item_model
.
ScatterItem
):
if
not
self
.
__isItemAvailable
(
plotItem
,
scan
):
self
.
__legend
.
setSymbol
(
"x"
)
self
.
__legend
.
setSymbolColor
(
"red"
)
self
.
setToolTip
(
"Not available in this scan"
)
elif
isinstance
(
plotItem
,
plot_item_model
.
ScatterItem
):
self
.
setToolTip
(
""
)
style
=
plotItem
.
getStyle
(
scan
)
self
.
__updateScatter
(
style
)
else
:
self
.
setToolTip
(
""
)
style
=
plotItem
.
getStyle
(
scan
)
color
=
self
.
getQColor
(
style
.
lineColor
)
if
style
.
symbolStyle
is
not
style_model
.
SymbolStyle
.
NO_SYMBOL
:
symbolStyle
=
style_model
.
symbol_to_silx
(
style
.
symbolStyle
)
...
...
@@ -606,7 +626,8 @@ class StylePropertyWidget(qt.QWidget):
self
.
__legend
.
setLineColor
(
color
)
self
.
__legend
.
setLineStyle
(
lineStyle
)
self
.
__legend
.
setLineWidth
(
1.5
)
except
Exception
:
except
Exception
as
e
:
self
.
setToolTip
(
f
"Unknown error<br/>
{
str
(
e
)
}
"
)
self
.
__legend
.
setLineColor
(
"grey"
)
self
.
__legend
.
setLineStyle
(
":"
)
self
.
__legend
.
setLineWidth
(
1.5
)
...
...
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