summaryrefslogtreecommitdiff
path: root/src/leap/baseapp/log.py
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-09-04 07:11:46 +0900
committerkali <kali@leap.se>2012-09-04 07:11:46 +0900
commit6ef92e257ce1e605194cb26ff6cb804c7d2c3418 (patch)
treea2cf102515e381859445a42703184fb32556e78d /src/leap/baseapp/log.py
parent83a3fed0d38e44e64cec027f9fd2fcd5a894f96a (diff)
parent3b752fcfac7a18891e2f948acae0cb4781678647 (diff)
Merge branch 'feature/qt-refactor' into develop
closes #474: refactor Qt Code
Diffstat (limited to 'src/leap/baseapp/log.py')
-rw-r--r--src/leap/baseapp/log.py60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/leap/baseapp/log.py b/src/leap/baseapp/log.py
new file mode 100644
index 00000000..0c98eb94
--- /dev/null
+++ b/src/leap/baseapp/log.py
@@ -0,0 +1,60 @@
+from PyQt4 import QtGui
+from PyQt4 import QtCore
+
+
+class LogPane(object):
+ """
+ a simple log pane
+ that writes new lines as they come
+ """
+
+ def createLogBrowser(self):
+ """
+ creates Browser widget for displaying logs
+ (in debug mode only).
+ """
+ self.loggerBox = QtGui.QGroupBox()
+ logging_layout = QtGui.QVBoxLayout()
+ self.logbrowser = QtGui.QTextBrowser()
+
+ startStopButton = QtGui.QPushButton("&Connect")
+ #startStopButton.clicked.connect(self.start_or_stopVPN)
+ self.startStopButton = startStopButton
+
+ logging_layout.addWidget(self.logbrowser)
+ logging_layout.addWidget(self.startStopButton)
+ self.loggerBox.setLayout(logging_layout)
+
+ # status box
+
+ self.statusBox = QtGui.QGroupBox()
+ grid = QtGui.QGridLayout()
+
+ self.updateTS = QtGui.QLabel('')
+ self.status_label = QtGui.QLabel('Disconnected')
+ self.ip_label = QtGui.QLabel('')
+ self.remote_label = QtGui.QLabel('')
+
+ tun_read_label = QtGui.QLabel("tun read")
+ self.tun_read_bytes = QtGui.QLabel("0")
+ tun_write_label = QtGui.QLabel("tun write")
+ self.tun_write_bytes = QtGui.QLabel("0")
+
+ grid.addWidget(self.updateTS, 0, 0)
+ grid.addWidget(self.status_label, 0, 1)
+ grid.addWidget(self.ip_label, 1, 0)
+ grid.addWidget(self.remote_label, 1, 1)
+ grid.addWidget(tun_read_label, 2, 0)
+ grid.addWidget(self.tun_read_bytes, 2, 1)
+ grid.addWidget(tun_write_label, 3, 0)
+ grid.addWidget(self.tun_write_bytes, 3, 1)
+
+ self.statusBox.setLayout(grid)
+
+ @QtCore.pyqtSlot(str)
+ def onLoggerNewLine(self, line):
+ """
+ simple slot: writes new line to logger Pane.
+ """
+ if self.debugmode:
+ self.logbrowser.append(line[:-1])