16 class HgRevisionSelectionDialog(QDialog, Ui_HgRevisionSelectionDialog): |
16 class HgRevisionSelectionDialog(QDialog, Ui_HgRevisionSelectionDialog): |
17 """ |
17 """ |
18 Class implementing a dialog to select a revision. |
18 Class implementing a dialog to select a revision. |
19 """ |
19 """ |
20 def __init__(self, tagsList, branchesList, bookmarksList=None, |
20 def __init__(self, tagsList, branchesList, bookmarksList=None, |
21 showNone=False, parent=None): |
21 noneLabel="", parent=None): |
22 """ |
22 """ |
23 Constructor |
23 Constructor |
24 |
24 |
25 @param tagsList list of tags (list of strings) |
25 @param tagsList list of tags (list of strings) |
26 @param branchesList list of branches (list of strings) |
26 @param branchesList list of branches (list of strings) |
27 @param bookmarksList list of bookmarks (list of strings) |
27 @param bookmarksList list of bookmarks (list of strings) |
28 @param showNone flag influencing the label of the 'None' selection |
28 @param noneLabel labeltext for "no revision selected" (string) |
29 (boolean) |
|
30 @param parent parent widget (QWidget) |
29 @param parent parent widget (QWidget) |
31 """ |
30 """ |
32 super().__init__(parent) |
31 super().__init__(parent) |
33 self.setupUi(self) |
32 self.setupUi(self) |
34 |
33 |
40 self.bookmarkCombo.addItems(sorted(bookmarksList)) |
39 self.bookmarkCombo.addItems(sorted(bookmarksList)) |
41 else: |
40 else: |
42 self.bookmarkButton.setHidden(True) |
41 self.bookmarkButton.setHidden(True) |
43 self.bookmarkCombo.setHidden(True) |
42 self.bookmarkCombo.setHidden(True) |
44 |
43 |
45 if showNone: |
44 if noneLabel: |
46 self.tipButton.setText(self.tr("No revision selected")) |
45 self.noneButton.setText(noneLabel) |
47 self.tipButton.setToolTip(self.tr( |
|
48 "Select to not specify a specific revision")) |
|
49 |
46 |
50 msh = self.minimumSizeHint() |
47 msh = self.minimumSizeHint() |
51 self.resize(max(self.width(), msh.width()), msh.height()) |
48 self.resize(max(self.width(), msh.width()), msh.height()) |
52 |
49 |
53 def __updateOK(self): |
50 def __updateOK(self): |
152 rev = self.tagCombo.currentText() |
149 rev = self.tagCombo.currentText() |
153 elif self.branchButton.isChecked(): |
150 elif self.branchButton.isChecked(): |
154 rev = self.branchCombo.currentText() |
151 rev = self.branchCombo.currentText() |
155 elif self.bookmarkButton.isChecked(): |
152 elif self.bookmarkButton.isChecked(): |
156 rev = self.bookmarkCombo.currentText() |
153 rev = self.bookmarkCombo.currentText() |
|
154 elif self.tipButton.isChecked(): |
|
155 rev = "tip" |
157 else: |
156 else: |
158 rev = "" |
157 rev = "" |
159 |
158 |
160 return rev |
159 return rev |