|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2003 - 2021 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing a dialog to enter the data for a tagging operation. |
|
8 """ |
|
9 |
|
10 from PyQt5.QtCore import pyqtSlot |
|
11 from PyQt5.QtWidgets import QDialog, QDialogButtonBox |
|
12 |
|
13 from .Ui_SvnTagDialog import Ui_SvnTagDialog |
|
14 |
|
15 |
|
16 class SvnTagDialog(QDialog, Ui_SvnTagDialog): |
|
17 """ |
|
18 Class implementing a dialog to enter the data for a tagging operation. |
|
19 """ |
|
20 def __init__(self, taglist, reposURL, standardLayout, parent=None): |
|
21 """ |
|
22 Constructor |
|
23 |
|
24 @param taglist list of previously entered tags (list of strings) |
|
25 @param reposURL repository path (string) or None |
|
26 @param standardLayout flag indicating the layout of the |
|
27 repository (boolean) |
|
28 @param parent parent widget (QWidget) |
|
29 """ |
|
30 super().__init__(parent) |
|
31 self.setupUi(self) |
|
32 |
|
33 self.okButton = self.buttonBox.button( |
|
34 QDialogButtonBox.StandardButton.Ok) |
|
35 self.okButton.setEnabled(False) |
|
36 |
|
37 self.tagCombo.clear() |
|
38 self.tagCombo.addItems(sorted(taglist, reverse=True)) |
|
39 |
|
40 if reposURL is not None and reposURL != "": |
|
41 self.tagCombo.setEditText(reposURL) |
|
42 |
|
43 if not standardLayout: |
|
44 self.TagActionGroup.setEnabled(False) |
|
45 |
|
46 msh = self.minimumSizeHint() |
|
47 self.resize(max(self.width(), msh.width()), msh.height()) |
|
48 |
|
49 @pyqtSlot(str) |
|
50 def on_tagCombo_editTextChanged(self, text): |
|
51 """ |
|
52 Private method used to enable/disable the OK-button. |
|
53 |
|
54 @param text tag name entered in the combo (string) |
|
55 """ |
|
56 self.okButton.setDisabled(text == "") |
|
57 |
|
58 def getParameters(self): |
|
59 """ |
|
60 Public method to retrieve the tag data. |
|
61 |
|
62 @return tuple of string and int (tag, tag operation) |
|
63 """ |
|
64 tag = self.tagCombo.currentText() |
|
65 tagOp = 0 |
|
66 if self.createRegularButton.isChecked(): |
|
67 tagOp = 1 |
|
68 elif self.createBranchButton.isChecked(): |
|
69 tagOp = 2 |
|
70 elif self.deleteRegularButton.isChecked(): |
|
71 tagOp = 4 |
|
72 elif self.deleteBranchButton.isChecked(): |
|
73 tagOp = 8 |
|
74 return (tag, tagOp) |