Ejemplo n.º 1
0
    def __init__(self, parent=None, name="scan_plot_widget"):

        QtImport.QWidget.__init__(self, parent)

        if name is not None:
            self.setObjectName(name)

        self.xdata = []
        self.ylabel = ""

        self.isRealTimePlot = None
        self.is_connected = None
        self.isScanning = None

        self.lblTitle = QtImport.QLabel(self)
        self.lblPosition = QtImport.QLabel(self)
        self.graph = QtBlissGraph(self)

        self.graph.canvas().setMouseTracking(True)
        self.graph.enableLegend(False)
        self.graph.enableZoom(False)
        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self.lblTitle)
        _main_vlayout.addWidget(self.lblPosition)
        _main_vlayout.addWidget(self.graph)
        _main_vlayout.setSpacing(2)
        _main_vlayout.setContentsMargins(0, 0, 0, 0)
Ejemplo n.º 2
0
    def __init__(self, parent, realtime_plot = False):
        """
        Descript. :
        """
        QtGui.QWidget.__init__(self, parent)

        self.axis_x_array = []
        self.axis_y_array = []

        self.realtime_plot = realtime_plot
         
        self.pymca_graph = QtBlissGraph(self)
        self.pymca_graph.showGrid()
        self.info_label = QtGui.QLabel("", self)  
        self.info_label.setAlignment(QtCore.Qt.AlignRight)

        _main_vlayout = QtGui.QVBoxLayout(self)
        _main_vlayout.addWidget(self.pymca_graph)  
        _main_vlayout.addWidget(self.info_label)
        _main_vlayout.setSpacing(2)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

        self.setSizePolicy(QtGui.QSizePolicy.Expanding,
                           QtGui.QSizePolicy.Expanding)

        QtCore.QObject.connect(self.pymca_graph,
                               QtCore.SIGNAL("QtBlissGraphSignal"),
                               self.handle_graph_signal)

        Qt4_widget_colors.set_widget_color(self, Qt4_widget_colors.WHITE)         
Ejemplo n.º 3
0
    def __init__(self, *args):
        BlissWidget.__init__(self, *args)

        self.defineSlot("newScan", ())

        self.defineSlot("newScanPoint", ())

        self.scanObject = None
        self.xdata = []
        self.ydata = []

        self.isConnected = None
        self.canAddPoint = True

        self.addProperty("specVersion", "string", "")
        self.addProperty("backgroundColor", "combo", ("white", "default"),
                         "white")
        self.addProperty("graphColor", "combo", ("white", "default"), "white")
        self.lblTitle = QLabel(self)
        self.graphPanel = QFrame(self)
        buttonBox = QHBox(self)
        self.lblPosition = QLabel(buttonBox)
        self.graph = QtBlissGraph(self.graphPanel)

        QObject.connect(self.graph, PYSIGNAL("QtBlissGraphSignal"),
                        self.handleBlissGraphSignal)
        QObject.disconnect(
            self.graph,
            SIGNAL("plotMousePressed(const QMouseEvent&)"),
            self.graph.onMousePressed,
        )
        QObject.disconnect(
            self.graph,
            SIGNAL("plotMouseReleased(const QMouseEvent&)"),
            self.graph.onMouseReleased,
        )
        self.graph.canvas().setMouseTracking(True)
        self.graph.enableLegend(False)
        self.graph.enableZoom(False)
        self.graph.setAutoLegend(False)
        self.lblPosition.setAlignment(Qt.AlignRight)
        self.lblTitle.setAlignment(Qt.AlignHCenter)
        self.lblTitle.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.lblPosition.setSizePolicy(QSizePolicy.Expanding,
                                       QSizePolicy.Fixed)
        buttonBox.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)

        QVBoxLayout(self.graphPanel)
        self.graphPanel.layout().addWidget(self.graph)

        QVBoxLayout(self)
        self.layout().addWidget(self.lblTitle)
        self.layout().addWidget(buttonBox)
        self.layout().addWidget(self.graphPanel)
