From d8105d53e3aa66448094df3f34eda54c3dcab865 Mon Sep 17 00:00:00 2001 From: elijah Date: Wed, 17 Sep 2014 16:42:51 -0700 Subject: single pref win: minor linting & add changes file --- src/leap/bitmask/gui/preferences_account_page.py | 19 +++++++++++++++---- src/leap/bitmask/gui/preferences_email_page.py | 9 +-------- src/leap/bitmask/gui/preferences_vpn_page.py | 3 ++- src/leap/bitmask/gui/preferenceswindow.py | 6 ++++++ 4 files changed, 24 insertions(+), 13 deletions(-) (limited to 'src/leap/bitmask/gui') diff --git a/src/leap/bitmask/gui/preferences_account_page.py b/src/leap/bitmask/gui/preferences_account_page.py index 00dbe626..ec6a7716 100644 --- a/src/leap/bitmask/gui/preferences_account_page.py +++ b/src/leap/bitmask/gui/preferences_account_page.py @@ -21,10 +21,9 @@ import logging from functools import partial from PySide import QtCore, QtGui -from ui_preferences_account_page import Ui_PreferencesAccountPage -from passwordwindow import PasswordWindow +from leap.bitmask.gui.ui_preferences_account_page import Ui_PreferencesAccountPage +from leap.bitmask.gui.passwordwindow import PasswordWindow from leap.bitmask.services import get_service_display_name -from leap.bitmask.config.leapsettings import LeapSettings logger = logging.getLogger(__name__) @@ -33,6 +32,14 @@ class PreferencesAccountPage(QtGui.QWidget): def __init__(self, parent, account, app): """ + :param parent: parent object of the PreferencesWindow. + :parent type: QWidget + + :param account: user account (user + provider or just provider) + :type account: Account + + :param app: the current App object + :type app: App """ QtGui.QWidget.__init__(self, parent) self.ui = Ui_PreferencesAccountPage() @@ -103,7 +110,11 @@ class PreferencesAccountPage(QtGui.QWidget): self._selected_services = set() - # remove existing checkboxes + # Remove existing checkboxes + # (the new widget is deleted when its parent is deleted. + # We need to loop backwards because removing things from the + # beginning shifts items and changes the order of items in the layout. + # Using `QObject.deleteLater` doesn't seem to work.) layout = self.ui.provider_services_layout for i in reversed(range(layout.count())): layout.itemAt(i).widget().setParent(None) diff --git a/src/leap/bitmask/gui/preferences_email_page.py b/src/leap/bitmask/gui/preferences_email_page.py index 0535762a..80e8d93e 100644 --- a/src/leap/bitmask/gui/preferences_email_page.py +++ b/src/leap/bitmask/gui/preferences_email_page.py @@ -19,24 +19,17 @@ Widget for "email" preferences import logging from PySide import QtCore, QtGui -from ui_preferences_email_page import Ui_PreferencesEmailPage +from leap.bitmask.gui.ui_preferences_email_page import Ui_PreferencesEmailPage logger = logging.getLogger(__name__) class PreferencesEmailPage(QtGui.QWidget): - """ - - """ - def __init__(self, parent, account, app): - """ - """ QtGui.QWidget.__init__(self, parent) self.ui = Ui_PreferencesEmailPage() self.ui.setupUi(self) - self.parent = parent self.account = account self.app = app diff --git a/src/leap/bitmask/gui/preferences_vpn_page.py b/src/leap/bitmask/gui/preferences_vpn_page.py index f3fa1ecc..901116b4 100644 --- a/src/leap/bitmask/gui/preferences_vpn_page.py +++ b/src/leap/bitmask/gui/preferences_vpn_page.py @@ -18,11 +18,12 @@ Widget for "vpn" preferences """ from PySide import QtCore, QtGui -from ui_preferences_vpn_page import Ui_PreferencesVpnPage +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 + class PreferencesVpnPage(QtGui.QWidget, Flashable): """ diff --git a/src/leap/bitmask/gui/preferenceswindow.py b/src/leap/bitmask/gui/preferenceswindow.py index 32651d5c..f9b7ddf6 100644 --- a/src/leap/bitmask/gui/preferenceswindow.py +++ b/src/leap/bitmask/gui/preferenceswindow.py @@ -150,6 +150,12 @@ class PreferencesWindow(QtGui.QDialog): self.ui.nav_widget.currentItemChanged Changes what page is displayed. + + :param current: the currently selected item (might be None?) + :type current: PySide.QtGui.QListWidgetItem + + :param previous: the previously selected item (might be None) + :type previous: PySide.QtGui.QListWidgetItem """ if not current: current = previous -- cgit v1.2.3