10 |
10 |
11 import os |
11 import os |
12 |
12 |
13 from PyQt5.QtCore import pyqtSlot, Qt, QPoint, QProcess, QTimer |
13 from PyQt5.QtCore import pyqtSlot, Qt, QPoint, QProcess, QTimer |
14 from PyQt5.QtGui import QCursor |
14 from PyQt5.QtGui import QCursor |
15 from PyQt5.QtWidgets import QWidget, QDialogButtonBox, QTreeWidgetItem, \ |
15 from PyQt5.QtWidgets import ( |
16 QAbstractButton, QMenu, QHeaderView, QApplication, QLineEdit |
16 QWidget, QDialogButtonBox, QTreeWidgetItem, QAbstractButton, QMenu, |
|
17 QHeaderView, QApplication, QLineEdit |
|
18 ) |
17 |
19 |
18 from E5Gui import E5MessageBox |
20 from E5Gui import E5MessageBox |
19 |
21 |
20 from .Ui_GitStashBrowserDialog import Ui_GitStashBrowserDialog |
22 from .Ui_GitStashBrowserDialog import Ui_GitStashBrowserDialog |
21 |
23 |
93 """ |
95 """ |
94 Protected slot implementing a close event handler. |
96 Protected slot implementing a close event handler. |
95 |
97 |
96 @param e close event (QCloseEvent) |
98 @param e close event (QCloseEvent) |
97 """ |
99 """ |
98 if self.process is not None and \ |
100 if ( |
99 self.process.state() != QProcess.NotRunning: |
101 self.process is not None and |
|
102 self.process.state() != QProcess.NotRunning |
|
103 ): |
100 self.process.terminate() |
104 self.process.terminate() |
101 QTimer.singleShot(2000, self.process.kill) |
105 QTimer.singleShot(2000, self.process.kill) |
102 self.process.waitForFinished(3000) |
106 self.process.waitForFinished(3000) |
103 |
107 |
104 self.__position = self.pos() |
108 self.__position = self.pos() |
219 def __finish(self): |
223 def __finish(self): |
220 """ |
224 """ |
221 Private slot called when the process finished or the user pressed |
225 Private slot called when the process finished or the user pressed |
222 the button. |
226 the button. |
223 """ |
227 """ |
224 if self.process is not None and \ |
228 if ( |
225 self.process.state() != QProcess.NotRunning: |
229 self.process is not None and |
|
230 self.process.state() != QProcess.NotRunning |
|
231 ): |
226 self.process.terminate() |
232 self.process.terminate() |
227 QTimer.singleShot(2000, self.process.kill) |
233 QTimer.singleShot(2000, self.process.kill) |
228 self.process.waitForFinished(3000) |
234 self.process.waitForFinished(3000) |
229 |
235 |
230 QApplication.restoreOverrideCursor() |
236 QApplication.restoreOverrideCursor() |
329 |
335 |
330 if output: |
336 if output: |
331 totals = {"files": 0, "additions": 0, "deletions": 0} |
337 totals = {"files": 0, "additions": 0, "deletions": 0} |
332 fileData = [] |
338 fileData = [] |
333 for line in output.splitlines(): |
339 for line in output.splitlines(): |
334 additions, deletions, name = \ |
340 additions, deletions, name = ( |
335 line.strip().split(None, 2) |
341 line.strip().split(None, 2) |
|
342 ) |
336 totals["files"] += 1 |
343 totals["files"] += 1 |
337 if additions != "-": |
344 if additions != "-": |
338 totals["additions"] += int(additions) |
345 totals["additions"] += int(additions) |
339 if deletions != "-": |
346 if deletions != "-": |
340 totals["deletions"] += int(deletions) |
347 totals["deletions"] += int(deletions) |