Ejemplo n.º 4
0
    def __init__(self, *args):
        BlissWidget.__init__(self, *args)

        self.defineSignal('newScan', ())

        self.scanObject = None
        self.xdata = []
        self.ylable = ""
        self.mylog = 0

        self.isConnected = None
        #self.canAddPoint = None
        self.canAddPoint = True

        self.addProperty('specVersion', 'string', '')
        self.addProperty('backgroundColor', 'combo', ('white', 'default'), 'white')
        self.addProperty('graphColor', 'combo', ('white', 'default'), 'white')
        self.lblTitle = QLabel(self)
        self.graphPanel = QFrame(self)
        buttonBox = QHBox(self)
        #self.cmdZoomIn = QToolButton(buttonBox)
        #self.cmdZoomOut = QToolButton(buttonBox)
        self.lblPosition = QLabel(buttonBox)
        self.graph = QtBlissGraph(self.graphPanel)
                         
        QObject.connect(self.graph, PYSIGNAL('QtBlissGraphSignal'), self.handleBlissGraphSignal)
        QObject.disconnect(self.graph, SIGNAL('plotMousePressed(const QMouseEvent&)'), self.graph.onMousePressed)
        QObject.disconnect(self.graph, SIGNAL('plotMouseReleased(const QMouseEvent&)'), self.graph.onMouseReleased)
        #QObject.connect(self.cmdZoomIn, SIGNAL('clicked()'), self.cmdZoomInClicked)
        #QObject.connect(self.cmdZoomOut, SIGNAL('clicked()'), self.cmdZoomOutClicked)

        #self.cmdZoomIn.setIconSet(QIconSet(Icons.load("zoomin")))
        #self.cmdZoomOut.setIconSet(QIconSet(Icons.load("zoomout")))
        #self.cmdZoomIn.setToggleButton(True)
        #self.cmdZoomOut.setToggleButton(True)
        #self.cmdZoomIn.setUsesTextLabel(False)
        #self.cmdZoomOut.setUsesTextLabel(False)
        self.graph.canvas().setMouseTracking(True)
        self.graph.enableLegend(False)
        self.graph.enableZoom(False)
        self.graph.setAutoLegend(False)
        self.lblPosition.setAlignment(Qt.AlignRight)
        self.lblTitle.setAlignment(Qt.AlignHCenter)
        self.lblTitle.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.lblPosition.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        buttonBox.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        
        QVBoxLayout(self.graphPanel)
        self.graphPanel.layout().addWidget(self.graph)

        QVBoxLayout(self)
        self.layout().addWidget(self.lblTitle)
        self.layout().addWidget(buttonBox)
        self.layout().addWidget(self.graphPanel)
Ejemplo n.º 5
0
    def __init__(self, parent=None, name="scan_plot_widget"):
        QtGui.QWidget.__init__(self, parent)

        if name is not None:
            self.setObjectName(name)

        self.xdata = []
        self.ylabel = ""

        self.isRealTimePlot = None
        self.isConnected = None
        self.isScanning = None

        self.lblTitle = QtGui.QLabel(self)
        #self.graphPanel = qt.QFrame(self)
        #buttonBox = qt.QHBox(self)
        self.lblPosition = QtGui.QLabel(self)
        self.graph = QtBlissGraph(self)

        QtCore.QObject.connect(self.graph, QtCore.SIGNAL('QtBlissGraphSignal'),
                               self.handleBlissGraphSignal)
        QtCore.QObject.disconnect(
            self.graph, QtCore.SIGNAL('plotMousePressed(const QMouseEvent&)'),
            self.graph.onMousePressed)
        QtCore.QObject.disconnect(
            self.graph, QtCore.SIGNAL('plotMouseReleased(const QMouseEvent&)'),
            self.graph.onMouseReleased)

        self.graph.canvas().setMouseTracking(True)
        self.graph.enableLegend(False)
        self.graph.enableZoom(False)
        #self.graph.setAutoLegend(False)
        """self.lblPosition.setAlignment(qt.Qt.AlignRight)
        self.lblTitle.setAlignment(qt.Qt.AlignHCenter)
        self.lblTitle.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)
        self.lblPosition.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)
        buttonBox.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)
        
        qt.QVBoxLayout(self.graphPanel)
        self.graphPanel.layout().addWidget(self.graph)

        qt.QVBoxLayout(self)
        self.layout().addWidget(self.lblTitle)
        self.layout().addWidget(buttonBox)
        self.layout().addWidget(self.graphPanel)
        self.setPaletteBackgroundColor(qt.Qt.white)"""
        _main_vlayout = QtGui.QVBoxLayout(self)
        _main_vlayout.addWidget(self.lblTitle)
        _main_vlayout.addWidget(self.lblPosition)
        _main_vlayout.addWidget(self.graph)
        _main_vlayout.setSpacing(2)
        _main_vlayout.setContentsMargins(0, 0, 0, 0)
