Exemple #1
0
    def __init__(self, parent):
        QtGui.QDialog.__init__(self, parent)
        self._ui = Ui_AdjustClipping()
        self._ui.setupUi(self)

        self._parent = parent
        self._viewer = parent._stageView
        clipRange = self._viewer.computeGfCamera().frustum.nearFar
        self._nearCache = self._viewer.overrideNear or clipRange.min
        self._farCache = self._viewer.overrideFar or clipRange.max

        self._refreshTimer = QtCore.QTimer(self)
        self._refreshTimer.setInterval(250)
        self._refreshTimer.start()

        # Connect timer
        QtCore.QObject.connect(self._refreshTimer, QtCore.SIGNAL('timeout()'),
                               self._updateAutomaticValues)

        # When the checkboxes change, we want to update instantly
        QtCore.QObject.connect(self._ui.overrideNear,
                               QtCore.SIGNAL('stateChanged(int)'),
                               self._overrideNearToggled)

        QtCore.QObject.connect(self._ui.overrideFar,
                               QtCore.SIGNAL('stateChanged(int)'),
                               self._overrideFarToggled)

        # we also want to update the clipping planes as the user is typing
        QtCore.QObject.connect(self._ui.nearEdit,
                               QtCore.SIGNAL('textChanged(QString)'),
                               self._nearChanged)

        QtCore.QObject.connect(self._ui.farEdit,
                               QtCore.SIGNAL('textChanged(QString)'),
                               self._farChanged)

        # uncheck the main window menu item when the window is closed
        QtCore.QObject.connect(self, QtCore.SIGNAL('finished(int)'),
                               self._cleanUpAndClose)

        # Set the checkboxes to their initial state
        self._ui.overrideNear.setChecked(self._viewer.overrideNear \
                                             is not None)
        self._ui.overrideFar.setChecked(self._viewer.overrideFar \
                                            is not None)

        # load the initial values for the text boxes, but first deactivate them
        # if their corresponding checkbox is off.
        self._ui.nearEdit.setEnabled(self._ui.overrideNear.isChecked())
        self._ui.nearEdit.setText(str(self._nearCache))

        self._ui.farEdit.setEnabled(self._ui.overrideFar.isChecked())
        self._ui.farEdit.setText(str(self._farCache))

        # Make sure only doubles can be typed in the text boxes
        self._ui.nearEdit.setValidator(QtGui.QDoubleValidator(self))
        self._ui.farEdit.setValidator(QtGui.QDoubleValidator(self))
Exemple #2
0
    def __init__(self, parent, dataModel):
        QtGui.QDialog.__init__(self, parent)
        self._ui = Ui_AdjustClipping()
        self._ui.setupUi(self)

        self._dataModel = dataModel
        clipRange = self._dataModel.cameraFrustum.nearFar
        self._nearCache = self._dataModel.overrideNear or clipRange.min
        self._farCache = self._dataModel.overrideFar or clipRange.max

        QtCore.QObject.connect(self._dataModel,
                               QtCore.SIGNAL('signalFrustumChanged()'),
                               self.update)

        # When the checkboxes change, we want to update instantly
        QtCore.QObject.connect(self._ui.overrideNear,
                               QtCore.SIGNAL('stateChanged(int)'),
                               self._overrideNearToggled)

        QtCore.QObject.connect(self._ui.overrideFar,
                               QtCore.SIGNAL('stateChanged(int)'),
                               self._overrideFarToggled)

        # we also want to update the clipping planes as the user is typing
        QtCore.QObject.connect(self._ui.nearEdit,
                               QtCore.SIGNAL('textChanged(QString)'),
                               self._nearChanged)

        QtCore.QObject.connect(self._ui.farEdit,
                               QtCore.SIGNAL('textChanged(QString)'),
                               self._farChanged)

        # Set the checkboxes to their initial state
        self._ui.overrideNear.setChecked(self._dataModel.overrideNear \
                                             is not None)
        self._ui.overrideFar.setChecked(self._dataModel.overrideFar \
                                            is not None)

        # load the initial values for the text boxes, but first deactivate them
        # if their corresponding checkbox is off.
        self._ui.nearEdit.setEnabled(self._ui.overrideNear.isChecked())
        self._ui.nearEdit.setText(str(self._nearCache))

        self._ui.farEdit.setEnabled(self._ui.overrideFar.isChecked())
        self._ui.farEdit.setText(str(self._farCache))

        # Make sure only doubles can be typed in the text boxes
        self._ui.nearEdit.setValidator(QtGui.QDoubleValidator(self))
        self._ui.farEdit.setValidator(QtGui.QDoubleValidator(self))
