From 3dd2680563e2f7477889052862c05908e0b7864b Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Mon, 12 Aug 2013 16:59:47 -0300 Subject: Move import to top, update path to new namespace. --- src/leap/bitmask/gui/mainwindow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/leap/bitmask/gui') diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index 6dd28f04..486bebf7 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -60,6 +60,7 @@ from leap.bitmask.services.eip.vpnlaunchers import EIPNoTunKextLoaded from leap.bitmask.util import __version__ as VERSION from leap.bitmask.util.keyring_helpers import has_keyring +from leap.bitmask.util.leap_log_handler import LeapLogHandler from leap.bitmask.services.mail.smtpconfig import SMTPConfig @@ -359,7 +360,6 @@ class MainWindow(QtGui.QMainWindow): :return: a logging handler or None :rtype: LeapLogHandler or None """ - from leap.util.leap_log_handler import LeapLogHandler leap_logger = logging.getLogger('leap') for h in leap_logger.handlers: if isinstance(h, LeapLogHandler): -- cgit v1.2.3 From 7bf7d66fbd80d28a1f97f61960d1af653ba6fe91 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Mon, 12 Aug 2013 17:00:28 -0300 Subject: Exit function if there is no handler to use. --- src/leap/bitmask/gui/mainwindow.py | 1 + 1 file changed, 1 insertion(+) (limited to 'src/leap/bitmask/gui') diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index 486bebf7..46def802 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -380,6 +380,7 @@ class MainWindow(QtGui.QMainWindow): leap_log_handler = self._get_leap_logging_handler() if leap_log_handler is None: logger.error('Leap logger handler not found') + return else: self._logger_window = LoggerWindow(handler=leap_log_handler) self._logger_window.setVisible( -- cgit v1.2.3 From 724ec2637fbe7625513dc1551faabd157724de7b Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Mon, 12 Aug 2013 16:35:06 -0300 Subject: Add filter input and case sensitivity toggle. --- src/leap/bitmask/gui/ui/loggerwindow.ui | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/leap/bitmask/gui') diff --git a/src/leap/bitmask/gui/ui/loggerwindow.ui b/src/leap/bitmask/gui/ui/loggerwindow.ui index b08428a9..47a1e717 100644 --- a/src/leap/bitmask/gui/ui/loggerwindow.ui +++ b/src/leap/bitmask/gui/ui/loggerwindow.ui @@ -18,10 +18,30 @@ :/images/mask-icon.png:/images/mask-icon.png - + + + + Filter by: + + + + + + + + + + Case Insensitive + + + true + + + + - + -- cgit v1.2.3 From c2ece2903e825ae730217c00ff3191202920f8c3 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Mon, 12 Aug 2013 16:36:33 -0300 Subject: Add filter option to the logger window. Closes #3407. --- src/leap/bitmask/gui/loggerwindow.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/leap/bitmask/gui') 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 = "" 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 -- cgit v1.2.3