9 |
9 |
10 import os |
10 import os |
11 import re |
11 import re |
12 import collections |
12 import collections |
13 |
13 |
14 from PyQt5.QtCore import pyqtSlot, Qt, QDate, QRegExp, QSize, QPoint, QFileInfo |
14 from PyQt5.QtCore import pyqtSlot, Qt, QDate, QSize, QPoint, QFileInfo |
15 from PyQt5.QtGui import ( |
15 from PyQt5.QtGui import ( |
16 QColor, QPixmap, QPainter, QPen, QBrush, QIcon, QTextCursor, QPalette |
16 QColor, QPixmap, QPainter, QPen, QBrush, QIcon, QTextCursor, QPalette |
17 ) |
17 ) |
18 from PyQt5.QtWidgets import ( |
18 from PyQt5.QtWidgets import ( |
19 QWidget, QDialogButtonBox, QHeaderView, QTreeWidgetItem, QApplication, |
19 QWidget, QDialogButtonBox, QHeaderView, QTreeWidgetItem, QApplication, |
1839 topItem.text(self.DateColumn) <= to_ and |
1839 topItem.text(self.DateColumn) <= to_ and |
1840 topItem.text(self.DateColumn) >= from_ and |
1840 topItem.text(self.DateColumn) >= from_ and |
1841 (branch == self.__allBranchesFilter or |
1841 (branch == self.__allBranchesFilter or |
1842 topItem.text(self.BranchColumn) in |
1842 topItem.text(self.BranchColumn) in |
1843 [branch, closedBranch]) and |
1843 [branch, closedBranch]) and |
1844 searchRx.indexIn(txt) > -1 |
1844 searchRx.search(txt) is not None |
1845 ): |
1845 ): |
1846 topItem.setHidden(False) |
1846 topItem.setHidden(False) |
1847 if topItem is currentItem: |
1847 if topItem is currentItem: |
1848 self.on_logTree_currentItemChanged(topItem, None) |
1848 self.on_logTree_currentItemChanged(topItem, None) |
1849 else: |
1849 else: |
1864 """ |
1864 """ |
1865 indexIsRole = False |
1865 indexIsRole = False |
1866 txt = self.fieldCombo.itemData(self.fieldCombo.currentIndex()) |
1866 txt = self.fieldCombo.itemData(self.fieldCombo.currentIndex()) |
1867 if txt == "author": |
1867 if txt == "author": |
1868 fieldIndex = self.AuthorColumn |
1868 fieldIndex = self.AuthorColumn |
1869 searchRx = QRegExp(self.rxEdit.text(), Qt.CaseInsensitive) |
1869 searchRx = re.compile(self.rxEdit.text(), re.IGNORECASE) |
1870 elif txt == "revision": |
1870 elif txt == "revision": |
1871 fieldIndex = self.RevisionColumn |
1871 fieldIndex = self.RevisionColumn |
1872 txt = self.rxEdit.text() |
1872 txt = self.rxEdit.text() |
1873 if txt.startswith("^"): |
1873 if txt.startswith("^"): |
1874 searchRx = QRegExp(r"^\s*{0}".format(txt[1:]), |
1874 searchRx = re.compile(r"^\s*{0}".format(txt[1:]), |
1875 Qt.CaseInsensitive) |
1875 re.IGNORECASE) |
1876 else: |
1876 else: |
1877 searchRx = QRegExp(txt, Qt.CaseInsensitive) |
1877 searchRx = re.compile(txt, re.IGNORECASE) |
1878 elif txt == "file": |
1878 elif txt == "file": |
1879 fieldIndex = self.__changesRole |
1879 fieldIndex = self.__changesRole |
1880 searchRx = QRegExp(self.rxEdit.text(), Qt.CaseInsensitive) |
1880 searchRx = re.compile(self.rxEdit.text(), re.IGNORECASE) |
1881 indexIsRole = True |
1881 indexIsRole = True |
1882 elif txt == "phase": |
1882 elif txt == "phase": |
1883 fieldIndex = self.PhaseColumn |
1883 fieldIndex = self.PhaseColumn |
1884 searchRx = QRegExp(self.rxEdit.text(), Qt.CaseInsensitive) |
1884 searchRx = re.compile(self.rxEdit.text(), re.IGNORECASE) |
1885 else: |
1885 else: |
1886 fieldIndex = self.__messageRole |
1886 fieldIndex = self.__messageRole |
1887 searchRx = QRegExp(self.rxEdit.text(), Qt.CaseInsensitive) |
1887 searchRx = re.compile(self.rxEdit.text(), re.IGNORECASE) |
1888 indexIsRole = True |
1888 indexIsRole = True |
1889 |
1889 |
1890 return fieldIndex, searchRx, indexIsRole |
1890 return fieldIndex, searchRx, indexIsRole |
1891 |
1891 |
1892 @pyqtSlot(bool) |
1892 @pyqtSlot(bool) |
2428 else: |
2428 else: |
2429 # Find based on complete message text |
2429 # Find based on complete message text |
2430 txt = "\n".join(topItem.data(0, self.__messageRole)) |
2430 txt = "\n".join(topItem.data(0, self.__messageRole)) |
2431 else: |
2431 else: |
2432 txt = topItem.text(fieldIndex) |
2432 txt = topItem.text(fieldIndex) |
2433 if searchRx.indexIn(txt) > -1: |
2433 if searchRx.search(txt) is not None: |
2434 self.logTree.setCurrentItem(self.logTree.topLevelItem(index)) |
2434 self.logTree.setCurrentItem(self.logTree.topLevelItem(index)) |
2435 break |
2435 break |
2436 else: |
2436 else: |
2437 E5MessageBox.information( |
2437 E5MessageBox.information( |
2438 self, |
2438 self, |