Table of Contents

Eric3 Source Documentation: Project  
# -*- coding: utf-8 -*-

# Copyright (c) 2002, 2003 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module implementing a dialog to add files of a directory to the project.
"""

from qt import *

from AddDirectoryForm import AddDirForm

class AddDirectoryDialog(AddDirForm):
    """
    Class implementing a dialog to add files of a directory to the project.
    """
    def __init__(self,pro,parent = None,name = None,modal = 0,fl = 0):
        """
        Constructor
        
        Arguments
        
            pro -- reference to the project object
            
            parent -- parent widget of this dialog (QWidget)
            
            name -- name of this dialog (string or QString)
            
            modal -- flag for a modal dialog (boolean)
            
            fl -- window flags
        """
        AddDirForm.__init__(self,parent,name,1,fl)
        
        self.targetDirEdit.setText(pro.ppath)
        self.ppath = pro.ppath
        
    def handleDirDialog(self, textEdit):
        """
        Private slot to display a directory selection dialog.
        
        Arguments
        
            textEdit -- field for the display of the selected directory name
                (QLineEdit)
        """
        directory = QFileDialog.getExistingDirectory(self.targetDirEdit.text(),
            self, None, self.trUtf8("Select target directory"), 1)
            
        if not directory.isNull():
            textEdit.setText(QDir.convertSeparators(directory))
            
    def handleSDirDialog(self):
        """
        Private slot to handle the source dir button press.
        """
        self.handleDirDialog(self.sourceDirEdit)
        
    def handleTDirDialog(self):
        """
        Private slot to handle the target dir button press.
        """
        self.handleDirDialog(self.targetDirEdit)
        
    def handleSTextChanged(self, dir):
        """
        Private slot to handle the source dir text changed.
        
        If the entered source directory is a subdirectory of the current
        projects main directory, the target directory path is synchronized.
        It is assumed, that the user wants to add a bunch of files to
        the project in place.
        
        Arguments
        
            dir -- the text of the source directory line edit
        """
        if dir.startsWith(self.ppath):
            self.targetDirEdit.setText(dir)
            
    def getData(self):
        """
        Public slot to retrieve the dialogs data.
        
        Returns
        
            tuple of three values (string, string, boolean) giving the
            source and target directory and a flag indicating a recursive add
        """
        return (str(self.sourceDirEdit.text()), 
            str(self.targetDirEdit.text()),
            self.recursiveCheckBox.isChecked())

Table of Contents

This document was automatically generated by HappyDoc version 2.1