Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
X
xsocs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
22
Issues
22
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kmap
xsocs
Commits
18a704e1
Commit
18a704e1
authored
Jul 25, 2018
by
Thomas Vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use updated RangeSlider to control colormap range
parent
6fd09b01
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
36 deletions
+19
-36
xsocs/gui/widgets/XsocsPlot2D.py
xsocs/gui/widgets/XsocsPlot2D.py
+19
-36
No files found.
xsocs/gui/widgets/XsocsPlot2D.py
View file @
18a704e1
...
...
@@ -47,7 +47,7 @@ from silx.math.histogram import Histogramnd
from
silx.gui.plot.matplotlib
import
Colormap
from
..widgets.Containers
import
GroupBox
from
..
widge
ts.RangeSlider
import
RangeSlider
from
..
silx_impor
ts.RangeSlider
import
RangeSlider
from
..widgets.PointWidget
import
PointWidget
from
...gui.icons
import
getQIcon
as
getKmapIcon
from
..widgets.Input
import
StyledLineEdit
...
...
@@ -193,8 +193,8 @@ class XsocsPlot2DColorDialog(Qt.QDialog):
grpBox
=
GroupBox
(
'Range'
)
grpBoxLayout
=
Qt
.
QGridLayout
(
grpBox
)
self
.
__rngSlider
=
rngSlider
=
RangeSlider
()
grpBoxLayout
.
addWidget
(
rngSlider
,
0
,
0
,
1
,
2
)
self
.
__rngSlider
=
RangeSlider
()
grpBoxLayout
.
addWidget
(
self
.
__
rngSlider
,
0
,
0
,
1
,
2
)
self
.
__filledProfile
=
filledProfile
=
ColorFilledProfile
()
filledProfile
.
setFixedHeight
(
100
)
...
...
@@ -218,7 +218,8 @@ class XsocsPlot2DColorDialog(Qt.QDialog):
self
.
__setupWidgets
()
rngSlider
.
sigSliderMoved
.
connect
(
self
.
__rngSliderMoved
)
self
.
__rngSlider
.
sigValueChanged
.
connect
(
self
.
__rangeSliderValueChanged
)
def
__updateColorMap
(
self
,
colormap
,
minVal
,
maxVal
,
nColors
):
"""
...
...
@@ -251,20 +252,20 @@ class XsocsPlot2DColorDialog(Qt.QDialog):
self
.
__setColormapPixmap
()
self
.
__applyColormap
()
def
__r
ngSliderMoved
(
self
,
event
):
"""
Slot for the sliderMoved signal.
:param
even
t:
:
return
:
def
__r
angeSliderValueChanged
(
self
,
first
,
second
):
"""
Slot for the range slider sigValueChanged signal.
:param
float firs
t:
:
param float second
:
"""
blockedMin
=
self
.
__minEdit
.
blockSignals
(
True
)
blockedMax
=
self
.
__maxEdit
.
blockSignals
(
True
)
self
.
__minEdit
.
setText
(
'{0:6g}'
.
format
(
event
.
lef
t
))
self
.
__maxEdit
.
setText
(
'{0:6g}'
.
format
(
event
.
right
))
self
.
__minEdit
.
setText
(
'{0:6g}'
.
format
(
firs
t
))
self
.
__maxEdit
.
setText
(
'{0:6g}'
.
format
(
second
))
colormap
=
self
.
__colormap
self
.
__updateColorMap
(
colormap
.
colormap
,
event
.
lef
t
,
event
.
right
,
firs
t
,
second
,
colormap
.
nColors
)
self
.
__minEdit
.
blockSignals
(
blockedMin
)
self
.
__maxEdit
.
blockSignals
(
blockedMax
)
...
...
@@ -277,9 +278,7 @@ class XsocsPlot2DColorDialog(Qt.QDialog):
"""
minVal
=
float
(
self
.
__minEdit
.
text
())
maxVal
=
float
(
self
.
__maxEdit
.
text
())
blocked
=
self
.
__rngSlider
.
blockSignals
(
True
)
self
.
__rngSlider
.
setSliderValues
(
minVal
,
maxVal
)
self
.
__rngSlider
.
blockSignals
(
blocked
)
self
.
__rngSlider
.
setValues
(
minVal
,
maxVal
)
colormap
=
self
.
__colormap
self
.
__updateColorMap
(
colormap
.
colormap
,
minVal
,
...
...
@@ -308,21 +307,6 @@ class XsocsPlot2DColorDialog(Qt.QDialog):
"""
return
self
.
__curve
def
__setSliderProfile
(
self
):
"""
Draws the histogram profile on the slider.
:return:
"""
histo
=
self
.
__histogram
rngSlider
=
self
.
__rngSlider
colormap
=
self
.
__colormap
pixmap
=
_arrayToPixmap
(
histo
.
histo
,
cm
.
jet
,
256
)
rngSlider
.
setSliderPixmap
(
pixmap
)
def
__setupWidgets
(
self
):
"""
Initializes the colorbars, histogram, etc...
...
...
@@ -339,16 +323,15 @@ class XsocsPlot2DColorDialog(Qt.QDialog):
return
histo
=
self
.
__histogram
rngSlider
=
self
.
__rngSlider
colormap
=
self
.
__colormap
self
.
__minEdit
.
setText
(
'{0:6g}'
.
format
(
colormap
.
minVal
))
self
.
__maxEdit
.
setText
(
'{0:6g}'
.
format
(
colormap
.
maxVal
))
rngSlider
.
setRange
([
histo
.
edges
[
0
][
0
],
histo
.
edges
[
0
][
-
1
]
])
rngSlider
.
setSliderValues
(
colormap
.
minVal
,
colormap
.
maxVal
)
self
.
__
setSliderProfile
(
)
self
.
__rngSlider
.
setRange
(
histo
.
edges
[
0
][
0
],
histo
.
edges
[
0
][
-
1
])
self
.
__rngSlider
.
setNumberOfSteps
(
256
)
self
.
__rngSlider
.
setValues
(
colormap
.
minVal
,
colormap
.
maxVal
)
self
.
__
rngSlider
.
setGroovePixmapFromProfile
(
histo
.
histo
,
'jet'
)
self
.
__drawHistogram
()
def
__drawHistogram
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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