9 |
9 |
10 |
10 |
11 import os |
11 import os |
12 |
12 |
13 from PyQt5.QtCore import QTimer, QProcess, Qt, pyqtSlot |
13 from PyQt5.QtCore import QTimer, QProcess, Qt, pyqtSlot |
14 from PyQt5.QtWidgets import QHeaderView, QLineEdit, QDialog, \ |
14 from PyQt5.QtWidgets import ( |
15 QDialogButtonBox, QTreeWidgetItem |
15 QHeaderView, QLineEdit, QDialog, QDialogButtonBox, QTreeWidgetItem |
|
16 ) |
16 |
17 |
17 from E5Gui import E5MessageBox |
18 from E5Gui import E5MessageBox |
18 |
19 |
19 from .Ui_SvnBlameDialog import Ui_SvnBlameDialog |
20 from .Ui_SvnBlameDialog import Ui_SvnBlameDialog |
20 |
21 |
57 """ |
58 """ |
58 Protected slot implementing a close event handler. |
59 Protected slot implementing a close event handler. |
59 |
60 |
60 @param e close event (QCloseEvent) |
61 @param e close event (QCloseEvent) |
61 """ |
62 """ |
62 if self.process is not None and \ |
63 if ( |
63 self.process.state() != QProcess.NotRunning: |
64 self.process is not None and |
|
65 self.process.state() != QProcess.NotRunning |
|
66 ): |
64 self.process.terminate() |
67 self.process.terminate() |
65 QTimer.singleShot(2000, self.process.kill) |
68 QTimer.singleShot(2000, self.process.kill) |
66 self.process.waitForFinished(3000) |
69 self.process.waitForFinished(3000) |
67 |
70 |
68 e.accept() |
71 e.accept() |
109 def __finish(self): |
112 def __finish(self): |
110 """ |
113 """ |
111 Private slot called when the process finished or the user pressed the |
114 Private slot called when the process finished or the user pressed the |
112 button. |
115 button. |
113 """ |
116 """ |
114 if self.process is not None and \ |
117 if ( |
115 self.process.state() != QProcess.NotRunning: |
118 self.process is not None and |
|
119 self.process.state() != QProcess.NotRunning |
|
120 ): |
116 self.process.terminate() |
121 self.process.terminate() |
117 QTimer.singleShot(2000, self.process.kill) |
122 QTimer.singleShot(2000, self.process.kill) |
118 self.process.waitForFinished(3000) |
123 self.process.waitForFinished(3000) |
119 |
124 |
120 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
125 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
177 the contents pane. |
182 the contents pane. |
178 """ |
183 """ |
179 self.process.setReadChannel(QProcess.StandardOutput) |
184 self.process.setReadChannel(QProcess.StandardOutput) |
180 |
185 |
181 while self.process.canReadLine(): |
186 while self.process.canReadLine(): |
182 s = str(self.process.readLine(), self.__ioEncoding, 'replace')\ |
187 s = str( |
183 .strip() |
188 self.process.readLine(), self.__ioEncoding, 'replace').strip() |
184 rev, s = s.split(None, 1) |
189 rev, s = s.split(None, 1) |
185 try: |
190 try: |
186 author, text = s.split(' ', 1) |
191 author, text = s.split(' ', 1) |
187 except ValueError: |
192 except ValueError: |
188 author = s.strip() |
193 author = s.strip() |