From 25314fd2aed81aa5281bc3d93dbcc7919368ebe1 Mon Sep 17 00:00:00 2001 From: Bicker Date: Wed, 22 May 2019 17:45:37 +0200 Subject: Initial commit --- gui/widgets/spinbox.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 gui/widgets/spinbox.py (limited to 'gui/widgets/spinbox.py') diff --git a/gui/widgets/spinbox.py b/gui/widgets/spinbox.py new file mode 100644 index 0000000..1abb63a --- /dev/null +++ b/gui/widgets/spinbox.py @@ -0,0 +1,14 @@ +from PyQt5.QtWidgets import QSpinBox + + +class SpinBox(QSpinBox): + def __init__(self): + super(QSpinBox, self).__init__() + self.setMaximum(2**31 - 1) + self.setMinimum(-self.maximum()) + + def get_value(self, ql_type): + return ql_type(self.value()) + + def on_change(self, change_event_function): + self.valueChanged.connect(lambda: change_event_function(self)) -- cgit v1.2.3