from ..Qt import QtWidgets, QtGui


class BinningWindow(QtWidgets.QDialog):
    def __init__(self, parent=None):
        super().__init__(parent=parent)

        layout = QtWidgets.QFormLayout()

        self.label = QtWidgets.QLabel('Digits (negative values position left of decimal point)')
        self.spinbox = QtWidgets.QLineEdit()
        self.spinbox.setValidator(QtGui.QDoubleValidator())
        self.spinbox.setText('1')
        layout.addRow(self.label, self.spinbox)

        self.dialogbox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
        self.dialogbox.accepted.connect(self.accept)
        self.dialogbox.rejected.connect(self.reject)
        layout.addWidget(self.dialogbox)

        self.setLayout(layout)
