9 |
9 |
10 |
10 |
11 import os |
11 import os |
12 import collections |
12 import collections |
13 |
13 |
14 from PyQt5.QtCore import pyqtSlot, Qt, QDate, QProcess, QTimer, QRegExp, \ |
14 from PyQt5.QtCore import ( |
15 QSize, QPoint, QFileInfo |
15 pyqtSlot, Qt, QDate, QProcess, QTimer, QRegExp, QSize, QPoint, QFileInfo |
16 from PyQt5.QtGui import QCursor, QColor, QPixmap, QPainter, QPen, QIcon, \ |
16 ) |
17 QTextCursor |
17 from PyQt5.QtGui import ( |
18 from PyQt5.QtWidgets import QWidget, QDialogButtonBox, QHeaderView, \ |
18 QCursor, QColor, QPixmap, QPainter, QPen, QIcon, QTextCursor |
19 QTreeWidgetItem, QApplication, QLineEdit, QMenu, QInputDialog |
19 ) |
|
20 from PyQt5.QtWidgets import ( |
|
21 QWidget, QDialogButtonBox, QHeaderView, QTreeWidgetItem, QApplication, |
|
22 QLineEdit, QMenu, QInputDialog |
|
23 ) |
20 |
24 |
21 from E5Gui.E5Application import e5App |
25 from E5Gui.E5Application import e5App |
22 from E5Gui import E5MessageBox, E5FileDialog |
26 from E5Gui import E5MessageBox, E5FileDialog |
23 |
27 |
24 from Globals import strToQByteArray |
28 from Globals import strToQByteArray |
370 """ |
374 """ |
371 Protected slot implementing a close event handler. |
375 Protected slot implementing a close event handler. |
372 |
376 |
373 @param e close event (QCloseEvent) |
377 @param e close event (QCloseEvent) |
374 """ |
378 """ |
375 if self.process is not None and \ |
379 if ( |
376 self.process.state() != QProcess.NotRunning: |
380 self.process is not None and |
|
381 self.process.state() != QProcess.NotRunning |
|
382 ): |
377 self.process.terminate() |
383 self.process.terminate() |
378 QTimer.singleShot(2000, self.process.kill) |
384 QTimer.singleShot(2000, self.process.kill) |
379 self.process.waitForFinished(3000) |
385 self.process.waitForFinished(3000) |
380 |
386 |
381 self.vcs.getPlugin().setPreferences( |
387 self.vcs.getPlugin().setPreferences( |
713 itm.setData(0, self.__parentsRole, parents) |
719 itm.setData(0, self.__parentsRole, parents) |
714 for parent in parents: |
720 for parent in parents: |
715 self.__childrenInfo[parent].append(commitId) |
721 self.__childrenInfo[parent].append(commitId) |
716 |
722 |
717 if self.logTree.topLevelItemCount() > 1: |
723 if self.logTree.topLevelItemCount() > 1: |
718 topedges = \ |
724 topedges = ( |
719 self.logTree.topLevelItem( |
725 self.logTree.topLevelItem( |
720 self.logTree.indexOfTopLevelItem(itm) - 1)\ |
726 self.logTree.indexOfTopLevelItem(itm) - 1) |
721 .data(0, self.__edgesRole) |
727 .data(0, self.__edgesRole) |
|
728 ) |
722 else: |
729 else: |
723 topedges = None |
730 topedges = None |
724 |
731 |
725 icon = self.__generateIcon(column, color, edges, topedges, |
732 icon = self.__generateIcon(column, color, edges, topedges, |
726 QColor("blue"), |
733 QColor("blue"), |
869 def __finish(self): |
876 def __finish(self): |
870 """ |
877 """ |
871 Private slot called when the process finished or the user pressed |
878 Private slot called when the process finished or the user pressed |
872 the button. |
879 the button. |
873 """ |
880 """ |
874 if self.process is not None and \ |
881 if ( |
875 self.process.state() != QProcess.NotRunning: |
882 self.process is not None and |
|
883 self.process.state() != QProcess.NotRunning |
|
884 ): |
876 self.process.terminate() |
885 self.process.terminate() |
877 QTimer.singleShot(2000, self.process.kill) |
886 QTimer.singleShot(2000, self.process.kill) |
878 self.process.waitForFinished(3000) |
887 self.process.waitForFinished(3000) |
879 |
888 |
880 QApplication.restoreOverrideCursor() |
889 QApplication.restoreOverrideCursor() |
904 logEntry["parents"], logEntry["refnames"], |
913 logEntry["parents"], logEntry["refnames"], |
905 logEntry["authormail"], logEntry["committermail"] |
914 logEntry["authormail"], logEntry["committermail"] |
906 ) |
915 ) |
907 for date in [logEntry["authordate"], logEntry["committerdate"]]: |
916 for date in [logEntry["authordate"], logEntry["committerdate"]]: |
908 dt = QDate.fromString(date, Qt.ISODate) |
917 dt = QDate.fromString(date, Qt.ISODate) |
909 if not self.__maxDate.isValid() and \ |
918 if ( |
910 not self.__minDate.isValid(): |
919 not self.__maxDate.isValid() and |
|
920 not self.__minDate.isValid() |
|
921 ): |
911 self.__maxDate = dt |
922 self.__maxDate = dt |
912 self.__minDate = dt |
923 self.__minDate = dt |
913 else: |
924 else: |
914 if self.__maxDate < dt: |
925 if self.__maxDate < dt: |
915 self.__maxDate = dt |
926 self.__maxDate = dt |
1215 else: |
1226 else: |
1216 # Filter based on complete subject text |
1227 # Filter based on complete subject text |
1217 txt = topItem.data(0, self.__subjectRole) |
1228 txt = topItem.data(0, self.__subjectRole) |
1218 else: |
1229 else: |
1219 txt = topItem.text(fieldIndex) |
1230 txt = topItem.text(fieldIndex) |
1220 if topItem.text(self.DateColumn) <= to_ and \ |
1231 if ( |
1221 topItem.text(self.DateColumn) >= from_ and \ |
1232 topItem.text(self.DateColumn) <= to_ and |
1222 searchRx.indexIn(txt) > -1: |
1233 topItem.text(self.DateColumn) >= from_ and |
|
1234 searchRx.indexIn(txt) > -1 |
|
1235 ): |
1223 topItem.setHidden(False) |
1236 topItem.setHidden(False) |
1224 if topItem is currentItem: |
1237 if topItem is currentItem: |
1225 self.on_logTree_currentItemChanged(topItem, None) |
1238 self.on_logTree_currentItemChanged(topItem, None) |
1226 else: |
1239 else: |
1227 topItem.setHidden(True) |
1240 topItem.setHidden(True) |
1306 self.__diffUpdatesFiles = True |
1319 self.__diffUpdatesFiles = True |
1307 index1 = self.logTree.indexOfTopLevelItem(selectedItems[0]) |
1320 index1 = self.logTree.indexOfTopLevelItem(selectedItems[0]) |
1308 index2 = self.logTree.indexOfTopLevelItem(selectedItems[1]) |
1321 index2 = self.logTree.indexOfTopLevelItem(selectedItems[1]) |
1309 if index1 > index2: |
1322 if index1 > index2: |
1310 # Swap the entries |
1323 # Swap the entries |
1311 selectedItems[0], selectedItems[1] = \ |
1324 selectedItems[0], selectedItems[1] = ( |
1312 selectedItems[1], selectedItems[0] |
1325 selectedItems[1], selectedItems[0] |
|
1326 ) |
1313 html = "{0}<hr/>{1}".format( |
1327 html = "{0}<hr/>{1}".format( |
1314 self.__generateDetailsTableText(selectedItems[0]), |
1328 self.__generateDetailsTableText(selectedItems[0]), |
1315 self.__generateDetailsTableText(selectedItems[1]), |
1329 self.__generateDetailsTableText(selectedItems[1]), |
1316 ) |
1330 ) |
1317 self.detailsEdit.setHtml(html) |
1331 self.detailsEdit.setHtml(html) |
1819 pfile = e5App().getObject("Project").getProjectFile() |
1833 pfile = e5App().getObject("Project").getProjectFile() |
1820 lastModified = QFileInfo(pfile).lastModified().toString() |
1834 lastModified = QFileInfo(pfile).lastModified().toString() |
1821 res, shouldReopen = self.vcs.gitBranch( |
1835 res, shouldReopen = self.vcs.gitBranch( |
1822 self.repodir, revision=commit, branchName=branch, |
1836 self.repodir, revision=commit, branchName=branch, |
1823 branchOp=GitBranchDialog.CreateSwitchBranch) |
1837 branchOp=GitBranchDialog.CreateSwitchBranch) |
1824 shouldReopen = shouldReopen or \ |
1838 shouldReopen = ( |
|
1839 shouldReopen or |
1825 QFileInfo(pfile).lastModified().toString() != lastModified |
1840 QFileInfo(pfile).lastModified().toString() != lastModified |
|
1841 ) |
1826 if res: |
1842 if res: |
1827 if shouldReopen: |
1843 if shouldReopen: |
1828 res = E5MessageBox.yesNo( |
1844 res = E5MessageBox.yesNo( |
1829 None, |
1845 None, |
1830 self.tr("Switch"), |
1846 self.tr("Switch"), |