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

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

     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.ControlText import ControlText
    14  import pyforms.Utils.tools as tools
    15  from PyQt4 import uic
    16  from PyQt4 import QtGui
    17
    18 -class ControlDir(ControlText):
    19
    20 -    def initForm(self):
    21          control_path = tools.getFileInSameDirectory(__file__,"fileInput.ui")
    22          self._form = uic.loadUi( control_path )
    23          self._form.label.setText(self._label)
    24
    25 -    def pushButton_clicked(self):
    26          value = str(QtGui.QFileDialog.getExistingDirectory(self._form, 'Choose a directory', self.value) )
    27          if value: self.value = value
    28
    29      @property
    30 -    def parent(self): return ControlText.parent.fget(self, value)
    31
    32      @parent.setter
    33 -    def parent(self, value):
    34          ControlText.parent.fset(self, value)
    35          self._form.pushButton.clicked.connect(self.pushButton_clicked)
    36