16 |
16 |
17 |
17 |
18 class GitCommandDialog(QDialog, Ui_GitCommandDialog): |
18 class GitCommandDialog(QDialog, Ui_GitCommandDialog): |
19 """ |
19 """ |
20 Class implementing the Git command dialog. |
20 Class implementing the Git command dialog. |
21 |
21 |
22 It implements a dialog that is used to enter an |
22 It implements a dialog that is used to enter an |
23 arbitrary Git command. It asks the user to enter |
23 arbitrary Git command. It asks the user to enter |
24 the commandline parameters. |
24 the commandline parameters. |
25 """ |
25 """ |
|
26 |
26 def __init__(self, argvList, ppath, parent=None): |
27 def __init__(self, argvList, ppath, parent=None): |
27 """ |
28 """ |
28 Constructor |
29 Constructor |
29 |
30 |
30 @param argvList history list of commandline arguments (list of strings) |
31 @param argvList history list of commandline arguments (list of strings) |
31 @param ppath pathname of the project directory (string) |
32 @param ppath pathname of the project directory (string) |
32 @param parent parent widget of this dialog (QWidget) |
33 @param parent parent widget of this dialog (QWidget) |
33 """ |
34 """ |
34 super().__init__(parent) |
35 super().__init__(parent) |
35 self.setupUi(self) |
36 self.setupUi(self) |
36 |
37 |
37 self.okButton = self.buttonBox.button( |
38 self.okButton = self.buttonBox.button(QDialogButtonBox.StandardButton.Ok) |
38 QDialogButtonBox.StandardButton.Ok) |
|
39 self.okButton.setEnabled(False) |
39 self.okButton.setEnabled(False) |
40 |
40 |
41 self.commandCombo.clear() |
41 self.commandCombo.clear() |
42 self.commandCombo.addItems(argvList) |
42 self.commandCombo.addItems(argvList) |
43 if len(argvList) > 0: |
43 if len(argvList) > 0: |
44 self.commandCombo.setCurrentIndex(0) |
44 self.commandCombo.setCurrentIndex(0) |
45 self.projectDirLabel.setText(ppath) |
45 self.projectDirLabel.setText(ppath) |
46 |
46 |
47 # modify some what's this help texts |
47 # modify some what's this help texts |
48 t = self.commandCombo.whatsThis() |
48 t = self.commandCombo.whatsThis() |
49 if t: |
49 if t: |
50 t += Utilities.getPercentReplacementHelp() |
50 t += Utilities.getPercentReplacementHelp() |
51 self.commandCombo.setWhatsThis(t) |
51 self.commandCombo.setWhatsThis(t) |
52 |
52 |
53 msh = self.minimumSizeHint() |
53 msh = self.minimumSizeHint() |
54 self.resize(max(self.width(), msh.width()), msh.height()) |
54 self.resize(max(self.width(), msh.width()), msh.height()) |
55 |
55 |
56 @pyqtSlot(str) |
56 @pyqtSlot(str) |
57 def on_commandCombo_editTextChanged(self, text): |
57 def on_commandCombo_editTextChanged(self, text): |
58 """ |
58 """ |
59 Private method used to enable/disable the OK-button. |
59 Private method used to enable/disable the OK-button. |
60 |
60 |
61 @param text ignored |
61 @param text ignored |
62 """ |
62 """ |
63 self.okButton.setDisabled(self.commandCombo.currentText() == "") |
63 self.okButton.setDisabled(self.commandCombo.currentText() == "") |
64 |
64 |
65 def getData(self): |
65 def getData(self): |
66 """ |
66 """ |
67 Public method to retrieve the data entered into this dialog. |
67 Public method to retrieve the data entered into this dialog. |
68 |
68 |
69 @return commandline parameters (string) |
69 @return commandline parameters (string) |
70 """ |
70 """ |
71 return self.commandCombo.currentText() |
71 return self.commandCombo.currentText() |