Plugins/VcsPlugins/vcsSubversion/SvnCommandDialog.py

changeset 0
de9c2efb9d02
child 12
1d8dd9706f46
equal deleted inserted replaced
-1:000000000000 0:de9c2efb9d02
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2003 - 2009 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing the Subversion command dialog.
8 """
9
10 from PyQt4.QtCore import *
11 from PyQt4.QtGui import *
12
13 from E4Gui.E4Completers import E4DirCompleter
14
15 from Ui_SvnCommandDialog import Ui_SvnCommandDialog
16
17 import Utilities
18
19 class SvnCommandDialog(QDialog, Ui_SvnCommandDialog):
20 """
21 Class implementing the Subversion command dialog.
22
23 It implements a dialog that is used to enter an
24 arbitrary subversion command. It asks the user to enter
25 the commandline parameters and the working directory.
26 """
27 def __init__(self, argvList, wdList, ppath, parent = None):
28 """
29 Constructor
30
31 @param argvList history list of commandline arguments (list of strings)
32 @param wdList history list of working directories (list of strings)
33 @param ppath pathname of the project directory (string)
34 @param parent parent widget of this dialog (QWidget)
35 """
36 QDialog.__init__(self, parent)
37 self.setupUi(self)
38
39 self.workdirCompleter = E4DirCompleter(self.workdirCombo)
40
41 self.okButton = self.buttonBox.button(QDialogButtonBox.Ok)
42 self.okButton.setEnabled(False)
43
44 self.commandCombo.clear()
45 self.commandCombo.addItems(argvList)
46 if len(argvList) > 0:
47 self.commandCombo.setCurrentIndex(0)
48 self.workdirCombo.clear()
49 self.workdirCombo.addItems(wdList)
50 if len(wdList) > 0:
51 self.workdirCombo.setCurrentIndex(0)
52 self.projectDirLabel.setText(ppath)
53
54 # modify some what's this help texts
55 t = self.commandCombo.whatsThis()
56 if t:
57 t += Utilities.getPercentReplacementHelp()
58 self.commandCombo.setWhatsThis(t)
59
60 @pyqtSlot()
61 def on_dirButton_clicked(self):
62 """
63 Private method used to open a directory selection dialog.
64 """
65 cwd = self.workdirCombo.currentText()
66 if not cwd:
67 cwd = self.projectDirLabel.text()
68 d = QFileDialog.getExistingDirectory(\
69 self,
70 self.trUtf8("Working directory"),
71 cwd,
72 QFileDialog.Options(QFileDialog.ShowDirsOnly))
73
74 if d:
75 self.workdirCombo.setEditText(Utilities.toNativeSeparators(d))
76
77 def on_commandCombo_editTextChanged(self, text):
78 """
79 Private method used to enable/disable the OK-button.
80
81 @param text ignored
82 """
83 self.okButton.setDisabled(self.commandCombo.currentText() == "")
84
85 def getData(self):
86 """
87 Public method to retrieve the data entered into this dialog.
88
89 @return a tuple of argv, workdir
90 """
91 return (self.commandCombo.currentText(),
92 self.workdirCombo.currentText())

eric ide

mercurial