13 except (NameError): |
13 except (NameError): |
14 pass |
14 pass |
15 |
15 |
16 import os |
16 import os |
17 |
17 |
18 from PyQt4.QtCore import pyqtSlot, QProcess, QTimer, Qt, QRegExp, QCoreApplication |
18 from PyQt4.QtCore import pyqtSlot, QProcess, QTimer, Qt, QRegExp, \ |
19 from PyQt4.QtGui import QDialog, QDialogButtonBox, QHeaderView, QTreeWidgetItem, \ |
19 QCoreApplication |
20 QLineEdit |
20 from PyQt4.QtGui import QDialog, QDialogButtonBox, QHeaderView, \ |
|
21 QTreeWidgetItem, QLineEdit |
21 |
22 |
22 from E5Gui import E5MessageBox |
23 from E5Gui import E5MessageBox |
23 |
24 |
24 from .Ui_HgGpgSignaturesDialog import Ui_HgGpgSignaturesDialog |
25 from .Ui_HgGpgSignaturesDialog import Ui_HgGpgSignaturesDialog |
25 |
26 |
128 self.inputGroup.setEnabled(True) |
129 self.inputGroup.setEnabled(True) |
129 self.inputGroup.show() |
130 self.inputGroup.show() |
130 |
131 |
131 def __finish(self): |
132 def __finish(self): |
132 """ |
133 """ |
133 Private slot called when the process finished or the user pressed the button. |
134 Private slot called when the process finished or the user pressed |
|
135 the button. |
134 """ |
136 """ |
135 if self.process is not None and \ |
137 if self.process is not None and \ |
136 self.process.state() != QProcess.NotRunning: |
138 self.process.state() != QProcess.NotRunning: |
137 self.process.terminate() |
139 self.process.terminate() |
138 QTimer.singleShot(2000, self.process.kill) |
140 QTimer.singleShot(2000, self.process.kill) |
142 self.inputGroup.hide() |
144 self.inputGroup.hide() |
143 |
145 |
144 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
146 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
145 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
147 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
146 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
148 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
147 self.buttonBox.button(QDialogButtonBox.Close).setFocus(Qt.OtherFocusReason) |
149 self.buttonBox.button(QDialogButtonBox.Close).setFocus( |
|
150 Qt.OtherFocusReason) |
148 |
151 |
149 self.process = None |
152 self.process = None |
150 |
153 |
151 if self.signaturesList.topLevelItemCount() == 0: |
154 if self.signaturesList.topLevelItemCount() == 0: |
152 # no patches present |
155 # no patches present |
186 |
189 |
187 def __resizeColumns(self): |
190 def __resizeColumns(self): |
188 """ |
191 """ |
189 Private method to resize the list columns. |
192 Private method to resize the list columns. |
190 """ |
193 """ |
191 self.signaturesList.header().resizeSections(QHeaderView.ResizeToContents) |
194 self.signaturesList.header().resizeSections( |
|
195 QHeaderView.ResizeToContents) |
192 self.signaturesList.header().setStretchLastSection(True) |
196 self.signaturesList.header().setStretchLastSection(True) |
193 |
197 |
194 def __generateItem(self, revision, changeset, signature): |
198 def __generateItem(self, revision, changeset, signature): |
195 """ |
199 """ |
196 Private method to generate a patch item in the list of patches. |
200 Private method to generate a patch item in the list of patches. |
201 """ |
205 """ |
202 if revision == "" and changeset == "": |
206 if revision == "" and changeset == "": |
203 QTreeWidgetItem(self.signaturesList, [signature]) |
207 QTreeWidgetItem(self.signaturesList, [signature]) |
204 else: |
208 else: |
205 revString = "{0:>7}:{1}".format(revision, changeset) |
209 revString = "{0:>7}:{1}".format(revision, changeset) |
206 topItems = self.signaturesList.findItems(revString, Qt.MatchExactly) |
210 topItems = self.signaturesList.findItems( |
|
211 revString, Qt.MatchExactly) |
207 if len(topItems) == 0: |
212 if len(topItems) == 0: |
208 # first signature for this changeset |
213 # first signature for this changeset |
209 topItm = QTreeWidgetItem(self.signaturesList, [ |
214 topItm = QTreeWidgetItem(self.signaturesList, [ |
210 "{0:>7}:{1}".format(revision, changeset)]) |
215 "{0:>7}:{1}".format(revision, changeset)]) |
211 topItm.setExpanded(True) |
216 topItm.setExpanded(True) |
283 @pyqtSlot() |
288 @pyqtSlot() |
284 def on_verifyButton_clicked(self): |
289 def on_verifyButton_clicked(self): |
285 """ |
290 """ |
286 Private slot to verify the signatures of the selected revision. |
291 Private slot to verify the signatures of the selected revision. |
287 """ |
292 """ |
288 rev = self.signaturesList.selectedItems()[0].text(0).split(":")[0].strip() |
293 rev = self.signaturesList.selectedItems()[0].text(0)\ |
|
294 .split(":")[0].strip() |
289 self.vcs.getExtensionObject("gpg")\ |
295 self.vcs.getExtensionObject("gpg")\ |
290 .hgGpgVerifySignatures(self.__path, rev) |
296 .hgGpgVerifySignatures(self.__path, rev) |
291 |
297 |
292 @pyqtSlot(str) |
298 @pyqtSlot(str) |
293 def on_categoryCombo_activated(self, txt): |
299 def on_categoryCombo_activated(self, txt): |
312 Private method to filter the log entries. |
318 Private method to filter the log entries. |
313 """ |
319 """ |
314 searchRxText = self.rxEdit.text() |
320 searchRxText = self.rxEdit.text() |
315 filterTop = self.categoryCombo.currentText() == self.trUtf8("Revision") |
321 filterTop = self.categoryCombo.currentText() == self.trUtf8("Revision") |
316 if filterTop and searchRxText.startswith("^"): |
322 if filterTop and searchRxText.startswith("^"): |
317 searchRx = QRegExp("^\s*{0}".format(searchRxText[1:]), Qt.CaseInsensitive) |
323 searchRx = QRegExp( |
|
324 "^\s*{0}".format(searchRxText[1:]), Qt.CaseInsensitive) |
318 else: |
325 else: |
319 searchRx = QRegExp(searchRxText, Qt.CaseInsensitive) |
326 searchRx = QRegExp(searchRxText, Qt.CaseInsensitive) |
320 for topIndex in range(self.signaturesList.topLevelItemCount()): |
327 for topIndex in range(self.signaturesList.topLevelItemCount()): |
321 topLevelItem = self.signaturesList.topLevelItem(topIndex) |
328 topLevelItem = self.signaturesList.topLevelItem(topIndex) |
322 if filterTop: |
329 if filterTop: |
323 topLevelItem.setHidden(searchRx.indexIn(topLevelItem.text(0)) == -1) |
330 topLevelItem.setHidden( |
|
331 searchRx.indexIn(topLevelItem.text(0)) == -1) |
324 else: |
332 else: |
325 visibleChildren = topLevelItem.childCount() |
333 visibleChildren = topLevelItem.childCount() |
326 for childIndex in range(topLevelItem.childCount()): |
334 for childIndex in range(topLevelItem.childCount()): |
327 childItem = topLevelItem.child(childIndex) |
335 childItem = topLevelItem.child(childIndex) |
328 if searchRx.indexIn(childItem.text(0)) == -1: |
336 if searchRx.indexIn(childItem.text(0)) == -1: |