Plugins/VcsPlugins/vcsMercurial/HgTagDialog.py

changeset 178
dd9f0bca5e2f
child 734
dbdca9e6b46c
equal deleted inserted replaced
177:c822ccc4d138 178:dd9f0bca5e2f
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2010 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 pyqtSlot
11 from PyQt4.QtGui import QDialog, QDialogButtonBox
12
13 from .Ui_HgTagDialog import Ui_HgTagDialog
14
15 class HgTagDialog(QDialog, Ui_HgTagDialog):
16 """
17 Class implementing a dialog to enter the data for a tagging operation.
18 """
19 CreateRegularTag = 1
20 CreateLocalTag = 2
21 DeleteTag = 3
22 CreateBranch = 4
23
24 def __init__(self, taglist, parent = None):
25 """
26 Constructor
27
28 @param taglist list of previously entered tags (list of strings)
29 @param parent parent widget (QWidget)
30 """
31 QDialog.__init__(self, parent)
32 self.setupUi(self)
33
34 self.okButton = self.buttonBox.button(QDialogButtonBox.Ok)
35 self.okButton.setEnabled(False)
36
37 self.tagCombo.clear()
38 self.tagCombo.addItems(taglist)
39
40 @pyqtSlot(str)
41 def on_tagCombo_editTextChanged(self, text):
42 """
43 Private method used to enable/disable the OK-button.
44
45 @param text tag name entered in the combo (string)
46 """
47 self.okButton.setDisabled(text == "")
48
49 def getParameters(self):
50 """
51 Public method to retrieve the tag data.
52
53 @return tuple of string and int (tag, tag operation)
54 """
55 tag = self.tagCombo.currentText()
56 tagOp = 0
57 if self.createRegularButton.isChecked():
58 tagOp = HgTagDialog.CreateRegularTag
59 elif self.createLocalButton.isChecked():
60 tagOp = HgTagDialog.CreateLocalTag
61 elif self.deleteButton.isChecked():
62 tagOp = HgTagDialog.DeleteTag
63 return (tag, tagOp)

eric ide

mercurial