Ejemplo n.º 6
0
    def __init__(self, parent=None, name="scan_plot_widget"):
        qt.QWidget.__init__(self, parent, name)

        self.xdata = []
        self.ylabel = ""

        self.isRealTimePlot = None
        self.isConnected = None
        self.isScanning = None

        self.lblTitle = qt.QLabel(self)
        self.graphPanel = qt.QFrame(self)
        buttonBox = qt.QHBox(self)
        self.lblPosition = qt.QLabel(buttonBox)
        self.graph = QtBlissGraph(self.graphPanel)

        qt.QObject.connect(
            self.graph, qt.PYSIGNAL("QtBlissGraphSignal"), self.handleBlissGraphSignal
        )
        qt.QObject.disconnect(
            self.graph,
            qt.SIGNAL("plotMousePressed(const QMouseEvent&)"),
            self.graph.onMousePressed,
        )
        qt.QObject.disconnect(
            self.graph,
            qt.SIGNAL("plotMouseReleased(const QMouseEvent&)"),
            self.graph.onMouseReleased,
        )

        self.graph.canvas().setMouseTracking(True)
        self.graph.enableLegend(False)
        self.graph.enableZoom(False)
        # self.graph.setAutoLegend(False)
        self.lblPosition.setAlignment(qt.Qt.AlignRight)
        self.lblTitle.setAlignment(qt.Qt.AlignHCenter)
        self.lblTitle.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)
        self.lblPosition.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)
        buttonBox.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)

        qt.QVBoxLayout(self.graphPanel)
        self.graphPanel.layout().addWidget(self.graph)

        qt.QVBoxLayout(self)
        self.layout().addWidget(self.lblTitle)
        self.layout().addWidget(buttonBox)
        self.layout().addWidget(self.graphPanel)
        self.setPaletteBackgroundColor(qt.Qt.white)
Ejemplo n.º 7
0
    def __init__(self, *args):
        BlissWidget.__init__(self, *args)

        self.defineSignal('newScan', ())

        self.scanObject = None
        self.xdata = []
        self.ylable = ""
        self.mylog = 0
        self.canAddPoint = True
        self.dm = DataManager()
        event.connect(self.dm, "scan_new", self.newScan)
        event.connect(self.dm, "scan_data", self.newScanPoint)

        self.addProperty('backgroundColor', 'combo', ('white', 'default'), 'white')
        self.addProperty('graphColor', 'combo', ('white', 'default'), 'white')
        self.lblTitle = QLabel(self)
        self.graphPanel = QFrame(self)
        buttonBox = QHBox(self)
        self.lblPosition = QLabel(buttonBox)
        self.graph = QtBlissGraph(self.graphPanel)
                         
        QObject.connect(self.graph, PYSIGNAL('QtBlissGraphSignal'), self.handleBlissGraphSignal)
        QObject.disconnect(self.graph, SIGNAL('plotMousePressed(const QMouseEvent&)'), self.graph.onMousePressed)
        QObject.disconnect(self.graph, SIGNAL('plotMouseReleased(const QMouseEvent&)'), self.graph.onMouseReleased)
 
        self.graph.canvas().setMouseTracking(True)
        self.graph.enableLegend(False)
        self.graph.enableZoom(False)
        self.graph.setAutoLegend(False)
        self.lblPosition.setAlignment(Qt.AlignRight)
        self.lblTitle.setAlignment(Qt.AlignHCenter)
        self.lblTitle.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.lblPosition.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        buttonBox.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        
        QVBoxLayout(self.graphPanel)
        self.graphPanel.layout().addWidget(self.graph)

        QVBoxLayout(self)
        self.layout().addWidget(self.lblTitle)
        self.layout().addWidget(buttonBox)
        self.layout().addWidget(self.graphPanel)
