diff options
author | Ivan Alejandro <ivanalejandro0@yahoo.com.ar> | 2013-05-27 15:10:49 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@yahoo.com.ar> | 2013-05-29 14:29:32 -0300 |
commit | c928400ff02adf6c23c5341c2139e95f2c49976d (patch) | |
tree | 265a8340cfad6a92a1c2696003221956c81cdfc4 /src/leap/gui | |
parent | ef00c4ec75446c60dea8f790ae86109e0d8b6ca3 (diff) |
Integrate LoggerWindow with client
Diffstat (limited to 'src/leap/gui')
-rw-r--r-- | src/leap/gui/mainwindow.py | 37 | ||||
-rw-r--r-- | src/leap/gui/ui/mainwindow.ui | 10 |
2 files changed, 45 insertions, 2 deletions
diff --git a/src/leap/gui/mainwindow.py b/src/leap/gui/mainwindow.py index a8aa1b1c..12187f51 100644 --- a/src/leap/gui/mainwindow.py +++ b/src/leap/gui/mainwindow.py @@ -35,6 +35,7 @@ from leap.common.events import events_pb2 as proto from leap.config.leapsettings import LeapSettings from leap.config.providerconfig import ProviderConfig from leap.crypto.srpauth import SRPAuth +from leap.gui.loggerwindow import LoggerWindow from leap.gui.wizard import Wizard from leap.services.eip.eipbootstrapper import EIPBootstrapper from leap.services.eip.eipconfig import EIPConfig @@ -208,6 +209,7 @@ class MainWindow(QtGui.QMainWindow): self.ui.action_about_leap.triggered.connect(self._about) self.ui.action_quit.triggered.connect(self.quit) self.ui.action_wizard.triggered.connect(self._launch_wizard) + self.ui.action_show_logs.triggered.connect(self._show_logger_window) self.raise_window.connect(self._do_raise_mainwindow) # Used to differentiate between real quits and close to tray @@ -249,6 +251,8 @@ class MainWindow(QtGui.QMainWindow): self._wizard = None self._wizard_firstrun = False + self._logger_window = None + self._bypass_checks = bypass_checks self._soledad = None @@ -282,6 +286,35 @@ class MainWindow(QtGui.QMainWindow): self._wizard.exec_() self._wizard = None + def _get_leap_logging_handler(self): + """ + Gets the leap handler from the top level logger + + :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): + return h + return None + + def _show_logger_window(self): + """ + Displays the window with the history of messages logged until now + and displays the new ones on arrival. + """ + if self._logger_window is None: + leap_log_handler = self._get_leap_logging_handler() + if leap_log_handler is None: + logger.error('Leap logger handler not found') + else: + self._logger_window = LoggerWindow(handler=leap_log_handler) + self._logger_window.show() + else: + self._logger_window.show() + def _remember_state_changed(self, state): enable = True if state == QtCore.Qt.Checked else False self.ui.chkAutoLogin.setEnabled(enable) @@ -1101,6 +1134,10 @@ class MainWindow(QtGui.QMainWindow): self._really_quit = True if self._wizard: self._wizard.close() + + if self._logger_window: + self._logger_window.close() + self.close() if self._quit_callback: diff --git a/src/leap/gui/ui/mainwindow.ui b/src/leap/gui/ui/mainwindow.ui index b42ff180..fdf5c167 100644 --- a/src/leap/gui/ui/mainwindow.ui +++ b/src/leap/gui/ui/mainwindow.ui @@ -396,7 +396,7 @@ <x>0</x> <y>0</y> <width>415</width> - <height>25</height> + <height>21</height> </rect> </property> <widget class="QMenu" name="menuSession"> @@ -417,9 +417,10 @@ </widget> <widget class="QMenu" name="menuSettings"> <property name="title"> - <string>S&ettings</string> + <string>&Utils</string> </property> <addaction name="action_wizard"/> + <addaction name="action_show_logs"/> </widget> <addaction name="menuSession"/> <addaction name="menuSettings"/> @@ -451,6 +452,11 @@ <string>&Wizard</string> </property> </action> + <action name="action_show_logs"> + <property name="text"> + <string>Show &logs</string> + </property> + </action> </widget> <tabstops> <tabstop>lnUser</tabstop> |