diff options
author | Ivan Alejandro <ivanalejandro0@gmail.com> | 2013-08-12 16:36:33 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@gmail.com> | 2013-08-12 17:01:50 -0300 |
commit | c2ece2903e825ae730217c00ff3191202920f8c3 (patch) | |
tree | e2fef702dfe56adbeeda7440e797a48908ee5c5f | |
parent | 724ec2637fbe7625513dc1551faabd157724de7b (diff) |
Add filter option to the logger window.
Closes #3407.
-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 |