Ejemplo n.º 8
0
    def __init__(self, *args):
        BlissWidget.__init__(self, *args)

        self.addProperty("mnemonic", "string", "")
        self.addProperty("unit", "combo", ("C", "K"), "C")
        self.addProperty("baseTime", "combo", ("current time", "0"), "0")

        self.lstChannelValueDisplay = []
        self.lstChannelWidgets = []
        self.data = {}
        self.lakeshore = None

        graphBox = QVBox(self)
        graphButtonsBox = QHBox(graphBox)
        graphButtonsBox.setSpacing(5)
        self.graph = QtBlissGraph(graphBox)
        self.graph.setx1timescale(True)
        self.graph.xlabel("time")
        self.graph.ylabel("temperature (%s)" % self["unit"])
        self.graph.setPaletteBackgroundColor(Qt.white)
        self.graph.canvas().setMouseTracking(True)
        self.cmdResetZoom = QPushButton("Reset zoom", graphButtonsBox)
        self.lblXY = QLabel("X = ? ; Y = ?", graphButtonsBox)
        HorizontalSpacer(graphButtonsBox)
        self.cmdSaveData = QToolButton(graphButtonsBox)
        self.cmdSaveData.setUsesTextLabel(True)
        self.cmdSaveData.setTextLabel("Save data to file")
        self.cmdSaveData.setIconSet(QIconSet(Icons.load("save")))
        self.cmdSaveData.setTextPosition(QToolButton.BesideIcon)

        self.topFrame = QVGroupBox("Lakeshore - ", self)
        updateFreqBox = QHBox(self.topFrame)
        updateFreqBox.setSpacing(5)
        QLabel("Update frequency : every", updateFreqBox)
        self.spnUpdateFrequency = QSpinBox(64, 30000, 500, updateFreqBox)
        QLabel("millisecond", updateFreqBox)
        self.lblUpdateFrequency = QLabel("<nobr><b>current = ?</b></nobr>",
                                         updateFreqBox)
        self.cmdUpdateFrequency = QPushButton("Change", updateFreqBox)
        HorizontalSpacer(updateFreqBox)
        self.lblStatus = QLabel("<h1>status</h1>", self.topFrame)
        self.lblStatus.setAlignment(Qt.AlignCenter)
        innerBox = QVBox(self.topFrame)
        self.channelsBox = QGrid(8, innerBox)
        self.channelsBox.setSpacing(5)
        self.channelsBox.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        commandsBox = QVBox(innerBox)
        VerticalSpacer(self.topFrame)
        resetBox = QHBox(self.topFrame)
        HorizontalSpacer(resetBox)
        #self.cmdReset = QToolButton(resetBox)
        #self.cmdReset.setUsesTextLabel(True)
        #self.cmdReset.setTextLabel("Reset instrument")
        #self.cmdReset.setIconSet(QIconSet(Icons.load("reload")))
        #self.cmdReset.setTextPosition(QToolButton.BesideIcon)

        #QObject.connect(self.cmdReset, SIGNAL("clicked()"), self.lsReset)
        QObject.connect(self.cmdResetZoom, SIGNAL('clicked()'),
                        self.graph.ResetZoom)
        QObject.connect(self.cmdSaveData, SIGNAL('clicked()'), self.saveGraph)
        QObject.connect(self.graph, PYSIGNAL('QtBlissGraphSignal'),
                        self.graphSignal)
        QObject.connect(self.cmdUpdateFrequency, SIGNAL("clicked()"),
                        self.lsUpdateFrequency)

        QVBoxLayout(self, 5, 5)
        self.layout().addWidget(graphBox)
        self.layout().addWidget(self.topFrame)
