5 |
5 |
6 """ |
6 """ |
7 Module implementing a dialog to browse the log history. |
7 Module implementing a dialog to browse the log history. |
8 """ |
8 """ |
9 |
9 |
10 |
10 import re |
11 import os |
11 import os |
12 |
12 |
13 import pysvn |
13 import pysvn |
14 |
14 |
15 from PyQt5.QtCore import Qt, QDate, QRegExp, pyqtSlot, QPoint |
15 from PyQt5.QtCore import Qt, QDate, pyqtSlot, QPoint |
16 from PyQt5.QtWidgets import ( |
16 from PyQt5.QtWidgets import ( |
17 QHeaderView, QWidget, QApplication, QDialogButtonBox, QTreeWidgetItem |
17 QHeaderView, QWidget, QApplication, QDialogButtonBox, QTreeWidgetItem |
18 ) |
18 ) |
19 |
19 |
20 from E5Gui import E5MessageBox |
20 from E5Gui import E5MessageBox |
565 from_ = self.fromDate.date().toString("yyyy-MM-dd") |
565 from_ = self.fromDate.date().toString("yyyy-MM-dd") |
566 to_ = self.toDate.date().addDays(1).toString("yyyy-MM-dd") |
566 to_ = self.toDate.date().addDays(1).toString("yyyy-MM-dd") |
567 txt = self.fieldCombo.currentText() |
567 txt = self.fieldCombo.currentText() |
568 if txt == self.tr("Author"): |
568 if txt == self.tr("Author"): |
569 fieldIndex = 1 |
569 fieldIndex = 1 |
570 searchRx = QRegExp(self.rxEdit.text(), Qt.CaseInsensitive) |
570 searchRx = re.compile(self.rxEdit.text(), re.IGNORECASE) |
571 elif txt == self.tr("Revision"): |
571 elif txt == self.tr("Revision"): |
572 fieldIndex = 0 |
572 fieldIndex = 0 |
573 txt = self.rxEdit.text() |
573 txt = self.rxEdit.text() |
574 if txt.startswith("^"): |
574 if txt.startswith("^"): |
575 searchRx = QRegExp( |
575 searchRx = re.compile( |
576 r"^\s*{0}".format(txt[1:]), Qt.CaseInsensitive) |
576 r"^\s*{0}".format(txt[1:]), re.IGNORECASE) |
577 else: |
577 else: |
578 searchRx = QRegExp(txt, Qt.CaseInsensitive) |
578 searchRx = re.compile(txt, re.IGNORECASE) |
579 else: |
579 else: |
580 fieldIndex = 3 |
580 fieldIndex = 3 |
581 searchRx = QRegExp(self.rxEdit.text(), Qt.CaseInsensitive) |
581 searchRx = re.compile(self.rxEdit.text(), re.IGNORECASE) |
582 |
582 |
583 currentItem = self.logTree.currentItem() |
583 currentItem = self.logTree.currentItem() |
584 for topIndex in range(self.logTree.topLevelItemCount()): |
584 for topIndex in range(self.logTree.topLevelItemCount()): |
585 topItem = self.logTree.topLevelItem(topIndex) |
585 topItem = self.logTree.topLevelItem(topIndex) |
586 if ( |
586 if ( |
587 topItem.text(2) <= to_ and |
587 topItem.text(2) <= to_ and |
588 topItem.text(2) >= from_ and |
588 topItem.text(2) >= from_ and |
589 searchRx.indexIn(topItem.text(fieldIndex)) > -1 |
589 searchRx.search(topItem.text(fieldIndex)) is not None |
590 ): |
590 ): |
591 topItem.setHidden(False) |
591 topItem.setHidden(False) |
592 if topItem is currentItem: |
592 if topItem is currentItem: |
593 self.on_logTree_currentItemChanged(topItem, None) |
593 self.on_logTree_currentItemChanged(topItem, None) |
594 else: |
594 else: |