Exemple #3
0
    def __init__(self, parent):
        QtGui.QDialog.__init__(self,parent)
        self._ui = Ui_AdjustClipping()
        self._ui.setupUi(self)

        self._parent = parent
        self._viewer = parent._stageView
        clipRange = self._viewer.computeGfCamera().frustum.nearFar
        self._nearCache = self._viewer.overrideNear or clipRange.min
        self._farCache = self._viewer.overrideFar or clipRange.max

        self._refreshTimer = QtCore.QTimer(self)
        self._refreshTimer.setInterval(250)
        self._refreshTimer.start()

        # Connect timer
        QtCore.QObject.connect(self._refreshTimer, QtCore.SIGNAL('timeout()'),
                               self._updateAutomaticValues)

        # When the checkboxes change, we want to update instantly
        QtCore.QObject.connect(self._ui.overrideNear,
                               QtCore.SIGNAL('stateChanged(int)'),
                               self._overrideNearToggled)

        QtCore.QObject.connect(self._ui.overrideFar,
                               QtCore.SIGNAL('stateChanged(int)'),
                               self._overrideFarToggled)

        # we also want to update the clipping planes as the user is typing
        QtCore.QObject.connect(self._ui.nearEdit,
                               QtCore.SIGNAL('textChanged(QString)'),
                               self._nearChanged)

        QtCore.QObject.connect(self._ui.farEdit,
                               QtCore.SIGNAL('textChanged(QString)'),
                               self._farChanged)

        # uncheck the main window menu item when the window is closed
        QtCore.QObject.connect(self,
                               QtCore.SIGNAL('finished(int)'),
                               self._cleanUpAndClose)

        # Set the checkboxes to their initial state
        self._ui.overrideNear.setChecked(self._viewer.overrideNear \
                                             is not None)
        self._ui.overrideFar.setChecked(self._viewer.overrideFar \
                                            is not None)

        # load the initial values for the text boxes, but first deactivate them
        # if their corresponding checkbox is off.
        self._ui.nearEdit.setEnabled(self._ui.overrideNear.isChecked())
        self._ui.nearEdit.setText(str(self._nearCache))

        self._ui.farEdit.setEnabled(self._ui.overrideFar.isChecked())
        self._ui.farEdit.setText(str(self._farCache))

        # Make sure only doubles can be typed in the text boxes
        self._ui.nearEdit.setValidator(QtGui.QDoubleValidator(self))
        self._ui.farEdit.setValidator(QtGui.QDoubleValidator(self))
