Commit 222d53a0 authored by Damien Naudet's avatar Damien Naudet

Added some arrow icons to the slider to make sure they're visible in .

parent 11954875
......@@ -36,6 +36,8 @@ import numpy as np
from silx.gui import qt as Qt
from ...gui.icons import getQIcon as getKmapIcon
RangeSliderEvent = namedtuple('RangeSliderEvent', ['left', 'right',
'leftIndex', 'rightIndex'])
......@@ -64,6 +66,9 @@ class RangeSlider(Qt.QWidget):
self.__focus = None
self.__range = None
self.__sliderIcons = {'left': getKmapIcon('right_arrow'),
'right': getKmapIcon('left_arrow')}
self.__sliders = OrderedDict([('left', Qt.QRect()),
('right', Qt.QRect())])
self.__values = {'left': None, 'right': None}
......@@ -370,6 +375,8 @@ class RangeSlider(Qt.QWidget):
was no previous pixmap.
:return:
"""
if pixmap is not None and pixmap.width() <= 1:
raise ValueError('Pixmap must have a width > 1.')
self.__pixmap = pixmap
if resetSliders:
self.setSliderValues(None, None)
......@@ -394,6 +401,9 @@ class RangeSlider(Qt.QWidget):
if profile.ndim != 1:
raise ValueError('Profile must be a 1D array.')
if profile.shape[0] <= 1:
raise ValueError('Profile must be have a length > 1.')
if colormap is not None:
nColors = len(colormap)
if nColors > 255:
......@@ -484,6 +494,8 @@ class RangeSlider(Qt.QWidget):
option.initFrom(self)
for side, slider in sliders.items():
option.icon = self.__sliderIcons[side]
option.iconSize = slider.size() * 0.7
if self.__hover == side:
option.state |= Qt.QStyle.State_MouseOver
elif option.state & Qt.QStyle.State_MouseOver:
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="10"
height="28"
id="svg2"
version="1.1"
inkscape:version="0.48.5 r10040"
sodipodi:docname="left_arrow.svg"
inkscape:export-filename="/users/naudet/workspace/dau/id01/devs/kmap/kmap/resources/gui/icons/left_arrow.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="7.9195959"
inkscape:cx="-24.014604"
inkscape:cy="21.090896"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1219"
inkscape:window-height="840"
inkscape:window-x="39"
inkscape:window-y="66"
inkscape:window-maximized="0"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="-2.7755576e-17" />
<metadata
id="metadata7">
<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></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-18.125,-1021.3125)">
<path
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 19.066629,1034.5583 8.333758,12.7532 1e-6,-23.8648 z"
id="path2985"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
</g>
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="10"
height="28"
id="svg2"
version="1.1"
inkscape:version="0.48.5 r10040"
sodipodi:docname="left_arrow.svg"
inkscape:export-filename="/users/naudet/workspace/dau/id01/devs/kmap/kmap/resources/gui/icons/left_arrow.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="7.9195959"
inkscape:cx="-24.014604"
inkscape:cy="21.090896"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1219"
inkscape:window-height="840"
inkscape:window-x="39"
inkscape:window-y="66"
inkscape:window-maximized="0"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="-2.7755576e-17" />
<metadata
id="metadata7">
<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></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-18.125,-1021.3125)">
<path
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 27.400388,1036.1999 -8.333758,-12.7532 -1e-6,23.8648 z"
id="path2985"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
</g>
</svg>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment