def _updateComponentUi(self):
        spectrum_component_items = self._ui.listWidgetSpectrumComponents.selectedItems(
        )
        spectrum_component_selected = (len(spectrum_component_items) > 0)

        self._ui.pushButtonDeleteSpectrumComponent.setEnabled(
            spectrum_component_selected)
        self._ui.comboBoxColourMap.setEnabled(spectrum_component_selected)
        self._ui.pushButtonAutorange.setEnabled(spectrum_component_selected)
        self._ui.comboBoxScale.setEnabled(spectrum_component_selected)
        self._ui.spinBoxDataFieldComponent.setEnabled(
            spectrum_component_selected)
        self._ui.pushButtonReverseColours.setEnabled(
            spectrum_component_selected)
        self._ui.lineEditDataRangeMin.setEnabled(spectrum_component_selected)
        self._ui.lineEditDataRangeMax.setEnabled(spectrum_component_selected)
        self._ui.lineEditColourRangeMin.setEnabled(spectrum_component_selected)
        self._ui.lineEditColourRangeMax.setEnabled(spectrum_component_selected)
        self._ui.checkBoxExtendBelow.setEnabled(spectrum_component_selected)
        self._ui.checkBoxExtendAbove.setEnabled(spectrum_component_selected)
        self._ui.checkBoxFixMinimum.setEnabled(spectrum_component_selected)
        self._ui.checkBoxFixMaximum.setEnabled(spectrum_component_selected)
        self._ui.pushButtonMoveDownSpectrumComponent.setEnabled(
            spectrum_component_selected)
        self._ui.pushButtonMoveUpSpectrumComponent.setEnabled(
            spectrum_component_selected)

        if spectrum_component_selected:
            active_spectrum_component = spectrum_component_items[0]
            sc = active_spectrum_component.data(SPECTRUM_DATA_ROLE)
            self._ui.comboBoxColourMap.blockSignals(True)
            self._ui.comboBoxColourMap.setCurrentIndex(
                sc.getColourMappingType())
            self._ui.comboBoxColourMap.blockSignals(False)
            self._ui.spinBoxDataFieldComponent.setValue(sc.getFieldComponent())
            self._ui.lineEditDataRangeMin.setText(
                FLOAT_STRING_FORMAT.format(sc.getRangeMinimum()))
            self._ui.lineEditDataRangeMax.setText(
                FLOAT_STRING_FORMAT.format(sc.getRangeMaximum()))
            self._ui.lineEditColourRangeMin.setText(
                FLOAT_STRING_FORMAT.format(sc.getColourMinimum()))
            self._ui.lineEditColourRangeMax.setText(
                FLOAT_STRING_FORMAT.format(sc.getColourMaximum()))
            self._ui.checkBoxExtendBelow.setChecked(sc.isExtendBelow())
            self._ui.checkBoxExtendAbove.setChecked(sc.isExtendAbove())
            self._ui.checkBoxFixMinimum.setChecked(sc.isFixMinimum())
            self._ui.checkBoxFixMaximum.setChecked(sc.isFixMaximum())
            self._ui.comboBoxScale.setCurrentIndex(sc.getScaleType())
            self._ui.lineEditExaggeration.setText(
                FLOAT_STRING_FORMAT.format(sc.getExaggeration()))

            row = self._ui.listWidgetSpectrumComponents.row(
                active_spectrum_component)
            self._ui.pushButtonMoveUpSpectrumComponent.setEnabled(row > 0)
            self._ui.pushButtonMoveDownSpectrumComponent.setEnabled(
                row < (self._ui.listWidgetSpectrumComponents.count() - 1))

            active_spectrum_component.setText(getComponentString(sc, row + 1))
 def _setTime(self, time):
     self._ui.lineEditTime.setText(FLOAT_STRING_FORMAT.format(time))
     self._ui.horizontalSliderTime.blockSignals(True)
     self._ui.horizontalSliderTime.setValue(
         self._calcSliderValueFromTime(time))
     self._ui.horizontalSliderTime.blockSignals(False)
     self._timekeeper.setTime(time)
 def _displayVector(self, widget, values, numberFormat=FLOAT_STRING_FORMAT):
     """
     Display real vector values in a widget. Also handle scalar
     """
     if isinstance(values, Number):
         newText = FLOAT_STRING_FORMAT.format(values)
     else:
         newText = ", ".join(numberFormat.format(value) for value in values)
     widget.setText(newText)
 def _maximumTimeValueChanged(self, value):
     if value < self._timekeeper.getMinimumTime():
         self._ui.doubleSpinBoxMaximumTime.setValue(
             self._timekeeper.getMaximumTime())
     else:
         self._timekeeper.setMaximumTime(value)
         displayed_time = float(self._ui.lineEditTime.text())
         if displayed_time > value:
             self._ui.lineEditTime.setText(
                 FLOAT_STRING_FORMAT.format(value))
 def _exaggerationEntered(self):
     sc = self._getCurrentSpectrumcomponent()
     try:
         valueText = self._ui.lineEditExaggeration.text()
         value = float(valueText)
         result = sc.setExaggeration(value)
         if result != ZINC_OK:
             raise ValueError("")
     except ValueError:
         ArgonLogger.getLogger().error(
             "Error setting log scale exaggeration")
     self._ui.lineEditExaggeration.setText(
         FLOAT_STRING_FORMAT.format(sc.getExaggeration()))
 def _colourRangeMaxEntered(self):
     sc = self._getCurrentSpectrumcomponent()
     try:
         valueText = self._ui.lineEditColourRangeMax.text()
         value = float(valueText)
         result = sc.setColourMaximum(value)
         if result != ZINC_OK:
             raise ValueError("")
     except ValueError:
         ArgonLogger.getLogger().error(
             "Error setting spectrum component colour range maximum")
     self._ui.lineEditColourRangeMax.setText(
         FLOAT_STRING_FORMAT.format(sc.getColourMaximum()))
 def _displayReal(self, widget, value):
     """
     Display real value in a widget
     """
     newText = FLOAT_STRING_FORMAT.format(value)
     widget.setText(newText)