Exemple #4
0
    def __init__(self, parent, dataModel):
        QtGui.QDialog.__init__(self,parent)
        self._ui = Ui_AdjustClipping()
        self._ui.setupUi(self)

        self._dataModel = dataModel
        clipRange = self._dataModel.cameraFrustum.nearFar
        self._nearCache = self._dataModel.overrideNear or clipRange.min
        self._farCache = self._dataModel.overrideFar or clipRange.max

        QtCore.QObject.connect(self._dataModel, 
                               QtCore.SIGNAL('signalFrustumChanged()'),
                               self.update)

        # When the checkboxes change, we want to update instantly
        QtCore.QObject.connect(self._ui.overrideNear,
                               QtCore.SIGNAL('stateChanged(int)'),
                               self._overrideNearToggled)

        QtCore.QObject.connect(self._ui.overrideFar,
                               QtCore.SIGNAL('stateChanged(int)'),
                               self._overrideFarToggled)

        # we also want to update the clipping planes as the user is typing
        QtCore.QObject.connect(self._ui.nearEdit,
                               QtCore.SIGNAL('textChanged(QString)'),
                               self._nearChanged)

        QtCore.QObject.connect(self._ui.farEdit,
                               QtCore.SIGNAL('textChanged(QString)'),
                               self._farChanged)

        # Set the checkboxes to their initial state
        self._ui.overrideNear.setChecked(self._dataModel.overrideNear \
                                             is not None)
        self._ui.overrideFar.setChecked(self._dataModel.overrideFar \
                                            is not None)

        # load the initial values for the text boxes, but first deactivate them
        # if their corresponding checkbox is off.
        self._ui.nearEdit.setEnabled(self._ui.overrideNear.isChecked())
        self._ui.nearEdit.setText(str(self._nearCache))

        self._ui.farEdit.setEnabled(self._ui.overrideFar.isChecked())
        self._ui.farEdit.setText(str(self._farCache))

        # Make sure only doubles can be typed in the text boxes
        self._ui.nearEdit.setValidator(QtGui.QDoubleValidator(self))
        self._ui.farEdit.setValidator(QtGui.QDoubleValidator(self))
Exemple #5
0
class AdjustClipping(QtGui.QDialog):
    def __init__(self, parent):
        QtGui.QDialog.__init__(self,parent)
        self._ui = Ui_AdjustClipping()
        self._ui.setupUi(self)

        self._parent = parent
        self._viewer = parent._stageView
        clipRange = self._viewer.computeGfCamera().frustum.nearFar
        self._nearCache = self._viewer.overrideNear or clipRange.min
        self._farCache = self._viewer.overrideFar or clipRange.max

        self._refreshTimer = QtCore.QTimer(self)
        self._refreshTimer.setInterval(250)
        self._refreshTimer.start()

        # Connect timer
        QtCore.QObject.connect(self._refreshTimer, QtCore.SIGNAL('timeout()'),
                               self._updateAutomaticValues)

        # When the checkboxes change, we want to update instantly
        QtCore.QObject.connect(self._ui.overrideNear,
                               QtCore.SIGNAL('stateChanged(int)'),
                               self._overrideNearToggled)

        QtCore.QObject.connect(self._ui.overrideFar,
                               QtCore.SIGNAL('stateChanged(int)'),
                               self._overrideFarToggled)

        # we also want to update the clipping planes as the user is typing
        QtCore.QObject.connect(self._ui.nearEdit,
                               QtCore.SIGNAL('textChanged(QString)'),
                               self._nearChanged)

        QtCore.QObject.connect(self._ui.farEdit,
                               QtCore.SIGNAL('textChanged(QString)'),
                               self._farChanged)

        # uncheck the main window menu item when the window is closed
        QtCore.QObject.connect(self,
                               QtCore.SIGNAL('finished(int)'),
                               self._cleanUpAndClose)

        # Set the checkboxes to their initial state
        self._ui.overrideNear.setChecked(self._viewer.overrideNear \
                                             is not None)
        self._ui.overrideFar.setChecked(self._viewer.overrideFar \
                                            is not None)

        # load the initial values for the text boxes, but first deactivate them
        # if their corresponding checkbox is off.
        self._ui.nearEdit.setEnabled(self._ui.overrideNear.isChecked())
        self._ui.nearEdit.setText(str(self._nearCache))

        self._ui.farEdit.setEnabled(self._ui.overrideFar.isChecked())
        self._ui.farEdit.setText(str(self._farCache))

        # Make sure only doubles can be typed in the text boxes
        self._ui.nearEdit.setValidator(QtGui.QDoubleValidator(self))
        self._ui.farEdit.setValidator(QtGui.QDoubleValidator(self))

    def _updateAutomaticValues(self):
        """Read the automatically computed clipping planes and put them
           in the text boxes when they are deactivated"""
        clipRange = self._viewer.computeGfCamera().frustum.nearFar
        if (not self._ui.overrideNear.isChecked()) and \
                self._nearCache != clipRange.min :
            self._nearCache = clipRange.min
            self._ui.nearEdit.setText(str(self._nearCache))

        if (not self._ui.overrideFar.isChecked()) and \
                self._farCache != clipRange.max :
            self._farCache = clipRange.max
            self._ui.farEdit.setText(str(self._farCache))

    def _overrideNearToggled(self, state):
        """Called when the "Override Near" checkbox is toggled"""
        self._ui.nearEdit.setEnabled(state)
        if state:
            self._viewer.overrideNear = self._nearCache
        else:
            self._viewer.overrideNear = None

    def _overrideFarToggled(self, state):
        """Called when the "Override Far" checkbox is toggled"""
        self._ui.farEdit.setEnabled(state)
        if state:
            self._viewer.overrideFar = self._farCache
        else:
            self._viewer.overrideFar = None

    def _nearChanged(self, text):
        """Called when the Near text box changed.  This can happen when we
        are updating the value but the widget is actually inactive - don't
        do anything in that case."""
        if len(text) == 0 or not self._ui.nearEdit.isEnabled():
            return

        try:
            self._viewer.overrideNear = float(text)
        except ValueError:
            pass

    def _farChanged(self, text):
        """Called when the Far text box changed.  This can happen when we
        are updating the value but he widget is actually inactive - don't
        do anything in that case."""
        if len(text) == 0 or not self._ui.farEdit.isEnabled():
            return

        try:
            self._viewer.overrideFar = float(text)
        except ValueError:
            pass

    def _cleanUpAndClose(self, result):
        self._refreshTimer.stop()
        self._parent._ui.actionAdjust_Clipping.setChecked(False)
