Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
UmSenhorQualquer committed Aug 14, 2018
1 parent e8db022 commit 3e43958
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docs/source/api-reference/controls.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ControlBoundingSlider
:members:
:undoc-members:
:show-inheritance:
:exclude-members: init_form, serialize, deserialize
:exclude-members: css, error, label_visible, changed_event, load_form, save_form, init_form

----------------------------

Expand All @@ -41,7 +41,7 @@ ControlButton
:members:
:undoc-members:
:show-inheritance:
:exclude-members: init_form, serialize, deserialize
:exclude-members: css, error, label_visible, changed_event, load_form, save_form, init_form, label

----------------------------

Expand Down
29 changes: 27 additions & 2 deletions pyforms_gui/controls/control_boundingslider.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,18 +258,28 @@ class ControlBoundingSlider(ControlBase):
"""
.. image:: https://raw.githubusercontent.com/UmSenhorQualquer/pyforms/master/tutorials/Controls4Docs/ControlBoundingSlider.png
|
"""

def __init__(self, *args, **kwargs):
"""
:param tupple default: The default value is a list containing in the first element the lower value and in the second element the upper value. Default = [20,40].
:param bool horizontal: Flag indicating if the Bounding slider should be draw horizontally or vertically. Default = True.
:param bool show_spinboxes: Show or hide the spinboxes. Default = True
:param float minimum: Defines the minimum value that can be selected.
:param float maximum: Defines the maximum value that can be selected.
:param bool convert_2_int: Flag to define if the control should return floats or integers.
"""
self._horizontal = kwargs.get('horizontal', True)
self._show_spinboxes = kwargs.get('show_spinboxes', True)
ControlBase.__init__(self, *args, **kwargs)

self.min = kwargs.get('min', kwargs.get('minimum', 0))
self.max = kwargs.get('max', kwargs.get('maximum', 100))
self.value = kwargs.get('default', [10,20])
self.convert_2_int = kwargs.get('convert_2_int', False)
self.__update()

def init_form(self):
Expand Down Expand Up @@ -380,6 +390,9 @@ def save_form(self, data, path=None):

@property
def value(self):
"""
Sets and gets the control value. It should be a list or tuple of 2 values.
"""
return self._boundingbox._minVal, self._boundingbox._maxVal

@value.setter
Expand All @@ -393,6 +406,9 @@ def value(self, value):

@property
def min(self):
"""
Sets and gets the minimum value possible.
"""
return self._boundingbox._lower

@min.setter
Expand All @@ -404,6 +420,9 @@ def min(self, value):

@property
def max(self):
"""
Sets and gets the maximum value possible.
"""
return self._boundingbox._higher

@max.setter
Expand All @@ -415,6 +434,9 @@ def max(self, value):

@property
def scale(self):
"""
Sets and gets the scale value.
"""
return self._boundingbox.scale

@scale.setter
Expand All @@ -423,6 +445,9 @@ def scale(self, value):

@property
def convert_2_int(self):
"""
Flag to define if the control should return floats or integers.
"""
return not self._boundingbox._use_float

@convert_2_int.setter
Expand Down
21 changes: 19 additions & 2 deletions pyforms_gui/controls/control_button.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-



from confapp import conf

from AnyQt import uic
Expand All @@ -14,6 +12,13 @@

class ControlButton(ControlBase):
def __init__(self, *args, **kwargs):
"""
...
:param str icon: Button icon
:param bool checkable: Flag to set the button checkable.
"""
self._checkable = kwargs.get('checkable', False)
super(ControlButton, self).__init__(*args, **kwargs)

Expand All @@ -31,6 +36,9 @@ def init_form(self):
self._form.setToolTip(self.help)

def click(self):
"""
Trigger a click event
"""
self._form.click()

def load_form(self, data, path=None):
Expand All @@ -52,6 +60,9 @@ def label(self, value):

@property
def icon(self):
"""
Sets and gets the icon of the button.
"""
return self._form.icon()

@icon.setter
Expand All @@ -65,6 +76,9 @@ def icon(self, value):

@property
def value(self):
"""
Sets and gets the value of the Button. The value should be a function
"""
return None

@value.setter
Expand All @@ -78,6 +92,9 @@ def value(self, value):

@property
def checked(self):
"""
Sets and gets the button checked state
"""
return self._form.isChecked()

@checked.setter
Expand Down

0 comments on commit 3e43958

Please sign in to comment.