6 """ |
6 """ |
7 Module implementing a dialog for the configuration of eric6's keyboard |
7 Module implementing a dialog for the configuration of eric6's keyboard |
8 shortcuts. |
8 shortcuts. |
9 """ |
9 """ |
10 |
10 |
11 |
11 import re |
12 from PyQt5.QtCore import pyqtSignal, QRegExp, Qt, pyqtSlot |
12 |
|
13 from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt |
13 from PyQt5.QtGui import QKeySequence |
14 from PyQt5.QtGui import QKeySequence |
14 from PyQt5.QtWidgets import QHeaderView, QDialog, QTreeWidgetItem |
15 from PyQt5.QtWidgets import QHeaderView, QDialog, QTreeWidgetItem |
15 |
16 |
16 from E5Gui.E5Application import e5App |
17 from E5Gui.E5Application import e5App |
17 from E5Gui import E5MessageBox |
18 from E5Gui import E5MessageBox |
460 """ |
461 """ |
461 Private slot called, when the text in the search edit changes. |
462 Private slot called, when the text in the search edit changes. |
462 |
463 |
463 @param txt text of the search edit (string) |
464 @param txt text of the search edit (string) |
464 """ |
465 """ |
|
466 rx = re.compile(re.escape(txt), re.IGNORECASE) |
465 for topIndex in range(self.shortcutsList.topLevelItemCount()): |
467 for topIndex in range(self.shortcutsList.topLevelItemCount()): |
466 topItem = self.shortcutsList.topLevelItem(topIndex) |
468 topItem = self.shortcutsList.topLevelItem(topIndex) |
467 childHiddenCount = 0 |
469 childHiddenCount = 0 |
468 for index in range(topItem.childCount()): |
470 for index in range(topItem.childCount()): |
469 itm = topItem.child(index) |
471 itm = topItem.child(index) |
470 if ( |
472 if ( |
471 (self.actionButton.isChecked() and |
473 (self.actionButton.isChecked() and |
472 not QRegExp(txt, Qt.CaseInsensitive).indexIn( |
474 rx.search(itm.text(0)) is not None) or |
473 itm.text(0)) > -1) or |
|
474 (self.shortcutButton.isChecked() and |
475 (self.shortcutButton.isChecked() and |
475 not txt.lower() in itm.text(1).lower() and |
476 not txt.lower() in itm.text(1).lower() and |
476 not txt.lower() in itm.text(2).lower()) |
477 not txt.lower() in itm.text(2).lower()) |
477 ): |
478 ): |
478 itm.setHidden(True) |
479 itm.setHidden(True) |