7 Module implementing the Subversion command dialog. |
7 Module implementing the Subversion command dialog. |
8 """ |
8 """ |
9 |
9 |
10 from __future__ import unicode_literals |
10 from __future__ import unicode_literals |
11 |
11 |
12 from PyQt5.QtCore import pyqtSlot |
|
13 from PyQt5.QtWidgets import QDialog, QDialogButtonBox |
12 from PyQt5.QtWidgets import QDialog, QDialogButtonBox |
14 |
13 |
15 from E5Gui.E5Completers import E5DirCompleter |
14 from E5Gui.E5PathPicker import E5PathPickerModes |
16 from E5Gui import E5FileDialog |
|
17 |
15 |
18 from .Ui_SvnCommandDialog import Ui_SvnCommandDialog |
16 from .Ui_SvnCommandDialog import Ui_SvnCommandDialog |
19 |
17 |
20 import Utilities |
18 import Utilities |
21 import UI.PixmapCache |
|
22 |
19 |
23 |
20 |
24 class SvnCommandDialog(QDialog, Ui_SvnCommandDialog): |
21 class SvnCommandDialog(QDialog, Ui_SvnCommandDialog): |
25 """ |
22 """ |
26 Class implementing the Subversion command dialog. |
23 Class implementing the Subversion command dialog. |
39 @param parent parent widget of this dialog (QWidget) |
36 @param parent parent widget of this dialog (QWidget) |
40 """ |
37 """ |
41 super(SvnCommandDialog, self).__init__(parent) |
38 super(SvnCommandDialog, self).__init__(parent) |
42 self.setupUi(self) |
39 self.setupUi(self) |
43 |
40 |
44 self.dirButton.setIcon(UI.PixmapCache.getIcon("open.png")) |
41 self.workdirPicker.setMode(E5PathPickerModes.DirectoryMode) |
45 |
|
46 self.workdirCompleter = E5DirCompleter(self.workdirCombo) |
|
47 |
42 |
48 self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) |
43 self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) |
49 self.okButton.setEnabled(False) |
44 self.okButton.setEnabled(False) |
50 |
45 |
51 self.commandCombo.clear() |
46 self.commandCombo.clear() |
52 self.commandCombo.addItems(argvList) |
47 self.commandCombo.addItems(argvList) |
53 if len(argvList) > 0: |
48 if len(argvList) > 0: |
54 self.commandCombo.setCurrentIndex(0) |
49 self.commandCombo.setCurrentIndex(0) |
55 self.workdirCombo.clear() |
50 self.workdirPicker.clear() |
56 self.workdirCombo.addItems(wdList) |
51 self.workdirPicker.addItems(wdList) |
57 if len(wdList) > 0: |
52 if len(wdList) > 0: |
58 self.workdirCombo.setCurrentIndex(0) |
53 self.workdirPicker.setCurrentIndex(0) |
59 self.projectDirLabel.setText(ppath) |
54 self.projectDirLabel.setText(ppath) |
60 |
55 |
61 # modify some what's this help texts |
56 # modify some what's this help texts |
62 t = self.commandCombo.whatsThis() |
57 t = self.commandCombo.whatsThis() |
63 if t: |
58 if t: |
64 t += Utilities.getPercentReplacementHelp() |
59 t += Utilities.getPercentReplacementHelp() |
65 self.commandCombo.setWhatsThis(t) |
60 self.commandCombo.setWhatsThis(t) |
66 |
61 |
67 msh = self.minimumSizeHint() |
62 msh = self.minimumSizeHint() |
68 self.resize(max(self.width(), msh.width()), msh.height()) |
63 self.resize(max(self.width(), msh.width()), msh.height()) |
69 |
|
70 @pyqtSlot() |
|
71 def on_dirButton_clicked(self): |
|
72 """ |
|
73 Private method used to open a directory selection dialog. |
|
74 """ |
|
75 cwd = self.workdirCombo.currentText() |
|
76 if not cwd: |
|
77 cwd = self.projectDirLabel.text() |
|
78 d = E5FileDialog.getExistingDirectory( |
|
79 self, |
|
80 self.tr("Working directory"), |
|
81 cwd, |
|
82 E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) |
|
83 |
|
84 if d: |
|
85 self.workdirCombo.setEditText(Utilities.toNativeSeparators(d)) |
|
86 |
64 |
87 def on_commandCombo_editTextChanged(self, text): |
65 def on_commandCombo_editTextChanged(self, text): |
88 """ |
66 """ |
89 Private method used to enable/disable the OK-button. |
67 Private method used to enable/disable the OK-button. |
90 |
68 |