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
78aeaec6
Commit
78aeaec6
authored
May 29, 2021
by
Valentin Valls
Browse files
Sync scan styles on selected item
parent
e4ee0ce6
Changes
2
Hide whitespace changes
Inline
Side-by-side
bliss/flint/widgets/curve_plot_property.py
View file @
78aeaec6
...
...
@@ -642,6 +642,7 @@ class _DataItem(_property_tree_helper.ScanRowItem):
class
ScanItem
(
NamedTuple
):
scan
:
scan_model
.
Scan
plotModel
:
plot_model
.
Plot
plotItem
:
plot_model
.
Item
curveWidget
:
qt
.
QWidget
...
...
@@ -677,7 +678,7 @@ class ScanTableView(data_views.VDataTableView):
self
.
setColumn
(
self
.
ScanStyleColumn
,
title
=
"Style"
,
delegate
=
delegates
.
Style
Scan
Delegate
,
delegate
=
delegates
.
S
canS
tyleDelegate
,
resizeMode
=
qt
.
QHeaderView
.
ResizeToContents
,
)
self
.
setColumn
(
...
...
@@ -712,7 +713,6 @@ class ScanTableView(data_views.VDataTableView):
return
qt
.
QModelIndex
()
def
selectScan
(
self
,
select
:
scan_model
.
Scan
):
model
=
self
.
model
()
index
=
self
.
scanIndex
(
select
)
selectionModel
=
self
.
selectionModel
()
# selectionModel.reset()
...
...
@@ -990,6 +990,7 @@ class CurvePlotPropertyWidget(qt.QWidget):
index
=
item
.
index
()
selectionModel
=
self
.
__tree
.
selectionModel
()
selectionModel
.
setCurrentIndex
(
index
,
flags
)
self
.
__syncScanModel
()
def
__scanSelectionChanged
(
self
,
scan
:
scan_model
.
Scan
):
curveWidget
=
self
.
__focusWidget
...
...
@@ -1091,9 +1092,12 @@ class CurvePlotPropertyWidget(qt.QWidget):
plotModel
=
self
.
__plotModel
if
plotModel
is
None
:
return
plotItem
=
widget
.
selectedPlotItem
()
scans
=
widget
.
scanList
()
scanList
=
[
ScanItem
(
s
,
plotModel
,
widget
)
for
s
in
scans
]
scanList
=
[
ScanItem
(
s
,
plotModel
,
plotItem
,
widget
)
for
s
in
scans
]
self
.
__scanListModel
.
setObjectList
(
scanList
)
with
qtutils
.
blockSignals
(
self
.
__scanListView
):
self
.
__scanListView
.
selectScan
(
widget
.
selectedScan
())
def
__structureChanged
(
self
):
if
self
.
__plotModel
.
isInTransaction
():
...
...
bliss/flint/widgets/delegates.py
View file @
78aeaec6
...
...
@@ -210,7 +210,7 @@ class RemovePropertyItemDelegate(qt.QStyledItemDelegate):
pass
class
Style
Scan
Delegate
(
qt
.
QStyledItemDelegate
):
class
S
canS
tyleDelegate
(
qt
.
QStyledItemDelegate
):
"""Style delegate to display scan style.
"""
...
...
@@ -220,7 +220,7 @@ class StyleScanDelegate(qt.QStyledItemDelegate):
def
createEditor
(
self
,
parent
,
option
,
index
):
if
not
index
.
isValid
():
return
super
(
Style
Scan
Delegate
,
self
).
createEditor
(
parent
,
option
,
index
)
return
super
(
S
canS
tyleDelegate
,
self
).
createEditor
(
parent
,
option
,
index
)
editor
=
StylePropertyWidget
(
parent
)
editor
.
setEditable
(
self
.
__editable
)
...
...
@@ -242,7 +242,9 @@ class StyleScanDelegate(qt.QStyledItemDelegate):
def
__updateEditor
(
self
,
editor
:
qt
.
QWidget
,
index
:
qt
.
QModelIndex
):
scanItem
=
index
.
data
(
ObjectRole
)
plotItem
=
self
.
__getFirstItem
(
scanItem
.
plotModel
)
plotItem
=
scanItem
.
plotItem
if
plotItem
is
None
:
plotItem
=
self
.
__getFirstItem
(
scanItem
.
plotModel
)
editor
.
setScan
(
scanItem
.
scan
)
editor
.
setPlotItem
(
plotItem
)
...
...
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