Package pyforms :: Package gui :: Package Controls :: Module ControlProgress |
[hide private]
[frames] | no frames]

# Source Code for Module pyforms.gui.Controls.ControlProgress

     1  #!/usr/bin/python
     2  # -*- coding: utf-8 -*-
     3
     4  __author__      = "Ricardo Ribeiro"
     5  __credits__     = ["Ricardo Ribeiro"]
     6  __license__     = "MIT"
     7  __version__     = "0.0"
     8  __maintainer__  = "Ricardo Ribeiro"
     9  __email__       = "ricardojvr@gmail.com"
    10  __status__      = "Development"
    11
    12
    13  from pyforms.gui.Controls.ControlBase import ControlBase
    14  import pyforms.Utils.tools as tools
    15  from PyQt4 import uic
    16
    17 -class ControlProgress(ControlBase):
    18
    19      _min = 0
    20      _max = 100
    21
    22 -    def __init__(self, label = "%p%", defaultValue = 0, min = 0, max = 100):
    23          self._updateSlider = True
    24          self._min = min
    25          self._max = max
    26
    27          ControlBase.__init__(self, label, defaultValue)
    28
    29 -    def initForm(self):
    30          control_path = tools.getFileInSameDirectory(__file__,"progressInput.ui")
    31          self._form = uic.loadUi( control_path )
    32          self._form.horizontalSlider.setMinimum(self._min)
    33          self._form.horizontalSlider.setMaximum(self._max)
    34          self._form.horizontalSlider.setValue( self._value )
    35          self._form.horizontalSlider.setFormat( self._label )
    36
    37      @property
    38 -    def label(self): return self._label
    39
    40      @label.setter
    41 -    def label(self, value):
    42          self._label = value
    43          self._form.horizontalSlider.setFormat( self._label )
    44
    45      @property
    46 -    def value(self): return self._value
    47
    48      @value.setter
    49 -    def value(self, value): self._form.horizontalSlider.setValue( value )
    50
    51
    52      @property
    53 -    def min(self): return self._form.horizontalSlider.minimum()
    54
    55      @min.setter
    56 -    def min(self, value): self._form.horizontalSlider.setMinimum(value)
    57
    58      @property
    59 -    def max(self): return self._form.horizontalSlider.maximum()
    60
    61      @max.setter
    62 -    def max(self, value): self._form.horizontalSlider.setMaximum(value)
    63