7 Module implementing a dialog showing signed changesets. |
7 Module implementing a dialog showing signed changesets. |
8 """ |
8 """ |
9 |
9 |
10 from __future__ import unicode_literals |
10 from __future__ import unicode_literals |
11 try: |
11 try: |
12 str = unicode # __IGNORE_WARNING__ |
12 str = unicode |
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, \ |
18 from PyQt4.QtCore import pyqtSlot, QProcess, QTimer, Qt, QRegExp, \ |
21 QTreeWidgetItem, QLineEdit |
21 QTreeWidgetItem, QLineEdit |
22 |
22 |
23 from E5Gui import E5MessageBox |
23 from E5Gui import E5MessageBox |
24 |
24 |
25 from .Ui_HgGpgSignaturesDialog import Ui_HgGpgSignaturesDialog |
25 from .Ui_HgGpgSignaturesDialog import Ui_HgGpgSignaturesDialog |
26 |
|
27 import Preferences |
|
28 |
26 |
29 |
27 |
30 class HgGpgSignaturesDialog(QDialog, Ui_HgGpgSignaturesDialog): |
28 class HgGpgSignaturesDialog(QDialog, Ui_HgGpgSignaturesDialog): |
31 """ |
29 """ |
32 Class implementing a dialog showing signed changesets. |
30 Class implementing a dialog showing signed changesets. |
92 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
90 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
93 repodir = os.path.dirname(repodir) |
91 repodir = os.path.dirname(repodir) |
94 if os.path.splitdrive(repodir)[1] == os.sep: |
92 if os.path.splitdrive(repodir)[1] == os.sep: |
95 return |
93 return |
96 |
94 |
97 args = [] |
95 args = self.vcs.initCommand("sigs") |
98 args.append('sigs') |
|
99 |
96 |
100 if self.__hgClient: |
97 if self.__hgClient: |
101 self.inputGroup.setEnabled(False) |
98 self.inputGroup.setEnabled(False) |
102 self.inputGroup.hide() |
99 self.inputGroup.hide() |
103 |
100 |
119 if not procStarted: |
116 if not procStarted: |
120 self.inputGroup.setEnabled(False) |
117 self.inputGroup.setEnabled(False) |
121 self.inputGroup.hide() |
118 self.inputGroup.hide() |
122 E5MessageBox.critical( |
119 E5MessageBox.critical( |
123 self, |
120 self, |
124 self.trUtf8('Process Generation Error'), |
121 self.tr('Process Generation Error'), |
125 self.trUtf8( |
122 self.tr( |
126 'The process {0} could not be started. ' |
123 'The process {0} could not be started. ' |
127 'Ensure, that it is in the search path.' |
124 'Ensure, that it is in the search path.' |
128 ).format('hg')) |
125 ).format('hg')) |
129 else: |
126 else: |
130 self.inputGroup.setEnabled(True) |
127 self.inputGroup.setEnabled(True) |
152 |
149 |
153 self.process = None |
150 self.process = None |
154 |
151 |
155 if self.signaturesList.topLevelItemCount() == 0: |
152 if self.signaturesList.topLevelItemCount() == 0: |
156 # no patches present |
153 # no patches present |
157 self.__generateItem("", "", self.trUtf8("no signatures found")) |
154 self.__generateItem("", "", self.tr("no signatures found")) |
158 self.__resizeColumns() |
155 self.__resizeColumns() |
159 self.__resort() |
156 self.__resort() |
160 |
157 |
161 def on_buttonBox_clicked(self, button): |
158 def on_buttonBox_clicked(self, button): |
162 """ |
159 """ |
231 the contents pane. |
228 the contents pane. |
232 """ |
229 """ |
233 self.process.setReadChannel(QProcess.StandardOutput) |
230 self.process.setReadChannel(QProcess.StandardOutput) |
234 |
231 |
235 while self.process.canReadLine(): |
232 while self.process.canReadLine(): |
236 s = str(self.process.readLine(), |
233 s = str(self.process.readLine(), self.vcs.getEncoding(), |
237 Preferences.getSystem("IOEncoding"), |
|
238 'replace').strip() |
234 'replace').strip() |
239 self.__processOutputLine(s) |
235 self.__processOutputLine(s) |
240 |
236 |
241 def __processOutputLine(self, line): |
237 def __processOutputLine(self, line): |
242 """ |
238 """ |
259 It reads the error output of the process and inserts it into the |
255 It reads the error output of the process and inserts it into the |
260 error pane. |
256 error pane. |
261 """ |
257 """ |
262 if self.process is not None: |
258 if self.process is not None: |
263 s = str(self.process.readAllStandardError(), |
259 s = str(self.process.readAllStandardError(), |
264 Preferences.getSystem("IOEncoding"), |
260 self.vcs.getEncoding(), 'replace') |
265 'replace') |
|
266 self.__showError(s) |
261 self.__showError(s) |
267 |
262 |
268 def __showError(self, out): |
263 def __showError(self, out): |
269 """ |
264 """ |
270 Private slot to show some error. |
265 Private slot to show some error. |
318 def __filterSignatures(self): |
313 def __filterSignatures(self): |
319 """ |
314 """ |
320 Private method to filter the log entries. |
315 Private method to filter the log entries. |
321 """ |
316 """ |
322 searchRxText = self.rxEdit.text() |
317 searchRxText = self.rxEdit.text() |
323 filterTop = self.categoryCombo.currentText() == self.trUtf8("Revision") |
318 filterTop = self.categoryCombo.currentText() == self.tr("Revision") |
324 if filterTop and searchRxText.startswith("^"): |
319 if filterTop and searchRxText.startswith("^"): |
325 searchRx = QRegExp( |
320 searchRx = QRegExp( |
326 "^\s*{0}".format(searchRxText[1:]), Qt.CaseInsensitive) |
321 "^\s*{0}".format(searchRxText[1:]), Qt.CaseInsensitive) |
327 else: |
322 else: |
328 searchRx = QRegExp(searchRxText, Qt.CaseInsensitive) |
323 searchRx = QRegExp(searchRxText, Qt.CaseInsensitive) |