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

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

     1  from pyforms.gui.Controls.ControlEmptyWidget import ControlEmptyWidget
     2
     3
     4 -class ControlDockWidget(ControlEmptyWidget):
     5
     6      SIDE_LEFT = 'left'
     7      SIDE_RIGHT = 'right'
     8      SIDE_TOP = 'top'
     9      SIDE_BOTTOM = 'bottom'
    10      SIDE_DETACHED = 'detached'
    11
    12 -    def __init__(self, label='', default=None, side='left'):
    13          super(ControlDockWidget, self).__init__(label)
    14          self.side = side
    15          if default is not None: self.value = default
    16          self._show = True
    17
    18      @property
    19 -    def label(self): return self._label
    20
    21      @label.setter
    22 -    def label(self, value):
    23          self._label = value
    24          if hasattr(self, 'dock'): self.dock.setWindowTitle(value)
    25
    26 -    def save(self, data):
    27          data['side'] = self.side
    28          super(ControlDockWidget, self).save(data)
    29
    30 -    def load(self, data):
    31          self.side = data['side']
    32          super(ControlDockWidget, self).load(data)
    33
    34 -    def show(self):
    35          """
    36          Show the control
    37          """
    38          self._show = True
    39          if hasattr(self, 'dock'): self.dock.show()
    40
    41 -    def hide(self):
    42          """
    43          Hide the control
    44          """
    45          self._show = False
    46          if hasattr(self, 'dock'): self.dock.hide()
    47