summaryrefslogtreecommitdiff
path: root/src/leap/bitmask
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-08-12 17:06:22 -0300
committerTomás Touceda <chiiph@leap.se>2013-08-12 17:06:22 -0300
commitc52981ceb04b5905f2003d6112811468b6434243 (patch)
treeccff011ae8a18e1eb7812c059a092268bbe105d2 /src/leap/bitmask
parent75a1b6e96b789a8d3d4b9b22bbf62e30ffe62751 (diff)
parent3804ef99e24be6296a77d6dc61b0e2f8ad86e8ce (diff)
Merge remote-tracking branch 'ivan/feature/3407_add-log-filtering' into develop
Diffstat (limited to 'src/leap/bitmask')
-rw-r--r--src/leap/bitmask/gui/loggerwindow.py23
-rw-r--r--src/leap/bitmask/gui/mainwindow.py3
-rw-r--r--src/leap/bitmask/gui/ui/loggerwindow.ui24
3 files changed, 46 insertions, 4 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
diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py
index 6dd28f04..46def802 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):
@@ -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(
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 @@
<normaloff>:/images/mask-icon.png</normaloff>:/images/mask-icon.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout">
- <item row="2" column="0" colspan="2">
+ <item row="2" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Filter by:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="leFilterBy"/>
+ </item>
+ <item row="2" column="2">
+ <widget class="QCheckBox" name="cbCaseInsensitive">
+ <property name="text">
+ <string>Case Insensitive</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="3">
<widget class="QTextBrowser" name="txtLogHistory"/>
</item>
- <item row="0" column="0" colspan="2">
+ <item row="0" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="btnDebug">