# Path: spimagine/gui/gui_utils.py
# def createImageCheckbox(parent, img1=None, img2 = None, tooltip =""):
#     check = QtWidgets.QCheckBox("",parent)
#     checkStr = checkBoxStyleStr%(absPath(img1),absPath(img2))
#     if os.name =="nt":
#         checkStr = checkStr.replace("\\","/")
# 
#     check.setStyleSheet(checkStr)
#     if tooltip:
#         check.setToolTip(tooltip)
#     return check
# 
# def createStandardCheckbox(parent,  tooltip =""):
#     check = QtWidgets.QCheckBox("",parent)
#     checkStr = checkNormalBoxStyleStr
#     if os.name =="nt":
#         checkStr = checkStr.replace("\\","/")
# 
#     check.setStyleSheet(checkStr)
#     check.setToolTip(tooltip)
#     return check
# 
# def createStandardButton(parent,fName = None,method = None, width = 24, tooltip = ""):
#     but = QtWidgets.QPushButton("",parent)
#     but.setStyleSheet("background-color: black;color:black;color:lightgrey;")
#     if fName:
#         but.setIcon(QtGui.QIcon(fName))
#     but.setIconSize(QtCore.QSize(width,width))
#     if method:
#         but.clicked.connect(method)
#     but.setMaximumWidth(width)
#     but.setMaximumHeight(width)
#     if tooltip:
#         but.setToolTip(tooltip)
#     return but
# 
# Path: spimagine/gui/floatslider.py
# class FloatSlider(QtWidgets.QSlider):
#     floatValueChanged = QtCore.pyqtSignal(float)
#     def __init__(self,*args):
#         super(FloatSlider,self).__init__(*args)
#         self.setRange(0,1.,100)
#         self.valueChanged.connect(self.onChanged)
# 
#         self.setStyleSheet("QToolTip { color:white;}")
# 
#     def setRange(self,minVal,maxVal,steps=100):
#         assert(minVal <= maxVal)
#         super(FloatSlider,self).setRange(0,steps)
#         self.minVal = minVal
#         self.maxVal = maxVal
#         self.steps = steps
# 
#     def _from_float(self,x):
#         ind = int(self.steps*(x-self.minVal)/(self.maxVal-self.minVal))
#         ind = max(0,min(self.steps,ind))
#         logger.debug("floatslider (id = %s):  index from float %s = %s"%(id(self), x,ind))
#         return ind
# 
#     def _from_int(self,n):
#         return self.minVal+1.*(self.maxVal-self.minVal)*n/self.steps
# 
# 
#     def setValue(self,val):
#         logger.debug("floatslider (id = %s): setValue to : %s"%(id(self),val))
#         self.floatValue = val
# 
#         # this surpressed anoying feedback
#         old = self.blockSignals(True)
#         super(FloatSlider,self).setValue(self._from_float(val))
#         self.blockSignals(old)
# 
#     def value(self):
#         return self.floatValue
#         # return self._from_int(super(FloatSlider,self).value())
# 
#     def onChanged(self,ind):
#         self.floatValue = self._from_int(ind)
#         self.floatValueChanged.emit(self.floatValue)
#         # self.floatValueChanged.emit(self._from_int(ind))


import logging
import sys
import os
import numpy as np
import spimagine
from six.moves import range, zip
from PyQt5 import QtCore, QtGui, QtWidgets
from spimagine.gui.gui_utils import createImageCheckbox,createStandardCheckbox, createStandardButton
from spimagine.gui.floatslider import FloatSlider
        gridBox.addWidget(self.checkInterpolate, 3, 1)

        gridBox.addWidget(QtWidgets.QLabel("invert colors:\t"),4,0)
        gridBox.addWidget(self.checkInvert,4,1)

        gridBox.addWidget(QtWidgets.QLabel("colormap:\t"),5,0)

        self.colorCombo = QtWidgets.QComboBox()

        self.colormaps = list(sorted(spimagine.config.__COLORMAPDICT__.keys()))

        self.colorCombo.setIconSize(QtCore.QSize(80,20))

        for s in self.colormaps:
            self.colorCombo.addItem(QtGui.QIcon(absPath("../colormaps/cmap_%s.png"%s)),s)

        gridBox.addWidget(self.colorCombo,5,1)

        gridBox.addWidget(self.butColor,6,0)


        self.sliderAlphaPow = FloatSlider(QtCore.Qt.Horizontal)
        self.sliderAlphaPow.setRange(0,1.,400)
        self.sliderAlphaPow.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.sliderAlphaPow.setTracking(True)
        self.sliderAlphaPow.setValue(1.)

        gridBox.addWidget(QtWidgets.QLabel("opacity transfer:\t"),7,0)
        gridBox.addWidget(self.sliderAlphaPow,7,1)


