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

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

     1  #!/usr/bin/python
     2  # -*- coding: utf-8 -*-
     3
     4  from pyforms.gui.Controls.ControlText import ControlText
     5  import pyforms.Utils.tools as tools
     6  from PyQt4 import uic
     7  from PyQt4.QtGui import QFileDialog
     8
     9  __author__ = "Ricardo Ribeiro"
    10  __copyright__ = ""
    11  __credits__ = "Ricardo Ribeiro"
    12  __license__ = "MIT"
    13  __version__ = "0.0"
    14  __maintainer__ = ["Ricardo Ribeiro", "Carlos Mão de Ferro"]
    15  __email__ = ["ricardojvr at gmail.com", "cajomferro at gmail.com"]
    16  __status__ = "Development"
    17
    18
    19 -class ControlFile(ControlText):
    20
    21 -    def initForm(self):
    22          control_path = tools.getFileInSameDirectory(__file__, "fileInput.ui")
    23          self._form = uic.loadUi(control_path)
    24          self._form.label.setText(self._label)
    25
    26 -    def pushButton_clicked(self):
    27          value = str(QFileDialog.getOpenFileName(
    28              self._form, self._label, self.value))
    29          if value:
    30              self.value = value
    31
    32      @property
    33 -    def parent(self): return ControlText.parent.fget(self, value)
    34
    35      @parent.setter
    36 -    def parent(self, value):
    37          ControlText.parent.fset(self, value)
    38          self._form.pushButton.clicked.connect(self.pushButton_clicked)
    39