Package pyforms :: Package web :: Package Controls :: Module ControlBoundingSlider |
[hide private]
[frames] | no frames]

# Source Code for Module pyforms.web.Controls.ControlBoundingSlider

     1  import pyforms.Utils.tools as tools
     2  from PyQt4 import uic, QtGui,QtCore
     3  from pyforms.web.Controls.ControlBase import ControlBase
     4
     5
     6 -class ControlBoundingSlider(ControlBase):
     7
     8      _min = 0
     9      _max = 100
    10
    11 -    def __init__(self, label = "", defaultValue=(0,100) , min = 0, max = 100, horizontal=False, **kwargs):
    12          self._min = min
    13          self._max = max
    14          self._horizontal = horizontal
    15          ControlBase.__init__(self, label, defaultValue, **kwargs)
    16
    17
    18 -    def initControl(self):
    19          return "controls.push(new ControlBoundingSlider('{0}', '{1}', [{2}, {3}], {4}, {5}, '{6}','{7}'));".format(
    20              self._label, self._name, self.value[0], self.value[1],
    21              self._min,  self._max , self._horizontal, self.help)
    22
    23
    24 -    def _update(self, minval, maxval): self.value = minval, maxval
    25
    26 -    def valueChanged(self, value): self.value = value
    27
    28 -    def load(self, data):
    29          if 'value' in data: self.value = data['value']
    30
    31 -    def save(self, data):
    32          if self.value: data['value'] = self.value
    33
    34
    35
    36      @property
    37 -    def min(self): return self._min
    38
    39      @min.setter
    40 -    def min(self, value):  self._min = value
    41
    42      @property
    43 -    def max(self): return self._max
    44
    45      @max.setter
    46 -    def max(self, value): self._max = value
    47