diff options
Diffstat (limited to 'src/leap/bitmask/gui/preferences_vpn_page.py')
-rw-r--r-- | src/leap/bitmask/gui/preferences_vpn_page.py | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/leap/bitmask/gui/preferences_vpn_page.py b/src/leap/bitmask/gui/preferences_vpn_page.py index 5b5c9604..fc15340f 100644 --- a/src/leap/bitmask/gui/preferences_vpn_page.py +++ b/src/leap/bitmask/gui/preferences_vpn_page.py @@ -22,9 +22,9 @@ from leap.bitmask.gui.ui_preferences_vpn_page import Ui_PreferencesVpnPage from leap.bitmask.config.leapsettings import LeapSettings from leap.bitmask.gui.flashable import Flashable +from leap.bitmask.gui.preferences_page import PreferencesPage - -class PreferencesVpnPage(QtGui.QWidget, Flashable): +class PreferencesVpnPage(PreferencesPage, Flashable): """ Page in the preferences window that shows VPN settings @@ -41,19 +41,24 @@ class PreferencesVpnPage(QtGui.QWidget, Flashable): :param app: shared App instance :type app: App """ - QtGui.QWidget.__init__(self, parent) + PreferencesPage.__init__(self, parent, account, app) self.AUTOMATIC_GATEWAY_LABEL = self.tr("Automatic") - self.account = account - self.app = app - # Load UI self.ui = Ui_PreferencesVpnPage() self.ui.setupUi(self) self.ui.flash_label.setVisible(False) self.hide_flash() - # Connections + self.setup_connections() + + # Trigger update + self.app.backend.eip_get_gateways_list(domain=self.account.domain) + + def setup_connections(self): + """ + connect signals + """ self.ui.gateways_list.clicked.connect(self._save_selected_gateway) sig = self.app.signaler sig.eip_get_gateways_list.connect(self._update_gateways_list) @@ -61,8 +66,16 @@ class PreferencesVpnPage(QtGui.QWidget, Flashable): sig.eip_uninitialized_provider.connect( self._gateways_list_uninitialized) - # Trigger update - self.app.backend.eip_get_gateways_list(domain=self.account.domain) + def teardown_connections(self): + """ + disconnect signals + """ + self.ui.gateways_list.clicked.disconnect(self._save_selected_gateway) + sig = self.app.signaler + sig.eip_get_gateways_list.disconnect(self._update_gateways_list) + sig.eip_get_gateways_list_error.disconnect(self._gateways_list_error) + sig.eip_uninitialized_provider.disconnect( + self._gateways_list_uninitialized) def _save_selected_gateway(self, index): """ |