Skip to content

Commit

Permalink
Add step to ControlNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
UmSenhorQualquer committed Oct 12, 2018
1 parent 5b8d1cb commit 00cd13b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pyforms_gui/controls/control_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ def __init__(self, *args, **kwargs):
:param int maximum: Maximum value.
:param float default: Set the value. Default = 0.
:param int decimals: Decimals precision.
:param float step: Step jump value.
"""
self._min = kwargs.get('minimum', 0)
self._max = kwargs.get('maximum', 100)
self._min = kwargs.get('minimum', 0)
self._max = kwargs.get('maximum', 100)
if 'default' not in kwargs: kwargs['default'] = 0
ControlBase.__init__(self, *args, **kwargs)
self.decimals = kwargs.get('decimals', 0)

self.step = kwargs.get('step', 1)

def init_form(self):
control_path = tools.getFileInSameDirectory(__file__, "number.ui")
self._form = uic.loadUi(control_path)
Expand Down Expand Up @@ -79,3 +81,9 @@ def decimals(self): return self.form.spinBox.decimals()

@decimals.setter
def decimals(self, value): self.form.spinBox.setDecimals(value)

@property
def step(self): return self.form.spinBox.singleStep()

@step.setter
def step(self, value): self.form.spinBox.setSingleStep(value)

0 comments on commit 00cd13b

Please sign in to comment.