|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2003 - 2009 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 PyQt4.QtCore import * |
|
11 from PyQt4.QtGui import * |
|
12 |
|
13 from Ui_SvnTagDialog import Ui_SvnTagDialog |
|
14 |
|
15 class SvnTagDialog(QDialog, Ui_SvnTagDialog): |
|
16 """ |
|
17 Class implementing a dialog to enter the data for a tagging operation. |
|
18 """ |
|
19 def __init__(self, taglist, reposURL, standardLayout, parent = None): |
|
20 """ |
|
21 Constructor |
|
22 |
|
23 @param taglist list of previously entered tags (list of strings) |
|
24 @param reposURL repository path (string) or None |
|
25 @param standardLayout flag indicating the layout of the |
|
26 repository (boolean) |
|
27 @param parent parent widget (QWidget) |
|
28 """ |
|
29 QDialog.__init__(self, parent) |
|
30 self.setupUi(self) |
|
31 |
|
32 self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) |
|
33 self.okButton.setEnabled(False) |
|
34 |
|
35 self.tagCombo.clear() |
|
36 self.tagCombo.addItems(taglist) |
|
37 |
|
38 if reposURL is not None and reposURL != "": |
|
39 self.tagCombo.setEditText(reposURL) |
|
40 |
|
41 if not standardLayout: |
|
42 self.TagActionGroup.setEnabled(False) |
|
43 |
|
44 def on_tagCombo_editTextChanged(self, text): |
|
45 """ |
|
46 Private method used to enable/disable the OK-button. |
|
47 |
|
48 @param text text of the tag combobox (string) |
|
49 """ |
|
50 self.okButton.setDisabled(text == "") |
|
51 |
|
52 def getParameters(self): |
|
53 """ |
|
54 Public method to retrieve the tag data. |
|
55 |
|
56 @return tuple of string and int (tag, tag operation) |
|
57 """ |
|
58 tag = self.tagCombo.currentText() |
|
59 tagOp = 0 |
|
60 if self.createRegularButton.isChecked(): |
|
61 tagOp = 1 |
|
62 elif self.createBranchButton.isChecked(): |
|
63 tagOp = 2 |
|
64 elif self.deleteRegularButton.isChecked(): |
|
65 tagOp = 4 |
|
66 elif self.deleteBranchButton.isChecked(): |
|
67 tagOp = 8 |
|
68 return (tag, tagOp) |