|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2003 - 2019 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the Subversion command dialog. |
|
8 """ |
|
9 |
|
10 from __future__ import unicode_literals |
|
11 |
|
12 from PyQt5.QtWidgets import QDialog, QDialogButtonBox |
|
13 |
|
14 from E5Gui.E5PathPicker import E5PathPickerModes |
|
15 |
|
16 from .Ui_SvnCommandDialog import Ui_SvnCommandDialog |
|
17 |
|
18 import Utilities |
|
19 |
|
20 |
|
21 class SvnCommandDialog(QDialog, Ui_SvnCommandDialog): |
|
22 """ |
|
23 Class implementing the Subversion command dialog. |
|
24 |
|
25 It implements a dialog that is used to enter an |
|
26 arbitrary subversion command. It asks the user to enter |
|
27 the commandline parameters and the working directory. |
|
28 """ |
|
29 def __init__(self, argvList, wdList, ppath, parent=None): |
|
30 """ |
|
31 Constructor |
|
32 |
|
33 @param argvList history list of commandline arguments (list of strings) |
|
34 @param wdList history list of working directories (list of strings) |
|
35 @param ppath pathname of the project directory (string) |
|
36 @param parent parent widget of this dialog (QWidget) |
|
37 """ |
|
38 super(SvnCommandDialog, self).__init__(parent) |
|
39 self.setupUi(self) |
|
40 |
|
41 self.workdirPicker.setMode(E5PathPickerModes.DirectoryMode) |
|
42 |
|
43 self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) |
|
44 self.okButton.setEnabled(False) |
|
45 |
|
46 self.commandCombo.clear() |
|
47 self.commandCombo.addItems(argvList) |
|
48 if len(argvList) > 0: |
|
49 self.commandCombo.setCurrentIndex(0) |
|
50 self.workdirPicker.clear() |
|
51 self.workdirPicker.addItems(wdList) |
|
52 if len(wdList) > 0: |
|
53 self.workdirPicker.setCurrentIndex(0) |
|
54 self.projectDirLabel.setText(ppath) |
|
55 |
|
56 # modify some what's this help texts |
|
57 t = self.commandCombo.whatsThis() |
|
58 if t: |
|
59 t += Utilities.getPercentReplacementHelp() |
|
60 self.commandCombo.setWhatsThis(t) |
|
61 |
|
62 msh = self.minimumSizeHint() |
|
63 self.resize(max(self.width(), msh.width()), msh.height()) |
|
64 |
|
65 def on_commandCombo_editTextChanged(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() == "") |
|
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.workdirPicker.currentText()) |