Exemple #6
0
class AdjustClipping(QtGui.QDialog):
    """The dataModel provided to this VC must conform to the following
    interface:
    
    Editable properties:
       overrideNear (float or None, which indicates the override is disabled)
       overrideFar  (float or None, which indicates the override is disabled)

    Readable properties:
       cameraFrustum (Gf.Frustum, or struct that has a Gf.Range1d 'nearFar' member)

    Signals:
       signalFrustumChanged() - whenever the near/far clipping values
                                may have changed.
    """
    def __init__(self, parent, dataModel):
        QtGui.QDialog.__init__(self,parent)
        self._ui = Ui_AdjustClipping()
        self._ui.setupUi(self)

        self._dataModel = dataModel
        clipRange = self._dataModel.cameraFrustum.nearFar
        self._nearCache = self._dataModel.overrideNear or clipRange.min
        self._farCache = self._dataModel.overrideFar or clipRange.max

        QtCore.QObject.connect(self._dataModel, 
                               QtCore.SIGNAL('signalFrustumChanged()'),
                               self.update)

        # When the checkboxes change, we want to update instantly
        QtCore.QObject.connect(self._ui.overrideNear,
                               QtCore.SIGNAL('stateChanged(int)'),
                               self._overrideNearToggled)

        QtCore.QObject.connect(self._ui.overrideFar,
                               QtCore.SIGNAL('stateChanged(int)'),
                               self._overrideFarToggled)

        # we also want to update the clipping planes as the user is typing
        QtCore.QObject.connect(self._ui.nearEdit,
                               QtCore.SIGNAL('textChanged(QString)'),
                               self._nearChanged)

        QtCore.QObject.connect(self._ui.farEdit,
                               QtCore.SIGNAL('textChanged(QString)'),
                               self._farChanged)

        # Set the checkboxes to their initial state
        self._ui.overrideNear.setChecked(self._dataModel.overrideNear \
                                             is not None)
        self._ui.overrideFar.setChecked(self._dataModel.overrideFar \
                                            is not None)

        # load the initial values for the text boxes, but first deactivate them
        # if their corresponding checkbox is off.
        self._ui.nearEdit.setEnabled(self._ui.overrideNear.isChecked())
        self._ui.nearEdit.setText(str(self._nearCache))

        self._ui.farEdit.setEnabled(self._ui.overrideFar.isChecked())
        self._ui.farEdit.setText(str(self._farCache))

        # Make sure only doubles can be typed in the text boxes
        self._ui.nearEdit.setValidator(QtGui.QDoubleValidator(self))
        self._ui.farEdit.setValidator(QtGui.QDoubleValidator(self))

    def _updateEditorsFromDataModel(self):
        """Read the dataModel-computed clipping planes and put them
           in the text boxes when they are deactivated."""
        clipRange = self._dataModel.cameraFrustum.nearFar
        if (not self._ui.overrideNear.isChecked()) and \
                self._nearCache != clipRange.min :
            self._nearCache = clipRange.min
            self._ui.nearEdit.setText(str(self._nearCache))

        if (not self._ui.overrideFar.isChecked()) and \
                self._farCache != clipRange.max :
            self._farCache = clipRange.max
            self._ui.farEdit.setText(str(self._farCache))

    def paintEvent(self, paintEvent):
        """Overridden from base class so we can perform JIT updating
        of editors to limit the number of redraws we perform"""
        self._updateEditorsFromDataModel()
        super(AdjustClipping, self).paintEvent(paintEvent)

    def _overrideNearToggled(self, state):
        """Called when the "Override Near" checkbox is toggled"""
        self._ui.nearEdit.setEnabled(state)
        if state:
            self._dataModel.overrideNear = self._nearCache
        else:
            self._dataModel.overrideNear = None

    def _overrideFarToggled(self, state):
        """Called when the "Override Far" checkbox is toggled"""
        self._ui.farEdit.setEnabled(state)
        if state:
            self._dataModel.overrideFar = self._farCache
        else:
            self._dataModel.overrideFar = None

    def _nearChanged(self, text):
        """Called when the Near text box changed.  This can happen when we
        are updating the value but the widget is actually inactive - don't
        do anything in that case."""
        if len(text) == 0 or not self._ui.nearEdit.isEnabled():
            return

        try:
            self._dataModel.overrideNear = float(text)
        except ValueError:
            pass

    def _farChanged(self, text):
        """Called when the Far text box changed.  This can happen when we
        are updating the value but he widget is actually inactive - don't
        do anything in that case."""
        if len(text) == 0 or not self._ui.farEdit.isEnabled():
            return

        try:
            self._dataModel.overrideFar = float(text)
        except ValueError:
            pass

    def closeEvent(self, event):
        # Ensure that even if the dialog doesn't get destroyed right away,
        # we'll stop doing work.
        QtCore.QObject.disconnect(self._dataModel, 
                                  QtCore.SIGNAL('signalFrustumChanged()'),
                                  self.update)

        event.accept()
        # Since the dialog is the immediate-edit kind, we consider
        # window-close to be an accept, so our clients can know the dialog is
        # done by listening for the finished(int) signal
        self.accept()