# Path: spimagine/gui/gui_utils.py
# def createImageCheckbox(parent, img1=None, img2 = None, tooltip =""):
#     check = QtWidgets.QCheckBox("",parent)
#     checkStr = checkBoxStyleStr%(absPath(img1),absPath(img2))
#     if os.name =="nt":
#         checkStr = checkStr.replace("\\","/")
# 
#     check.setStyleSheet(checkStr)
#     if tooltip:
#         check.setToolTip(tooltip)
#     return check
# 
# def createStandardCheckbox(parent,  tooltip =""):
#     check = QtWidgets.QCheckBox("",parent)
#     checkStr = checkNormalBoxStyleStr
#     if os.name =="nt":
#         checkStr = checkStr.replace("\\","/")
# 
#     check.setStyleSheet(checkStr)
#     check.setToolTip(tooltip)
#     return check
# 
# def createStandardButton(parent,fName = None,method = None, width = 24, tooltip = ""):
#     but = QtWidgets.QPushButton("",parent)
#     but.setStyleSheet("background-color: black;color:black;color:lightgrey;")
#     if fName:
#         but.setIcon(QtGui.QIcon(fName))
#     but.setIconSize(QtCore.QSize(width,width))
#     if method:
#         but.clicked.connect(method)
#     but.setMaximumWidth(width)
#     but.setMaximumHeight(width)
#     if tooltip:
#         but.setToolTip(tooltip)
#     return but
# 
# Path: spimagine/gui/floatslider.py
# class FloatSlider(QtWidgets.QSlider):
#     floatValueChanged = QtCore.pyqtSignal(float)
#     def __init__(self,*args):
#         super(FloatSlider,self).__init__(*args)
#         self.setRange(0,1.,100)
#         self.valueChanged.connect(self.onChanged)
# 
#         self.setStyleSheet("QToolTip { color:white;}")
# 
#     def setRange(self,minVal,maxVal,steps=100):
#         assert(minVal <= maxVal)
#         super(FloatSlider,self).setRange(0,steps)
#         self.minVal = minVal
#         self.maxVal = maxVal
#         self.steps = steps
# 
#     def _from_float(self,x):
#         ind = int(self.steps*(x-self.minVal)/(self.maxVal-self.minVal))
#         ind = max(0,min(self.steps,ind))
#         logger.debug("floatslider (id = %s):  index from float %s = %s"%(id(self), x,ind))
#         return ind
# 
#     def _from_int(self,n):
#         return self.minVal+1.*(self.maxVal-self.minVal)*n/self.steps
# 
# 
#     def setValue(self,val):
#         logger.debug("floatslider (id = %s): setValue to : %s"%(id(self),val))
#         self.floatValue = val
# 
#         # this surpressed anoying feedback
#         old = self.blockSignals(True)
#         super(FloatSlider,self).setValue(self._from_float(val))
#         self.blockSignals(old)
# 
#     def value(self):
#         return self.floatValue
#         # return self._from_int(super(FloatSlider,self).value())
# 
#     def onChanged(self,ind):
#         self.floatValue = self._from_int(ind)
#         self.floatValueChanged.emit(self.floatValue)
#         # self.floatValueChanged.emit(self._from_int(ind))


# Path: spimagine/gui/volsettings.py
import logging
import sys
import os
import numpy as np
import spimagine
from six.moves import range, zip
from PyQt5 import QtCore, QtGui, QtWidgets
from spimagine.gui.gui_utils import createImageCheckbox,createStandardCheckbox, createStandardButton
from spimagine.gui.floatslider import FloatSlider

        gridBox.addWidget(self.checkInterpolate, 3, 1)

        gridBox.addWidget(QtWidgets.QLabel("invert colors:\t"),4,0)
        gridBox.addWidget(self.checkInvert,4,1)

        gridBox.addWidget(QtWidgets.QLabel("colormap:\t"),5,0)

        self.colorCombo = QtWidgets.QComboBox()

        self.colormaps = list(sorted(spimagine.config.__COLORMAPDICT__.keys()))

        self.colorCombo.setIconSize(QtCore.QSize(80,20))

        for s in self.colormaps:
            self.colorCombo.addItem(QtGui.QIcon(absPath("../colormaps/cmap_%s.png"%s)),s)

        gridBox.addWidget(self.colorCombo,5,1)

        gridBox.addWidget(self.butColor,6,0)


        self.sliderAlphaPow = FloatSlider(QtCore.Qt.Horizontal)
        self.sliderAlphaPow.setRange(0,1.,400)
        self.sliderAlphaPow.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.sliderAlphaPow.setTracking(True)
        self.sliderAlphaPow.setValue(1.)

        gridBox.addWidget(QtWidgets.QLabel("opacity transfer:\t"),7,0)
        gridBox.addWidget(self.sliderAlphaPow,7,1)


        self.sliderOcc = FloatSlider(QtCore.Qt.Horizontal)