diff options
author | Tomás Touceda <chiiph@leap.se> | 2013-08-12 17:06:22 -0300 |
---|---|---|
committer | Tomás Touceda <chiiph@leap.se> | 2013-08-12 17:06:22 -0300 |
commit | c52981ceb04b5905f2003d6112811468b6434243 (patch) | |
tree | ccff011ae8a18e1eb7812c059a092268bbe105d2 /src/leap/bitmask/gui/loggerwindow.py | |
parent | 75a1b6e96b789a8d3d4b9b22bbf62e30ffe62751 (diff) | |
parent | 3804ef99e24be6296a77d6dc61b0e2f8ad86e8ce (diff) |
Merge remote-tracking branch 'ivan/feature/3407_add-log-filtering' into develop
Diffstat (limited to 'src/leap/bitmask/gui/loggerwindow.py')
-rw-r--r-- | src/leap/bitmask/gui/loggerwindow.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/leap/bitmask/gui/loggerwindow.py b/src/leap/bitmask/gui/loggerwindow.py index 981bf65d..9b4ba55d 100644 --- a/src/leap/bitmask/gui/loggerwindow.py +++ b/src/leap/bitmask/gui/loggerwindow.py @@ -56,6 +56,10 @@ class LoggerWindow(QtGui.QDialog): self.ui.btnWarning.toggled.connect(self._load_history), self.ui.btnError.toggled.connect(self._load_history), self.ui.btnCritical.toggled.connect(self._load_history) + self.ui.leFilterBy.textEdited.connect(self._filter_by) + self.ui.cbCaseInsensitive.stateChanged.connect(self._load_history) + + self._current_filter = "" # Load logging history and connect logger with the widget self._logging_handler = handler @@ -95,7 +99,14 @@ class LoggerWindow(QtGui.QDialog): close_tag = "</td></tr>" message = open_tag + message + close_tag - self.ui.txtLogHistory.append(message) + filter_by = self._current_filter + msg = message + if self.ui.cbCaseInsensitive.isChecked(): + msg = msg.upper() + filter_by = filter_by.upper() + + if msg.find(filter_by) != -1: + self.ui.txtLogHistory.append(message) def _load_history(self): """ @@ -120,6 +131,16 @@ class LoggerWindow(QtGui.QDialog): logging.CRITICAL: self.ui.btnCritical.isChecked() } + def _filter_by(self, text): + """ + Sets the text to use for filtering logs in the log window. + + :param text: the text to compare with the logs when filtering. + :type text: str + """ + self._current_filter = text + self._load_history() + def _save_log_to_file(self): """ Lets the user save the current log to a file |