Ejemplo n.º 9
0
    def __init__(self, *args):
        BlissWidget.__init__(self, *args)

        self.energyScan = None
        self.scanObject = None
        self.element = None

        self.sessionId = None
        self.blSampleId = None
        self.scanParameters = {}
        self.archive_directory = None

        self.addProperty('mnemonic', 'string', '')
        self.addProperty('icons', 'string', '')
        self.addProperty('formatString', 'formatString', '##.####')
        self.addProperty('decimalPlaces', 'string', '4')

        self.defineSlot('setDirectory', ())
        self.defineSlot('setPrefix', ())
        self.defineSlot('setElement', ())
        self.defineSlot('setSample', ())
        self.defineSlot('setSession', ())

        self.defineSignal('energyScanning', ())
        self.defineSignal('energyScanConnected', ())
        self.defineSignal('energyScanCanMove', ())
        self.defineSignal('edgeScanEnergies', ())

        self.parametersBox = QHGroupBox("Parameters", self)
        self.parametersBox.hide()
        self.parametersBox.setInsideMargin(4)
        self.parametersBox.setInsideSpacing(2)
        self.parametersBox.setCheckable(True)
        self.parametersBox.setChecked(False)

        QLabel("Prefix:", self.parametersBox)
        self.prefixInput = QLineEdit(self.parametersBox)
        self.prefixInput.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        QObject.connect(self.prefixInput,
                        SIGNAL('textChanged(const QString &)'),
                        self.prefixChanged)
        QLabel("Directory:", self.parametersBox)
        self.directoryInput = QLineEdit(self.parametersBox)
        self.directoryInput.setSizePolicy(QSizePolicy.Expanding,
                                          QSizePolicy.Fixed)
        QObject.connect(self.directoryInput,
                        SIGNAL('textChanged(const QString &)'),
                        self.directoryChanged)

        self.browseButton = QToolButton(self.parametersBox)
        self.browseButton.setTextLabel("Browse")
        self.browseButton.setUsesTextLabel(True)
        self.browseButton.setTextPosition(QToolButton.BesideIcon)
        QObject.connect(self.browseButton, SIGNAL("clicked()"),
                        self.browseButtonClicked)

        self.scanBox = QHGroupBox("Energy scan", self)
        self.scanBox.setInsideMargin(4)
        self.scanBox.setInsideSpacing(2)
        self.scanBox.hide()
        self.startScanButton = MenuButton(self.scanBox, "Start scan")
        self.startScanButton.hide()
        self.connect(self.startScanButton, PYSIGNAL('executeCommand'),
                     self.startEnergyScan)
        self.connect(self.startScanButton, PYSIGNAL('cancelCommand'),
                     self.cancelEnergyScan)

        self.statusBox = QHGroupBox("(no element)", self.scanBox)
        self.statusBox.hide()
        #self.statusBox.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.MinimumExpanding)
        self.statusBox.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.statusBox.setAlignment(QGroupBox.AlignCenter)
        self.scanStatus = QLabel(self.statusBox)
        self.scanStatus.setSizePolicy(QSizePolicy.Expanding,
                                      QSizePolicy.MinimumExpanding)
        self.scanStatus.setAlignment(QLabel.AlignCenter)

        box4 = QVBox(self.scanBox)
        peakLabel = QLabel("Peak:", box4)
        peakLabel.setAlignment(QLabel.AlignHCenter | QLabel.AlignBottom)
        kev1Label = QLabel("(keV)", box4)
        kev1Label.setAlignment(QLabel.AlignHCenter | QLabel.AlignTop)
        #kev2Label.setSizePolicy(QSizePolicy.Minimum,QSizePolicy.Fixed)
        self.peakInput = shortLineEdit(self.scanBox)
        self.peakInput.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        self.peakInput.setValidator(QDoubleValidator(self))

        box5 = QVBox(self.scanBox)
        inflectionLabel = QLabel("Inflection:", box5)
        inflectionLabel.setAlignment(QLabel.AlignHCenter | QLabel.AlignBottom)
        kev2Label = QLabel("(keV)", box5)
        kev2Label.setAlignment(QLabel.AlignHCenter | QLabel.AlignTop)
        #kev1Label.setSizePolicy(QSizePolicy.Minimum,QSizePolicy.Fixed)
        self.inflectionInput = shortLineEdit(self.scanBox)
        self.inflectionInput.setSizePolicy(QSizePolicy.Minimum,
                                           QSizePolicy.Fixed)
        self.inflectionInput.setValidator(QDoubleValidator(self))

        box6 = QVBox(self.scanBox)
        remoteLabel = QLabel("Remote:", box6)
        remoteLabel.setAlignment(QLabel.AlignHCenter | QLabel.AlignBottom)
        kev3Label = QLabel("(keV)", box6)
        kev3Label.setAlignment(QLabel.AlignHCenter | QLabel.AlignTop)
        #kev3Label.setSizePolicy(QSizePolicy.Minimum,QSizePolicy.Fixed)
        self.remoteInput = shortLineEdit(self.scanBox)
        self.remoteInput.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        self.remoteInput.setValidator(QDoubleValidator(self))

        box7 = QVBox(self.scanBox)
        remoteLabel = QLabel("2nd Remote:", box7)
        remoteLabel.setAlignment(QLabel.AlignHCenter | QLabel.AlignBottom)
        kev4Label = QLabel("(keV)", box7)
        kev4Label.setAlignment(QLabel.AlignHCenter | QLabel.AlignTop)
        #kev4Label.setSizePolicy(QSizePolicy.Minimum,QSizePolicy.Fixed)
        self.remote2Input = shortLineEdit(self.scanBox)
        self.remote2Input.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        self.remote2Input.setValidator(QDoubleValidator(self))

        self.acceptBox = QVBox(self.scanBox)
        self.acceptBox.setSpacing(2)
        self.acceptButton = MenuButton2(self.acceptBox, "Accept")
        self.resetButton = MenuButton2(self.acceptBox, "Reset")
        self.acceptBox.hide()
        QObject.connect(self.resetButton, SIGNAL('clicked()'),
                        self.resetEnergies)
        QObject.connect(self.acceptButton, SIGNAL('clicked()'),
                        self.acceptEnergies)

        self.parametersBox.setSizePolicy(QSizePolicy.MinimumExpanding,
                                         QSizePolicy.Fixed)
        self.scanBox.setSizePolicy(QSizePolicy.MinimumExpanding,
                                   QSizePolicy.Fixed)
        self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)

        self.instanceSynchronize("parametersBox", "prefixInput",
                                 "directoryInput", "peakInput",
                                 "inflectionInput", "remoteInput",
                                 "remote2Input")

        self.choochGraphs = QtBlissGraph(self)
        self.choochGraphs.setSizePolicy(QSizePolicy.Expanding,
                                        QSizePolicy.Fixed)

        QVBoxLayout(self)
        self.layout().addWidget(self.parametersBox)
        self.layout().addWidget(self.scanBox)
        self.layout().addWidget(self.choochGraphs)

        self.setEnabled(False)
