From db18ad67d4149b5f5a6f68db1f52abd91f6f9373 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Thu, 25 Jul 2013 11:41:15 +0200 Subject: reset rates when disconnecting --- src/leap/gui/statuspanel.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/leap/gui') diff --git a/src/leap/gui/statuspanel.py b/src/leap/gui/statuspanel.py index ac0f5162..3e0377f9 100644 --- a/src/leap/gui/statuspanel.py +++ b/src/leap/gui/statuspanel.py @@ -126,6 +126,16 @@ class StatusPanelWidget(QtGui.QWidget): self._up_rate = RateMovingAverage() self._down_rate = RateMovingAverage() + def _reset_traffic_rates(self): + """ + Resets up and download rates, and cleans up the labels. + """ + self._up_rate.reset() + self._down_rate.reset() + zeroed = {VPNManager.TUNTAP_WRITE_KEY: 0, + VPNManager.TUNTAP_READ_KEY: 0} + self.update_vpn_status(zeroed) + def _update_traffic_rates(self, up, down): """ Updates up and download rates. @@ -286,6 +296,7 @@ class StatusPanelWidget(QtGui.QWidget): Sets the state of the widget to how it should look after EIP has stopped """ + self._reset_traffic_rates() self.ui.btnEipStartStop.setText(self.tr("Turn ON")) self.ui.btnEipStartStop.disconnect(self) self.ui.btnEipStartStop.clicked.connect( -- cgit v1.2.3