|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2003 - 2022 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the Subversion command dialog. |
|
8 """ |
|
9 |
|
10 from PyQt6.QtWidgets import QDialog, QDialogButtonBox |
|
11 |
|
12 from EricWidgets.EricPathPicker import EricPathPickerModes |
|
13 |
|
14 from .Ui_SvnCommandDialog import Ui_SvnCommandDialog |
|
15 |
|
16 import Utilities |
|
17 |
|
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 super().__init__(parent) |
|
37 self.setupUi(self) |
|
38 |
|
39 self.workdirPicker.setMode(EricPathPickerModes.DIRECTORY_MODE) |
|
40 |
|
41 self.okButton = self.buttonBox.button( |
|
42 QDialogButtonBox.StandardButton.Ok) |
|
43 self.okButton.setEnabled(False) |
|
44 |
|
45 self.commandCombo.clear() |
|
46 self.commandCombo.addItems(argvList) |
|
47 if len(argvList) > 0: |
|
48 self.commandCombo.setCurrentIndex(0) |
|
49 self.workdirPicker.clear() |
|
50 self.workdirPicker.addItems(wdList) |
|
51 if len(wdList) > 0: |
|
52 self.workdirPicker.setCurrentIndex(0) |
|
53 self.projectDirLabel.setText(ppath) |
|
54 |
|
55 # modify some what's this help texts |
|
56 t = self.commandCombo.whatsThis() |
|
57 if t: |
|
58 t += Utilities.getPercentReplacementHelp() |
|
59 self.commandCombo.setWhatsThis(t) |
|
60 |
|
61 msh = self.minimumSizeHint() |
|
62 self.resize(max(self.width(), msh.width()), msh.height()) |
|
63 |
|
64 def on_commandCombo_editTextChanged(self, text): |
|
65 """ |
|
66 Private method used to enable/disable the OK-button. |
|
67 |
|
68 @param text ignored |
|
69 """ |
|
70 self.okButton.setDisabled(self.commandCombo.currentText() == "") |
|
71 |
|
72 def getData(self): |
|
73 """ |
|
74 Public method to retrieve the data entered into this dialog. |
|
75 |
|
76 @return a tuple of argv, workdir |
|
77 """ |
|
78 return (self.commandCombo.currentText(), |
|
79 self.workdirPicker.currentText()) |