~ubuntu-branches/ubuntu/karmic/eric/karmic

« back to all changes in this revision

Viewing changes to eric/VCS/subversionPackage/CommandDialog.py

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2008-01-28 18:02:25 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080128180225-6nrox6yrworh2c4v
Tags: 4.0.4-1ubuntu1
* Add python-qt3 to build-depends becuase that's where Ubuntu puts 
  pyqtconfig
* Change maintainer to MOTU

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- coding: utf-8 -*-
2
 
 
3
 
# Copyright (c) 2003 - 2007 Detlev Offenbach <detlev@die-offenbachs.de>
4
 
#
5
 
 
6
 
"""
7
 
Module implementing the Subversion command dialog.
8
 
"""
9
 
 
10
 
from qt import *
11
 
 
12
 
from KdeQt import KQFileDialog
13
 
 
14
 
from CommandForm import CommandForm
15
 
import Utilities
16
 
 
17
 
class SvnCommandDialog(CommandForm):
18
 
    """
19
 
    Class implementing the Subversion command dialog.
20
 
    
21
 
    It implements a dialog that is used to enter an
22
 
    arbitrary subversion command. It asks the user to enter
23
 
    the commandline parameters and the working directory.
24
 
    """
25
 
    def __init__(self, argvList, wdList, ppath, parent=None):
26
 
        """
27
 
        Constructor
28
 
        
29
 
        @param argvList history list of commandline arguments (QStringList)
30
 
        @param wdList history list of working directories (QStringList)
31
 
        @param ppath pathname of the project directory (string)
32
 
        @param parent parent widget of this dialog (QWidget)
33
 
        """
34
 
        CommandForm.__init__(self, parent, None, 1)
35
 
        
36
 
        self.commandCombo.clear()
37
 
        self.commandCombo.insertStringList(argvList)
38
 
        if argvList.count() > 0:
39
 
            self.commandCombo.setCurrentItem(0)
40
 
        self.workdirCombo.clear()
41
 
        self.workdirCombo.insertStringList(wdList)
42
 
        if wdList.count() > 0:
43
 
            self.workdirCombo.setCurrentItem(0)
44
 
        self.projectDirLabel.setText(ppath)
45
 
        
46
 
        # modify some what's this help texts
47
 
        t = QWhatsThis.textFor(self.commandCombo)
48
 
        if not t.isEmpty():
49
 
            t = t.append(Utilities.getPercentReplacementHelp())
50
 
            QWhatsThis.add(self.commandCombo, t)
51
 
        
52
 
    def handleDir(self):
53
 
        """
54
 
        Private method used to open a directory selection dialog.
55
 
        """
56
 
        cwd = self.workdirCombo.currentText()
57
 
        if cwd.isEmpty():
58
 
            cwd = self.projectDirLabel.text()
59
 
        d = KQFileDialog.getExistingDirectory(cwd,
60
 
            self, None, self.trUtf8('Working directory'))
61
 
            
62
 
        if not d.isEmpty():
63
 
            self.workdirCombo.setCurrentText(QDir.convertSeparators(d))
64
 
        
65
 
    def enableOkButton(self, text):
66
 
        """
67
 
        Private method used to enable/disable the OK-button.
68
 
        
69
 
        @param text ignored
70
 
        """
71
 
        self.okButton.setDisabled(self.commandCombo.currentText().isEmpty())
72
 
    
73
 
    def getData(self):
74
 
        """
75
 
        Public method to retrieve the data entered into this dialog.
76
 
        
77
 
        @return a tuple of argv, workdir
78
 
        """
79
 
        return (self.commandCombo.currentText(),
80
 
                self.workdirCombo.currentText())