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_HgShelveBrowserDialog import Ui_HgShelveBrowserDialog |
22 from .Ui_HgShelveBrowserDialog import Ui_HgShelveBrowserDialog |
21 |
23 |
84 """ |
86 """ |
85 if self.__hgClient: |
87 if self.__hgClient: |
86 if self.__hgClient.isExecuting(): |
88 if self.__hgClient.isExecuting(): |
87 self.__hgClient.cancel() |
89 self.__hgClient.cancel() |
88 else: |
90 else: |
89 if self.process is not None and \ |
91 if ( |
90 self.process.state() != QProcess.NotRunning: |
92 self.process is not None and |
|
93 self.process.state() != QProcess.NotRunning |
|
94 ): |
91 self.process.terminate() |
95 self.process.terminate() |
92 QTimer.singleShot(2000, self.process.kill) |
96 QTimer.singleShot(2000, self.process.kill) |
93 self.process.waitForFinished(3000) |
97 self.process.waitForFinished(3000) |
94 |
98 |
95 self.__position = self.pos() |
99 self.__position = self.pos() |
227 def __finish(self): |
231 def __finish(self): |
228 """ |
232 """ |
229 Private slot called when the process finished or the user pressed |
233 Private slot called when the process finished or the user pressed |
230 the button. |
234 the button. |
231 """ |
235 """ |
232 if self.process is not None and \ |
236 if ( |
233 self.process.state() != QProcess.NotRunning: |
237 self.process is not None and |
|
238 self.process.state() != QProcess.NotRunning |
|
239 ): |
234 self.process.terminate() |
240 self.process.terminate() |
235 QTimer.singleShot(2000, self.process.kill) |
241 QTimer.singleShot(2000, self.process.kill) |
236 self.process.waitForFinished(3000) |
242 self.process.waitForFinished(3000) |
237 |
243 |
238 QApplication.restoreOverrideCursor() |
244 QApplication.restoreOverrideCursor() |
462 Private slot to restore the selected shelve of changes. |
468 Private slot to restore the selected shelve of changes. |
463 """ |
469 """ |
464 itm = self.shelveList.selectedItems()[0] |
470 itm = self.shelveList.selectedItems()[0] |
465 if itm is not None: |
471 if itm is not None: |
466 name = itm.text(self.NameColumn) |
472 name = itm.text(self.NameColumn) |
467 self.vcs.getExtensionObject("shelve")\ |
473 self.vcs.getExtensionObject("shelve").hgUnshelve( |
468 .hgUnshelve(self.__projectDir, shelveName=name) |
474 self.__projectDir, shelveName=name) |
469 self.on_refreshButton_clicked() |
475 self.on_refreshButton_clicked() |
470 |
476 |
471 def __deleteShelves(self): |
477 def __deleteShelves(self): |
472 """ |
478 """ |
473 Private slot to delete the selected shelves. |
479 Private slot to delete the selected shelves. |
474 """ |
480 """ |
475 shelveNames = [] |
481 shelveNames = [] |
476 for itm in self.shelveList.selectedItems(): |
482 for itm in self.shelveList.selectedItems(): |
477 shelveNames.append(itm.text(self.NameColumn)) |
483 shelveNames.append(itm.text(self.NameColumn)) |
478 if shelveNames: |
484 if shelveNames: |
479 self.vcs.getExtensionObject("shelve")\ |
485 self.vcs.getExtensionObject("shelve").hgDeleteShelves( |
480 .hgDeleteShelves(self.__projectDir, shelveNames=shelveNames) |
486 self.__projectDir, shelveNames=shelveNames) |
481 self.on_refreshButton_clicked() |
487 self.on_refreshButton_clicked() |
482 |
488 |
483 def __cleanupShelves(self): |
489 def __cleanupShelves(self): |
484 """ |
490 """ |
485 Private slot to delete all shelves. |
491 Private slot to delete all shelves. |
486 """ |
492 """ |
487 self.vcs.getExtensionObject("shelve")\ |
493 self.vcs.getExtensionObject("shelve").hgCleanupShelves( |
488 .hgCleanupShelves(self.__projectDir) |
494 self.__projectDir) |
489 self.on_refreshButton_clicked() |
495 self.on_refreshButton_clicked() |