Exemple #7
0
class AdjustClipping(QtWidgets.QDialog):
    """The dataModel provided to this VC must conform to the following
    interface:

    Editable properties:
       overrideNear (float or None, which indicates the override is disabled)
       overrideFar  (float or None, which indicates the override is disabled)

    Readable properties:
       cameraFrustum (Gf.Frustum, or struct that has a Gf.Range1d 'nearFar' member)

    Signals:
       signalFrustumChanged() - whenever the near/far clipping values
                                may have changed.
    """
    def __init__(self, parent, dataModel):
        QtWidgets.QDialog.__init__(self, parent)
        self._ui = Ui_AdjustClipping()
        self._ui.setupUi(self)

        self._dataModel = dataModel
        clipRange = self._dataModel.cameraFrustum.nearFar
        self._nearCache = self._dataModel.overrideNear or clipRange.min
        self._farCache = self._dataModel.overrideFar or clipRange.max

        self._dataModel.signalFrustumChanged.connect(self.update)

        # When the checkboxes change, we want to update instantly
        self._ui.overrideNear.stateChanged.connect(self._overrideNearToggled)

        self._ui.overrideFar.stateChanged.connect(self._overrideFarToggled)

        # we also want to update the clipping planes as the user is typing
        self._ui.nearEdit.textChanged.connect(self._nearChanged)

        self._ui.farEdit.textChanged.connect(self._farChanged)

        # Set the checkboxes to their initial state
        self._ui.overrideNear.setChecked(self._dataModel.overrideNear \
                                             is not None)
        self._ui.overrideFar.setChecked(self._dataModel.overrideFar \
                                            is not None)

        # load the initial values for the text boxes, but first deactivate them
        # if their corresponding checkbox is off.
        self._ui.nearEdit.setEnabled(self._ui.overrideNear.isChecked())
        self._ui.nearEdit.setText(str(self._nearCache))

        self._ui.farEdit.setEnabled(self._ui.overrideFar.isChecked())
        self._ui.farEdit.setText(str(self._farCache))

        # Make sure only doubles can be typed in the text boxes
        self._ui.nearEdit.setValidator(QtGui.QDoubleValidator(self))
        self._ui.farEdit.setValidator(QtGui.QDoubleValidator(self))

    def _updateEditorsFromDataModel(self):
        """Read the dataModel-computed clipping planes and put them
           in the text boxes when they are deactivated."""
        clipRange = self._dataModel.cameraFrustum.nearFar
        if (not self._ui.overrideNear.isChecked()) and \
                self._nearCache != clipRange.min :
            self._nearCache = clipRange.min
            self._ui.nearEdit.setText(str(self._nearCache))

        if (not self._ui.overrideFar.isChecked()) and \
                self._farCache != clipRange.max :
            self._farCache = clipRange.max
            self._ui.farEdit.setText(str(self._farCache))

    def paintEvent(self, paintEvent):
        """Overridden from base class so we can perform JIT updating
        of editors to limit the number of redraws we perform"""
        self._updateEditorsFromDataModel()
        super(AdjustClipping, self).paintEvent(paintEvent)

    def _overrideNearToggled(self, state):
        """Called when the "Override Near" checkbox is toggled"""
        self._ui.nearEdit.setEnabled(state)
        if state:
            self._dataModel.overrideNear = self._nearCache
        else:
            self._dataModel.overrideNear = None

    def _overrideFarToggled(self, state):
        """Called when the "Override Far" checkbox is toggled"""
        self._ui.farEdit.setEnabled(state)
        if state:
            self._dataModel.overrideFar = self._farCache
        else:
            self._dataModel.overrideFar = None

    def _nearChanged(self, text):
        """Called when the Near text box changed.  This can happen when we
        are updating the value but the widget is actually inactive - don't
        do anything in that case."""
        if len(text) == 0 or not self._ui.nearEdit.isEnabled():
            return

        try:
            self._dataModel.overrideNear = float(text)
        except ValueError:
            pass

    def _farChanged(self, text):
        """Called when the Far text box changed.  This can happen when we
        are updating the value but he widget is actually inactive - don't
        do anything in that case."""
        if len(text) == 0 or not self._ui.farEdit.isEnabled():
            return

        try:
            self._dataModel.overrideFar = float(text)
        except ValueError:
            pass

    def closeEvent(self, event):
        # Ensure that even if the dialog doesn't get destroyed right away,
        # we'll stop doing work.
        self._dataModel.signalFrustumChanged.disconnect(self.update)

        event.accept()
        # Since the dialog is the immediate-edit kind, we consider
        # window-close to be an accept, so our clients can know the dialog is
        # done by listening for the finished(int) signal
        self.accept()
