def __init__(self, attribute, parentWidget=None, addNotificationListener=True):
    super(ScalarWidget, self).__init__(attribute, parentWidget=parentWidget, addNotificationListener=addNotificationListener)
    hbox = QtGui.QHBoxLayout()
    self._widget = QtGui.QLineEdit(self)
    validator = QtGui.QDoubleValidator(self)
    validator.setDecimals(3)
    self._widget.setValidator(validator)
    hbox.addWidget(self._widget, 1)
    hbox.addStretch(0)
    hbox.setContentsMargins(0, 0, 0, 0)
    self.setLayout(hbox)
    self.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
    self.updateWidgetValue()
    if self.isEditable():
        self._widget.editingFinished.connect(self._invokeSetter)
    else:
        self._widget.setReadOnly(True)
def __init__(self, attribute, parentWidget=None, addNotificationListener=True):
    super(ScalarWidget, self).__init__(attribute, parentWidget=parentWidget, addNotificationListener=addNotificationListener)
    hbox = QtGui.QHBoxLayout()
    self._widget = QtGui.QLineEdit(self)
    validator = QtGui.QDoubleValidator(self)
    validator.setDecimals(3)
    self._widget.setValidator(validator)
    hbox.addWidget(self._widget, 1)
    hbox.addStretch(0)
    hbox.setContentsMargins(0, 0, 0, 0)
    self.setLayout(hbox)
    self.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
    self.updateWidgetValue()
    if self.isEditable():
        self._widget.editingFinished.connect(self._invokeSetter)
    else:
        self._widget.setReadOnly(True)