20 def __init__(self, tagsList, branchesList, bookmarksList=None, |
20 def __init__(self, tagsList, branchesList, bookmarksList=None, |
21 parent=None): |
21 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 |
26 @param branchesList list of branches (list of strings) |
26 @type list of str |
27 @param bookmarksList list of bookmarks (list of strings) |
27 @param branchesList list of branches |
28 @param parent parent widget (QWidget) |
28 @type list of str |
|
29 @param bookmarksList list of bookmarks |
|
30 @type list of str |
|
31 @param parent parent widget |
|
32 @type QWidget |
29 """ |
33 """ |
30 super().__init__(parent) |
34 super().__init__(parent) |
31 self.setupUi(self) |
35 self.setupUi(self) |
32 |
36 |
33 self.buttonBox.button( |
37 self.buttonBox.button( |
39 self.bookmarkCombo.addItems(sorted(bookmarksList)) |
43 self.bookmarkCombo.addItems(sorted(bookmarksList)) |
40 else: |
44 else: |
41 self.bookmarkButton.setHidden(True) |
45 self.bookmarkButton.setHidden(True) |
42 self.bookmarkCombo.setHidden(True) |
46 self.bookmarkCombo.setHidden(True) |
43 |
47 |
|
48 # connect various radio buttons and input fields |
|
49 self.idButton.toggled.connect(self.__updateOK) |
|
50 self.tagButton.toggled.connect(self.__updateOK) |
|
51 self.branchButton.toggled.connect(self.__updateOK) |
|
52 self.bookmarkButton.toggled.connect(self.__updateOK) |
|
53 self.expressionButton.toggled.connect(self.__updateOK) |
|
54 |
|
55 self.idEdit.textChanged.connect(self.__updateOK) |
|
56 self.expressionEdit.textChanged.connect(self.__updateOK) |
|
57 |
|
58 self.tagCombo.editTextChanged.connect(self.__updateOK) |
|
59 self.branchCombo.editTextChanged.connect(self.__updateOK) |
|
60 self.bookmarkCombo.editTextChanged.connect(self.__updateOK) |
|
61 |
44 msh = self.minimumSizeHint() |
62 msh = self.minimumSizeHint() |
45 self.resize(max(self.width(), msh.width()), msh.height()) |
63 self.resize(max(self.width(), msh.width()), msh.height()) |
46 |
64 |
|
65 @pyqtSlot() |
47 def __updateOK(self): |
66 def __updateOK(self): |
48 """ |
67 """ |
49 Private slot to update the OK button. |
68 Private slot to update the OK button. |
50 """ |
69 """ |
51 enabled = True |
70 enabled = True |
55 enabled = self.tagCombo.currentText() != "" |
74 enabled = self.tagCombo.currentText() != "" |
56 elif self.branchButton.isChecked(): |
75 elif self.branchButton.isChecked(): |
57 enabled = self.branchCombo.currentText() != "" |
76 enabled = self.branchCombo.currentText() != "" |
58 elif self.bookmarkButton.isChecked(): |
77 elif self.bookmarkButton.isChecked(): |
59 enabled = self.bookmarkCombo.currentText() != "" |
78 enabled = self.bookmarkCombo.currentText() != "" |
|
79 elif self.expressionButton.isChecked(): |
|
80 enabled = enabled and bool(self.expressionEdit.text()) |
60 |
81 |
61 self.buttonBox.button( |
82 self.buttonBox.button( |
62 QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) |
83 QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) |
63 |
|
64 @pyqtSlot(bool) |
|
65 def on_idButton_toggled(self, checked): |
|
66 """ |
|
67 Private slot to handle changes of the ID select button. |
|
68 |
|
69 @param checked state of the button (boolean) |
|
70 """ |
|
71 self.__updateOK() |
|
72 |
|
73 @pyqtSlot(bool) |
|
74 def on_tagButton_toggled(self, checked): |
|
75 """ |
|
76 Private slot to handle changes of the Tag select button. |
|
77 |
|
78 @param checked state of the button (boolean) |
|
79 """ |
|
80 self.__updateOK() |
|
81 |
|
82 @pyqtSlot(bool) |
|
83 def on_branchButton_toggled(self, checked): |
|
84 """ |
|
85 Private slot to handle changes of the Branch select button. |
|
86 |
|
87 @param checked state of the button (boolean) |
|
88 """ |
|
89 self.__updateOK() |
|
90 |
|
91 @pyqtSlot(bool) |
|
92 def on_bookmarkButton_toggled(self, checked): |
|
93 """ |
|
94 Private slot to handle changes of the Bookmark select button. |
|
95 |
|
96 @param checked state of the button (boolean) |
|
97 """ |
|
98 self.__updateOK() |
|
99 |
|
100 @pyqtSlot(str) |
|
101 def on_idEdit_textChanged(self, txt): |
|
102 """ |
|
103 Private slot to handle changes of the ID edit. |
|
104 |
|
105 @param txt text of the edit (string) |
|
106 """ |
|
107 self.__updateOK() |
|
108 |
|
109 @pyqtSlot(str) |
|
110 def on_tagCombo_editTextChanged(self, txt): |
|
111 """ |
|
112 Private slot to handle changes of the Tag combo. |
|
113 |
|
114 @param txt text of the combo (string) |
|
115 """ |
|
116 self.__updateOK() |
|
117 |
|
118 @pyqtSlot(str) |
|
119 def on_branchCombo_editTextChanged(self, txt): |
|
120 """ |
|
121 Private slot to handle changes of the Branch combo. |
|
122 |
|
123 @param txt text of the combo (string) |
|
124 """ |
|
125 self.__updateOK() |
|
126 |
|
127 @pyqtSlot(str) |
|
128 def on_bookmarkCombo_editTextChanged(self, txt): |
|
129 """ |
|
130 Private slot to handle changes of the Bookmark combo. |
|
131 |
|
132 @param txt text of the combo (string) |
|
133 """ |
|
134 self.__updateOK() |
|
135 |
84 |
136 def getParameters(self): |
85 def getParameters(self): |
137 """ |
86 """ |
138 Public method to retrieve the merge data. |
87 Public method to retrieve the merge data. |
139 |
88 |
140 @return tuple naming the revision and a flag indicating a |
89 @return tuple naming the revision and a flag indicating a |
141 forced merge (string, boolean) |
90 forced merge |
|
91 @rtype tuple of (str, bool) |
142 """ |
92 """ |
143 if self.numberButton.isChecked(): |
93 if self.numberButton.isChecked(): |
144 rev = "rev({0})".format(self.numberSpinBox.value()) |
94 rev = "rev({0})".format(self.numberSpinBox.value()) |
145 elif self.idButton.isChecked(): |
95 elif self.idButton.isChecked(): |
146 rev = "id({0})".format(self.idEdit.text()) |
96 rev = "id({0})".format(self.idEdit.text()) |
148 rev = self.tagCombo.currentText() |
98 rev = self.tagCombo.currentText() |
149 elif self.branchButton.isChecked(): |
99 elif self.branchButton.isChecked(): |
150 rev = self.branchCombo.currentText() |
100 rev = self.branchCombo.currentText() |
151 elif self.bookmarkButton.isChecked(): |
101 elif self.bookmarkButton.isChecked(): |
152 rev = self.bookmarkCombo.currentText() |
102 rev = self.bookmarkCombo.currentText() |
|
103 elif self.expressionButton.isChecked(): |
|
104 rev = self.expressionEdit.text() |
153 else: |
105 else: |
154 rev = "" |
106 rev = "" |
155 |
107 |
156 return rev, self.forceCheckBox.isChecked() |
108 return rev, self.forceCheckBox.isChecked() |