Plugins/VcsPlugins/vcsMercurial/HgRevisionSelectionDialog.py

changeset 178
dd9f0bca5e2f
child 202
6854bb0beda5
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 select a revision.
8 """
9
10 from PyQt4.QtGui import QDialog
11
12 from .Ui_HgRevisionSelectionDialog import Ui_HgRevisionSelectionDialog
13
14 class HgRevisionSelectionDialog(QDialog, Ui_HgRevisionSelectionDialog):
15 """
16 Class implementing a dialog to select a revision.
17 """
18 def __init__(self, tagsList, branchesList, parent = None):
19 """
20 Constructor
21
22 @param tagsList list of tags (list of strings)
23 @param branchesList list of branches (list of strings)
24 @param parent parent widget (QWidget)
25 """
26 QDialog.__init__(self, parent)
27 self.setupUi(self)
28
29 self.tagCombo.addItems(list(sorted(tagsList)))
30 self.branchCombo.addItems(list(sorted(["default"] + branchesList)))
31
32 def getRevision(self):
33 """
34 Public method to retrieve the selected revision.
35
36 @return tuple naming the revision and a flag indicating a
37 forced merge (string, boolean)
38 """
39 if self.numberButton.isChecked():
40 rev = str(self.numberSpinBox.value())
41 elif self.idButton.isChecked():
42 rev = self.idEdit.text()
43 elif self.tagButton.isChecked():
44 rev = self.tagCombo.currentText()
45 elif self.branchButton.isChecked():
46 rev = self.branchCombo.currentText()
47 else:
48 rev = ""
49
50 return rev

eric ide

mercurial