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/__pycache__/calendar.cpython-35.pyc | Bin 0 -> 1142 bytes gui/widgets/__pycache__/checkbox.cpython-35.pyc | Bin 0 -> 1043 bytes gui/widgets/__pycache__/double_spinbox.cpython-35.pyc | Bin 0 -> 1209 bytes gui/widgets/__pycache__/label.cpython-35.pyc | Bin 0 -> 702 bytes gui/widgets/__pycache__/line_edit.cpython-35.pyc | Bin 0 -> 1038 bytes gui/widgets/__pycache__/money_spinbox.cpython-35.pyc | Bin 0 -> 1216 bytes gui/widgets/__pycache__/spinbox.cpython-35.pyc | Bin 0 -> 1133 bytes gui/widgets/calendar.py | 13 +++++++++++++ gui/widgets/checkbox.py | 12 ++++++++++++ gui/widgets/double_spinbox.py | 15 +++++++++++++++ gui/widgets/label.py | 9 +++++++++ gui/widgets/line_edit.py | 12 ++++++++++++ gui/widgets/money_spinbox.py | 15 +++++++++++++++ gui/widgets/spinbox.py | 14 ++++++++++++++ 14 files changed, 90 insertions(+) create mode 100644 gui/widgets/__pycache__/calendar.cpython-35.pyc create mode 100644 gui/widgets/__pycache__/checkbox.cpython-35.pyc create mode 100644 gui/widgets/__pycache__/double_spinbox.cpython-35.pyc create mode 100644 gui/widgets/__pycache__/label.cpython-35.pyc create mode 100644 gui/widgets/__pycache__/line_edit.cpython-35.pyc create mode 100644 gui/widgets/__pycache__/money_spinbox.cpython-35.pyc create mode 100644 gui/widgets/__pycache__/spinbox.cpython-35.pyc create mode 100644 gui/widgets/calendar.py create mode 100644 gui/widgets/checkbox.py create mode 100644 gui/widgets/double_spinbox.py create mode 100644 gui/widgets/label.py create mode 100644 gui/widgets/line_edit.py create mode 100644 gui/widgets/money_spinbox.py create mode 100644 gui/widgets/spinbox.py (limited to 'gui/widgets') diff --git a/gui/widgets/__pycache__/calendar.cpython-35.pyc b/gui/widgets/__pycache__/calendar.cpython-35.pyc new file mode 100644 index 0000000..fcd150c Binary files /dev/null and b/gui/widgets/__pycache__/calendar.cpython-35.pyc differ diff --git a/gui/widgets/__pycache__/checkbox.cpython-35.pyc b/gui/widgets/__pycache__/checkbox.cpython-35.pyc new file mode 100644 index 0000000..49f87fc Binary files /dev/null and b/gui/widgets/__pycache__/checkbox.cpython-35.pyc differ diff --git a/gui/widgets/__pycache__/double_spinbox.cpython-35.pyc b/gui/widgets/__pycache__/double_spinbox.cpython-35.pyc new file mode 100644 index 0000000..31d21df Binary files /dev/null and b/gui/widgets/__pycache__/double_spinbox.cpython-35.pyc differ diff --git a/gui/widgets/__pycache__/label.cpython-35.pyc b/gui/widgets/__pycache__/label.cpython-35.pyc new file mode 100644 index 0000000..13726bf Binary files /dev/null and b/gui/widgets/__pycache__/label.cpython-35.pyc differ diff --git a/gui/widgets/__pycache__/line_edit.cpython-35.pyc b/gui/widgets/__pycache__/line_edit.cpython-35.pyc new file mode 100644 index 0000000..8b314d1 Binary files /dev/null and b/gui/widgets/__pycache__/line_edit.cpython-35.pyc differ diff --git a/gui/widgets/__pycache__/money_spinbox.cpython-35.pyc b/gui/widgets/__pycache__/money_spinbox.cpython-35.pyc new file mode 100644 index 0000000..f55f3da Binary files /dev/null and b/gui/widgets/__pycache__/money_spinbox.cpython-35.pyc differ diff --git a/gui/widgets/__pycache__/spinbox.cpython-35.pyc b/gui/widgets/__pycache__/spinbox.cpython-35.pyc new file mode 100644 index 0000000..d23e28b Binary files /dev/null and b/gui/widgets/__pycache__/spinbox.cpython-35.pyc differ diff --git a/gui/widgets/calendar.py b/gui/widgets/calendar.py new file mode 100644 index 0000000..5f09834 --- /dev/null +++ b/gui/widgets/calendar.py @@ -0,0 +1,13 @@ +from PyQt5.QtWidgets import QCalendarWidget + + +class CalendarWidget(QCalendarWidget): + def __init__(self): + super(QCalendarWidget, self).__init__() + + def get_value(self, ql_type): + date = self.selectedDate() + return ql_type(date.day(), date.month(), date.year()) + + def on_change(self, change_event_function): + self.selectionChanged.connect(lambda: change_event_function(self)) diff --git a/gui/widgets/checkbox.py b/gui/widgets/checkbox.py new file mode 100644 index 0000000..d8e32f1 --- /dev/null +++ b/gui/widgets/checkbox.py @@ -0,0 +1,12 @@ +from PyQt5.QtWidgets import QCheckBox + + +class CheckBox(QCheckBox): + def __init__(self): + super(QCheckBox, self).__init__() + + def get_value(self, ql_type): + return ql_type(self.isChecked()) + + def on_change(self, change_event_function): + self.stateChanged.connect(lambda: change_event_function(self)) diff --git a/gui/widgets/double_spinbox.py b/gui/widgets/double_spinbox.py new file mode 100644 index 0000000..bde201d --- /dev/null +++ b/gui/widgets/double_spinbox.py @@ -0,0 +1,15 @@ +from PyQt5.QtWidgets import QDoubleSpinBox + + +class DoubleSpinBox(QDoubleSpinBox): + def __init__(self): + super(QDoubleSpinBox, self).__init__() + self.setMaximum(2**31 - 1) + self.setMinimum(-self.maximum()) + self.setDecimals(16) + + 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)) diff --git a/gui/widgets/label.py b/gui/widgets/label.py new file mode 100644 index 0000000..a0ce233 --- /dev/null +++ b/gui/widgets/label.py @@ -0,0 +1,9 @@ +from PyQt5.QtWidgets import QLabel + + +class Label(QLabel): + def __init__(self, label): + super(QLabel, self).__init__(label) + + def on_change(self, change_event_function): + pass diff --git a/gui/widgets/line_edit.py b/gui/widgets/line_edit.py new file mode 100644 index 0000000..a87a7b6 --- /dev/null +++ b/gui/widgets/line_edit.py @@ -0,0 +1,12 @@ +from PyQt5.QtWidgets import QLineEdit + + +class LineEdit(QLineEdit): + def __init__(self): + super(QLineEdit, self).__init__() + + def get_value(self, ql_type): + return ql_type(self.text()) + + def on_change(self, change_event_function): + self.textChanged.connect(lambda: change_event_function(self)) diff --git a/gui/widgets/money_spinbox.py b/gui/widgets/money_spinbox.py new file mode 100644 index 0000000..680a432 --- /dev/null +++ b/gui/widgets/money_spinbox.py @@ -0,0 +1,15 @@ +from PyQt5.QtWidgets import QDoubleSpinBox + + +class MoneySpinbox(QDoubleSpinBox): + def __init__(self): + super(QDoubleSpinBox, self).__init__() + self.setPrefix('$') + self.setMaximum(2**31 - 1) + self.setMinimum(-self.maximum()) + + def get_value(self, ql_type): + return ql_type(self.value(), self.prefix()) + + def on_change(self, change_event_function): + self.valueChanged.connect(lambda: change_event_function(self)) 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