Ejemplo n.º 10
0
    def __init__(self, parent=None, name="Colormap Dialog", slider=False):
        if QTVERSION < '4.0.0':
            qt.QDialog.__init__(self, parent, name)
            self.setCaption(name)
        else:
            qt.QDialog.__init__(self, parent)
            self.setWindowTitle(name)
        self.title = name

        self.colormapList = [
            "Greyscale", "Reverse Grey", "Temperature", "Red", "Green", "Blue",
            "Many"
        ]

        # default values
        self.dataMin = -10
        self.dataMax = 10
        self.minValue = 0
        self.maxValue = 1

        self.colormapIndex = 2
        self.colormapType = 0

        self.autoscale = False
        self.autoscale90 = False
        # main layout
        if QTVERSION < '4.0.0':
            vlayout = qt.QVBoxLayout(self, 0, -1, "Main ColormapDialog Layout")
        else:
            vlayout = qt.QVBoxLayout(self)
        vlayout.setMargin(10)
        vlayout.setSpacing(0)

        # layout 1 : -combo to choose colormap
        #            -autoscale button
        #            -autoscale 90% button
        hbox1 = qt.QWidget(self)
        hlayout1 = qt.QHBoxLayout(hbox1)
        vlayout.addWidget(hbox1)
        hlayout1.setMargin(0)
        hlayout1.setSpacing(10)

        # combo
        self.combo = qt.QComboBox(hbox1)
        for colormap in self.colormapList:
            if QTVERSION < '4.0.0':
                self.combo.insertItem(colormap)
            else:
                self.combo.addItem(colormap)
        self.connect(self.combo, qt.SIGNAL("activated(int)"),
                     self.colormapChange)
        hlayout1.addWidget(self.combo)

        # autoscale
        self.autoScaleButton = qt.QPushButton("Autoscale", hbox1)
        if QTVERSION < '4.0.0':
            self.autoScaleButton.setToggleButton(True)
        else:
            self.autoScaleButton.setCheckable(True)
        self.autoScaleButton.setAutoDefault(False)
        self.connect(self.autoScaleButton, qt.SIGNAL("toggled(bool)"),
                     self.autoscaleChange)
        hlayout1.addWidget(self.autoScaleButton)

        # autoscale 90%
        self.autoScale90Button = qt.QPushButton("Autoscale 90%", hbox1)
        if QTVERSION < '4.0.0':
            self.autoScale90Button.setToggleButton(True)
        else:
            self.autoScale90Button.setCheckable(True)
        self.autoScale90Button.setAutoDefault(False)

        self.connect(self.autoScale90Button, qt.SIGNAL("toggled(bool)"),
                     self.autoscale90Change)
        hlayout1.addWidget(self.autoScale90Button)

        # hlayout
        if QTVERSION > '4.0.0':
            hbox0 = qt.QWidget(self)
            self.__hbox0 = hbox0
            hlayout0 = qt.QHBoxLayout(hbox0)
            hlayout0.setMargin(0)
            hlayout0.setSpacing(0)
            vlayout.addWidget(hbox0)
            #hlayout0.addStretch(10)

            self.buttonGroup = qt.QButtonGroup()
            g1 = qt.QCheckBox(hbox0)
            g1.setText("Linear")
            g2 = qt.QCheckBox(hbox0)
            g2.setText("Logarithmic")
            g3 = qt.QCheckBox(hbox0)
            g3.setText("Gamma")
            self.buttonGroup.addButton(g1, 0)
            self.buttonGroup.addButton(g2, 1)
            self.buttonGroup.addButton(g3, 2)
            self.buttonGroup.setExclusive(True)
            if self.colormapType == 1:
                self.buttonGroup.button(1).setChecked(True)
            elif self.colormapType == 2:
                self.buttonGroup.button(2).setChecked(True)
            else:
                self.buttonGroup.button(0).setChecked(True)
            hlayout0.addWidget(g1)
            hlayout0.addWidget(g2)
            hlayout0.addWidget(g3)
            vlayout.addWidget(hbox0)
            self.connect(self.buttonGroup, qt.SIGNAL("buttonClicked(int)"),
                         self.buttonGroupChange)

        vlayout.addSpacing(20)

        hboxlimits = qt.QWidget(self)
        hboxlimitslayout = qt.QHBoxLayout(hboxlimits)
        hboxlimitslayout.setMargin(0)
        hboxlimitslayout.setSpacing(0)

        if slider:
            self.slider = DoubleSlider.DoubleSlider(hboxlimits, scale=False)
            hboxlimitslayout.addWidget(self.slider)
        else:
            self.slider = None

        vlayout.addWidget(hboxlimits)

        vboxlimits = qt.QWidget(hboxlimits)
        vboxlimitslayout = qt.QVBoxLayout(vboxlimits)
        vboxlimitslayout.setMargin(0)
        vboxlimitslayout.setSpacing(0)
        hboxlimitslayout.addWidget(vboxlimits)

        # hlayout 2 : - min label
        #             - min texte
        hbox2 = qt.QWidget(vboxlimits)
        self.__hbox2 = hbox2
        hlayout2 = qt.QHBoxLayout(hbox2)
        hlayout2.setMargin(0)
        hlayout2.setSpacing(0)
        #vlayout.addWidget(hbox2)
        vboxlimitslayout.addWidget(hbox2)
        hlayout2.addStretch(10)

        self.minLabel = qt.QLabel(hbox2)
        self.minLabel.setText("Minimum")
        hlayout2.addWidget(self.minLabel)

        hlayout2.addSpacing(5)
        hlayout2.addStretch(1)
        self.minText = MyQLineEdit(hbox2)
        self.minText.setFixedWidth(150)
        self.minText.setAlignment(qt.Qt.AlignRight)
        self.connect(self.minText, qt.SIGNAL("returnPressed()"),
                     self.minTextChanged)
        hlayout2.addWidget(self.minText)

        # hlayout 3 : - min label
        #             - min text
        hbox3 = qt.QWidget(vboxlimits)
        self.__hbox3 = hbox3
        hlayout3 = qt.QHBoxLayout(hbox3)
        hlayout3.setMargin(0)
        hlayout3.setSpacing(0)
        #vlayout.addWidget(hbox3)
        vboxlimitslayout.addWidget(hbox3)

        hlayout3.addStretch(10)
        self.maxLabel = qt.QLabel(hbox3)
        self.maxLabel.setText("Maximum")
        hlayout3.addWidget(self.maxLabel)

        hlayout3.addSpacing(5)
        hlayout3.addStretch(1)

        self.maxText = MyQLineEdit(hbox3)
        self.maxText.setFixedWidth(150)
        self.maxText.setAlignment(qt.Qt.AlignRight)

        self.connect(self.maxText, qt.SIGNAL("returnPressed()"),
                     self.maxTextChanged)
        hlayout3.addWidget(self.maxText)

        # Graph widget for color curve...
        self.c = QtBlissGraph(self)
        self.c.xlabel("Data Values")
        self.c.enableZoom(False)
        self.c.setCanvasBackground(qt.Qt.white)
        self.c.canvas().setMouseTracking(1)

        self.c.enableAxis(Qwt5.QwtPlot.xBottom)

        self.marge = (abs(self.dataMax) + abs(self.dataMin)) / 6.0
        self.minmd = self.dataMin - self.marge
        self.maxpd = self.dataMax + self.marge

        self.c.setx1axislimits(self.minmd, self.maxpd)
        self.c.sety1axislimits(-11.5, 11.5)
        self.c.picker.setSelectionFlags(Qwt5.QwtPicker.NoSelection)

        x = [self.minmd, self.dataMin, self.dataMax, self.maxpd]
        y = [-10, -10, 10, 10]
        self.c.newCurve("ConstrainedCurve", x, y)
        self.markers = []
        self.__x = x
        self.__y = y
        for i in range(4):
            index = self.c.insertx1marker(x[i], y[i], noline=True)
            marker = self.c.markersdict[index]['marker']
            if i in [1, 2]:
                self.c.setmarkerfollowmouse(index, 1)
            marker.setLinePen(qt.QPen(qt.Qt.green, 2, qt.Qt.DashDotLine))
            marker.setSymbol(
                Qwt5.QwtSymbol(Qwt5.QwtSymbol.Diamond, qt.QBrush(qt.Qt.blue),
                               qt.QPen(qt.Qt.red), qt.QSize(15, 15)))
            self.markers.append(index)

        #self.c.enablemarkermode()
        self.c.setMinimumSize(qt.QSize(250, 200))
        vlayout.addWidget(self.c)

        if QTVERSION < '4.0.0':
            self.connect(self.c, qt.PYSIGNAL("QtBlissGraphSignal"), self.chval)
            self.connect(self.c, qt.PYSIGNAL("QtBlissGraphSignal"), self.chmap)
            if slider:
                self.connect(self.slider,
                             qt.PYSIGNAL("doubleSliderValueChanged"),
                             self._sliderChanged)
        else:
            self.connect(self.c, qt.SIGNAL("QtBlissGraphSignal"), self.chval)
            self.connect(self.c, qt.SIGNAL("QtBlissGraphSignal"), self.chmap)

            if slider:
                self.connect(self.slider,
                             qt.SIGNAL("doubleSliderValueChanged"),
                             self._sliderChanged)

        # colormap window can not be resized
        self.setFixedSize(vlayout.minimumSize())