Exemple #8
0
class AdjustClipping(QtGui.QDialog):
    def __init__(self, parent):
        QtGui.QDialog.__init__(self, parent)
        self._ui = Ui_AdjustClipping()
        self._ui.setupUi(self)

        self._parent = parent
        self._viewer = parent._stageView
        clipRange = self._viewer.computeGfCamera().frustum.nearFar
        self._nearCache = self._viewer.overrideNear or clipRange.min
        self._farCache = self._viewer.overrideFar or clipRange.max

        self._refreshTimer = QtCore.QTimer(self)
        self._refreshTimer.setInterval(250)
        self._refreshTimer.start()

        # Connect timer
        QtCore.QObject.connect(self._refreshTimer, QtCore.SIGNAL('timeout()'),
                               self._updateAutomaticValues)

        # When the checkboxes change, we want to update instantly
        QtCore.QObject.connect(self._ui.overrideNear,
                               QtCore.SIGNAL('stateChanged(int)'),
                               self._overrideNearToggled)

        QtCore.QObject.connect(self._ui.overrideFar,
                               QtCore.SIGNAL('stateChanged(int)'),
                               self._overrideFarToggled)

        # we also want to update the clipping planes as the user is typing
        QtCore.QObject.connect(self._ui.nearEdit,
                               QtCore.SIGNAL('textChanged(QString)'),
                               self._nearChanged)

        QtCore.QObject.connect(self._ui.farEdit,
                               QtCore.SIGNAL('textChanged(QString)'),
                               self._farChanged)

        # uncheck the main window menu item when the window is closed
        QtCore.QObject.connect(self, QtCore.SIGNAL('finished(int)'),
                               self._cleanUpAndClose)

        # Set the checkboxes to their initial state
        self._ui.overrideNear.setChecked(self._viewer.overrideNear \
                                             is not None)
        self._ui.overrideFar.setChecked(self._viewer.overrideFar \
                                            is not None)

        # load the initial values for the text boxes, but first deactivate them
        # if their corresponding checkbox is off.
        self._ui.nearEdit.setEnabled(self._ui.overrideNear.isChecked())
        self._ui.nearEdit.setText(str(self._nearCache))

        self._ui.farEdit.setEnabled(self._ui.overrideFar.isChecked())
        self._ui.farEdit.setText(str(self._farCache))

        # Make sure only doubles can be typed in the text boxes
        self._ui.nearEdit.setValidator(QtGui.QDoubleValidator(self))
        self._ui.farEdit.setValidator(QtGui.QDoubleValidator(self))

    def _updateAutomaticValues(self):
        """Read the automatically computed clipping planes and put them
           in the text boxes when they are deactivated"""
        clipRange = self._viewer.computeGfCamera().frustum.nearFar
        if (not self._ui.overrideNear.isChecked()) and \
                self._nearCache != clipRange.min :
            self._nearCache = clipRange.min
            self._ui.nearEdit.setText(str(self._nearCache))

        if (not self._ui.overrideFar.isChecked()) and \
                self._farCache != clipRange.max :
            self._farCache = clipRange.max
            self._ui.farEdit.setText(str(self._farCache))

    def _overrideNearToggled(self, state):
        """Called when the "Override Near" checkbox is toggled"""
        self._ui.nearEdit.setEnabled(state)
        if state:
            self._viewer.overrideNear = self._nearCache
        else:
            self._viewer.overrideNear = None

    def _overrideFarToggled(self, state):
        """Called when the "Override Far" checkbox is toggled"""
        self._ui.farEdit.setEnabled(state)
        if state:
            self._viewer.overrideFar = self._farCache
        else:
            self._viewer.overrideFar = None

    def _nearChanged(self, text):
        """Called when the Near text box changed.  This can happen when we
        are updating the value but the widget is actually inactive - don't
        do anything in that case."""
        if len(text) == 0 or not self._ui.nearEdit.isEnabled():
            return

        try:
            self._viewer.overrideNear = float(text)
        except ValueError:
            pass

    def _farChanged(self, text):
        """Called when the Far text box changed.  This can happen when we
        are updating the value but he widget is actually inactive - don't
        do anything in that case."""
        if len(text) == 0 or not self._ui.farEdit.isEnabled():
            return

        try:
            self._viewer.overrideFar = float(text)
        except ValueError:
            pass

    def _cleanUpAndClose(self, result):
        self._refreshTimer.stop()
        self._parent._ui.actionAdjust_Clipping.setChecked(False)